Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into test

guq 7 лет назад
Родитель
Сommit
97ba18a2a9

+ 1 - 1
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Product.java

@@ -14,7 +14,7 @@ public class Product extends CommonBaseEntity implements Serializable {
     private String pr_unit;
     private String pr_kind;
     private String pr_orispeccode;
-    private long pr_whid;
+    private Long pr_whid;
     private String pr_whcode;
     private String pr_whname;
     private Long pr_zxbzs;

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java

@@ -53,7 +53,7 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
         //校验组合件和子件不允许相同
         if (bomDetailList.size() > 0){
             for (BomDetail bomDetail : bomDetailList){
-                if (bom.getBo_mothercode().equals(bomDetail.getProductDTO().getPr_code())){
+                if (bom.getBo_mothercode().equals(bomDetail.getBd_soncode())){
                     throw new BizException(BizExceptionCode.BOM_CODE_REPEAT);
                 }
             }

+ 1 - 5
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -336,16 +336,13 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
             if (!Status.ENABLE.getDisplay().equals(product.getPr_status())){
                 throw new BizException(BizExceptionCode.BIZ_BANNED);
             }
-            String code = getMapper().getCodeById(id);
-            product = new Product();
-            product.setId(id);
             product.setPr_status(Status.BANNED.getDisplay());
             product.setPr_statuscode(Status.BANNED.name());
             product.setUpdaterId(BaseContextHolder.getUserId());
             product.setUpdateTime(new Date());
             getMapper().updateByPrimaryKeySelective(product);
             //记录LOG
-            docBaseDTO = generateMsgObj(id, code);
+            docBaseDTO = generateMsgObj(id, product.getPr_code());
             messageLogService.customizeLog(docBaseDTO, Operation.BANNED);
             return docBaseDTO;
         }else{
@@ -365,7 +362,6 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
             if (!Status.BANNED.getDisplay().equals(product.getPr_status())){
                 throw new BizException(BizExceptionCode.BIZ_ENABLE);
             }else{
-                product.setId(id);
                 product.setPr_statuscode(Status.ENABLE.name());
                 product.setPr_status(Status.ENABLE.getDisplay());
                 product.setUpdaterId(BaseContextHolder.getUserId());

+ 10 - 4
frontend/saas-web/app/util/BaseUtil.js

@@ -86,11 +86,17 @@ Ext.define('saas.util.BaseUtil', {
          * @param message: 内容
          * @return : Promise
          */
-        showConfirm: function (title, message) {
+        showConfirm: function (title, message, config) {
             return new Ext.Promise(function (resolve, reject) {
-                Ext.MessageBox.confirm(title, message, function (buttonId) {
-                    return resolve(buttonId);
-                });
+                Ext.MessageBox.show(Ext.Object.merge({
+                    title: title,
+                    msg: message,
+                    buttons: Ext.Msg.YESNO,
+                    icon: Ext.Msg.QUESTION,
+                    fn: function (buttonId) {
+                        return resolve(buttonId);
+                    }
+                }, config));
             })
         },
 

+ 71 - 2
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -31,7 +31,6 @@ Ext.define('saas.view.core.form.FormPanel', {
     remoteConfig: true, // 是否需要从远端读取form配置
     toolBtns: [], // 自定义按钮
     codeInHeader: true, // 单据编号显示在toolbar
-    closeConfirm: true, // 关闭确认
     invalidText: '表单校验有误,请检查', // 校验未通过提示内容
     dirtyAuditText: '表单数据有修改,是否先保存修改?', // 有修改时点击审核提示内容
     noDirtySaveText: '表单数据无修改', // 无修改点击保存提示内容
@@ -487,7 +486,7 @@ Ext.define('saas.view.core.form.FormPanel', {
         return dirty;
     },
 
-    getDirtyData: function() {
+    getSaveData: function() {
         var me = this,
         viewModel = me.getViewModel(),
         allData = viewModel.getData(),
@@ -508,6 +507,52 @@ Ext.define('saas.view.core.form.FormPanel', {
             main: formData,
         };
 
+        for (var i = 0; i < detailCount; i++) {
+            var g = detailGrids[i];
+            var gridDirtyData = g.getSaveData();
+            var modelDetail = allData['detail' + i];
+            var detailBindFields = modelDetail.detailBindFields;
+
+            Ext.Array.each(gridDirtyData, function(d) {
+                for(k in d) {
+                    if(!Ext.Array.contains(detailBindFields, k)) {
+                        delete d[k];
+                    }
+                }
+            });
+            
+
+            dirtyData['detail' + i] = gridDirtyData;
+        }
+
+        return dirtyData;
+    },
+
+    getDirtyData: function() {
+        var me = this,
+        formF = me.getForm(),
+        viewModel = me.getViewModel(),
+        allData = viewModel.getData(),
+        bindFields = allData.base.bindFields,
+        detailCount = me.detailCount,
+        formData = {},
+        detailGrids = me.query('detailGridField');
+
+        Ext.Array.each(bindFields, function(field) {
+            var v = allData[field];
+            var f = formF.findField(field);
+            if(Ext.isDate(v)) {
+                v = Ext.Date.format(v, 'Y-m-d H:i:s');
+            }
+            if(f && f.isDirty()) {
+                formData[field] = f.originalValue;
+            }
+        });
+
+        var dirtyData = {
+            main: formData,
+        };
+
         for (var i = 0; i < detailCount; i++) {
             var g = detailGrids[i];
             var gridDirtyData = g.getDirtyData();
@@ -544,4 +589,28 @@ Ext.define('saas.view.core.form.FormPanel', {
     beforeUnAudit: function() {
         return true;
     },
+
+    promiseCloseTab: function() {
+        var me = this,
+        controller = me.getController();
+
+        if(me.isDirty()) {
+            return saas.util.BaseUtil.showConfirm('提示', '表单数据有修改,离开前要保存吗?', {
+                buttons: Ext.Msg.YESNOCANCEL
+            }).then(function(yes) {
+                if(yes === 'yes') {
+                    controller.onSave();
+                    return false;
+                }else if(yes === 'no') {
+                    return true;
+                }else {
+                    return false
+                }
+            })
+        }else {
+            return new Promise(function (resolve, reject) {
+                return resolve(true);
+            });
+        }
+    }
 });

+ 1 - 1
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -169,7 +169,7 @@ Ext.define('saas.view.core.form.FormPanelController', {
         modelData = viewModel.getData();
 
         //form里面数据
-        var formData = form.getDirtyData();
+        var formData = form.getSaveData();
 
         var params = {
             main:formData.main

+ 16 - 2
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -458,7 +458,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         return allData;
     },
 
-    getDirtyData: function() {
+    getSaveData: function() {
         var me = this,
         store = me.getStore(),
         allData = store.getData().items,
@@ -518,5 +518,19 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             }
         });
         return trueData;
-    }
+    },
+
+    getDirtyData: function() {
+        var me = this,
+        store = me.getStore(),
+        modifiedData = store.getModifiedRecords(),
+        dirtyData = [];
+
+        Ext.Array.each(modifiedData, function(m, index) {
+            var modified = m.modified;
+            dirtyData.push(modified);
+        });
+
+        return dirtyData;
+    },
 });

+ 12 - 9
frontend/saas-web/app/view/core/tab/Controller.js

@@ -32,10 +32,11 @@ Ext.define('saas.view.core.tab.Controller', {
          
                 if (me.fireEvent('beforeclose', me) !== false) {
                     if (me.tabBar) {
-                        if(tabView.closeConfirm && tabView.isDirty()) {
-                            saas.util.BaseUtil.showConfirm('提示', '表单数据有修改,确定要退出吗?')
-                            .then(function(yes) {
-                                if(yes == 'yes') {
+                        if(tabView.fireEvent('beforeclose', tabView) !== false) {
+                            tabView.promiseCloseTab()
+                            .then(function(close) {
+                                console.log();
+                                if(close) {
                                     if (me.tabBar.closeTab(me) === false) {
                                         return;
                                     }
@@ -47,11 +48,13 @@ Ext.define('saas.view.core.tab.Controller', {
                             }
                         }
                     } else {
-                        if(tabView.closeConfirm == 'function' && tabView.isDirty()) {
-                            saas.util.BaseUtil.showConfirm('提示', '表单数据有修改,确定要退出吗?')
-                            .then(function(yes) {
-                                if(yes == 'yes') {
-                                    me.fireClose();
+                        if(tabView.fireEvent('beforeclose', tabView) !== false) {
+                            tabView.promiseCloseTab()
+                            .then(function(close) {
+                                if(close) {
+                                    if (me.tabBar.closeTab(me) === false) {
+                                        return;
+                                    }
                                 }
                             });
                         }else {

+ 4 - 0
frontend/saas-web/app/view/document/customer/FormPanel.js

@@ -258,6 +258,8 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 allowBlank:false,
                 text : "电话", 
                 editor : {
+                    regex:/^1(3|4|5|7|8|9)\d{9}$/,
+                    regexText:'请输入正确的手机号码',
                     hideTrigger:true,
                     xtype : "textfield"
                 },
@@ -369,6 +371,8 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 allowBlank:true,
                 text : "联系电话", 
                 editor : {
+                    regex:/^1(3|4|5|7|8|9)\d{9}$/,
+                    regexText:'请输入正确的手机号码',
                     xtype : "textfield",
                     hideTrigger:true,
                 },

+ 2 - 0
frontend/saas-web/app/view/document/employee/Window.js

@@ -88,6 +88,8 @@ Ext.define('saas.view.document.employee.Window', {
                 xtype:'textfield',
                 fieldLabel: '联系电话',
                 name: 'em_mobile',
+                regex:/^1(3|4|5|7|8|9)\d{9}$/,
+                regexText:'请输入正确的手机号码',
                 allowBlank:false,
                 maxLength: 20
             },{

+ 16 - 2
frontend/saas-web/app/view/document/kind/ChildForm.js

@@ -112,7 +112,7 @@ Ext.define('saas.view.document.kind.ChildForm', {
                 xtype:'textfield',
                 name:'ft_name',
                 allowBlank:false,
-                relativeField:'ord_type',
+                relativeField:'ord_type,osd_type',
                 fieldLabel:'收支名称',
                 maxLength: 20
             },{
@@ -135,6 +135,17 @@ Ext.define('saas.view.document.kind.ChildForm', {
                         {"display":"收入", "value":'收入'},
                         {"display":"支出", "value":'支出'}
                     ]
+                },
+                listeners:{
+                    afterrender:function(f){
+                        if(f.ownerCt.ownerCt._parent.xtype == "money-othreceipts-formpanel"){
+                            f.setReadOnly(true);
+                            f.setValue('收入')
+                        }else if(f.ownerCt.ownerCt._parent.xtype == "money-othspendings-formpanel"){
+                            f.setReadOnly(true);
+                            f.setValue('支出')
+                        }
+                    }
                 }
             }]
         }
@@ -219,7 +230,10 @@ Ext.define('saas.view.document.kind.ChildForm', {
                 if(relativeField&&relativeValue&&form.ownerCt._parent&&form.ownerCt._parent.xtype!='document-kind'){
                     var grid = form.ownerCt._parent.down('grid');
                     var rec = grid.getSelectionModel().getLastSelected();
-                    rec.set(relativeField,relativeValue);
+                    var relfields = relativeField.split(',');//多个界面不同字段使用同种下拉新增时
+                    Ext.Array.each(relfields,function(name) {
+                        rec.set(name,relativeValue);
+                    });
                 }
                 if(combo){
                     combo.store.load(function() {

+ 2 - 0
frontend/saas-web/app/view/document/vendor/FormPanel.js

@@ -253,6 +253,8 @@ Ext.define('saas.view.document.vendor.FormPanel', {
                 allowBlank:false,
                 text : "电话", 
                 editor : {
+                    regex:/^1(3|4|5|7|8|9)\d{9}$/,
+                    regexText:'请输入正确的手机号码',
                     hideTrigger:true,
                     xtype : "textfield"
                 },

+ 1 - 1
frontend/saas-web/app/view/money/verification/FormPanelController.js

@@ -566,7 +566,7 @@ Ext.define('saas.view.money.verification.FormPanelController', {
         modelData = viewModel.getData();
 
         //form里面数据
-        var formData = form.getDirtyData();
+        var formData = form.getSaveData();
 
         var params = {
             main:formData.main

+ 2 - 2
frontend/saas-web/app/view/stock/inventory/EditDataList.js

@@ -500,7 +500,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
     },
     onSave:function(){
         var me = this,
-        gridData = me.getDirtyData();
+        gridData = me.getSaveData();
         if(gridData==null){
             saas.util.BaseUtil.showErrorToast('未修改数据');
         }
@@ -519,7 +519,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
             saas.util.BaseUtil.showErrorToast('保存失败: ' + res.message);
         });        
     },
-    getDirtyData: function() {
+    getSaveData: function() {
         var me = this,
         store = me.getStore(),
         allData = store.getData().items,

+ 1 - 1
frontend/saas-web/app/view/sys/account/AddWindow.js

@@ -30,7 +30,7 @@ Ext.define('saas.view.sys.account.AddWindow', {
                     allowBlank:false,
                     maxLength: 30,
                     columnWidth:0.7,
-                    regex:/^1(3|4|5|7|8)\d{9}$/,
+                    regex:/^1(3|4|5|7|8|9)\d{9}$/,
                     regexText:'请输入正确的手机号码',
                     listeners:{
                         change:function(f,a,b){

+ 3 - 1
frontend/saas-web/app/view/sys/account/DataList.js

@@ -22,7 +22,9 @@ Ext.define('saas.view.sys.account.DataList', {
         width: 140,
         name: 'mobile',
         xtype: 'textfield',
-        emptyText : '手机号码'
+        emptyText : '手机号码',
+        regex:/^1(3|4|5|7|8|9)\d{9}$/,
+        regexText:'请输入正确的手机号码'
     },{
         xtype:'button',
         text:'查询',

+ 2 - 0
frontend/saas-web/app/view/sys/account/EditWindow.js

@@ -46,6 +46,8 @@ Ext.define('saas.view.sys.account.EditWindow', {
             },{
                 xtype:'textfield',
                 fieldLabel: '手机号码',
+                regex:/^1(3|4|5|7|8|9)\d{9}$/,
+                regexText:'请输入正确的手机号码',
                 name: 'mobile',
                 readOnly:true,
                 editable:false,

+ 2 - 0
frontend/saas-web/app/view/sys/config/FormPanel.js

@@ -67,6 +67,8 @@ Ext.define('saas.view.sys.config.FormPanel', {
         bind:'{tel}',
         xtype: 'textfield',
         name: 'tel',
+        regex:/^1(3|4|5|7|8|9)\d{9}$/,
+        regexText:'请输入正确的手机号码',
         fieldLabel: '电话',
         beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         allowBlank: false,

+ 2 - 0
frontend/saas-web/app/view/sys/feedback/FormPanel.js

@@ -37,6 +37,8 @@ Ext.define('saas.view.sys.feedback.FormPanel', {
             xtype : "textfield", 
             name : "fb_mobile", 
             fieldLabel : "手机号",
+            regex:/^1(3|4|5|7|8|9)\d{9}$/,
+            regexText:'请输入正确的手机号码',
             value:saas.util.BaseUtil.getCurrentUser() ? saas.util.BaseUtil.getCurrentUser().mobile:null
         }, {
             xtype : "textfield",