/** * Created by zhouy on 2018/10/18. */ Ext.define('trade.saas.view.document.warehouse.Window', { extend: 'saas.view.document.kind.ChildForm', xtype: 'document-warehouse-window', dataKind:'warehouse',//类型标识 caller:'WareHouse', belong:{ columns: [{ text: '编号', dataIndex: 'wh_code', width: 150 },{ text: '仓库名称', dataIndex: 'wh_description', width: 200 },{ text: '类型', dataIndex: 'wh_type', width: 110 },{ text: '仓库状态码', dataIndex: 'wh_status', hidden:true, },{ text: '仓库状态', dataIndex: 'wh_statuscode', width:90, xtype: 'actioncolumn', align : 'center', items: [{ iconCls:'', getClass: function(v, meta, rec) { if(rec.get('wh_statuscode')=='ENABLE'){ return 'x-grid-checkcolumn-checked-btn'; }else{ return 'x-grid-checkcolumn-btn'; } }, handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); var type=rec.get('wh_statuscode')=='ENABLE'?true:false; // 禁用/启用 var form = this.ownerCt.ownerCt.ownerCt; var grid = this.ownerCt.ownerCt; saas.util.BaseUtil.request({ url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'), params: '', method: 'POST', }) .then(function(localJson) { if(localJson.success){ saas.util.BaseUtil.showSuccessToast('操作成功'); grid.store.load(); } }) .catch(function(e) { saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message); }); } }] }], keyField:'id', reqUrl: '/api/document/warehouse/save', delUrl: '/api/document/warehouse/delete' }, etc:{ warehouse:{ items:[{ xtype:'hidden', name:'id' },{ xtype:'textfield', fieldLabel: '仓库编号', name: 'wh_code', autoCode:true, allowBlank:false, maxLength: 20 },{ xtype:'textfield', fieldLabel: '仓库名称', name: 'wh_description', allowBlank:false, maxLength: 20 },{ xtype:'combo', fieldLabel: '仓库类型', name: 'wh_type', allowBlank:false, displayField : "display", editable:false, hideTrigger : false, maxLength : 100.0, minValue : null, positiveNum : false, queryMode : "local", valueField : "value", store:{ fields: ['display', 'value'], data : [ {"display":"良品仓", "value":'良品仓'}, {"display":"不良品仓", "value":'不良品仓'} ] } },{ readOnly:true, xtype:'textfield', fieldLabel: '仓库状态', name: 'wh_status', value:'已启用', maxLength: 20 },{ xtype:'hidden', fieldLabel: '仓库状态码', name: 'wh_statuscode', value:'ENABLE' }] } } });