Преглед на файлове

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

rainco преди 7 години
родител
ревизия
3ce913ed26

+ 0 - 9
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -331,9 +331,6 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         //检查转单状态
         String acceptstatus = purchase.getPu_acceptstatuscode();
 
-        if ("TURNIN".equals(acceptstatus)){
-            return Result.error(ExceptionCode.TURNIN_EXIST);
-        }
         if ("CLOSED".equals(acceptstatus)){
             return Result.error(ExceptionCode.CLOSED_EXIST);
         }
@@ -403,16 +400,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
             }
         }
-        //更新主表入库状态
-        purchase.setPu_acceptstatus("已入库");
-        purchase.setPu_acceptstatuscode("TURNIN");
-
         DocBaseDTO baseDTO = new DocBaseDTO();
         baseDTO.setId(pi_id);
         baseDTO.setCode(piInoutno);
         baseDTO.setName("采购验收单");
-        //更新存在字段
-        int affect = getMapper().updateByPrimaryKeySelective(purchase);
         return Result.success(baseDTO);
     }
 

+ 1 - 1
frontend/saas-web/Readme.md

@@ -96,7 +96,7 @@ viewModel: view.core.form.FormPanelModel
 | allowBlank | 是否必填列 | x | true |
 | isValid | 自定义校验规则,传入value,返回boolean | x | function(v) { return v > 10; } |
 - 需要根据columns在models文件夹下添加storeModel对应的Model
-
+- allowBlan和isValid的校验只会校验dirty数据
 ---
 
 ## 查询列表配置

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

@@ -197,20 +197,7 @@ Ext.define('saas.view.core.base.GridPanel', {
             }
         }
     },
-
-    getCondition: function(f,conditionExpression){
-        var condition = '';
-        if((f.xtype == 'checkbox' || f.xtype == 'radio')){
-            
-        }else if(f.xtype=='textfield'&&f.value!=''){
-            condition=conditionExpression.replace(new RegExp("\\{0}","g"), f.value);
-        }
-        if(condition.length>0){
-            condition+= ' AND ';
-        }
-        return condition;
-    },
-
+    
     insertFirstColumn:function(columns){
         var me=this;
         if(columns.length>0 && columns[0].xtype!='actioncolumn'){

+ 2 - 2
frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js

@@ -23,7 +23,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                     var selectRecordArr = selModel.view.ownerCt.selectRecordArr;
                     var index = -1;
                     index = selectRecordArr.findIndex(function(f){
-                        return f.id==(rec&&rec.id?rec.id:0)
+                        return f.id==id
                     });
                     if(index>-1){
                         selectRecordArr.splice(index,1);
@@ -115,7 +115,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                                     }
                                 });
                                 var index = mainGrid.store.data.items.findIndex(function(f){
-                                    return f.id==rec.id
+                                    return f.id==(rec&&rec.id?rec.id:0)
                                 });
                                 rec = mainGrid.store.data.getAt(index+1);
                             });

+ 3 - 0
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -95,6 +95,9 @@ Ext.define('saas.view.core.form.FormPanel', {
                     cls: 'x-formpanel-btn-orange',
                     xtype: 'button',
                     text: '新增',
+                    bind: {
+                        hidden: '{!id}'
+                    },
                     handler: 'add'
                 }, {
                     xtype: 'button',

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

@@ -17,8 +17,8 @@ Ext.define('saas.view.core.form.FormPanelController', {
 
     add: function(){
         var form = this.getView();
-        var id = form.xtype + '_add';
-        openTab(form.xtype,'新增' + form._title,id);
+        var id = form.xtype + '-add';
+        openTab(form.xtype,'新增' + form._title, id);
     },
     
     delete: function(){
@@ -95,9 +95,16 @@ Ext.define('saas.view.core.form.FormPanelController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                form.initId = localJson.data.id;
+                var id = localJson.data.id;
+                var code = localJson.data.code;
+                form.initId = id;
                 form.FormUtil.loadData(form);
                 showToast('保存成功');
+
+                var newId = form.xtype + '-' + id;
+                var newTitle = form._title + '(' + code + ')';
+
+                refreshTabTitle(newId, newTitle);
             }
         })
         .catch(function(res) {
@@ -149,7 +156,15 @@ Ext.define('saas.view.core.form.FormPanelController', {
             if(localJson.success){
                 // 未保存直接审核会返回id
                 if(localJson.data) {
-                    form.initId = localJson.data.id;
+                    var id = localJson.data.id;
+                    var code = localJson.data.code;
+                    
+                    form.initId = id;
+
+                    var newId = form.xtype + '-' + id;
+                    var newTitle = form._title + '(' + code + ')';
+
+                    refreshTabTitle(newId, newTitle);
                 }
                 form.FormUtil.loadData(form);
                 form.setEditable(false);

+ 2 - 2
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -207,8 +207,8 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             var grid = tableView.up('grid'),
             idValue = record.get(grid.idField),
             codeValue = record.get(grid.codeField),
-            id = grid.xtype + idValue;
-            openTab(grid.addXtype,grid.addTitle+"("+codeValue+")",id, {
+            id = grid.addXtype + '-' + idValue;
+            openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", id, {
                 initId: idValue
             });
         }

+ 1 - 1
frontend/saas-web/app/view/core/query/QueryPanelController.js

@@ -36,7 +36,7 @@ Ext.define('saas.view.core.query.QueryPanelController', {
         var me = this,
         queryPanel = me.getView(),
         gridPanel = queryPanel.down('core-query-querygridpanel'),
-        id = gridPanel.addXtype + '_add';
+        id = gridPanel.addXtype + '-add';
         openTab(gridPanel.addXtype,'新增'+gridPanel.addTitle,id)
     },
     onReSetClick:function(btn){

+ 15 - 15
frontend/saas-web/app/view/main/Navigation.js

@@ -138,14 +138,14 @@ Ext.define('saas.view.main.Navigation', {
                             Ext.Array.each(menuItemText, function (item) {
                                 item.addEventListener('click', function (e) {
                                     var target = e.target,
-                                        dataset = target.dataset,
-                                        viewType = dataset.viewtype,
-                                        type = dataset.type,
-                                        text = dataset.text,
-                                        id = dataset.id;
+                                    dataset = target.dataset,
+                                    viewType = dataset.viewtype,
+                                    type = dataset.type,
+                                    text = dataset.text,
+                                    id = dataset.id;
 
-                                    var tabTitle = text + (type == 'form' ? '' : '查询'),
-                                        tabId = 'maintab-' + type + '-' + id;
+                                    var tabTitle = text + '查询',
+                                    tabId = 'maintab-' + type + '-' + id;
 
                                     menu.navItem.classList.remove(menu.navView.overItemCls);
                                     openTab(viewType, tabTitle, tabId);
@@ -155,14 +155,14 @@ Ext.define('saas.view.main.Navigation', {
                             Ext.Array.each(menuItemIcon, function (item) {
                                 item.addEventListener('click', function (e) {
                                     var target = e.target,
-                                        dataset = target.dataset,
-                                        viewType = dataset.viewtype,
-                                        type = dataset.type,
-                                        text = dataset.text,
-                                        id = dataset.id;
-
-                                    var tabTitle = text + (type == 'form' ? '' : '查询'),
-                                        tabId = 'maintab-' + type + '-' + id;
+                                    dataset = target.dataset,
+                                    viewType = dataset.viewtype,
+                                    type = dataset.type,
+                                    text = dataset.text,
+                                    id = dataset.id;
+
+                                    var tabTitle ='新增' + text,
+                                    tabId = viewType + '-add';
 
                                     menu.navItem.classList.remove(menu.navView.overItemCls);
                                     openTab(viewType, tabTitle, tabId);

+ 1 - 1
frontend/saas-web/app/view/stock/otherIn/FormPanelController.js

@@ -66,7 +66,7 @@ Ext.define('saas.view.stock.otherIn.FormPanelController', {
                 beforerender: function (f) {
                     Ext.apply(f, {
 
-                        dataUrl: '/api/document/vendor/list',
+                        dataUrl: '/api/document/customer/list',
                         // dataUrl:'http://localhost:9480/customer/list',
                         dbfinds: [{
                             from: 'id',

+ 129 - 15
frontend/saas-web/app/view/sys/maxnumbers/DataList.js

@@ -12,11 +12,35 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
     deleteUrl:'http://192.168.253.31:8920/number/delete/',
 
     tbar: [{
+        width: 150,
+        name: 'mn_caller',
+        xtype: 'textfield',
+        emptyText : '单据Caller'
+    },{
+        width: 150,
+        name: 'mn_leadcode',
+        xtype: 'textfield',
+        emptyText : '单据前缀'
+    },{
         cls:'x-formpanel-btn-orange',
         xtype:'button',
         text:'查询',
         listeners: {
-            click: 'onQuery'
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                var tbar = b.ownerCt;
+                grid.condition = '';
+                var items = [];
+                var fields = tbar.items.items.map(f => f.name);
+                Ext.each(fields, function(f, index){
+                    var field = tbar.down('[name='+f+']');
+                    if(field){
+                        items.push(field);
+                    }
+                });
+                grid.condition = grid.getCondition(items);
+                grid.store.loadPage(1);
+            }
         }
     },'->',{
         cls:'x-formpanel-btn-blue',
@@ -67,7 +91,7 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
             me.store = Ext.create('Ext.data.Store',{
                 fields:fields,
                 autoLoad: true,
-                pageSize: 10,
+                pageSize: 11,
                 data: [],
                 proxy: {
                     timeout:8000,
@@ -172,19 +196,6 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
         }
     },
 
-    getCondition: function(f,conditionExpression){
-        var condition = '';
-        if((f.xtype == 'checkbox' || f.xtype == 'radio')&&f.logic){
-            
-        }else if(f.xtype=='textfield'&&f.value!=''){
-            condition=conditionExpression.replace(new RegExp("\\{0}","g"), f.value);
-        }
-        if(condition.length>0){
-            condition+= ' AND ';
-        }
-        return condition;
-    },
-
     insertFirstColumn:function(columns){
         var me=this;
         if(columns.length>0 && columns[0].xtype!='actioncolumn'){
@@ -233,6 +244,109 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
             return false;
         }
 		return data;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getCondition: function(items) {
+        var me = this,
+        conditions = [];
+
+        for(var i = 0; i < items.length; i++) {
+            var item = items[i];
+            var field = item.name,
+            func = item.getCondition,
+            value = item.value,
+            condition;
+
+            if(typeof func == 'function') {
+                condition = {
+                    type: 'condition',
+                    value: func(value)
+                }
+            }else {
+                var xtype = item.xtype || 'textfield',
+                type = item.fieldType || me.getDefaultFieldType(xtype),
+                operation = item.operation || me.getDefaultFieldOperation(xtype),
+                conditionValue = me.getConditionValue(xtype, value);
+    
+                if(!conditionValue) {
+                    continue;
+                }
+                condition = {
+                    type: type,
+                    field: field,
+                    operation: operation,
+                    value: conditionValue
+                }
+            }
+            conditions.push(condition);
+        };
+        return conditions;
+    },
+
+    getDefaultFieldType: function(xtype) {
+        var type;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            type = 'number';
+        }else if(Ext.Array.contains(['datefield', 'condatefield'], xtype)) {
+            type = 'date';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo', 'radiofield', 'radio'], xtype)) {
+            type = 'enum';
+        }else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function(xtype) {
+        var operation;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['datefield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['condatefield'], xtype)) {
+            operation = 'between';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo'], xtype)) {
+            operation = 'in';
+        }else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function(xtype, value) {
+        var conditionValue;
+        if(xtype == 'datefield') {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+        }else if(xtype == 'condatefield') {
+            var from = value.from,
+            to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+        }else if(xtype == 'combobox' || xtype == 'combo') {
+            conditionValue = '\'' + value + '\'';
+        }else if(xtype == 'multicombo') {
+            conditionValue = value.map(function(v) {
+                return '\'' + v.value + '\'';
+            }).join(',');
+        }else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
+    refresh:function(){
+        //debugger
     }
 
 })

+ 135 - 6
frontend/saas-web/app/view/sys/messagelog/DataList.js

@@ -5,16 +5,43 @@ Ext.define('saas.view.sys.messagelog.DataList', {
     autoScroll: true,
     frame:true,
     layout:'fit',
-    dataUrl:'http://192.168.253.58:8920/messagelog/list',
-    saveUrl:'/api/common/number/save',
-    deleteUrl:'/api/common/number/delete/',
+    dataUrl:'api/common/messagelog/list',
 
     tbar: [{
+        width: 150,
+        name: 'ml_caller',
+        xtype: 'textfield',
+        emptyText : '单据Caller'
+    },{
+        width: 150,
+        name: 'ml_code',
+        xtype: 'textfield',
+        emptyText : '单据编号'
+    },{
+        width: 150,
+        name: 'ml_man',
+        xtype: 'textfield',
+        emptyText : '处理人'
+    },{
         cls:'x-formpanel-btn-orange',
         xtype:'button',
         text:'查询',
         listeners: {
-            click: 'onQuery'
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                var tbar = b.ownerCt;
+                grid.condition = '';
+                var items = [];
+                var fields = tbar.items.items.map(f => f.name);
+                Ext.each(fields, function(f, index){
+                    var field = tbar.down('[name='+f+']');
+                    if(field){
+                        items.push(field);
+                    }
+                });
+                grid.condition = grid.getCondition(items);
+                grid.store.loadPage(1);
+            }
         }
     },'->'],
 
@@ -24,6 +51,10 @@ Ext.define('saas.view.sys.messagelog.DataList', {
         width : 0, 
         dataIndex : "id", 
         xtype : "numbercolumn",   
+    },{
+        text:'单据Caller',
+        dataIndex : "ml_caller",
+        width : 200.0, 
     },{
         text : "单据编号", 
         width : 200.0, 
@@ -45,7 +76,6 @@ Ext.define('saas.view.sys.messagelog.DataList', {
         width : 200, 
     }],
 
-    dbSearchFields: [],
     condition:'',
 
     initComponent: function() {
@@ -55,7 +85,7 @@ Ext.define('saas.view.sys.messagelog.DataList', {
             me.store = Ext.create('Ext.data.Store',{
                 fields:fields,
                 autoLoad: true,
-                pageSize: 10,
+                pageSize: 11,
                 data: [],
                 proxy: {
                     timeout:8000,
@@ -114,6 +144,105 @@ Ext.define('saas.view.sys.messagelog.DataList', {
         return condition;
     },
 
+     /**
+     * 获得过滤条件
+     */
+    getCondition: function(items) {
+        var me = this,
+        conditions = [];
+
+        for(var i = 0; i < items.length; i++) {
+            var item = items[i];
+            var field = item.name,
+            func = item.getCondition,
+            value = item.value,
+            condition;
+
+            if(typeof func == 'function') {
+                condition = {
+                    type: 'condition',
+                    value: func(value)
+                }
+            }else {
+                var xtype = item.xtype || 'textfield',
+                type = item.fieldType || me.getDefaultFieldType(xtype),
+                operation = item.operation || me.getDefaultFieldOperation(xtype),
+                conditionValue = me.getConditionValue(xtype, value);
+    
+                if(!conditionValue) {
+                    continue;
+                }
+                condition = {
+                    type: type,
+                    field: field,
+                    operation: operation,
+                    value: conditionValue
+                }
+            }
+            conditions.push(condition);
+        };
+        return conditions;
+    },
+
+    getDefaultFieldType: function(xtype) {
+        var type;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            type = 'number';
+        }else if(Ext.Array.contains(['datefield', 'condatefield'], xtype)) {
+            type = 'date';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo', 'radiofield', 'radio'], xtype)) {
+            type = 'enum';
+        }else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function(xtype) {
+        var operation;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['datefield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['condatefield'], xtype)) {
+            operation = 'between';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo'], xtype)) {
+            operation = 'in';
+        }else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function(xtype, value) {
+        var conditionValue;
+        if(xtype == 'datefield') {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+        }else if(xtype == 'condatefield') {
+            var from = value.from,
+            to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+        }else if(xtype == 'combobox' || xtype == 'combo') {
+            conditionValue = '\'' + value + '\'';
+        }else if(xtype == 'multicombo') {
+            conditionValue = value.map(function(v) {
+                return '\'' + v.value + '\'';
+            }).join(',');
+        }else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
     refresh:function(){
         //debugger
     }

+ 21 - 2
frontend/saas-web/overrides/i18n.js

@@ -7,10 +7,10 @@
  */
 function openTab(xtype, title, id, config) {
     var mainTab = Ext.getCmp('main-tab-panel');
-    var panel = Ext.getCmp(id);
+    var panel = mainTab.query('[tabId="' + id + '"]')[0];
     if(!panel) {
         panel = Ext.create('saas.view.core.tab.Panel', {
-            id: id,
+            tabId: id,
             title: title,
             viewType: xtype,
             viewConfig: config
@@ -39,4 +39,23 @@ function showToast(content, title) {
         slideDUration: 400,
         maxWidth: 400
     });
+}
+
+/**
+ * 重设tab标题
+ */
+function refreshTabTitle(id, title) {
+    var currentTab = getCurrentTab();
+    currentTab.tabId = id;
+    currentTab.setTitle(title);
+}
+
+/**
+ * 获得当前Tab
+ */
+function getCurrentTab() {
+    var mainTab = Ext.getCmp('main-tab-panel');
+    var currentTab = mainTab.getActiveTab();
+
+    return currentTab;
 }