supply.HTGLEditGridPanel = Ext.extend(Ext.ux.grid.EditorGridPanel, {
id:null,
frame:false,
border:false,
isAdd:true,
businessId:null,
fileUpload : true,
initComponent:function() {
var fields = [
{name: 'id', type: 'string'},
{name: 'businessid', type: 'string'},
{name: 'contractcode', type: 'string'},
{name: 'signcode', type: 'string'},
{name: 'contractname', type: 'string'},
{name: 'realname', type: 'string'},
{name: 'attribute', type: 'string'},
{name: 'note', type: 'string'}
];
var forms = new Ext.form.FormPanel({
fileUpload: true,
baseCls: 'x-plain',
layout:'form',
url: com.sjs.supply.action.ContractAction.uploadFile,
frame:true,
items: [
{
xtype : 'textfield',
title : '附件上传',
inputType : 'file',
itemId : 'uploadFileType',
}
],
buttons: [{
text: '上传',
handler: function() {
form.getForm().submit({
success: function(form, action){
Ext.Msg.alert('信息', '文件上传成功!');
},
failure: function(){
Ext.Msg.alert('错误', '文件上传失败');
}
});
}
}]
})
//时间
this.timeField = new Ext.ux.form.DateTimeField({
format:'Y-m-d H:i:s',
allowBlank:false,
selectOnFocus:true,
editable:false, width:150
});
//金额
this.amountField = new Ext.form.NumberField({
allowBlank:false,
maxLength:20,
width : 100
});
//备注
this.remarkField = new Ext.form.TextField({
maxLength:500,
width : 100
});
var data = [["0","原件"], ["1","复印件"], ["2","其他"]];
var Typestore = new Ext.data.SimpleStore({ fields:["value","text"],data:data });
this.cm = new Ext.grid.ColumnModel([
this.rowNumberer,
this.sm,
{header:'id',dataIndex:'id',hidden:true},
{header:'业务编号',dataIndex:'businessid',hidden:true},
{header:'合同编号',dataIndex:'contractcode',sortable:true,editor:new Ext.form.TextField()},
{header:'签约编号',dataIndex:'signcode',sortable:true,editor:new Ext.form.TextField()},
{header:'合同名称',dataIndex:'contractname',sortable:true,editor:new Ext.form.TextField()},
{header:'扫描件',sortable:true,width:280,editor:forms},
{header:'扫描件类型',dataIndex:'attribute',width:150,sortable:true,
editor:new Ext.form.ComboBox({
store:Typestore,
mode:"local",
displayField:"text",
valueField:"value",
triggerAction:"all",
emptyText:"请选择",
value:"text" }),
renderer:function(value){ if(value == 0) return "原件"
if(value == 1) return "复印件"
return "其他"}},
{header:'备注',dataIndex:'note',sortable:true,editor:new Ext.form.TextField()},
]);
this.store = this.createStore({
searchFn:com.sjs.supply.action.SContractAction.getSContractPaginationList,
deleteFn:com.sjs.supply.action.SContractAction.deleteSContract,
updateFn:com.sjs.supply.action.SContractAction.updateSContract,
fields:Ext.data.Record.create(fields),
keyField:'id',
sort:'id',
dir:'ASC'
});
this.store.baseParams.businessId = this.businessId;
this.tbar = this.createTbar({
startEditing:2
},true,true);
this.tbar.add("-");
this.bbar = this.createBbar(this.store);
supply.RKEditGridPanel.superclass.initComponent.call(this);
},
initNewRecord:function(Record){
return new Record({
attribute:0,
businessid:this.businessId
});
},
loadStore:function(businessId){
this.businessId = businessId;
this.store.baseParams.businessId = businessId;
this.store.load();
}
});