| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- 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', "禁用");
- }
- }
- });
|