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

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

rainco 7 лет назад
Родитель
Сommit
363b61d560
21 измененных файлов с 348 добавлено и 86 удалено
  1. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/BillCodeSeq.java
  3. 1 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  4. 0 9
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  5. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java
  6. 1 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java
  7. 9 5
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  8. 2 2
      applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml
  9. 1 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java
  10. 1 1
      frontend/saas-web/Readme.md
  11. 1 14
      frontend/saas-web/app/view/core/base/GridPanel.js
  12. 2 2
      frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js
  13. 3 0
      frontend/saas-web/app/view/core/form/FormPanel.js
  14. 19 4
      frontend/saas-web/app/view/core/form/FormPanelController.js
  15. 2 2
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  16. 1 1
      frontend/saas-web/app/view/core/query/QueryPanelController.js
  17. 15 15
      frontend/saas-web/app/view/main/Navigation.js
  18. 1 1
      frontend/saas-web/app/view/stock/otherIn/FormPanelController.js
  19. 129 15
      frontend/saas-web/app/view/sys/maxnumbers/DataList.js
  20. 135 6
      frontend/saas-web/app/view/sys/messagelog/DataList.js
  21. 21 2
      frontend/saas-web/overrides/i18n.js

+ 1 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -40,7 +40,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALE_CLOSE(72001, "单据已关闭,无法进行操作"),
     SALE_YQTYBEYONDQTY(72001, "明细行已转数量大于数量"),
     SALE_NULL_BILL(72002, "单据不存在或者明细为空"),
-    SALEOUT_ALL_TURNIN(72003, "该销售出货单已全部转退货,无法转销售退货单"),
+    SALEOUT_ALL_TURNIN(72003, "该出货单已全部转退货,无法转销售退货单"),
     SALEOUT_POSTSTATUS_ERROR(72004,"当前单据状态无法进行此操作。"),
     SALEOUT_POST_ERROR(72005,""),
     //资金

+ 1 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/BillCodeSeq.java

@@ -22,7 +22,7 @@ public enum  BillCodeSeq {
 
     SALE("销售订单", "Sale"),
 
-    SALEOUT("销售出货单", "SaleOut"),
+    SALEOUT("出货单", "SaleOut"),
 
     SALEIN("销售退货单", "SaleIn"),
 

+ 1 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -82,7 +82,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == con) {
             con = "1=1";
         }
-        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
               list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
         } else {
               list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);

+ 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);
     }
 

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java

@@ -149,8 +149,8 @@ public class ProdInOutController {
 
     @PostMapping("/turnProdIn/{id}")
     public Result turnProdin(@PathVariable("id") Long id){
-        prodInOutService.turnProdin(id);
-        return Result.success();
+        DocBaseDTO baseDTO  = prodInOutService.turnProdin(id);
+        return Result.success(baseDTO);
     };
 
     @PostMapping("/close/{id}")

+ 1 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java

@@ -118,5 +118,5 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      * 出库单转退货单
      * @param id
      */
-    Result turnProdin(Long id);
+    DocBaseDTO turnProdin(Long id);
 }

+ 9 - 5
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -363,7 +363,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     }
 
     @Override
-    public Result turnProdin(Long id) {
+    public DocBaseDTO turnProdin(Long id) {
         Integer count=0;
         double pdOutqty=0;
         double pdYqty=0;
@@ -389,7 +389,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
         //判断可转数
         if (count==0) {
-            return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
+            throw  new BizException(ExceptionCode.TURNINNUM_NOT_EXIST);
         }
         //插入销售退货单主表
         ProdInOut targetPi = new ProdInOut();
@@ -455,7 +455,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                 prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
             }
         }
-        return Result.success();
+
+        //日志记录
+        DocBaseDTO baseDTO = new DocBaseDTO(pi_id, piInoutno, BillCodeSeq.SALEIN.getCaller());
+        //messageLogService.customizeLog(baseDTO, Operation.);
+        return baseDTO;
 
     }
 
@@ -548,7 +552,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
                 prodInOutMapper.validateCodeWhenUpdate(code, id);
         String caller ="";
-        if(pi_class.equals("销售出货单")){
+        if(pi_class.equals("出货单")){
             caller = BillCodeSeq.SALEOUT.getCaller();
         }else {//销售退货单
             caller = BillCodeSeq.SALEIN.getCaller();
@@ -580,7 +584,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     private void setTotal(ProdInOut prodInOut ) {
         String pi_class = prodInOut.getPi_class();
         Long id = prodInOut.getId();
-        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){//销售出货单
+        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){//出货单
             //更新明细
             prodIODetailMapper.updatePDSaleOut(id);
             //更新主表

+ 2 - 2
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -746,13 +746,13 @@ update prodiodetail a
           and pd_piid=#{id}  GROUP BY pd_ioid ) b
           where IFNULL(b.pd_ioid ,0)= a.pd_id
      ),0)
-where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pi_class='销售出货单')
+where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pi_class='出货单')
   </update>
   <update id="updateSaleYqty" parameterType="long">
 
     update saledetail a set a.sd_yqty =IFNULL( ( select b.pd_outqty from (
     select pd_sdid,sum(pd_outqty) pd_outqty from prodiodetail left join
-    prodinout on pd_piid = pi_id where pd_piclass='销售出货单' and pi_said=#{id}
+    prodinout on pd_piid = pi_id where pd_piclass='出货单' and pi_said=#{id}
     GROUP BY pd_sdid) b where IFNULL(b.pd_sdid ,0) = a.sd_id ),0) where a.sd_said =#{id}
   </update>
 

+ 1 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java

@@ -75,7 +75,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == con) {
             con = "1=1";
         }
-        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
             list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
         } else {
             list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);

+ 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;
 }