Browse Source

代码提交

hy 7 years ago
parent
commit
15816ba2d2

+ 2 - 3
frontend/saas-web/app/model/document/bom.js → frontend/saas-web/app/model/document/bomdetail.js

@@ -1,13 +1,12 @@
-Ext.define('saas.model.document.bom', {
+Ext.define('saas.model.document.bomdetail', {
     extend: 'saas.model.Base',
     fields: [
         { name: 'id', type: 'int' },
-        { name: 'bd_id', type: 'int' },
         { name: 'bd_bomid', type: 'int' },
         { name: 'bd_detno', type: 'int' },
         { name: 'bd_sonid', type: 'int' },
         { name: 'bd_soncode', type: 'string' },
-        { name: 'bo_unit', type: 'string' },
+        { name: 'bd_unit', type: 'string' },
         { name: 'bd_baseqty', type: 'string' },
         { name: 'bd_replace', type: 'string' },
         { name: 'bd_remark', type: 'string' },

+ 1 - 1
frontend/saas-web/app/view/core/base/BasePanelController.js

@@ -7,7 +7,7 @@ Ext.define('saas.view.core.base.BasePanelController', {
 
     query: function() {
         var form = this.view;
-        var grid = form.down('core-baseform-gridpanel');
+        var grid = form.down('core-base-gridpanel');
         grid.condition = '';
         var fields = form.searchField.map(f => f.name);
         var items = [];

+ 1 - 1
frontend/saas-web/app/view/core/base/GridPanel.js

@@ -153,11 +153,11 @@ Ext.define('saas.view.core.base.GridPanel', {
                 })
                 .then(function() {
                     showToast('操作成功');
+                    grid.store.load();
                 })
                 .catch(function(response) {
                     showToast('操作失败');
                 });
-                grid.store.load();
         }else{
             showToast('请勾选至少一条明细。');
         }

+ 42 - 4
frontend/saas-web/app/view/document/bom/BasePanel.js

@@ -5,12 +5,50 @@ Ext.define('saas.view.document.bom.BasePanel', {
     controller: 'document-bom-basepanel',
     viewModel: 'document-bom-basepanel',
 
+    searchField:[],
+
     //字段属性
+    _formXtype:'document-bom-formpanel',
     _title:'BOM资料',
-    _dataUrl:basePath + 'document/vendor/getVendorsByCondition',
-    _saveUrl:basePath + 'document/vendor/save',
-    _deleteUrl:basePath + 'document/vendor/delete',
-
+    // _dataUrl:basePath+'ducument/customer/list',
+    _batchOpenUrl:'http://192.168.253.31:9480/bom/batchOpen',
+    _batchCloseUrl:'http://192.168.253.31:9480/bom/batchClose',
+    _batchDeleteUrl:'http://192.168.253.31:9480/bom/batchDelete',
 
+    gridConfig: {
+        idField: 'id',
+        codeField: 'bo_mothercode',
+        dataUrl: 'http://192.168.253.31:9480/bom/list',
+        columns : [{
+            text : "id", 
+            width : 0, 
+            dataIndex : "id", 
+            xtype : "numbercolumn",   
+        },{
+            text : "母件id", 
+            width : 0, 
+            dataIndex : "bo_motherid", 
+            xtype : "numbercolumn",   
+        },{
+            text : "母件编号", 
+            width : 200.0, 
+            dataIndex : "bo_mothercode", 
+        }, 
+        {
+            text : "母件名称", 
+            dataIndex : "bo_mothername", 
+            width : 120.0, 
+        }, 
+        {
+            text : "BOM状态", 
+            dataIndex : "bo_status", 
+            width : 120.0, 
+        }, 
+        {
+            text : "BOM版本", 
+            dataIndex : "bo_version", 
+            width : 120.0, 
+        }]
+    },
 
 });

+ 65 - 0
frontend/saas-web/app/view/document/bom/FormController.js

@@ -0,0 +1,65 @@
+Ext.define('saas.view.document.bom.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.document-bom-formpanel',
+    
+    init: function (form) {
+        var me = this;
+        this.control({});
+    },
+
+    auditBtnClick: function() {
+        var me = this,
+        form = me.getView(),
+        statusCodeField = form._statusCodeField,
+        viewModel = me.getViewModel(),
+        status = viewModel.data[statusCodeField];
+        status == 'OPEN' ? me.unAudit() : me.audit();
+    },
+
+    audit: function(){
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel();
+        
+        me.BaseUtil.request({
+            url: form._openUrl+'/'+viewModel.data.id,
+            params: '',
+            method: 'POST',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                showToast('启用成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+                viewModel.set('base.editable', false);
+            }
+        })
+        .catch(function(res) {
+            console.error(res);
+            showToast('启用失败: ' + res.message);
+        });
+    },
+    unAudit: function() {
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel();
+        
+        me.BaseUtil.request({
+            url: form._closeUrl+'/'+viewModel.data.id,
+            params: '',
+            method: 'POST',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                showToast('禁用成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+                viewModel.set('base.editable', false);
+            }
+        })
+        .catch(function(res) {
+            console.log(res);
+            showToast('禁用失败: ' + res.message);
+        });
+    }
+});

+ 17 - 0
frontend/saas-web/app/view/document/bom/FormModel.js

@@ -0,0 +1,17 @@
+Ext.define('saas.view.document.bom.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.document-bom-formpanel',
+
+    data: {
+        id: 0
+    },
+
+    formulas:{
+        showAuditBtn:{
+            bind:'{id}',
+            get:function(value){
+                return !value;
+            }
+        }
+    }
+});

+ 162 - 0
frontend/saas-web/app/view/document/bom/FormPanel.js

@@ -0,0 +1,162 @@
+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:'http://192.168.253.31:9480/bom/read/',
+    _saveUrl:'http://192.168.253.31:9480/bom/save',
+    _openUrl:'http://192.168.253.31:9480/bom/open',
+    _closeUrl:'http://192.168.253.31:9480/bom/close',
+    _deleteUrl:'http://192.168.253.31:9480/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:'http://192.168.253.31:9480/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', "禁用");
+        }
+    }
+});

+ 2 - 1
frontend/saas-web/resources/json/navigation.json

@@ -188,9 +188,10 @@
             "viewType": "other-storeinformation",
             "leaf": true
         }, {
+            "id":"document-bom-basepanel",
             "text": "BOM资料",
             "viewType": "document-bom-basepanel",
-            "addTyep": "document-bom-formpanel",
+            "addType": "document-bom-formpanel",
             "leaf": true
         }, {
             "id":"other-bankinformation",