Browse Source

B2B对接界面提交

hy 7 years ago
parent
commit
fdd5d5bfc2

+ 17 - 0
frontend/saas-web/app/view/main/Navigation.js

@@ -86,6 +86,23 @@ Ext.define('saas.view.main.Navigation', {
             menuId = 'navMenu-' + id,
             menuId = 'navMenu-' + id,
             menu = Ext.getCmp(menuId);
             menu = Ext.getCmp(menuId);
 
 
+        //获取b2b权限
+        var enableB2B = me.ownerCt.ownerCt.getViewModel().get('enableB2B');
+
+        if(enableB2B==null||enableB2B==0||enableB2B=='0'){
+            Ext.each(menuItems,function(item,index){
+                if(item.items.length>0){
+                    var l = item.items.length;
+                    for(var i = 0;i<l;i++){
+                        if(item.items[i].b2b){
+                            item.items.splice(i--,1);
+                            l--;
+                        }
+                    };
+                }
+            })
+        }
+            
         if (!menu) {
         if (!menu) {
             var view = new Ext.DataView({
             var view = new Ext.DataView({
                 store: Ext.create('Ext.data.Store', {
                 store: Ext.create('Ext.data.Store', {

+ 428 - 0
frontend/saas-web/app/view/purchase/deviceQuery/DataList.js

@@ -0,0 +1,428 @@
+/**
+ * Created by zhouy on 2018/10/18.
+ */
+Ext.define('saas.view.purchase.deviceQuery.DataList', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'purchase-deviceQuery-datalist',
+    controller: 'purchase-deviceQuery-datalist',
+    viewModel: 'purchase-deviceQuery-datalist',
+    autoScroll: true,
+    frame:true,
+    style:'padding:0;',
+    layout:'fit',
+    dataUrl:'/api/purchase/purchase/device/list',                 
+    deleteUrl:'/api/commons/number/delete/',
+
+    plugins: [{
+        ptype: 'menuclipboard'
+    }],
+
+    tbar: [{
+        width: 240,
+        name: 'mn_name',
+        xtype: 'textfield',
+        allowBlank:true,
+        emptyText : '请输入型号/物料名称/品牌搜索',
+        enableKeyEvents: true,
+        listeners: {
+            keydown: {
+                fn: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        var grid = th.up('grid');
+                        grid.condition = grid.getConditions();
+                        grid.store.loadPage(1);
+                    }
+                }
+            }
+        },
+        getCondition:function(v){
+            return v;
+        }
+    },{
+        cls:'x-formpanel-btn-blue',
+        xtype:'button',
+        text:'查询',
+        listeners: {
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                grid.condition = grid.getConditions();
+                grid.store.loadPage(1);
+            }
+        }
+    },'->'],
+
+    columns : [{
+        text : 'id', 
+        width : 0, 
+        dataIndex : 'id', 
+        xtype : 'numbercolumn', 
+        hidden:true
+    },{
+        text : '品牌', 
+        width : 150.0, 
+        dataIndex : 'pr_brand', 
+        xtype : '', 
+    },{
+        text : '名称', 
+        width : 200.0, 
+        dataIndex : 'pr_detail', 
+        xtype : '', 
+    },{
+        text : '型号', 
+        width : 200.0, 
+        dataIndex : 'pr_orispeccode', 
+        xtype : '', 
+    },{
+        text : '规格', 
+        width : 200, 
+        dataIndex : 'pr_spec', 
+        xtype : '', 
+    },{
+        text : '包装', 
+        width : 100, 
+        dataIndex : 'pr_pack', 
+        xtype : '', 
+    },{
+        text : '供应商', 
+        width : 150.0, 
+        dataIndex : 'pr_vendor', 
+        xtype : '', 
+    },{
+        text : '库存', 
+        width : 100, 
+        dataIndex : 'pr_qty', 
+        xtype : 'numbercolumn', 
+        renderer: function(v, m, r) {
+            return saas.util.BaseUtil.numberFormat(v, 0, false);
+        },
+    },{
+        hidden:true,
+        text : '梯度', 
+        width : 100.0, 
+        dataIndex : 'pr_level', 
+        xtype : '', 
+    },{
+        hidden:true,
+        text : '大陆交货单价', 
+        width : 200.0, 
+        dataIndex : 'pr_cnprice', 
+        xtype : '', 
+    },{
+        hidden:true,
+        text : '香港交货单价', 
+        width : 200.0, 
+        dataIndex : 'pr_hkprice', 
+        xtype : '', 
+    },{
+        hidden:true,
+        text : '交期', 
+        width : 200.0, 
+        dataIndex : 'pr_leadtime', 
+        xtype : '', 
+    }, 
+    {
+        dataIndex: '',
+        flex: 1
+    }],
+
+    initComponent: function() {
+        var me = this;
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.columns = me.insertFirstColumn(me.columns);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 15,
+                data: [],
+                proxy: {
+                    timeout:8000,
+                    type: 'ajax',
+                    headers:{
+                        'Access-Control-Allow-Origin': '*',
+                        "Content-Type": 'application/json;charset=UTF-8'
+                    },
+                    url: me.dataUrl,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.content',
+                        totalProperty: 'data.totalElements',
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = '';
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            type :'component',
+                            keyword :condition==''?' ':condition[0].value,
+                            page: op._page,
+                            count: store.pageSize,
+                            filter: '',
+                            sorting:''
+                        });
+                    }
+                }
+            });
+
+            Ext.apply(me, {
+                dockedItems:[{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    displayInfo: true,
+                    store: me.store
+                }]
+            });
+        }
+        me.callParent(arguments);
+    },
+
+    onVastDeal:function(url,type){
+        var form = this.ownerCt;
+        var grid = this;
+        var data = grid.getGridSelected(type);
+        if(!data){
+            saas.util.BaseUtil.showErrorToast('请勾选符合条件的行进行操作。');
+            return false;
+        }
+        if(data&&data.length>0){
+            var params = JSON.stringify({baseDTOs:data});
+            saas.util.BaseUtil.request({
+                    url: url,
+                    params: params,
+                    method: 'POST',
+                    async:false
+                })
+                .then(function() {
+                    saas.util.BaseUtil.showSuccessToast('操作成功');
+                    grid.store.load();
+                })
+                .catch(function(e) {
+                    saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
+                });
+        }else{
+            saas.util.BaseUtil.showErrorToast('请勾选至少一条明细。');
+        }
+    },
+
+    listeners:{
+        boxready: function(grid, width, height, eOpts) {
+            var store = grid.getStore(),
+            gridBodyBox = grid.body.dom.getBoundingClientRect(),
+            gridBodyBoxHeight = gridBodyBox.height;
+
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
+
+            store.setPageSize(pageSize);
+        },
+        itemClick: function(view,record,a,index,c) {
+            var classList = c.target.classList.value;
+            var grid = this;
+            if(classList.indexOf('fa-pencil')>-1){
+                var form = this.ownerCt;
+                this.dialog = form.getController().getView().add({
+                    xtype: 'sys-maxnumbers-window',
+                    bind: {
+                        title: '修改单据编码规则'
+                    },
+                    _parent:form,
+                    _combo:this,
+                    record:record,
+                    session: true
+                });
+                this.dialog.show();
+            }else if(classList.indexOf('fa-trash-o')>-1){
+                //删除
+                var id = record.get('id');
+                if(id){
+                    saas.util.BaseUtil.request({
+                        url: grid.deleteUrl+id,
+                        method: 'POST',
+                    })
+                    .then(function(localJson) {
+                        if(localJson.success){
+                            //解析参数
+                            saas.util.BaseUtil.showSuccessToast('删除成功');
+                            view.ownerCt.store.load();
+                        }
+                    })
+                    .catch(function(e) {
+                        saas.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                    });
+                }
+            }
+        }
+    },
+
+    insertFirstColumn:function(columns){
+        var me=this;
+        return columns;
+    },
+
+    getGridSelected:function(type){
+        var isErrorSelect = false;
+        var checkField = this.statusCodeField;
+        var me = this,
+        items = me.selModel.getSelection(),
+        data = new Array() ;
+        Ext.each(items, function(item, index){
+            if(!Ext.isEmpty(item.data[me.idField])){
+                var o = new Object();
+                if(me.idField){
+                    o['id'] = item.data[me.idField];
+                }
+                if(me.codeField){
+                    o['code'] = item.data[me.codeField];
+                }
+                if(type&&type==item.data[checkField]){
+                    isErrorSelect = true
+                }
+                data.push(o);
+            }
+        });
+        if(isErrorSelect){
+            return false;
+        }
+		return data;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getConditions: function() {
+        var me = this,
+        tbar = me.getDockedItems()[0],
+        items = Ext.Array.filter(tbar.items.items, function(item) {
+            return !!item.name;
+        }),
+        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 type = item.fieldType || me.getDefaultFieldType(item),
+                    operation = item.operation || me.getDefaultFieldOperation(item),
+                    conditionValue = me.getConditionValue(item, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
+                }
+                conditions.push(condition);
+            }
+        }
+
+        return conditions;
+    },
+
+    /**
+     * 只要arr1和arr2中存在相同项即返回真
+     */
+    isContainsAny: function (arr1, arr2) {
+        for (var i = 0; i < arr2.length; i++) {
+            var a2 = arr2[i];
+            if (!!arr1.find(function (a1) {
+                    return a1 == a2
+                })) {
+                return true;
+            }
+        }
+        return false;
+    },
+
+    getDefaultFieldType: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            type;
+
+        if (me.isContainsAny(xtypes, ['numberfield'])) {
+            type = 'number';
+        } else if (me.isContainsAny(xtypes, ['datefield', 'condatefield', 'conmonthfield'])) {
+            type = 'date';
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            type = 'enum';
+        } else if (me.isContainsAny(xtypes, ['combobox', 'multicombo', 'combo', 'radiofield', 'radio'])) {
+            type = 'enum';
+        } else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            operation;
+
+        if (me.isContainsAny(xtypes, ['numberfield', 'datefield', 'dbfindtrigger'])) {
+            operation = '=';
+        } else if (me.isContainsAny(xtypes, ['condatefield', 'conmonthfield'])) {
+            operation = 'between';
+        } else if (me.isContainsAny(xtypes, ['multidbfindtrigger', 'combobox', 'multicombo', 'combo'])) {
+            operation = 'in';
+        } else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    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;
+    }
+
+})
+
+

+ 10 - 0
frontend/saas-web/app/view/purchase/deviceQuery/DataListController.js

@@ -0,0 +1,10 @@
+Ext.define('saas.view.purchase.deviceQuery.DataListController', {
+    extend: 'saas.view.core.base.BasePanelController',
+    alias: 'controller.purchase-deviceQuery-datalist',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/purchase/deviceQuery/DataListlModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.purchase.deviceQuery.DataListModel', {
+    extend: 'saas.view.core.base.BasePanelModel',
+    alias: 'viewmodel.purchase-deviceQuery-datalist'
+});

+ 376 - 0
frontend/saas-web/app/view/purchase/quotationList/DataList.js

@@ -0,0 +1,376 @@
+
+Ext.define('saas.view.purchase.quotationList.DataList', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'purchase-quotationList-datalist',
+    controller: 'purchase-quotationList-datalist',
+    viewModel: 'purchase-quotationList-datalist',
+    autoScroll: true,
+    frame:true,
+    layout:'fit',
+    
+    dataUrl:'http://10.1.80.23:8560/api/purchase/purchase/inquiry/list',                 
+    quotationListUrl:'/api/commons/number/delete/',
+
+    plugins: [{
+        ptype: 'menuclipboard'
+    },{
+        ptype: 'rowwidget',
+        widget: {
+            frame:true,
+            xtype: 'grid',
+            bind: {
+                store: '{record.quotationRspDTOList}',
+                //title: 'Orders for {record.name}'
+            },
+            columns: [{
+                text: '供应商名称',
+                dataIndex: 'vendName',
+                width: 175
+            }, {
+                text: '联系电话',
+                dataIndex: 'tel',
+                width: 265
+            }, {
+                text: '替代型号',
+                dataIndex: 'replaceOrispeccode',
+                width: 100,
+            }, {
+                width: 120,
+                text: '交期',
+                dataIndex: 'leadTime'
+            }, {
+                width: 120,
+                text: '税率',
+                dataIndex: 'taxRate'
+            }, {
+                width: 120,
+                text: '分段信息',
+                dataIndex: 'replies'
+            }, {
+                width: 120,
+                text: '操作',
+                dataIndex: 'agreed'
+            }]
+        }
+    }],
+
+    tbar: [{
+        width: 310,
+        name: 'search',
+        xtype: 'textfield',
+        emptyText : '请输入物料编号/品牌/名称/型号',
+        enableKeyEvents: true,
+        getCondition: function (value) {
+            return ' (pr_code like\'%' + value + '%\' or pr_detail like \'%' + value + '%\' or pr_brand like \'%' + value + '%\' or pr_orispeccode like \'%' + value + '%\') ';
+        },
+        listeners: {
+            keydown: {
+                fn: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        var grid = th.up('grid');
+                        grid.condition = grid.getConditions();
+                        grid.store.loadPage(1);
+                    }
+                }
+            }
+        }
+    },{
+        cls:'x-formpanel-btn-blue',
+        xtype:'button',
+        text:'查询',
+        listeners: {
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                grid.condition = grid.getConditions();
+                grid.store.loadPage(1);
+            }
+        }
+    }],
+
+    columns : [{
+        text : 'id', 
+        width : 0, 
+        dataIndex : 'id', 
+        xtype : 'numbercolumn', 
+        hidden:true
+    },{
+        text : '物料编号', 
+        width : 200.0, 
+        dataIndex : 'prodCode', 
+        xtype : '', 
+    }, 
+    {
+        text : '品牌', 
+        dataIndex : 'prodBrand', 
+        width : 110.0, 
+        xtype : '', 
+    }, 
+    {
+        text : '名称', 
+        dataIndex : 'prodName', 
+        width : 150.0
+    },{
+        text : '型号', 
+        dataIndex : 'prodOrispeccode',
+        width : 110.0
+    },{
+        text : '规格', 
+        dataIndex : 'prodSpec',
+        width : 110.0
+    },{
+        text : '单位', 
+        dataIndex : 'prodUnit',
+        width : 110.0
+    },{
+        text : '发起时间', 
+        dataIndex : 'startDate',
+        width : 160.0
+    },{
+        text : '截止日期', 
+        dataIndex : 'endDate',
+        width : 160.0
+    },{
+        text : '报价状态', 
+        dataIndex : 'quoted',
+        width : 110.0
+    }, {
+        dataIndex: '',
+        flex: 1
+    }],
+
+
+    dbSearchFields: [],
+    condition:'',
+
+    initComponent: function() {
+        var me = this;
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 15,
+                proxy: {
+                    timeout:8000,
+                    type: 'ajax',
+                    headers:{
+                        'Access-Control-Allow-Origin': '*',
+                        "Content-Type": 'application/json;charset=UTF-8'
+                    },
+                    url: me.dataUrl,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.content',
+                        totalProperty: 'data.totalElements',
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = '';
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            keyword:condition,
+                            pageNumber: op._page,
+                            pageSize: store.pageSize,
+                            quoted:1,
+                            fromDate:null,
+                            endDate:null,
+                            overdue:0
+                        });
+                    }
+                }
+            });
+
+            Ext.apply(me, {
+                dockedItems:[{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    displayInfo: true,
+                    store: me.store
+                }]
+            });
+        }
+        me.callParent(arguments);
+    },
+
+    listeners:{
+        boxready: function(grid, width, height, eOpts) {
+            var store = grid.getStore(),
+            gridBodyBox = grid.body.dom.getBoundingClientRect(),
+            gridBodyBoxHeight = gridBodyBox.height;
+
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
+
+            store.setPageSize(pageSize);
+        },
+        itemClick: function(view,record,a,index,c) {
+        }
+    },
+
+    getGridSelected:function(type){
+        var isErrorSelect = false;
+        var checkField = this.statusCodeField;
+        var me = this,
+        items = me.selModel.getSelection(),
+        data = new Array() ;
+        Ext.each(items, function(item, index){
+            if(!Ext.isEmpty(item.data[me.idField])){
+                var o = new Object();
+                if(me.idField){
+                    o['id'] = item.data[me.idField];
+                }
+                if(me.codeField){
+                    o['code'] = item.data[me.codeField];
+                }
+                if(type&&type==item.data[checkField]){
+                    isErrorSelect = true
+                }
+                data.push(o);
+            }
+        });
+        if(isErrorSelect){
+            return false;
+        }
+		return data;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getConditions: function() {
+        var me = this,
+        tbar = me.getDockedItems()[0],
+        items = Ext.Array.filter(tbar.items.items, function(item) {
+            return !!item.name;
+        }),
+        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 type = item.fieldType || me.getDefaultFieldType(item),
+                    operation = item.operation || me.getDefaultFieldOperation(item),
+                    conditionValue = me.getConditionValue(item, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
+                }
+                conditions.push(condition);
+            }
+        }
+
+        return conditions;
+    },
+
+    /**
+     * 只要arr1和arr2中存在相同项即返回真
+     */
+    isContainsAny: function (arr1, arr2) {
+        for (var i = 0; i < arr2.length; i++) {
+            var a2 = arr2[i];
+            if (!!arr1.find(function (a1) {
+                    return a1 == a2
+                })) {
+                return true;
+            }
+        }
+        return false;
+    },
+
+    getDefaultFieldType: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            type;
+
+        if (me.isContainsAny(xtypes, ['numberfield'])) {
+            type = 'number';
+        } else if (me.isContainsAny(xtypes, ['datefield', 'condatefield', 'conmonthfield'])) {
+            type = 'date';
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            type = 'enum';
+        } else if (me.isContainsAny(xtypes, ['combobox', 'multicombo', 'combo', 'radiofield', 'radio'])) {
+            type = 'enum';
+        } else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            operation;
+
+        if (me.isContainsAny(xtypes, ['numberfield', 'datefield', 'dbfindtrigger'])) {
+            operation = '=';
+        } else if (me.isContainsAny(xtypes, ['condatefield', 'conmonthfield'])) {
+            operation = 'between';
+        } else if (me.isContainsAny(xtypes, ['multidbfindtrigger', 'combobox', 'multicombo', 'combo'])) {
+            operation = 'in';
+        } else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    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;
+    }
+
+})
+
+

+ 10 - 0
frontend/saas-web/app/view/purchase/quotationList/DataListController.js

@@ -0,0 +1,10 @@
+Ext.define('saas.view.purchase.quotationList.DataListController', {
+    extend: 'saas.view.core.base.BasePanelController',
+    alias: 'controller.purchase-quotationList-datalist',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/purchase/quotationList/DataListlModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.purchase.quotationList.DataListModel', {
+    extend: 'saas.view.core.base.BasePanelModel',
+    alias: 'viewmodel.purchase-quotationList-datalist'
+});

+ 421 - 0
frontend/saas-web/app/view/purchase/sendQuotation/DataList.js

@@ -0,0 +1,421 @@
+/**
+ * Created by zhouy on 2018/10/18.
+ */
+Ext.define('saas.view.purchase.sendQuotation.DataList', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'purchase-sendQuotation-datalist',
+    controller: 'purchase-sendQuotation-datalist',
+    viewModel: 'purchase-sendQuotation-datalist',
+    autoScroll: true,
+    frame:true,
+    layout:'fit',
+    
+    dataUrl:'/api/document/product/list',                 
+    sendQuotationUrl:'/api/commons/number/delete/',
+
+    plugins: [{
+        ptype: 'menuclipboard'
+    }],
+
+    selModel: {
+        checkOnly:true,
+        type:'checkboxmodel'
+	},
+
+    tbar: [{
+        width: 310,
+        name: 'search',
+        xtype: 'textfield',
+        emptyText : '请输入物料编号/品牌/名称/型号',
+        enableKeyEvents: true,
+        getCondition: function (value) {
+            return ' (pr_code like\'%' + value + '%\' or pr_detail like \'%' + value + '%\' or pr_brand like \'%' + value + '%\' or pr_orispeccode like \'%' + value + '%\') ';
+        },
+        listeners: {
+            keydown: {
+                fn: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        var grid = th.up('grid');
+                        grid.condition = grid.getConditions();
+                        grid.store.loadPage(1);
+                    }
+                }
+            }
+        }
+    },{
+        cls:'x-formpanel-btn-blue',
+        xtype:'button',
+        text:'查询',
+        listeners: {
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                grid.condition = grid.getConditions();
+                grid.store.loadPage(1);
+            }
+        }
+    },'->',{
+        width: 180,
+        name: 'endDate',
+        xtype: 'numberfield',
+        decimalPrecision:0,
+        minValue:0,
+        fieldLabel : '报价截至天数'
+    },{
+        cls:'x-formpanel-btn-blue',
+        xtype:'button',
+        text:'发起询价',
+        listeners: {
+            click: function(){
+                var form = this.ownerCt.ownerCt;
+                var grid = this.ownerCt.ownerCt.items.items[0].grid;
+                var endDate = form.down('[name=endDate]');
+                if(!endDate.value||endDate.value==0){
+                    saas.util.BaseUtil.showErrorToast('请填写报价截至天数');
+                    return false;
+                }
+                form.onVastDeal(sendQuotation,'发起询价');
+            }
+        }
+    }],
+
+    columns : [{
+        text : 'id', 
+        width : 0, 
+        dataIndex : 'id', 
+        xtype : 'numbercolumn', 
+        hidden:true
+    },{
+        text : '物料编号', 
+        width : 200.0, 
+        dataIndex : 'pr_code', 
+        xtype : '', 
+    }, 
+    {
+        text : '品牌', 
+        dataIndex : 'pr_brand', 
+        width : 110.0, 
+        xtype : '', 
+    }, 
+    {
+        text : '名称', 
+        dataIndex : 'pr_detail', 
+        width : 150.0
+    },{
+        text : '型号', 
+        dataIndex : 'pr_orispeccode',
+        width : 110.0
+    },{
+        text : '规格', 
+        dataIndex : 'pr_spec',
+        width : 110.0
+    },{
+        text : '单位', 
+        dataIndex : 'pr_unit',
+        width : 110.0
+    }, {
+        dataIndex: '',
+        flex: 1
+    }],
+
+    dbSearchFields: [],
+    condition:'',
+
+    initComponent: function() {
+        var me = this;
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.columns = me.insertFirstColumn(me.columns);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 15,
+                data: [],
+                proxy: {
+                    timeout:8000,
+                    type: 'ajax',
+                    headers:{
+                        'Access-Control-Allow-Origin': '*',
+                        "Content-Type": 'application/json;charset=UTF-8'
+                    },
+                    url: me.dataUrl,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.list',
+                        totalProperty: 'data.total',
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = '';
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            w:1,
+                            page: op._page,
+                            count: store.pageSize,
+                            condition: JSON.stringify(condition)
+                        });
+                    }
+                }
+            });
+
+            Ext.apply(me, {
+                dockedItems:[{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    displayInfo: true,
+                    store: me.store
+                }]
+            });
+        }
+        me.callParent(arguments);
+    },
+
+    onVastDeal:function(url,type){
+        var form = this.ownerCt;
+        var grid = this;
+        var data = grid.getGridSelected(type);
+        if(!data){
+            saas.util.BaseUtil.showErrorToast('请勾选符合条件的行进行操作。');
+            return false;
+        }
+        if(data&&data.length>0){
+            var params = JSON.stringify({baseDTOs:data});
+            saas.util.BaseUtil.request({
+                    url: url,
+                    params: params,
+                    method: 'POST',
+                    async:false
+                })
+                .then(function() {
+                    saas.util.BaseUtil.showSuccessToast('操作成功');
+                    grid.store.load();
+                })
+                .catch(function(e) {
+                    saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
+                });
+        }else{
+            saas.util.BaseUtil.showErrorToast('请勾选至少一条明细。');
+        }
+    },
+
+    listeners:{
+        boxready: function(grid, width, height, eOpts) {
+            var store = grid.getStore(),
+            gridBodyBox = grid.body.dom.getBoundingClientRect(),
+            gridBodyBoxHeight = gridBodyBox.height;
+
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
+
+            store.setPageSize(pageSize);
+        },
+        itemClick: function(view,record,a,index,c) {
+            var classList = c.target.classList.value;
+            var grid = this;
+            if(classList.indexOf('fa-pencil')>-1){
+                var form = this.ownerCt;
+                this.dialog = form.getController().getView().add({
+                    xtype: 'sys-maxnumbers-window',
+                    bind: {
+                        title: '修改单据编码规则'
+                    },
+                    _parent:form,
+                    _combo:this,
+                    record:record,
+                    session: true
+                });
+                this.dialog.show();
+            }else if(classList.indexOf('fa-trash-o')>-1){
+                //删除
+                var id = record.get('id');
+                if(id){
+                    saas.util.BaseUtil.request({
+                        url: grid.deleteUrl+id,
+                        method: 'POST',
+                    })
+                    .then(function(localJson) {
+                        if(localJson.success){
+                            //解析参数
+                            saas.util.BaseUtil.showSuccessToast('删除成功');
+                            view.ownerCt.store.load();
+                        }
+                    })
+                    .catch(function(e) {
+                        saas.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                    });
+                }
+            }
+        }
+    },
+
+    insertFirstColumn:function(columns){
+        var me=this;
+        return columns;
+    },
+
+    getGridSelected:function(type){
+        var isErrorSelect = false;
+        var checkField = this.statusCodeField;
+        var me = this,
+        items = me.selModel.getSelection(),
+        data = new Array() ;
+        Ext.each(items, function(item, index){
+            if(!Ext.isEmpty(item.data[me.idField])){
+                var o = new Object();
+                if(me.idField){
+                    o['id'] = item.data[me.idField];
+                }
+                if(me.codeField){
+                    o['code'] = item.data[me.codeField];
+                }
+                if(type&&type==item.data[checkField]){
+                    isErrorSelect = true
+                }
+                data.push(o);
+            }
+        });
+        if(isErrorSelect){
+            return false;
+        }
+		return data;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getConditions: function() {
+        var me = this,
+        tbar = me.getDockedItems()[0],
+        items = Ext.Array.filter(tbar.items.items, function(item) {
+            return !!item.name;
+        }),
+        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 type = item.fieldType || me.getDefaultFieldType(item),
+                    operation = item.operation || me.getDefaultFieldOperation(item),
+                    conditionValue = me.getConditionValue(item, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
+                }
+                conditions.push(condition);
+            }
+        }
+
+        return conditions;
+    },
+
+    /**
+     * 只要arr1和arr2中存在相同项即返回真
+     */
+    isContainsAny: function (arr1, arr2) {
+        for (var i = 0; i < arr2.length; i++) {
+            var a2 = arr2[i];
+            if (!!arr1.find(function (a1) {
+                    return a1 == a2
+                })) {
+                return true;
+            }
+        }
+        return false;
+    },
+
+    getDefaultFieldType: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            type;
+
+        if (me.isContainsAny(xtypes, ['numberfield'])) {
+            type = 'number';
+        } else if (me.isContainsAny(xtypes, ['datefield', 'condatefield', 'conmonthfield'])) {
+            type = 'date';
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            type = 'enum';
+        } else if (me.isContainsAny(xtypes, ['combobox', 'multicombo', 'combo', 'radiofield', 'radio'])) {
+            type = 'enum';
+        } else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function (field) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            operation;
+
+        if (me.isContainsAny(xtypes, ['numberfield', 'datefield', 'dbfindtrigger'])) {
+            operation = '=';
+        } else if (me.isContainsAny(xtypes, ['condatefield', 'conmonthfield'])) {
+            operation = 'between';
+        } else if (me.isContainsAny(xtypes, ['multidbfindtrigger', 'combobox', 'multicombo', 'combo'])) {
+            operation = 'in';
+        } else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    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;
+    }
+
+})
+
+

+ 10 - 0
frontend/saas-web/app/view/purchase/sendQuotation/DataListController.js

@@ -0,0 +1,10 @@
+Ext.define('saas.view.purchase.sendQuotation.DataListController', {
+    extend: 'saas.view.core.base.BasePanelController',
+    alias: 'controller.purchase-sendQuotation-datalist',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/purchase/sendQuotation/DataListlModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.purchase.sendQuotation.DataListModel', {
+    extend: 'saas.view.core.base.BasePanelModel',
+    alias: 'viewmodel.purchase-sendQuotation-datalist'
+});

+ 1 - 0
frontend/saas-web/app/view/sys/maxnumbers/DataList.js

@@ -91,6 +91,7 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
         width : 0, 
         width : 0, 
         dataIndex : 'id', 
         dataIndex : 'id', 
         xtype : 'numbercolumn', 
         xtype : 'numbercolumn', 
+        hidden:true
     },{
     },{
         text : '单据名称', 
         text : '单据名称', 
         width : 200.0, 
         width : 200.0, 

+ 18 - 0
frontend/saas-web/app/view/viewport/ViewportController.js

@@ -33,6 +33,7 @@ Ext.define('saas.view.viewport.ViewportController', {
     },
     },
 
 
     mainviewboxready: function() {
     mainviewboxready: function() {
+        var me = this;
         //初始化setSessionPage地址
         //初始化setSessionPage地址
         Ext.DomHelper.insertHtml('beforeEnd', document.body, 
         Ext.DomHelper.insertHtml('beforeEnd', document.body, 
             '<iframe name="setSessionPage" hidden src="' + 
             '<iframe name="setSessionPage" hidden src="' + 
@@ -41,6 +42,23 @@ Ext.define('saas.view.viewport.ViewportController', {
         if(!Ext.isChrome && !Ext.isFirefox) {
         if(!Ext.isChrome && !Ext.isFirefox) {
             saas.util.BaseUtil.showConfirm('温馨提示', '为了更好地呈现页面效果,推荐使用Chrome浏览器或火狐浏览器');
             saas.util.BaseUtil.showConfirm('温馨提示', '为了更好地呈现页面效果,推荐使用Chrome浏览器或火狐浏览器');
         }
         }
+        //读取系统参数
+        saas.util.BaseUtil.request({url:'/api/commons/configs/list'})
+        .then(function(res) {
+            if(res.success) {
+                var list = res.data.list;
+                if(list.length>0){
+                    var d = {};
+                    Ext.each(list, function(item, index){
+                        d[item.code] = item.data;
+                    });
+                    me.getViewModel().setData(d)
+                }
+            }
+        })
+        .catch(function(e) {
+            console.error(e);
+        });
     },
     },
 
 
     showView: function(xtype) {
     showView: function(xtype) {

+ 22 - 5
frontend/saas-web/resources/json/navigation.json

@@ -18,6 +18,21 @@
             "text": "采购验退单",
             "text": "采购验退单",
             "addType": "purchase-purchaseout-formpanel",
             "addType": "purchase-purchaseout-formpanel",
             "viewType": "purchase-purchaseout-querypanel"
             "viewType": "purchase-purchaseout-querypanel"
+        },{
+            "b2b":true,
+            "id": "deviceQuery",
+            "text": "器件查询",
+            "viewType": "purchase-deviceQuery-datalist"
+        },{
+            "b2b":true,
+            "id": "sendQuotation",
+            "text": "发起询价",
+            "viewType": "purchase-sendQuotation-datalist"
+        },{
+            "b2b":true,
+            "id": "quotationList",
+            "text": "询价信息查询",
+            "viewType": "purchase-quotationList-datalist"
         }]
         }]
     }, {
     }, {
         "text": "报表",
         "text": "报表",
@@ -56,10 +71,12 @@
             "addType": "sale-salein-formpanel",
             "addType": "sale-salein-formpanel",
             "viewType": "sale-salein-querypanel"
             "viewType": "sale-salein-querypanel"
         }, {
         }, {
+            "b2b":true,
             "id": "sale-business-business",
             "id": "sale-business-business",
             "text": "公司商机",
             "text": "公司商机",
             "viewType": "sale-business-business"
             "viewType": "sale-business-business"
         }, {
         }, {
+            "b2b":true,
             "id": "sale-business-mybusiness",
             "id": "sale-business-mybusiness",
             "text": "我的商机",
             "text": "我的商机",
             "viewType": "sale-business-mybusiness"
             "viewType": "sale-business-mybusiness"
@@ -236,6 +253,11 @@
             "viewType": "document-bom-basepanel",
             "viewType": "document-bom-basepanel",
             "addType": "document-bom-formpanel",
             "addType": "document-bom-formpanel",
             "leaf": true
             "leaf": true
+        }, {
+            "id":"document-currencys-datalist",
+            "text": "币别资料",
+            "viewType": "document-currencys-datalist",
+            "leaf": true
         }, {
         }, {
             "id":"document-bankinformation-datalist",
             "id":"document-bankinformation-datalist",
             "text": "资金账户",
             "text": "资金账户",
@@ -288,11 +310,6 @@
             "text": "收支类别",
             "text": "收支类别",
             "viewType": "document-kind",
             "viewType": "document-kind",
             "leaf": true
             "leaf": true
-        }, {
-            "id":"document-currencys-datalist",
-            "text": "币别",
-            "viewType": "document-currencys-datalist",
-            "leaf": true
         }]
         }]
     }]
     }]
 }, {
 }, {