hy 6 年 前
コミット
961a9faad2

+ 7 - 0
app/Application.scss

@@ -120,3 +120,10 @@ $enable-font-awesome: dynamic(true);
     color:#fff;
   }
 }
+.x-btn-green{
+  background: #63bd7b !important;
+  border-color: #63bd7b !important;
+  .x-btn-inner-default-toolbar-small{
+    color:#fff;
+  }
+}

+ 15 - 1
app/view/form/formpanel/FormPanelController.js

@@ -18,11 +18,25 @@ Ext.define('uas.view.form.formpanel.FormPanelController', {
                         }],
                         searchUrl:'/api/searchPlanTree',
                         dataUrl:'/api/productList',
-                        addXtype: 'document-product-formpanel',
                         addTitle: '物料资料',
                         defaultCondition: "pr_statuscode='ENABLE'",
                     });
                 }
+            },
+            'vendormultitrigger[name=vcode]':{
+                beforerender:function(f){
+                    Ext.apply(f, {
+                        dbfinds: [{
+                            from: 'vcode',
+                            to: 'vcode',
+                            ignore: true
+                        }],
+                        searchUrl:'/api/searchPlanTree',
+                        dataUrl:'/api/productList',
+                        addTitle: '供应商资料',
+                        defaultCondition: "pr_statuscode='ENABLE'",
+                    });
+                }
             }
         });
     }

+ 16 - 2
app/view/form/formpanel/Grid.js

@@ -74,8 +74,8 @@ Ext.define('uas.view.form.formpanel.Grid', {
         }
     }, {
         dataIndex: 'code',
-        text: '采购单号',
-        width:240,
+        text: '采购单号(单选)',
+        width:200,
         locked: true,
         filter: {
             type:'string'
@@ -86,6 +86,20 @@ Ext.define('uas.view.form.formpanel.Grid', {
             allowBlank: false,
             selectOnFocus: false
         }
+    },{
+        dataIndex: 'vcode',
+        text: '供应商编号(多选)',
+        width:200,
+        locked: true,
+        filter: {
+            type:'string'
+        },
+        editor: {
+            name:'vcode',
+            xtype:'vendormultitrigger',
+            allowBlank: false,
+            selectOnFocus: false
+        }
     }, {
         dataIndex: 'status',
         text: '单据状态',

+ 4 - 18
app/view/form/formpanel/Panel.js

@@ -83,23 +83,9 @@ Ext.define('uas.view.form.formpanel.Panel', {
         minValue: '1:30 AM',
         maxValue: '9:15 PM'
     },{
-        xtype: 'radio',
-        name: 'radio1',
-        value: 'radiovalue1',
-        fieldLabel: 'Radio buttons',
-        boxLabel: 'radio 1'
-    }, {
-        xtype: 'radio',
-        name: 'radio1',
-        value: 'radiovalue2',
-        fieldLabel: '',
-        labelSeparator: '',
-        hideEmptyLabel: false,
-        boxLabel: 'radio 2'
-    }, {
-        xtype: 'displayfield',
-        name: 'displayfield1',
-        fieldLabel: 'Display field',
-        value: 'Display field <span style="color: "green";">value</span>'
+        columnWidth:0.33,
+        xtype: 'producttrigger',
+        name: 'code',
+        fieldLabel: '采购单号',
     }]
 });

+ 7 - 1
app/view/grid/dataList/DataListPaging.js

@@ -12,12 +12,18 @@ Ext.define('uas.view.grid.dataList.DataListPaging', {
         cls:'x-dl-paging-combo',
         labelWidth:60,
         width:124,
-        value:100,
+        value:10,
         labelAlgin:'right',
         xtype:'combo',
         editable:false,
         fieldLabel:'每页显示',
         store:[[
+            '10',10
+        ],[
+            '20',20
+        ],[
+            '50',50
+        ],[
             '100',100
         ],[
             '200',200

+ 1 - 1
app/view/grid/dataList/DataListPanel.scss

@@ -53,7 +53,7 @@
             .x-form-item-label-default{
                 padding-top:4px;
             }
-            top:3px !important;
+            top: 4px !important;
         }
         .x-tbar-page-number{
             top:6px !important;

+ 5 - 1
app/view/trigger/DbfindTrigger.js

@@ -27,7 +27,11 @@ Ext.define('uas.view.trigger.DbfindTrigger', {
 
             fields.push(field);
             minWidth += width;
-            cols += '<span style="padding:0 10px 0 10px;width:' + width + 'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{' + field + '}</span>';
+            if(dbtpls.length==(x+1)){
+                cols += '<span style="padding:0 10px 0 10px;width:' + width + 'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{' + field + '}</span>';
+            }else{
+                cols += '<span style="padding:0 10px 0 10px;width:' + width + 'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{' + field + '}</span>';
+            }
         }
 
         minWidth += 15;

+ 21 - 12
app/view/trigger/DbfindTriggerPanel.js

@@ -22,8 +22,8 @@ Ext.define('uas.view.trigger.DbfindTriggerPanel', {
                 if(!grid.searchPlanWindow){
                     grid.searchPlanWindow = Ext.create('widget.searchPlanWindow',{
                         modal: false,
-                        height:grid.getHeight()*0.8,
-                        width:grid.getWidth()*0.8,
+                        height:grid.getHeight()*0.95,
+                        width:grid.getWidth()*0.95,
                         renderTo:grid.ownerCt.getEl(),
                         grid:grid
                     }).show();
@@ -88,7 +88,8 @@ Ext.define('uas.view.trigger.DbfindTriggerPanel', {
             me.store = Ext.create('Ext.data.Store',{
                 fields:fields,
                 autoLoad: true,
-                pageSize: 20,
+                pageSize: 10,
+                grid:me,
                 data: [],
                 proxy: {
                     type: 'ajax',
@@ -133,6 +134,23 @@ Ext.define('uas.view.trigger.DbfindTriggerPanel', {
                             size: store.pageSize,
                             condition: JSON.stringify(condition)
                         });
+                    },
+                    load: function(store, records, successful, operation, eOpts) {
+                        const grid = store.grid;
+                        const paging = grid.down('[xtype=dataListPaging]');
+                        const pageCountItem = paging.down('#pageCountItem');
+                        const dataCount = paging.down('#dataCountItem');
+                        if(store.totalCount!==Number.MAX_SAFE_INTEGER){
+                            //展示*号
+                            if(store.currentPage===Number.MAX_SAFE_INTEGER){
+                                let page = store.totalCount/store.pageSize;
+                                page = page>parseInt(page)?page+1:page;
+                                store.currentPage = page;
+                                paging.down('#inputItem').setValue(page);
+                            }
+                            pageCountItem.update(Ext.String.format(paging.afterPageText,store.currentPage));
+                            dataCount.setValue("行/共"+store.totalCount+"行");
+                        }
                     }
                 }
             });
@@ -143,15 +161,6 @@ Ext.define('uas.view.trigger.DbfindTriggerPanel', {
     },
 
     listeners:{
-        boxready: function(grid, width, height, eOpts) {
-            var store = grid.getStore(),
-            gridBodyBox = grid.body.dom.getBoundingClientRect(),
-            gridBodyBoxHeight = gridBodyBox.height;
-
-            var pageSize = Math.floor(gridBodyBoxHeight / 33);
-
-            store.setPageSize(pageSize);
-        },
         itemClick: function(view,record) {
             var me = this;
             var dbfinds = me.dbfinds;

+ 10 - 0
app/view/trigger/DbfindTriggerPanel.scss

@@ -53,7 +53,17 @@
         border-bottom-width: 1px !important;
     }
     .x-grid-paging-toolbar{
+        padding: 2px 0 2px 8px;
         border: 1px solid #abdaff !important;
         border-top-width: 0px !important;
     }
+    .x-paging-checkbox{
+        margin-top:-3px !important;
+    }
+}
+
+.x-window-searchPlanWindow{
+    .x-title-text::before{
+        display: none;
+    }
 }

+ 273 - 0
app/view/trigger/MultiDbfindPaging.js

@@ -0,0 +1,273 @@
+Ext.define('uas.view.trigger.MultiDbfindPaging', {
+    extend: 'Ext.toolbar.Paging',
+    xtype: 'multidbfindPaging',
+    cls:'x-dataListPaging',
+    height: 36,
+
+    dock: 'bottom',
+    displayInfo: false,
+    emptyMsg: "无数据",
+    items:[{
+        xtype:'checkbox',
+        cls:'x-paging-checkbox',
+        name:'showSelectRecord',
+        boxLabel:'已选中数据',
+        handler:function(b){
+            var grid = b.up('multidbfindtriggerpanel');
+            if(b.checked){
+                grid.store.loadData(grid.selectRecordArr);
+                grid.selModel.noChange = true;
+                grid.selModel.deselectAll();
+                grid.selModel.select(grid.selectRecordArr);
+                grid.selModel.noChange = false;
+                //刷新展示数据
+                var dataCount = grid.selectRecordArr.length,msg;
+                var display = b.ownerCt.child('#displayItem');
+                if (dataCount === 0) {
+                    msg = b.ownerCt.emptyMsg;
+                } else {
+                    msg = Ext.String.format(
+                        b.ownerCt.displayMsg,
+                        1,
+                        dataCount,
+                        dataCount
+                    );
+                }
+                display.setText(msg);
+                b.ownerCt.child('#inputItem').setValue(1);
+                b.ownerCt.child("#afterTextItem").setText('页,共'+dataCount+'页');
+            }else{
+                grid.selModel.noChange = true;
+                grid.selModel.deselectAll();
+                grid.selModel.select(grid.selectRecordArr);
+                grid.selModel.noChange = false;
+                grid.store.loadPage(1);
+            }
+        }
+    },'->',{
+        itemId: 'pageSizeItem',
+        cls:'x-dl-paging-combo',
+        labelWidth:60,
+        width:124,
+        value:10,
+        labelAlgin:'right',
+        xtype:'combo',
+        editable:false,
+        fieldLabel:'每页显示',
+        store:[[
+            '10',10
+        ],[
+            '20',20
+        ],[
+            '50',50
+        ],[
+            '100',100
+        ],[
+            '200',200
+        ],[
+            '500',500
+        ],[
+            '1000',1000
+        ]],
+        listeners:{
+            change:function(me,newValue,oldValue){
+                const paging = me.ownerCt;
+                const grid = paging.ownerCt;
+                const { store } = grid;
+                const pageCountItem = paging.down('#pageCountItem');
+                const dataCount = paging.down('#dataCountItem');
+                if(newValue!==oldValue){
+                    store.setPageSize(newValue);
+                    pageCountItem.update(Ext.String.format(paging.afterPageText,'*'));
+                    dataCount.setValue("行/共*行");
+                    store.loadPage(1)
+                }
+            }
+        }
+    },{
+        itemId: 'dataCountItem',
+        cls:'x-dl-paging-display',
+        xtype:'displayfield',
+        value:'行/共*行'
+    }],
+
+    getPagingItems: function() {
+        var me = this,
+            inputListeners = {
+                scope: me,
+                blur: me.onPagingBlur
+            };
+        inputListeners[Ext.supports.SpecialKeyDownRepeat ? 'keydown' : 'keypress'] = me.onPagingKeyDown;
+        return [
+            {
+                itemId: 'first',
+                tooltip: me.firstText,
+                overflowText: me.firstText,
+                iconCls: Ext.baseCSSPrefix + 'tbar-page-first',
+                disabled: true,
+                handler: me.moveFirst,
+                scope: me
+            },
+            {
+                itemId: 'prev',
+                tooltip: me.prevText,
+                overflowText: me.prevText,
+                iconCls: Ext.baseCSSPrefix + 'tbar-page-prev',
+                disabled: true,
+                handler: me.movePrevious,
+                scope: me
+            },
+            '-',
+            me.beforePageText,
+            {
+                xtype: 'numberfield',
+                itemId: 'inputItem',
+                name: 'inputItem',
+                cls: Ext.baseCSSPrefix + 'tbar-page-number',
+                allowDecimals: false,
+                minValue: 1,
+                hideTrigger: true,
+                enableKeyEvents: true,
+                keyNavEnabled: false,
+                selectOnFocus: true,
+                submitValue: false,
+                // mark it as not a field so the form will not catch it when getting fields
+                isFormField: false,
+                width: me.inputItemWidth,
+                margin: '-1 2 3 2',
+                listeners: inputListeners
+            },
+            {
+                xtype: 'tbtext',
+                itemId: 'pageCountItem',
+                html: Ext.String.format(me.afterPageText, '*')
+            },
+            '-',
+            {
+                itemId: 'next',
+                tooltip: me.nextText,
+                overflowText: me.nextText,
+                iconCls: Ext.baseCSSPrefix + 'tbar-page-next',
+                disabled: true,
+                handler: me.moveNext,
+                scope: me
+            },
+            {
+                itemId: 'last',
+                tooltip: me.lastText,
+                overflowText: me.lastText,
+                iconCls: Ext.baseCSSPrefix + 'tbar-page-last',
+                disabled: true,
+                handler: me.moveLast,
+                scope: me
+            },
+            '-',
+            {
+                itemId: 'refresh',
+                tooltip: me.refreshText,
+                overflowText: me.refreshText,
+                iconCls: Ext.baseCSSPrefix + 'tbar-loading',
+                disabled: me.store.isLoading(),
+                handler: me.doRefresh,
+                scope: me
+            }
+        ];
+    },
+    moveLast: function() {
+        var me = this, 
+            last = me.getPageData().pageCount;
+        if(me.down('[name=showSelectRecord]').checked==false){
+            if (me.fireEvent('beforechange', me, last) !== false) {
+                me.store.loadPage(Number.MAX_SAFE_INTEGER);
+                this.ownerCt.selModel.noChange = true;
+                this.ownerCt.selModel.deselectAll();
+                this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
+                this.ownerCt.selModel.noChange = false;
+                return true;
+            }
+        }
+        return false;
+    },
+    moveFirst: function() {
+        if(me.down('[name=showSelectRecord]').checked==false){
+            if (this.fireEvent('beforechange', this, 1) !== false) {
+                this.store.loadPage(1);
+                this.ownerCt.selModel.noChange = true;
+                this.ownerCt.selModel.deselectAll();
+                this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
+                this.ownerCt.selModel.noChange = false;
+                return true;
+            }
+        }
+        return false;
+    },
+    movePrevious: function() {
+        var me = this,
+            store = me.store,
+            prev = store.currentPage - 1;
+        if(me.down('[name=showSelectRecord]').checked==false){
+            if (prev > 0) {
+                if (me.fireEvent('beforechange', me, prev) !== false) {
+                    store.previousPage();
+                    this.ownerCt.selModel.noChange = true;
+                    this.ownerCt.selModel.deselectAll();
+                    this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
+                    this.ownerCt.selModel.noChange = false;
+                    return true;
+                }
+            }
+        }
+        return false;
+    },
+    moveNext: function() {
+        var me = this,
+            store = me.store,
+            total = me.getPageData().pageCount,
+            next = store.currentPage + 1;
+        if(me.down('[name=showSelectRecord]').checked==false){
+            if (next <= total) {
+                if (me.fireEvent('beforechange', me, next) !== false) {
+                    store.nextPage();
+                    this.ownerCt.selModel.noChange = true;
+                    this.ownerCt.selModel.deselectAll();
+                    this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
+                    this.ownerCt.selModel.noChange = false;
+                    return true;
+                }
+            }
+        }
+        return false;
+    },
+    doRefresh: function() {
+        var me = this,
+            store = me.store,
+            current = store.currentPage;
+        if(me.down('[name=showSelectRecord]').checked==false){
+            if (me.fireEvent('beforechange', me, current) !== false) {
+                store.loadPage(current);
+                this.ownerCt.selModel.noChange = true;
+                this.ownerCt.selModel.deselectAll();
+                this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
+                this.ownerCt.selModel.noChange = false;
+                return true;
+            }
+        }
+        return false;
+    },
+    updateInfo: function() {
+        var me = this,
+            displayItem = me.child('#displayItem'),
+            store = me.store,
+            pageData = me.getPageData(),
+            count, msg;
+        if (displayItem) {
+            count = store.getCount();
+            if (count === 0) {
+                msg = me.emptyMsg;
+            } else {
+                msg = Ext.String.format(me.displayMsg, pageData.fromRecord, pageData.toRecord, pageData.total);
+            }
+            displayItem.setText(msg);
+        }
+    }
+});

+ 305 - 0
app/view/trigger/MultiDbfindTrigger.js

@@ -0,0 +1,305 @@
+/**
+ *  multi dbfind trigger
+ * 改了下MultiDbfindTrigger的赋值方式,在grid中也会把多选的值用#号连接
+ */
+Ext.define('uas.view.trigger.MultiDbfindTrigger', {
+	extend: 'Ext.form.ComboBox',
+	alias: 'widget.multidbfindtrigger',
+	triggerCls: 'x-form-search-trigger',
+    queryMode: 'local',
+    displayField: 'dispaly',
+    valueField: 'value',
+    triggerCls: 'x-form-search-trigger',
+    minChars:1, // 设置用户输入字符多少时触发查询
+    tpl: '',
+    enableKeyEvents:true,
+    initComponent: function () {
+        var me = this;
+        Ext.apply(me, me.applyConfig());
+        me.callParent();
+    },
+    applyConfig: function() {
+        var me = this,
+        dbtpls = me.dbtpls || [],
+        fields = [],
+        minWidth = 0,
+        cols = '';
+
+        for(let x = 0; x < dbtpls.length; x++) {
+            let dbtpl = dbtpls[x],
+            width = dbtpl.width || 100,
+            field = dbtpl.field;
+
+            fields.push(field);
+            minWidth += width;
+
+            if(dbtpls.length==(x+1)){
+                cols += '<span style="padding:0 10px 0 10px;width:' + width + 'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{' + field + '}</span>';
+            }else{
+                cols += '<span style="padding:0 10px 0 10px;width:' + width + 'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{' + field + '}</span>';
+            }
+        }
+
+        minWidth += 15;
+
+        cfg = {
+            store: Ext.create('Ext.data.Store', {
+                fields: fields,
+                data: []
+            }),
+            listConfig: {
+                minWidth: minWidth,
+                width: minWidth,
+                maxHeight: 210,
+                autoScroll: true
+            },
+            tpl: Ext.create('Ext.XTemplate',
+                '<ul style="padding-left: 0px;"><tpl for=".">',
+                '<li role="option" class="x-boundlist-item" style="list-style:none; padding: 0;">',
+                '<div style="height:30px;">',
+                '' + cols + '',
+                '</li>',
+                '</tpl></ul>'
+            )
+        };
+
+        return cfg;
+    },
+    //输入值之后进行模糊查询
+    doQuery: function(queryString, forceAll, rawQuery) {
+        if(!this.fireEvent('beforequery', this)) {
+            return;
+        };
+    	queryString = queryString || '';
+    	var me = this;
+        me.judge(me);
+        var dbfinds=me.dbfinds;
+        me.lastQueryValue=queryString;
+        if(queryString.trim()==''){
+            me.collapse( );
+        }else{
+            //加载数据
+            var data,dbCondition=[];
+            if(me.dbfinds){
+                var dbtplcondition = "";
+                for (let index = 0; index < dbfinds.length; index++) {
+                    var item = dbfinds[index].from;
+                    if(!dbfinds[index].ignore){
+                        dbtplcondition+= "upper("+item+") like '%"+queryString.toUpperCase()+"%' or ";
+                    }
+                }
+                dbtplcondition = "(" + dbtplcondition.substring(0,dbtplcondition.length-4) + ")";
+                if(dbtplcondition.length>0){
+                    dbCondition = [{
+                        type: 'condition',
+                        value:dbtplcondition
+                    }];
+                }
+            }
+            //添加默认条件
+            if(me.defaultCondition) {
+                dbCondition.push({
+                    type: 'condition',
+                    value: me.defaultCondition
+                });
+            }
+            Ext.Ajax.request({
+                url: me.dataUrl,
+                params: {
+                    number: 1,
+                    size: 10,
+                    condition:JSON.stringify(dbCondition),
+                    page: 1,
+                    start: 0,
+                    limit: 10
+                },
+                method: 'GET',
+                success: function(response, opts) {
+                    data = Ext.decode(response.responseText);
+                    data = data.data?data.data.list:[];
+                    if(data!=null && data.length>0 && me.store){
+                        me.store.loadData(data,false);
+                        me.expand();
+                    }else{
+                        me.store.removeAll();
+                        me.collapse();
+                    }
+                },
+                failure: function(response, opts) {}
+            });                
+        }
+        return true;
+    },
+    onTriggerClick:function(f){
+        if(!this.fireEvent('beforetriggerclick', this)) {
+            return;
+        };
+        f.blur(f);
+        //判断dbfindtrigger归属
+        f.judge(f);
+        var panel = f.up('content-panel') || Ext.getCmp('content-panel'),panelEl;
+        if(!f.column&&f.ownerCt.ownerCt.id.indexOf('window-')>-1){
+            panelEl = f.ownerCt.ownerCt.getEl();
+        }else{
+            panelEl = panel.getEl()
+        }
+        var box = panelEl.getBox();
+        var height = box.height;
+        var width = box.width;
+        var win = panel.add(Ext.create('Ext.window.Window', {   
+            cls:'x-window-dbfind', 
+            trigger:f,
+            belong:f.ownerCt,  
+            modal:true,
+            height: height * 0.9,
+            width: width * 0.9,
+            title: '查找' + f.addTitle,
+            scrollable: true,
+            bodyPadding: 10,
+            constrain: true,
+            closable: true,
+            layout:'fit',
+            renderTo:panelEl,
+            items:[{
+                xtype:'multidbfindtriggerpanel',
+                columns: f.dbColumns,
+                dataUrl: f.dataUrl,
+                dbfinds: f.dbfinds,
+                belong: f.belong,
+                searchUrl: f.searchUrl,
+                dbSearchFields:f.dbSearchFields?f.dbSearchFields:[],
+                dbfindtrigger:f
+            }]
+        }));
+        win.show();
+    },
+
+    listeners: {
+        blur:function(f,e){
+            return true;//先不使用
+            var me = f,data;
+            var dbfinds = me.dbfinds;
+            if(f.value&&f.value!=''){
+                //添加默认条件
+                var searchField = null;
+                var dbCondition = [];
+                if(me.defaultCondition) {
+                    dbCondition.push({
+                        type: 'condition',
+                        value: me.defaultCondition
+                    });
+                }
+                for (let index = 0; index < dbfinds.length; index++) {
+                    var item = dbfinds[index].to;
+                    if(item==me.name){
+                        searchField = dbfinds[index].from;
+                    }
+                }
+                dbCondition.push({
+                    type: 'condition',
+                    value: searchField + "='"+me.value+"'"
+                });
+                Ext.Ajax.request({
+                    url: me.dataUrl,
+                    async:false,
+                    params: {
+                        number: 1,
+                        size: 1,
+                        condition:JSON.stringify(dbCondition),
+                        page: 1,
+                        start: 0,
+                        limit: 10
+                    },
+                    method: 'GET',
+                    success: function(response, opts) {
+                        data = Ext.decode(response.responseText);
+                        data = data.data?data.data.list:[];
+                    },
+                    failure: function(response, opts) {}
+                }); 
+            }
+            if(!f.value||f.value==''||data.length>1||data.length==0){
+                if(dbfinds&&dbfinds.length>0){
+                    if(me.belong=='grid'){
+                        for (let index = 0; index < dbfinds.length; index++) {
+                            var item = dbfinds[index];
+                            var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
+                            var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
+                            if(nowRec.get(item.to)&&nowRec.get(item.to)!=""){
+                                nowRec.set(item.to,null);
+                            }
+                            if(nowRec.modified){
+                                delete nowRec.modified[item.to];
+                            }
+                            if(JSON.stringify(nowRec.modified)=="{}"){
+                                nowRec.dirty = false
+                            }
+                            if(me.name==item.to){
+                                me.column.getEditor().setValue('');
+                            }
+                        }
+                    }
+                }
+            }else if(data.length==1){
+                if(dbfinds&&dbfinds.length>0){
+                    if(me.belong=='grid'){
+                        for (let index = 0; index < dbfinds.length; index++) {
+                            var item = dbfinds[index];
+                            var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
+                            var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
+                            nowRec.set(item.to,data[0][item.from]);
+                            if(me.name==item.to){
+                                me.column.getEditor().setValue(data[0][item.from]);
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        select:function(combo,record,eOpts){
+            var me = combo;
+            var dbfinds = me.dbfinds;
+            if(dbfinds&&dbfinds.length>0){
+                if(me.belong=='grid'){
+                    for (let index = 0; index < dbfinds.length; index++) {
+                        var item = dbfinds[index];
+                        var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
+                        var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
+                        nowRec.set(item.to,record.get(item.from));
+                        if(me.name==item.to){
+                            me.column.getEditor().setValue(record.get(item.from));
+                        }
+                    }
+                }else if(me.belong=='form'){
+                    for (let index = 0; index < dbfinds.length; index++) {
+                        var item = dbfinds[index];
+                        var field = me.ownerCt.down('[name='+item.to+']');
+                        if(field){
+                            var val = record.get(item.from);
+                            if(field.xtype=='dbfindtrigger'){
+                                field.setRawValue(val);
+                                field.value = val;
+                                field.lastTriggerValue=val;
+                            }else{
+                                field.setValue(val);
+                            }    
+                        }
+                    }
+                }
+            }
+        }
+    },
+
+    judge:function(f){
+        if(f.ownerCt.xtype.trim().toUpperCase().indexOf('QUERYFORMPANEL')>-1){
+            f.belong = 'form';
+            return f.ownerCt.ownerCt
+        }else if(f.ownerCt.xtype.trim().toUpperCase().indexOf('FORMPANEL')>-1){
+            f.belong = 'form';
+            return f.ownerCt
+        }else if(f.column){
+            f.belong = 'grid';
+            return f.column.ownerCt.ownerCt.ownerCt
+        }
+    }
+});

+ 377 - 0
app/view/trigger/MultiDbfindTriggerPanel.js

@@ -0,0 +1,377 @@
+Ext.define('uas.view.trigger.MultiDbfindTriggerPanel', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'multidbfindtriggerpanel',
+
+    dataUrl: '',
+    dbSearchFields: [],
+    condition:'',
+    selectRecordArr:[],
+    plugins: {
+        gridHeaderFilter: true
+    },
+
+    selModel: {
+        checkOnly:true,
+        type:'checkboxmodel',
+        ignoreRightMouseSelection : false,
+        listeners:{
+            select:function(selModel,record,c,d){
+                if(!selModel.noChange){
+                    var selectRecordArr = selModel.view.ownerCt.selectRecordArr;
+                    selectRecordArr.push(record);
+                }
+            },
+            deselect:function(selModel,record){
+                if(!selModel.noChange){
+                    var selectRecordArr = selModel.view.ownerCt.selectRecordArr;
+                    var index = -1;
+                    index = selectRecordArr.findIndex(function(f){
+                        return f.id==record.id
+                    });
+                    if(index>-1){
+                        selectRecordArr.splice(index,1);
+                    }
+                }
+            }
+         }
+    },
+    
+    listeners:{
+        itemdblclick:function( view, record, item, index, e, eOpts ) {
+            var grid = view.ownerCt;
+            var index = -1;
+            index = grid.selectRecordArr.findIndex(function(f){
+                return f.id==record.id
+            });
+            grid.selModel.noChange = true;
+            if(index==-1){
+                grid.selectRecordArr.push(record);
+                grid.selModel.select(grid.selectRecordArr);
+                // grid.store.loadPage(grid.store.currentPage);
+                grid.updateLayout();
+                grid.view.updateLayout();
+                Ext.resumeLayouts();
+            }else{
+                grid.selectRecordArr.splice(index,1);
+                grid.selModel.deselect(record);
+            }
+            grid.selModel.noChange = false;
+        }
+    },
+
+    dockedItems: [{
+        name:'operateToolbar',
+        cls:'x-grid-operateToolbar',
+        xtype: 'toolbar',
+        dock: 'top',
+        height:32,
+        items:[{
+            cls:'x-btn-blue',
+            xtype:'button',
+            text:'筛选',
+            handler:function(me){
+                const grid = me.up('multidbfindtriggerpanel');
+                if(!grid.searchPlanWindow){
+                    grid.searchPlanWindow = Ext.create('widget.searchPlanWindow',{
+                        modal: false,
+                        height:grid.getHeight()*0.95,
+                        width:grid.getWidth()*0.95,
+                        renderTo:grid.ownerCt.body,
+                        grid:grid
+                    }).show();
+                }else{
+                    grid.searchPlanWindow.show();
+                }
+            }
+        },{
+            cls:'x-btn-green',
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'确定',
+            handler:function(me){
+                var grid = me.up('multidbfindtriggerpanel');
+                var selectRecordArr = grid.selectRecordArr;
+                var dbfinds = grid.dbfinds;
+                //点开放大镜的行
+                var mainGrid = grid.dbfindtrigger.column.ownerCt.ownerCt;
+                var rec = mainGrid.selModel.getLastSelected();
+                Ext.Array.each(selectRecordArr,function(record,_index) {
+                    Ext.Array.each(dbfinds,function(dbfind) {
+                        if(rec){
+                            var nowRec = mainGrid.store.getData().getByKey(rec.id);
+                            nowRec.set(dbfind.to,record.get(dbfind.from));
+                        }
+                    });
+                    var index = mainGrid.store.data.items.findIndex(function(f){
+                        return f.id==(rec&&rec.id?rec.id:0)
+                    });
+                    rec = mainGrid.store.data.getAt(index+1);
+                    if(!rec&&_index!=selectRecordArr.length-1){//添加下一行
+                        var data = {};
+                        data[mainGrid.ownerCt.detnoColumn] = index + 2;
+                        mainGrid.store.insert(index+1, data);
+                        rec = mainGrid.store.data.getAt(index+1);
+                    }
+                });
+                //mainGrid.up('detailGridField').fireEvent('edit');
+                grid.ownerCt.close();
+            }
+        },{
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'批处理'
+        },{
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'上一页'
+        },{
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'下一页'
+        },{
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'导出'
+        },{
+            margin:'0 0 0 6',
+            xtype:'button',
+            text:'个性设置'
+        },{
+            margin:'0 0 0 12',
+            xtype:'button',
+            text:'关闭'
+        }]
+    },{
+        xtype: 'toolbar',
+        dock: 'top',
+        name:'searchPlan',
+        cls:'x-grid-searchPlan',
+        height:32,
+        items:[{
+            xtype:'displayfield',
+            value:'查询方案:'
+        }]
+    },{
+        xtype: 'toolbar',
+        dock: 'top',
+        name:'filterToolbar',
+        cls:'x-grid-filterToolbar',
+        height:32,
+        items:[{
+            xtype:'displayfield',
+            value:'筛选条件:'
+        },'->']
+    },{
+        xtype: 'multidbfindPaging'
+    }],
+
+    initComponent: function() {
+        var me = this;
+        me.selectRecordArr = [];
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 10,
+                grid:me,
+                data: [],
+                proxy: {
+                    type: 'ajax',
+                    url: me.dataUrl,
+                    timeout:8000,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.list',
+                        totalProperty: 'data.total',
+                    },
+                    listeners: {
+                        exception: function(proxy, response, operation, eOpts) {
+                            if(operation.success) {
+                                if(response.timedout) {
+                                    saas.util.BaseUtil.showErrorToast('请求超时');
+                                }
+                            }else {
+                                console.error('exception: ', response);
+                                saas.util.BaseUtil.showErrorToast('查询失败:' + (response.responseJson?response.responseJson.message:'请求超时'));
+                            }
+                        }
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = [];
+                        }
+                        //添加默认条件
+                        if(me.ownerCt.trigger.defaultCondition) {
+                            condition.push({
+                                type: 'condition',
+                                value: me.ownerCt.trigger.defaultCondition
+                            });
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            number: op._page,
+                            size: store.pageSize,
+                            condition: JSON.stringify(condition)
+                        });
+                    },
+                    load: function(store, records, successful, operation, eOpts) {
+                        const grid = store.grid;
+                        const paging = grid.down('[xtype=multidbfindPaging]');
+                        const pageCountItem = paging.down('#pageCountItem');
+                        const dataCount = paging.down('#dataCountItem');
+                        if(store.totalCount!==Number.MAX_SAFE_INTEGER){
+                            //展示*号
+                            if(store.currentPage===Number.MAX_SAFE_INTEGER){
+                                let page = store.totalCount/store.pageSize;
+                                page = page>parseInt(page)?page+1:page;
+                                store.currentPage = page;
+                                paging.down('#inputItem').setValue(page);
+                            }
+                            pageCountItem.update(Ext.String.format(paging.afterPageText,store.currentPage));
+                            dataCount.setValue("行/共"+store.totalCount+"行");
+                        }
+                    }
+                }
+            });
+        }
+        me.callParent(arguments);
+
+        me.getSearchPlan();
+    },
+
+     /**
+     * 获得过滤条件
+     */
+    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(value&&value!=''){
+                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 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
+        }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;
+    },
+
+    getSearchPlan:function(){
+        const me = this;
+        Ext.Ajax.request({
+            url: me.searchUrl,
+            params: '',
+            method: 'GET',
+            async:false,
+            success: function(response, opts) {
+                var _data = Ext.decode(response.responseText);
+                if(_data&&_data.data){
+                    const searchPlan = me.down('[name=searchPlan]');
+                    let items = [];
+                    Ext.Array.each(_data.data,function(p){
+                        if(p.children&&p.children.length>0){
+                            Ext.Array.each(p.children,function(item){
+                                items.push({
+                                    text:item.text,
+                                    xtype:'button'
+                                })
+                            })
+                        }
+                    });
+                    searchPlan.add(items);
+                }
+            },
+            failure: function(response, opts) {}
+        }); 
+    }
+});

+ 1 - 1
app/view/trigger/define/ProductTrigger.js

@@ -5,7 +5,7 @@ Ext.define('uas.view.trigger.define.ProductTrigger', {
     dbtpls: [{
         field: 'code',width: 200
     }, {
-        field: 'price',width: 150
+        field: 'price',width: 80
     }],
     dbColumns:[{
         text: "物料ID",

+ 60 - 0
app/view/trigger/define/VendorMultiTrigger.js

@@ -0,0 +1,60 @@
+Ext.define('uas.view.trigger.define.VendorMultiTrigger', {
+    extend: 'uas.view.trigger.MultiDbfindTrigger',
+    xtype: 'vendormultitrigger',
+
+    dbtpls: [{
+        field: 'vcode',width: 200
+    }],
+    dbColumns:[{
+        text: "物料ID",
+        hidden: true,
+        dataIndex: "id"
+    }, {
+        text: "供应商编号",       
+        dataIndex: "vcode",
+        width: 250,
+        filter:{
+            type:'string'
+        }
+    },{
+        text: "供应商",
+        width: 190,
+        dataIndex: "vendor",
+        filter:{
+            type:'string'
+        }
+    }, {
+        text : "型号", 
+        dataIndex : "currency", 
+        width : 200.0,
+        filter:{
+            type:'string'
+        }
+    }, {
+        text : "规格", 
+        dataIndex : "currency", 
+        width : 200.0,
+        filter:{
+            type:'string'
+        }
+    },{
+        text: "单位",
+        dataIndex: "currency",
+        width: 65
+    },{
+        text: "类型",
+        dataIndex: "currency",
+        width: 100
+    },{
+        text: "库存",
+        dataIndex: "price",
+        width: 100,
+        xtype: 'numbercolumn',
+        filter:{
+            type:'number'
+        }
+    }, {
+        dataIndex: '',
+        flex: 1
+    }]
+});

+ 1 - 1
index.html

@@ -53,7 +53,7 @@
                 setCookie('locale',"zh",0);
                 locale = 'zh';
             }
-            console.log('加载语言包:' + theme); 
+            console.log('加载语言包:' + locale); 
             Ext.manifest = theme + '_' + locale + '.json'; }; 
     </script>
 

+ 1 - 0
server/action/formGridList.js

@@ -12,6 +12,7 @@ var formGridList = (function(){
             recordman:"小明",
             auditman:"大明",
             special:(i%2)===0?true:false,
+            vcode:"VE"+(2019081900000001+Number(i))+""
         })
     }
     return arr;

+ 27 - 3
server/action/productList.js

@@ -1,6 +1,6 @@
 var productList = (function(){
     let arr = [];
-    for(let i=0;i<5;i++){
+    for(let i=0;i<20;i++){
         arr.push({
             id:(i+1),
             code:"PU"+(2019081900000001+Number(i))+"",
@@ -12,13 +12,37 @@ var productList = (function(){
             recordman:"小明",
             auditman:"大明",
             special:(i%2)===0?true:false,
+            vcode:"VE"+(2019081900000001+Number(i))+""
         })
     }
     return arr;
 })();
 
 module.exports = function(request, response){
-    return {
-        list: productList
+    var query = request.query;
+    var page = Number(query.page) || 1;
+    var start = Number(query.start) || 0;
+    var limit = Number(query.limit) || 0;
+    var result = {
+        total:Number.MAX_SAFE_INTEGER
     };
+
+    if(page===Number.MAX_SAFE_INTEGER){
+        result.total = productList.length
+        page = productList.length/limit;
+        page = page>parseInt(page)?page+1:page;
+        start = (page-1)*limit;
+    }else{
+        if(start<=productList.length&&(start+limit)>=productList.length){
+            result.total = productList.length
+        }
+    }
+
+    if(limit > 0) {
+        result.list = productList.slice(start, start + limit);
+    }else {
+        result.list = productList;
+    }
+
+    return result;
 }

ファイルの差分が大きいため隠しています
+ 0 - 0
triton_zh.json


ファイルの差分が大きいため隠しています
+ 0 - 0
triton_zh.jsonp


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません