Ext.define('erp.view.scm.product.ProductSNRule',{
extend: 'Ext.Viewport',
layout: 'fit',
hideBorders: true,
initComponent : function(){
var me = this;
Ext.apply(me, {
items: [{
layout: 'anchor',
bodyStyle: 'background:#f1f1f1;',
items: [{
xtype: 'erpFormPanel',
anchor: '100% 30%',
saveUrl: 'scm/product/saveProductSNRule.action',
deleteUrl: 'scm/product/deleteProductSNRule.action',
updateUrl: 'scm/product/updateProductSNRule.action',
getIdUrl: 'common/getId.action?seq=PRODUCTSNRULE_SEQ',
keyField: 'psr_id'
},{
xtype: 'gridpanel',
id: 'grid',
anchor : '100% 70%',
columns: [{
style :"text-align:center",
text: '类型',
width: 100,
dataIndex: 'psr_type',
editor:{
xtype:"combo",
format:"",
hideTrigger:false,
store:{
fields:[
'display',
'value'
],
data:[
{
display:"转换前",
value:"before"
},
{
display:"转换后",
value:"after"
}
]
},
queryMode:"local",
displayField:"display",
valueField:"value",
editable:false,
cls:null,
minValue:null,
maxLength:4000,
positiveNum:false
},
xtype: "combocolumn"
},{
style :"text-align:center",
text: 'ID',
width: 0,
hidden : true,
dataIndex: 'psr_id',
ignore: true,
},{
style :"text-align:center",
text: '序列号前缀',
width: 120,
dataIndex: 'psr_prefix',
logic:"necessaryField",
editor: {
xtype: "textfield",
hideTrigger: true,
store: null,
queryMode: "local",
editable: true,
cls: null,
minValue: "0",
maxLength: 4000,
positiveNum: false
}
},{
style :"text-align:center",
text: '长度',
logic:"necessaryField",
width: 80,
dataIndex: 'psr_length',
editor: {
xtype: "textfield",
hideTrigger: true,
store: null,
queryMode: "local",
editable: true,
cls: null,
minValue: "0",
maxLength: 4000,
positiveNum: false
},
xtype: 'numbercolumn',
align: "right",
format: ""
},{
style :"text-align:center",
text: '更新人',
width: 100,
dataIndex: 'psr_inman'
},{
style :"text-align:center",
text: '更新日期',
width: 150,
dataIndex: 'psr_indate',
readOnly: true,
align:"left",
format:"Y-m-d H:i:s",
xtype:"datecolumn"
},{
style :"text-align:center",
xtype: 'actioncolumn',
header: '操作',
width: 100,
align: 'center',
items: [{
icon: basePath + 'resource/images/16/delete.png',
tooltip: '删除',
handler: function(view, rowIndex, colIndex) {
var rec = view.getStore().getAt(rowIndex);
warnMsg('确定删除?', function(btn){
if(btn == 'yes'){
view.ownerCt.deleteRecord(rec);
} else if(btn == 'no'){
return;
}
})
}
}]
}],
GridUtil: Ext.create('erp.util.GridUtil'),
dbfinds: [],
columnLines: true,
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
}),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
store: new Ext.data.Store({
fields: ['psr_id', 'psr_type', 'psr_prefix', 'psr_length', 'psr_inman','psr_indate'],
data: [{},{}]
}),
necessaryFields:['psr_prefix', 'psr_length','psr_type'],
deleteRecord: function(record) {
if(record.get('psr_id') && record.get('psr_id') >= 0) {
var grid = this, url = "scm/product/deleteProductSNRuleDetail.action";
var form = Ext.getCmp('form');
grid.setLoading(true);
Ext.Ajax.request({
url : basePath + url,
params: {
caller: caller,
id: record.get('psr_id'),
pr_id: Ext.getCmp(form.keyField).value
},
method : 'post',
callback : function(opt, success, response){
grid.setLoading(false);
success && window.location.reload();
}
});
}else{
showError('删除明细为空!');
}
}
}]
}]
});
me.callParent(arguments);
}
});