Ext.define('saas.view.document.bom.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: 'document-bom-formpanel', controller: 'document-bom-formpanel', viewModel: 'document-bom-formpanel', caller:'Bom', //字段属性 _title:'客户资料', _idField: 'id', _codeField: 'bo_mothercode', _statusField: 'bo_status', _statusCodeField: 'bo_statuscode', _readUrl:basePath+'document/bom/read/', _saveUrl:basePath+'document/bom/save', _openUrl:basePath+'document/bom/open', _closeUrl:basePath+'document/bom/close', _deleteUrl:basePath+'document/bom/delete/', initId:0, defaultItems: [{ xtype: 'hidden', name: 'id', fieldLabel: 'id', allowBlank: true, columnWidth: 0.25 },{ xtype: 'hidden', name: 'bo_motherid', fieldLabel: '母件id', allowBlank: true, columnWidth: 0.25 },{ xtype: 'textfield', name: 'bo_mothername', fieldLabel: 'BOM名称', allowBlank: false, columnWidth: 0.25 },{ xtype: 'textfield', name: 'bo_mothercode', fieldLabel: 'BOM编号', allowBlank: true, columnWidth: 0.25 },{ xtype: 'textfield', name: 'bo_status', fieldLabel: 'BOM状态', allowBlank: true, columnWidth: 0.25 },{ xtype: 'hidden', name: 'bo_statuscode', fieldLabel: '状态码', allowBlank: true, columnWidth: 0.25 },{ format : "Y-m-d", xtype : "datefield", name : "createTime", fieldLabel : "创建时间", allowBlank : true, columnWidth : 0.25 },{ format : "Y-m-d", xtype : "datefield", name : "updateTime", fieldLabel : "更新时间", allowBlank : true, columnWidth : 0.25 }, { xtype : "detailGridField", detnoColumn: 'bd_detno', storeModel:'saas.model.document.bomdetail', deleteDetailUrl:basePath+'document/bom/deleteDetail/', columns : [ { text : "ID", dataIndex : "id", width : 0, xtype : "numbercolumn" }, { text : "关联ID", dataIndex : "bd_bomid", width : 0, xtype : "numbercolumn" }, { text : "子件编号", editor : { xtype : "textfield" }, dataIndex : "bd_soncode", width : 120.0, xtype : "", items : null }, { text : "单位", editor : { xtype : "textfield" }, dataIndex : "bd_unit", width : 120.0, xtype : "", items : null }, { text : "单位用量", editor : { xtype : "textfield" }, dataIndex : "bd_baseqty", width : 120.0, xtype : "", items : null }, { text : "替代料", editor : { xtype : "textfield" }, dataIndex : "bd_replace", width : 120.0, xtype : "", items : null }] }], /** * 一些初始化viewModel的方法 */ initViewModel: function() { var me = this, codeField = me._codeField, statusField = me._statusField, statusCodeField = me._statusCodeField, viewModel = me.getViewModel(); viewModel.set(codeField, ''); viewModel.set('createTime', new Date()); viewModel.set('updateTime', new Date()); if(statusCodeField) { var o = {}; o['auditBtnText'] = { bind: '{' + statusCodeField + '}', get: function(value) { viewModel.set(statusField, value == 'OPEN' ? '已开启' : '已关闭'); return value == 'OPEN' ? '已关闭' : '已开启' } }; viewModel.setFormulas(o); viewModel.set(statusCodeField, "OPEN"); }else { viewModel.set('auditBtnText', "已关闭"); } } });