87,921
社区成员
发帖
与我相关
我的任务
分享
Ext.create('Ext.Window',{
title:'上传文件',
width:400,
height:300,
layout:'fit',
collapsible : true,
maximizable : true,
plain : true,
buttonAlign : 'center',
html : '<form action="upload.do" method="post" enctype="multipart/form-data" id="form">' +
'<input name="file" type="file" value="" id="file" />' +
'<input type="hidden" value=\'{"table":"goodsOrder","path":"ss"}\' name="json" id="json">' +
'<input type="hidden" value="upload" name="action">' +
'</form>',
draggable : true,
bbar:[{
text:'提交',
handler:function(){
document.getElementById('form').submit();
}
}]
}).show();
items : {
labelWidth : 95,
bodyStyle : 'padding:30px 40px 0',
xtype : 'form',
defaultType : 'textfield',
frame : true,
border : false,
bodyBorder : false,
labelAlign : 'right',
labelSeparator : ':',
items : [{
fieldLabel:'文件',
allowBlank : false,
name : 'file',
xtype:'filefield',
buttonText:'选择文件'
},{
name:'action',
value:'upload',
xtype:'hiddenfield'
},{
name:'json',
value:'{"table":"goodsOrder","path":"d:/tmp/12月1月2月订单.xlsx"}',
xtype:'hiddenfield'
},{
fieldLabel : '工作表',
name : 'sheet'
},{
fieldLabel : '总行数',
name : 'row'
}, {
fieldLabel : '总列数',
name : 'cell'
}]
}
form.submit({
clientValidation: true,
url: 'path/upload.do'.replace('path',xsl.data.Data.path),
waitMsg: '正在上传...',
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure:function(){
alert('fail')
}
});