Forráskód Böngészése

产品库界面调整、接口对接

zhuth 7 éve
szülő
commit
c4c291b1d8

+ 4 - 4
frontend/saas-web/app/view/core/base/BasePanel.js

@@ -50,7 +50,7 @@ Ext.define('saas.view.core.base.BasePanel', {
                 frame:false,
                 xtype: 'toolbar',
                 dock: 'top',
-                layout: 'column',
+                // layout: 'column',
                 style: {
                     margin: '0 0 12px 0',
                     padding: '10px 0 14px 8px',
@@ -61,7 +61,7 @@ Ext.define('saas.view.core.base.BasePanel', {
                     handler: function() {
                         me.onQuery()
                     }
-                }], me.toolButtons)
+                }], ['->'], me.toolButtons)
             }],
             items: [gridcfg]
         });
@@ -114,7 +114,7 @@ Ext.define('saas.view.core.base.BasePanel', {
             value = item.value,
             condition;
 
-            if(value&&value!=''){
+            if(value !== undefined && value !== null && value !== ''){
                 if(typeof func == 'function') {
                     condition = {
                         type: 'condition',
@@ -125,7 +125,7 @@ Ext.define('saas.view.core.base.BasePanel', {
                     operation = item.operation || me.getDefaultFieldOperation(item),
                     conditionValue = me.getConditionValue(item, value);
         
-                    if(!conditionValue) {
+                    if(conditionValue === undefined && conditionValue === null && conditionValue === '') {
                         continue;
                     }
                     condition = {

+ 97 - 79
frontend/saas-web/app/view/sale/business/Product.js

@@ -5,50 +5,73 @@ Ext.define('saas.view.sale.business.Product', {
     extend: 'saas.view.core.base.BasePanel',
     xtype: 'sale-business-product',
 
-    controller: 'sale-business-Product',
-    viewModel: 'sale-business-Product',
     viewName: 'sale-business-Product',
 
 
-    // dataUrl: 'http://10.1.80.23:8560/api/sale/sale/enterprise/businessChance',
-    dataUrl: '/api/sale/sale/enterprise/businessChance',
+    // dataUrl: 'http://10.1.80.23:8560/api/document/product/prodStorage/list',
+    dataUrl: '/api/document/product/prodStorage/list',
     initComponent: function() {
         var me = this;
         Ext.apply(this, {
             searchField: [{
                 xtype: 'textfield',
                 name: 'keyword',
-                columnWidth: 0.15,
-                emptyText:'请输入物料编号/名称/型号/品牌'
+                columnWidth: 0.2,
+                emptyText:'请输入物料编号/名称/型号/品牌',
+                getCondition: function(value) {
+                    return  ' (prodCode like\'%' + value + '%\' or prodBrand like \'%'+value+'%\' or prodName like \'%'+value+'%\' or prodSpeccode like \'%'+value+'%\') ';
+                }
             }, {
                 xtype: 'combobox',
-                name: 'uploaded',
+                name: 'b2bStatus',
                 fieldLabel: '上传状态',
                 queryMode: 'local',
                 displayField: 'name',
                 valueField: 'value',
                 emptyText :'全部',
-                editable:false,
+                value: 0,
+                editable:true,
                 labelWidth: 80,
                 columnWidth: 0.2,
                 store: Ext.create('Ext.data.ArrayStore', {
                     fields: ['name', 'value'],
                     data: [
                         ["全部", "all"],
-                        ["未上传", "0"],
-                        ["已上传", "1"]
+                        ["待上传", "待上传"],
+                        ["已上传", "已上传"]
                     ]
-                })
+                }),
+                getCondition: function(v) {
+                    if(v == 'all') {
+                        return '1=1'
+                    }else {
+                        return 'ifnull(b2bStatus,\'待上传\')=' + '\'' + v + '\'';
+                    }
+                }
             }, {
                 xtype: 'checkbox',
-                name: 'self',
-                fieldLabel: '我的产品库'
+                name: 'status',
+                fieldLabel: '我的产品库',
+                columnWidth: 0.2,
+                getCondition: function(v) {
+                    if(v) {
+                        return 'status=' + Number(v);
+                    }else {
+                        return '1=1';
+                    }
+                }
+            }],
+
+            toolButtons: [{
+                xtype: 'button',
+                text: '上传公司产品',
+                handler: function() {
+                    me.onUpload();
+                }
             }],
         
             gridConfig: {
                 dataUrl: me.dataUrl,
-                rootProperty: 'data.content',
-                totalProperty: 'data.totalElements',
                 actionColumn: [],
                 selModel: {
                     type: 'cellmodel'
@@ -59,7 +82,7 @@ Ext.define('saas.view.sale.business.Product', {
                 }],
                 columns : [{
                     text: '物料编号',
-                    dataIndex: 'custName',
+                    dataIndex: 'prodCode',
                     width: 120
                 }, {
                     text: '品牌',
@@ -82,77 +105,72 @@ Ext.define('saas.view.sale.business.Product', {
                     dataIndex: 'prodUnit'
                 }, {
                     text: '上传状态',
-                    dataIndex: 'needQty'
+                    dataIndex: 'b2bStatus',
+                    renderer: function(v, m, r) {
+                        return v || '待上传';
+                    }
                 }, {
                     text: '我的产品',
-                    dataIndex: 'startDate'
+                    dataIndex: 'status',
+                    xtype: 'actioncolumn',
+                    align : 'center',
+                    items: [{
+                        iconCls:'',
+                        getClass: function(v, meta, rec) {
+                            if(rec.get('status')){
+                                return 'x-grid-checkcolumn-checked-btn';
+                            }else{
+                                return 'x-grid-checkcolumn-btn';
+                            }
+                        },
+                        handler: function(view, rowIndex, colIndex) {
+                            var rec = view.getStore().getAt(rowIndex);
+                            //  禁用/启用
+                            var grid = this.ownerCt.ownerCt;
+                            var params = {
+                                prodId: rec.get('prodId'),
+                                prodCode: rec.get('prodCode'),
+                                operate: new Number(!rec.get('status'))
+                            };
+                            grid.setLoading(true);
+                            saas.util.BaseUtil.request({
+                                url: 'http://10.1.80.23:8560/api/document/product/prodStorage/saler',
+                                params: JSON.stringify(params),
+                                method: 'POST',
+                            })
+                            .then(function(localJson) {
+                                grid.setLoading(false);
+                                if(localJson.success){
+                                    saas.util.BaseUtil.showSuccessToast('操作成功');
+                                    grid.store.load();
+                                }
+                            })
+                            .catch(function(e) {
+                                grid.setLoading(false);
+                                saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
+                            });
+                        }
+                    }]
                 }]
             },
         });
         this.callParent(arguments);
     },
 
-    /**
-     * 处理部分字段值
-     */
-    getConditionValue: function (field, value) {
-        var me = this,
-            xtypes = field.getXTypes().split('/'),
-            conditionValue;
-        if (me.isContainsAny(xtypes, ['datefield'])) {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
-        } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
-            var from = value.from,
-                to = value.to;
-
-            conditionValue = from + ',' + to;
-        } else if (me.isContainsAny(xtypes, ['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 (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
-            conditionValue = value;
-        } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
-            conditionValue = value;
-        } else if (me.isContainsAny(xtypes, ['multicombo'])) {
-            conditionValue = value.map ? value.map(function (v) {
-                return v.value;
-            }).join(',') : '';
-        } else {
-            conditionValue = value;
-        }
-
-        return conditionValue;
+    onUpload: function() {
+        var me = this;
+        me.setLoading(true);
+        saas.util.BaseUtil.request({
+            url: '/api/document/product/b2b/upload',
+            method: 'POST',
+        }).then(function(res) {
+            me.setLoading(false);
+            saas.util.BaseUtil.showSuccessToast('上传成功');
+            me.refresh();
+        }).catch(function(e) {
+            me.setLoading(false);
+            saas.util.BaseUtil.showErrorToast('上传失败: ' + e.message);
+        });
     },
 
-    getExtraParams: function(store, op, condition) {
-        var temp = {};
-
-        for(let x = 0; x < condition.length; x++) {
-            let c = condition[x];
-            if(c.field == 'keyword') {
-                temp.keyword = c.value;
-            }else if(c.field == 'date') {
-                temp.fromDate = new Date(c.value.split(',')[0]).getTime();
-                temp.endDate = new Date(c.value.split(',')[1]).getTime();
-            }else if(c.field == 'quoted') {
-                temp.quoted = c.value == 'all' ? null : c.value;
-            }else if(c.field == 'closed') {
-                // temp.endDate = c.value == 'all' ? null : (
-                //     c.value == '0' ? 
-                // );
-            }
-        }
-        let obj = {
-            pageNumber: store.exportNumber?store.exportNumber:op._page,
-            pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
-        };
-        for(let k in temp) {
-            if(!!temp[k]) {
-                obj[k] = temp[k];
-            }
-        }
-        return obj;
-     },
 });

+ 4 - 0
frontend/saas-web/resources/json/navigation.json

@@ -70,6 +70,10 @@
             "text": "销售退货单",
             "addType": "sale-salein-formpanel",
             "viewType": "sale-salein-querypanel"
+        }, {
+            "id": "sale-business-product",
+            "text": "产品库",
+            "viewType": "sale-business-product"
         }, {
             "b2b":true,
             "id": "sale-business-business",