浏览代码

多从表支持

zhuth 7 年之前
父节点
当前提交
569c3c0c99

+ 26 - 32
frontend/saas-web/app/util/FormUtil.js

@@ -36,22 +36,6 @@ Ext.define('saas.util.FormUtil', {
                         Ext.apply(item, cusItem);
                     });
                     Ext.Array.each(items, function(item) {
-                        var bind = item.bind,
-                        bindName = bind,
-                        defaultValue = item.defaultValue;
-                        
-                        if(bindName && !Ext.isString(bindName)) {
-                            bindName = bindName.value;
-                        }
-                        if(bindName) {
-                            bindName = bindName.replace(/[{|}]/g, '');
-                        }
-
-                        // 设置初始值
-                        if(defaultValue) {
-                            formModel.set(bindName, defaultValue);
-                        }
-
                         // 设置必填
                         if(item.allowBlank==false){
                             // TODO 需要判断类型
@@ -60,20 +44,24 @@ Ext.define('saas.util.FormUtil', {
 
                         // 如果是从表为其绑定store
                         if(item.xtype == 'detailGridField') {
+                            var index = form.detailCount;
                             var columns = item.columns,
                             cnames = columns.filter(function(c) {
                                 return c.dataIndex && !c.ignore;
                             }).map(function(c) {
                                 return c.dataIndex
                             });
-                            formModel.set('detailBindFields', cnames);
+
+                            formModel.set('detail' + index + '.detailBindFields', cnames);
                             item.bind = {
-                                store: '{detailStore}'
+                                store: '{detail' + index + '.detailStore}'
                             };     
-                            formModel.set('detailStore', Ext.create('Ext.data.Store', {
+                            formModel.set('detail' + index + '.detailStore', Ext.create('Ext.data.Store', {
                                 model:item.storeModel,
                                 data: []
                             }));
+
+                            form.detailCount++;
                         }
                     });
                 }
@@ -104,10 +92,20 @@ Ext.define('saas.util.FormUtil', {
                 form.setLoading(false);
                 var res = Ext.decode(response.responseText);
                 if(res.success) {
-                    form.setFormData({
-                        main: res.data.main,
-                        detail: res.data.items
-                    });
+                    var d = res.data;
+                    var o = {
+                        main: d.main
+                    };
+                    if(d.items) {
+                        o.detail0 = d.items;
+                    }else {
+                        var idx = 1;
+                        while(d['item' + idx]) {
+                            o['detail' + (idx - 1)] = d['item' + idx];
+                            idx++;
+                        }
+                    }
+                    form.setFormData(o);
                 }
             })
             .catch(function(response) {
@@ -128,15 +126,11 @@ Ext.define('saas.util.FormUtil', {
                 if(res.success){
                     var code = res.data.code;
                     var viewModel = form.getViewModel();
-                    var detailStore = viewModel.get('_detailStore');
-                    var detno = 0,datas=[];
-                    Ext.Array.each(new Array(10), function() {
-                        detno += 1;
-                        var data = {};
-                        data[form._detnoColumn] = detno;
-                        datas.push(data);
-                    })
-                    detailStore.loadData(datas);
+                    var detailGrids = form.query('detailGridField');
+
+                    Ext.Array.each(detailGrids, function(grid) {
+                        grid.add10EmptyRow();
+                    });
                     if(code){
                         viewModel.set(form._codeField,code);
                     }

+ 31 - 23
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -12,6 +12,7 @@ Ext.define('saas.view.core.form.FormPanel', {
     _codeField: '',
     _statusField: '',
     _idField: '',
+    detailCount: 0,
 
     //基础属性
     initId: 0,
@@ -90,22 +91,22 @@ Ext.define('saas.view.core.form.FormPanel', {
         
         var o = {};
         o[statusField] = {
-            bind: '{' + statusCodeField + '}',
+            bind: '{form.' + statusCodeField + '}',
             get: function(value) {
                 return value == 'AUDITED' ? '已审核' : '未审核'
             }
         };
         o['auditBtnText'] = {
-            bind: '{' + statusCodeField + '}',
+            bind: '{form.' + statusCodeField + '}',
             get: function(value) {
                 return value == 'AUDITED' ? '反审核' : '审核'
             }
         };
         viewModel.setFormulas(o);
 
-        viewModel.set('createTime', new Date());
-        viewModel.set('updateTime', new Date());
-        statusCodeField ? viewModel.set(statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
+        viewModel.set('form.createTime', new Date());
+        viewModel.set('form.updateTime', new Date());
+        statusCodeField ? viewModel.set('form.' + statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
     },
 
     addItems: function(items) {
@@ -122,24 +123,37 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel(),
         allData = viewModel.getData(),
         formData = allData['form'],
-        detailStore = allData['detailStore'],
+        detailCount = me.detailCount,
         data = {
             main: formData,
-            detail: detailStore.getData().items
         };
 
+        for(var i = 0; i < detailCount; i++) {
+            var detail = allData['detail' + i],
+            store = detail.detailStore;
+
+            data['detail' + i] = store.getData().items;
+        }
+
         return data;
     },
 
     setFormData: function(formData) {
         var me = this,
         main = formData.main,
-        detail = formData.detail,
+        detailCount = me.detailCount,
         viewModel = me.getViewModel(),
-        detailStore = viewModel.get('detailStore');
+        viewData = viewModel.getData();
+
+        viewModel.set('form', main);
 
-        viewModel.setData(main);
-        detailStore.loadData(detail);
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i],
+            detail = viewData['detail' + i],
+            store = detail.detailStore;
+
+            store.loadData(detailData);
+        }
     },
 
     /**
@@ -150,11 +164,16 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel();
 
         Ext.Array.each(items, function(item) {
-            var bind = item.bind,
+            var xtype = item.xtype,
+            bind = item.bind,
             name = item.name,
             ignore = item.ignore,
             defaultValue = item.defaultValue;
 
+            if(xtype == 'detailGridField') {
+                return;
+            }
+
             // 设置model绑定
             if(!ignore) {
                 if(bind) {
@@ -179,15 +198,4 @@ Ext.define('saas.view.core.form.FormPanel', {
 
         });
     },
-
-    initFormData: function(formData) {
-        var me = this,
-        main = formData.main,
-        detail = formData.detail,
-        viewModel = me.getViewModel();
-
-        viewModel.setData(main);
-        // viewModel.set('detailGridField');
-    }
-    
 });

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

@@ -81,16 +81,24 @@ Ext.define('saas.view.core.form.FormPanelController', {
     save:function(formData){
         var me = this,
         form = this.getView(),
+        detailCount = form.detailCount,
         viewModel = me.getViewModel(),
-        modelData = viewModel.getData(),
-        detailBindFields = modelData.detailBindFields;
+        modelData = viewModel.getData();
 
-        var gridData = formData.detail?formData.detail:[];
-        var dirtyGridData = [];
-        if(gridData.length>0){
-            Ext.each(gridData, function(item,index){
+        var params = {
+            main:formData.main
+        };
+
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i];
+            var modelDetail = modelData['detail' + i];
+            var dirtyGridData = [];
+            var detailBindFields = modelDetail.detailBindFields;
+
+            Ext.Array.each(detailData, function(item){
                 var d = Object.assign({}, item.data),
                 dirty = item.dirty;
+
                 if(dirty){
                     if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
                         d.id = 0;
@@ -103,11 +111,15 @@ Ext.define('saas.view.core.form.FormPanelController', {
                     dirtyGridData.push(d);
                 }
             });
+            params['item' + ( i + 1)] = dirtyGridData;
         }
-        var params = {
-            main:formData.main,
-            items:dirtyGridData
+
+        // 只有一个从表时从表字段改为items
+        if(detailCount == 1) {
+            params.items = params.item1;
+            delete params.item1;
         }
+
         me.BaseUtil.request({
             url: form._saveUrl,
             params: JSON.stringify(params),
@@ -127,8 +139,12 @@ Ext.define('saas.view.core.form.FormPanelController', {
     },
 
     audit: function(){
-        var me = this;
-        var form = this.getView();
+        var me = this,
+        form = this.getView(),
+        detailCount = form.detailCount,
+        viewModel = me.getViewModel(),
+        modelData = viewModel.getData();
+        
         if(form.getForm().wasDirty==false){
             Ext.Msg.alert('提示','未修改数据,请修改后保存');
             return false;
@@ -139,22 +155,41 @@ Ext.define('saas.view.core.form.FormPanelController', {
         }
         //form里面数据
         var formData = form.getFormData();
-        var gridData = formData.detail?formData.detail:[];
-        var dirtyGridData = [];
-        if(gridData.length>0){
-            Ext.each(gridData, function(item,index){
-                if(item.dirty){
-                    if((typeof item.data.id) != "number" && item.data.id.indexOf('extMode')>-1){
-                        item.data.id = 0;
+        var params = {
+            main: formData.main
+        };
+
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i];
+            var modelDetail = modelData['detail' + i];
+            var dirtyGridData = [];
+            var detailBindFields = modelDetail.detailBindFields;
+
+            Ext.Array.each(detailData, function(item){
+                var d = Object.assign({}, item.data),
+                dirty = item.dirty;
+
+                if(dirty){
+                    if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
+                        d.id = 0;
+                    }
+                    for(k in d) {
+                        if(!Ext.Array.contains(detailBindFields, k)) {
+                            delete d[k];
+                        }
                     }
-                    dirtyGridData.push(item.data)
+                    dirtyGridData.push(d);
                 }
             });
-        }   
-        var params = {
-            main:formData.main,
-            items:dirtyGridData
+            params['item' + ( i + 1)] = dirtyGridData;
+        }
+
+        // 只有一个从表时从表字段改为items
+        if(detailCount == 1) {
+            params.items = params.item1;
+            delete params.item1;
         }
+
         me.BaseUtil.request({
             url: form._auditUrl,
             params: JSON.stringify(params),

+ 4 - 2
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -3,14 +3,16 @@ Ext.define('saas.view.core.form.FormPanelModel', {
     alias: 'viewmodel.core-form-formpanel',
 
     data: {
-        id:0,
+        form: {
+            id: 0
+        },
         detailBindeFields: [], // 从表绑定列
         detailStore: null, // 从表store
     },
 
     formulas:{
         deleteHidden:{
-            bind:'{id}',
+            bind:'{form.id}',
             get:function(value){
                 return !value;
             }

+ 7 - 9
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -92,14 +92,13 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     add10EmptyRow: function() {
         var me = this,
-        form = me.ownerCt,
-        detnoColumn = form._detnoColumn,
+        detnoColumn = me._detnoColumn,
         store = me.getStore(),
         selectedRecord = me.selModel.lastSelected,
         datas = [];
 
         //当前行后序号全部加1
-        var detno = selectedRecord.data[form._detnoColumn];
+        var detno = selectedRecord ? selectedRecord.data[detnoColumn] : 0;
         Ext.Array.each(new Array(10), function() {
             detno += 1;
             var data = {};
@@ -111,15 +110,14 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     addDetail: function() {
         var me = this,
-            form = me.ownerCt,
-            detnoColumn = form._detnoColumn,
+            detnoColumn = me._detnoColumn,
             store = me.getStore(),
             selectedRecord = me.selModel.lastSelected,
             detno = 0;
 
         //当前行后序号全部加1
         if(selectedRecord){
-            detno = selectedRecord.data[form._detnoColumn];
+            detno = selectedRecord.data[detnoColumn];
             var store = me.store;
             store.each(function(item){
                 d = item.data[detnoColumn];
@@ -183,14 +181,13 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     swap: function(from, index, dir) {
         var me = this,
-        form = me.ownerCt,
         store = me.getStore(),
         to = store.getAt(index + dir);
 
         if(from && to) {
             var keys = me.getColumns().map(function(c) {
                 //剔除序号字段
-                if(c.dataIndex!=form._detnoColumn){
+                if(c.dataIndex!=me._detnoColumn){
                     return c.dataIndex 
                 }
             }),
@@ -205,5 +202,6 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             //聚焦目标行
             me.selModel.select(to);
         }
-    }
+    },
+
 });

+ 153 - 0
frontend/saas-web/app/view/money/payBalance/FormPanel.js

@@ -0,0 +1,153 @@
+Ext.define('saas.view.money.payBalance.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'money-paybalance-formpanel',
+
+    controller: 'money-paybalance-formpanel',
+    viewModel: 'money-paybalance-formpanel',
+
+    viewName: 'money-paybalance-formpanel',
+
+    caller: 'Purchase',
+
+    //字段属性
+    _title: '付款单',
+    _idField: 'id',
+    _codeField: 'pu_code',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
+    
+    _relationColumn: 'pd_puid',
+    _readUrl: 'http://192.168.0.181:8560/api/purchase/purchase/read/',
+    _saveUrl: 'http://192.168.0.181:8560/api/purchase/purchase/save',
+    _auditUrl: 'http://192.168.0.181:8560/api/purchase/purchase/audit',
+    _deleteUrl: 'http://192.168.0.181:8560/api/purchase/purchase/delete/',
+    _deleteDetailUrl: 'http://192.168.0.181:8560/api/purchase/purchase/deleteItem/',
+    _turnInUrl: 'http://192.168.253.228:8800/purchase/turnProdin/',
+    initId: 0,
+
+    // toolBtns: [{
+    //     xtype: 'button',
+    //     text: '转采购验收单',
+    //     handler: 'turnIn'
+    // }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        fieldLabel: 'id'
+    }, {
+        xtype: "textfield",
+        name: "pb_code",
+        fieldLabel: "付款单号"
+    }, {
+        xtype: "hidden",
+        name: "pb_vendid",
+        bind: "{pb_vendid}",
+        fieldLabel: "供应商ID"
+    }, {
+        xtype: "hidden",
+        name: "pb_vendcode",
+        fieldLabel: "供应商编号"
+    }, {
+        xtype: "dbfindtrigger",
+        name: "pb_vendname",
+        fieldLabel: "供应商名称"
+    }, {
+        xtype: 'numberfield',
+        name: 'pb_pdamount',
+        fieldLabel: '总欠款'
+    }, {
+        xtype: "datefield",
+        name: "pb_date",
+        fieldLabel: "日期"
+    }, {
+        xtype: "detailGridField",
+        storeModel: 'saas.model.purchase.purchasedetail',
+        _detnoColumn: 'pd_detno',
+        columns: [{
+            text: "序号",
+            dataIndex: "pd_detno",
+            width: 100,
+            xtype: "numbercolumn",
+            align: 'center',
+            format: '0',
+            summaryType: 'count',
+            summaryRenderer: function (value, summaryData, dataIndex) {
+                return Ext.String.format('合计: {0}条', value);
+            },
+        }, {
+            text: '资金账户',
+            dataIndex: 'pd_bankname'
+        }, {
+            text: "付款金额",
+            dataIndex: "pd_amount",
+        }, {
+            text: "结算方式",
+            dataIndex: "pd_paymethod"
+        }, {
+            text: "结算号",
+            dataIndex: "pd_paycode"
+        }, {
+            text: "备注",
+            dataIndex: "pd_remark"
+        }]
+    }, {
+        xtype: "detailGridField",
+        storeModel: 'saas.model.purchase.purchasedetail',
+        _detnoColumn: 'pbd_detno',
+        columns: [{
+            text: "序号",
+            dataIndex: "pbd_detno",
+            width: 100,
+            xtype: "numbercolumn",
+            align: 'center',
+            format: '0',
+            summaryType: 'count',
+            summaryRenderer: function (value, summaryData, dataIndex) {
+                return Ext.String.format('合计: {0}条', value);
+            },
+        }, {
+            text: '来源单号',
+            dataIndex: 'pbd_slcode'
+        }, {
+            text: "业务类型",
+            dataIndex: "pbd_slkind",
+        }, {
+            text: "单据日期",
+            dataIndex: "pbd_sldate"
+        }, {
+            text: "单据金额",
+            dataIndex: "pbd_amount"
+        }, {
+            text: "已核销金额",
+            dataIndex: "pd_remark"
+        }, {
+            text: "未核销金额",
+            dataIndex: "pd_remark"
+        }, {
+            text: "本次核销金额",
+            dataIndex: "pbd_nowbalance"
+        }]
+    }, {
+        format: "Y-m-d",
+        xtype: "datefield",
+        name: "createTime",
+        fieldLabel: "创建时间"
+    }, {
+        xtype: "datefield",
+        name: "updateTime",
+        fieldLabel: "更新时间"
+    }, {
+        xtype: "textfield",
+        readOnly: true,
+        editable: false,
+        name: "pd_status",
+        fieldLabel: "单据状态"
+    }, {
+        xtype: "hidden",
+        readOnly: true,
+        editable: false,
+        name: "pd_statuscode",
+        fieldLabel: "单据状态码"
+    }]
+});

+ 158 - 0
frontend/saas-web/app/view/money/payBalance/FormPanelController.js

@@ -0,0 +1,158 @@
+Ext.define('saas.view.purchase.purchase.FormPanelController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.money-paybalance-formpanel',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'pd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    },
+
+    turnIn: function() {
+        var me = this,
+        form = me.getView(),
+        id = form.getForm().findField(form._idField);
+        form.BaseUtil.request({
+            url: form._turnInUrl+id.value,
+            method: 'GET',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','转单成功');
+              
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','转单失败');
+        });
+     }
+});

+ 5 - 0
frontend/saas-web/app/view/money/payBalance/FormPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchase.FormPanelModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.money-paybalance-formpanel',
+
+});

+ 196 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanel.js

@@ -0,0 +1,196 @@
+Ext.define('saas.view.purchase.purchase.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'purchase-purchase-querypanel',
+
+    controller: 'purchase-purchase-querypanel',
+    viewModel: 'purchase-purchase-querypanel',
+
+    viewName: 'purchase-purchase-querypanel',
+    
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'pu_id',
+        bind: '{pu_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        getCondition: function(value) {
+            return 'pu_id=' + value;
+        }
+    }, {
+        xtype: 'textfield',
+        name: 'pu_code',
+        bind: '{pu_code}',
+        fieldLabel: '单据编号'
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_date',
+        bind: '{pu_date}',
+        fieldLabel: '采购日期',
+        columnWidth: 0.5,
+        operation: 'between'
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_vendcode',
+        bind: '{pu_vendcode}',
+        fieldLabel: '供应商编号'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_vendname',
+        bind: '{pu_vendname}',
+        fieldLabel: '供应商名称'
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        showDetail: true
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        showDetail: true
+    }, {
+        xtype: 'combobox',
+        name: 'pu_statuscode',
+       // bind: '{pu_statuscode}',
+        fieldLabel: '审核状态',
+        queryMode: 'local',
+        displayField: 'pu_status',
+        valueField: 'pu_statuscode',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+        fields: ['pu_statuscode', 'pu_status'],
+        data: [
+            ["$ALL", "全部"],
+            ["AUDITED", "已审核"],
+            ["UNAUDITED", "未审核"]
+        ]
+        })
+    }, {
+        xtype: 'multicombo',
+        name: 'pu_acceptstatuscode',
+        bind: '{pu_acceptstatuscode}',
+        fieldLabel: '入库状态',
+        datas: [
+            ["TURNIN", "已入库"],
+            ["UNTURNIN", "未入库"],
+            ["PARTIN", "部分入库"]
+        ]
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_total',
+        bind: '{pu_total}',
+        fieldLabel: '金额'
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_delivery',
+        bind: '{pu_delivery}',
+        fieldLabel: '交货日期',
+        columnWidth: 1
+    }],
+    queryGridConfig: {
+        idField: 'pu_id',
+        codeField: 'pu_code',
+        addTitle: '采购单',
+        addXtype: 'purchase-purchase-formpanel',
+        defaultCondition:'',
+        baseVastUrl: 'http://192.168.253.58:8800/purchase/',
+        baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        }, {
+            text: '含税金额',
+            dataIndex: 'pu_taxtotal',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '金额',
+            dataIndex: 'pu_total',
+            xtype: 'numbercolumn',
+            width: 120,
+            flex: 1
+        }],
+        relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        }, {
+            text: '采购序号',
+            dataIndex: 'pd_detno',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '物料编号',
+            dataIndex: 'pd_prodcode',
+            width: 120
+        }, {
+            text: '数量',
+            dataIndex: 'pd_qty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '单价',
+            dataIndex: 'pd_price',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已转数',
+            dataIndex: 'pd_ytqy',
+            xtype: 'numbercolumn',
+            width: 120,
+            flex: 1
+        }]
+    }
+});

+ 117 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanelController.js

@@ -0,0 +1,117 @@
+Ext.define('saas.view.purchase.purchase.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.purchase-purchase-querypanel',
+    
+    init: function (form) {
+        var me = this;
+        this.control({
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendname]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'pd_prodcode',
+                        }, {
+                            from:'pr_detail',to:'pr_detail'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料单位",
+                            "flex": 0,
+                            "dataIndex": "pr_unit",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchase.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.purchase-purchase-querypanel'
+
+});

+ 2 - 1
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -15,7 +15,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
      _codeField: 'pu_code',
      _statusField: 'pu_status',
      _statusCodeField: 'pu_statuscode',
-     _detnoColumn:  'pd_detno',
+     
      _relationColumn: 'pd_puid',
      _readUrl:'http://192.168.0.181:8560/api/purchase/purchase/read/',
      _saveUrl:'http://192.168.0.181:8560/api/purchase/purchase/save',
@@ -114,6 +114,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
         name : "detailGridField", 
         xtype : "detailGridField", 
         storeModel:'saas.model.purchase.purchasedetail',
+        _detnoColumn:  'pd_detno',
         columns : [
             {
                 text : "序号", 

+ 2 - 1
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -12,7 +12,7 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
     _codeField: 'pi_inoutno',
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
-    _detnoColumn:  'pd_pdno',
+    
     _relationColumn: 'pd_piid',
     _readUrl:'http://192.168.253.228:8800/prodinout/read/',
     _saveUrl:'http://192.168.253.228:8800/prodinout/save',
@@ -106,6 +106,7 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
         name : "detailGridField", 
         xtype : "detailGridField",
         storeModel:'saas.model.purchase.prodIODetail', 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号", 

+ 2 - 1
frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js

@@ -13,7 +13,7 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
     _codeField: 'pi_inoutno',
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
-    _detnoColumn:  'pd_pdno',
+    
     _relationColumn: 'pd_piid',
     _readUrl:'http://192.168.253.228:8800/prodinout/read/',
     _saveUrl:'http://192.168.253.228:8800/prodinout/save',
@@ -100,6 +100,7 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
     },{
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号", 

+ 2 - 1
frontend/saas-web/app/view/sale/sale/FormPanel.js

@@ -13,7 +13,7 @@ Ext.define('saas.view.sale.sale.FormPanel', {
      _codeField: 'sa_code',
      _statusField: 'sa_status',
      _statusCodeField: 'sa_statuscode',
-     _detnoColumn:  'sd_detno',
+     
      _relationColumn: 'sd_puid',
      _readUrl:'',
      _saveUrl:'',
@@ -114,6 +114,7 @@ Ext.define('saas.view.sale.sale.FormPanel', {
     ,{
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'sd_detno',
         columnWidth : 1,
         columns : [
             {

+ 2 - 1
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -12,7 +12,7 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
     _codeField: 'pi_inoutno',
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
-    _detnoColumn:  'pd_pdno',
+    
     _relationColumn: 'pd_piid',
     _readUrl:'',
     _saveUrl:'',
@@ -105,6 +105,7 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号", 

+ 2 - 1
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -15,7 +15,7 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
     _codeField: 'pi_inoutno',
     _statusField: 'pi_status',
     _statusCodeField: 'pi_statuscode',
-    _detnoColumn:  'pd_pdno',
+    
     _relationColumn: 'pd_piid',
     _readUrl:'http://192.168.253.228:8800/prodinout/read/',
     _saveUrl:'http://192.168.253.228:8800/prodinout/save',
@@ -109,6 +109,7 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
     },{
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号", 

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

@@ -11,7 +11,7 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
      _codeField: 'pi_inoutno',
      _statusField: 'pi_status',
      _statusCodeField: 'pi_statuscode',
-     _detnoColumn:  'pd_pdno',
+     
      _relationColumn: 'pd_piid',
      _readUrl:'http://localhost:8800/purchase/read/',
      _saveUrl:'http://localhost:8800/purchase/save',
@@ -73,6 +73,7 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号", 

+ 2 - 1
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -11,7 +11,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
      _codeField: 'pi_inoutno',
      _statusField: 'pi_status',
      _statusCodeField: 'pi_statuscode',
-     _detnoColumn:  'pd_pdno',
+     
      _relationColumn: 'pd_piid',
      _readUrl:'http://localhost:8800/purchase/read/',
      _saveUrl:'http://localhost:8800/purchase/save',
@@ -69,6 +69,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
+        _detnoColumn:  'pd_pdno',
         columns : [
             {
                 text : "序号",