1 function importExcel() {
2 PTC.navigation.loadScript("netmarkets/javascript/ext/ux/fileuploadfield/FileUploadField.js")
3 var win;
4 var uploadFilePanel = new Ext.FormPanel({
5 id: 'uploadFilePanel',
6 fileUpload: true,
7 width: 500,
8 frame: true,
9 autoHeight: true,
10 bodyStyle: 'padding: 10px 10px 10px 10px;',
11 labelWidth: 50,
12 defaults: {
13 anchor: '95%',
14 allowBlank: false,
15 msgTarget: 'side'
16 },
17 items: [{
18 xtype: 'fileuploadfield',
19 id: 'form-file',
20 emptyText: '请选择文件',
21 fieldLabel: '文件',
22 buttonText: '选择文件'
23
24 }
25 ]
26
27 });
28
29 if (!win) {
30 var processId = Ext.urlDecode(window.location.href).processid;
31 var actionDepart = Ext.urlDecode(window.location.href).actionDepart;
32 var pboId = Ext.urlDecode(window.location.href).pbo;
33 win = new Ext.Window({
34 title: '上传Excel文件',
35 closable: true,
36 height: 140,
37 width: 500,
38 resizable: false,
39 //border:false,
40 plain: true,
41 layout: 'border',
42 modal: true,
43 items: [{
44 xtype: 'panel',
45 region: 'center',
46 border: true,
47 bodyStyle: 'border-width:1px;border-style:solid;border-color:#000;',
48 defaults: {
49 autoScroll: false
50 },
51 width: 500,
52 height: 140,
53 layout: 'fit',
54 rowspan: 2,
55 items: uploadFilePanel
56 }
57 ],
58 buttons: [{
59 text: '保存',
60 handler: function () {
61 if (uploadFilePanel.getForm().isValid()) {
62 uploadFilePanel.getForm().submit({
63 url: 'url',64 waitMsg: '文件上传中...',
65 success: function (fp, o) {
66 msg('上传成功', o.result.msg);
67 window.location.reload();
68 },
69 failure: function (fp, o) {
70 msg('上传失败', o.result.msg);
71 }
72 });
73 }
74 }
75 }, {
76 text: '取消',
77 handler: function () {
78 uploadFilePanel.getForm().reset();
79 win.close();
80 }
81 }
82 ]
83 });
84 }
85 win.show(this);
86 }