Browse Source

代码合并

chenw 6 years ago
parent
commit
48660db316

+ 3 - 0
frontend/saas-web/app/view/core/base/GridPanel.js

@@ -87,6 +87,9 @@ Ext.define('saas.view.core.base.GridPanel', {
                                 console.error('exception: ', response);
                                 var message = response.responseJson?(response.responseJson.message==null?'没有数据':response.responseJson.message):'请求超时';
                                 saas.util.BaseUtil.showErrorToast('查询失败:' + message);
+                                if(response.responseJson.message==null){
+                                    Ext.getCmp('main-tab-panel').getActiveTab().items.items[0].items.items[0].store.removeAll()
+                                }
                             }
                         }
                     }

+ 115 - 10
frontend/saas-web/app/view/purchase/b2b/quotationList/DataList.js

@@ -381,6 +381,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
             status:status,
             refusereason:refusereason
         };
+        me.items.items[0].setLoading(true)
         Ext.Ajax.request({  
             url : '/api/purchase/purchase/inquiry/deal',
             timeout: 8000,  
@@ -392,6 +393,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
             method: 'POST',
             params:JSON.stringify(params),
             success: function(response, o){
+                me.items.items[0].setLoading(false)
                 var res = Ext.decode(response.responseText);
                 if(res.success){
                     me.down('grid').store.loadPage(1);
@@ -401,6 +403,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
                 }
             },
             failure: function (response, opts) {
+                me.items.items[0].setLoading(false)
                 saas.util.BaseUtil.showErrorToast('操作失败,请重试');
             }
         });
@@ -411,7 +414,7 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
         var win = Ext.create('Ext.window.Window', {  
             renderTo: me.getEl(),
             cls:'x-window-dbfind', 
-            height: 260,
+            height: 230,
             width: 450,
             modal:true,
             title: '选择分段数量',
@@ -431,9 +434,13 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
                 xtype:'grid',
                 frame:true,
                 anchor: '100% 100%',
-                width:206,
+                width:326,
+                margin:'5 0 0 0',
                 store:[],
-                height:138,
+                height:146,
+                plugins: [{
+                    ptype: 'menuclipboard'
+                }],
                 columns: [{
                     text: '分段数量',
                     dataIndex: 'lapQty',
@@ -446,18 +453,116 @@ Ext.define('saas.view.purchase.b2b.quotationList.DataList', {
                     dataIndex: 'price',
                     width: 90
                 },{
-                    text: '下单数量',
+                    text: '操作',
                     dataIndex: 'num',
-                    width: 90
+                    width: 120,
+                    renderer:function(v,m,r){
+                        return '<div style="width:100%;vertical-align: middle;    text-align: center;">'+
+                                    "<input type='button' value='选择' name='choose' style='border: 1px solid;color:#35baf6;cursor:pointer;background:#fff;'>"+
+                                '</div>';
+                    },
+                    listeners: {
+                        click: function (tableView, td, rowIdx, colIdx, e, model, tr) {
+                            let name = event.target.name;
+                            let _data = tableView.grid.store.data
+                            if(name == 'choose') {
+                                me.choose(_data,rowIdx,data);
+                                tableView.grid.ownerCt.close()
+                            }
+                        },
+                    }
                 }]
+            }]
+        });
+        win.show();
+    },
+    choose:function(data,rowIdx,row){
+        var me = this,minValue,maxValue = 999999999999999;
+        let nowRow = data.getAt(rowIdx);
+        let nextRow = data.getAt(rowIdx+1);
+        if(nextRow){
+            minValue = nowRow.data.lapQty
+            maxValue = nextRow.data.lapQty - 1
+        }else{
+            minValue = nowRow.data.lapQty
+        }
+        //显示弹窗
+        var win = Ext.create('Ext.window.Window', {  
+            renderTo: me.getEl(),
+            cls:'x-window-dbfind', 
+            height: 130,
+            width: 450,
+            modal:true,
+            title: '填写数量',
+            bodyPadding: 10,
+            constrain: true,
+            closable: true,
+            layout: {
+                type: 'hbox',
+                align: 'center'
+            },
+            items:[{
+                margin:'0 10 0 40',
+                labelWidth:60,
+                width:200,
+                minValue:minValue,
+                maxValue:maxValue,
+                xtype : "numberfield", 
+                decimalPrecision: 0,
+                name : "num",
+                fieldLabel : "数量"
             },{
-                margin:'20 0 0 0',
+                margin:'0 0 0 5',
                 xtype:'button',
-                text:'确认',
+                text:'确认下单',
                 handler:function(b){
-                    var refusereason = b.ownerCt.down('[name=refusereason]').value;
-                    me.sendMessage(id,status,refusereason);
-                    b.ownerCt.ownerCt.close();
+                    var num = b.ownerCt.down('[name=num]')
+                    if(!num.isValid()){
+                        saas.util.BaseUtil.showErrorToast('数量校验有误,请修改或重新选择分段');
+                    }
+                    var params = {
+                        id : row.id ,
+                        operate : row.agreed==1?0:1 ,
+                        prodCode : row.prodCode,
+                        vendName : row.vendName,
+                        vendUU : row.vendUU,
+                        userName : row.userName,
+                        tel : row.tel,
+                        taxRate : row.taxRate,
+                        price : nowRow.data.price,
+                        qty : num.value
+                    }
+                    b.ownerCt.setLoading(true)
+                    Ext.Ajax.request({  
+                        url : 'http://10.1.80.36:8560/api/purchase/purchase/inquiry/turnPurchase',
+                        timeout: 8000,  
+                        headers:{
+                            'Access-Control-Allow-Origin': '*',
+                            'Authorization':  saas.util.State.get('session').token,
+                            "Content-Type": 'application/json;charset=UTF-8'
+                        },
+                        method: 'POST',
+                        params:JSON.stringify(params),
+                        success: function(response, o){
+                            b.ownerCt.setLoading(false)
+                            var res = Ext.decode(response.responseText);
+                            if(res.success){
+                                me.down('grid').store.loadPage(1);
+                                saas.util.BaseUtil.showSuccessToast('下单成功');
+                                //打开采购单
+                                var config = {};
+                                config.initId = res.data.id;
+                                saas.util.BaseUtil.openTab('purchase-purchase-formpanel', '采购订单('+res.data.code+')', 'purchase-purchase-formpanel-'+res.data.id, config);
+                                b.ownerCt.close()
+                            }else{
+                                saas.util.BaseUtil.showErrorToast('操作失败:'+res.message);
+                            }
+                        },
+                        failure: function (response, opts) {
+                            b.ownerCt.setLoading(false)
+                            saas.util.BaseUtil.showErrorToast('操作失败,请重试');
+                        }
+                    });
                 }
             }]
         });

+ 2 - 0
frontend/saas-web/app/view/sale/b2b/recformpanel/FormPanelController.js

@@ -105,6 +105,8 @@ Ext.define('saas.view.sale.b2b.recformpanel.FormPanelController', {
             item.data.sourceId = item.data.sourceid
             item.data.sourceTable = item.data.sourcetable
             item.data.status = 0
+            item.data.sourceDate = item.data.sourceDate
+            item.data.orderCode = item.data.ordercode
             item.data.receiveCode = item.data.receivecode
             item.data.receiveName = item.data.receivename
             item.data.prodCode  = item.data.prodcode

+ 4 - 3
frontend/saas-web/app/view/sale/b2b/reconciliation/DataList.js

@@ -1,5 +1,5 @@
 /**
- * 应收对账单
+ * 对账单详情
  */
 Ext.define('saas.view.sale.b2b.reconciliation.DataList', {
     extend: 'saas.view.core.base.BasePanel',
@@ -105,7 +105,7 @@ Ext.define('saas.view.sale.b2b.reconciliation.DataList', {
                     width : 110.0,
                 },{
                     text : '对账日期', 
-                    dataIndex : 'apDate', 
+                    dataIndex : 'recordDate', 
                     xtype:'datecolumn',
                     renderer:function(v,m,r){
                         if(v&&v!=''){
@@ -176,7 +176,8 @@ Ext.define('saas.view.sale.b2b.reconciliation.DataList', {
         var obj = {
             count:op.config.limit,
             page:op.config.page,
-            searchFilter:JSON.stringify(searchFilter)
+            searchFilter:JSON.stringify(searchFilter),
+            sorting:JSON.stringify({"recordDate":"desc"})
         };
 
         return obj;