Browse Source

代码提交

hy 7 years ago
parent
commit
6e999dd249

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

@@ -171,6 +171,15 @@ Ext.define('saas.view.core.base.GridPanel', {
     },
 
     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 form = view.ownerCt.ownerCt;

+ 0 - 24
frontend/saas-web/app/view/sys/account/AccountInformation.js

@@ -1,24 +0,0 @@
-/**
- * Created by zhouy on 2018/10/18.
- */
-Ext.define('saas.view.sys.account.AccountInformation', {
-    extend: 'saas.view.document.kind.Kind',
-    xtype: 'sys-account-accountinformation',
-    autoScroll: true,
-    layout:'fit',
-    defaultType:'accountinformation',
-    tbar: ['->',{
-        xtype:'button',
-        text:'刷新',
-        listeners: {
-            click: 'onRefresh'
-        }
-    }],
-    listeners:{
-        afterrender:function(p){
-            p.getViewModel().setData({title:'账户信息'});
-        }
-    }
-})
-
-

+ 361 - 0
frontend/saas-web/app/view/sys/account/DataList.js

@@ -0,0 +1,361 @@
+/**
+ * Created by zhouy on 2018/10/18.
+ */
+Ext.define('saas.view.sys.account.DataList', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'sys-account-datalist',
+    controller: 'sys-account-datalist',
+    viewModel: 'sys-account-datalist',
+    autoScroll: true,
+    frame:true,
+    layout:'fit',
+    //工具类
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+    dataUrl:'http://192.168.253.31:8560/api/account/account/accountRole/list',                 
+
+    tbar: [{
+        width: 150,
+        name: 'mn_name',
+        xtype: 'textfield',
+        emptyText : '账户名称'
+    },{
+        width: 150,
+        name: 'mn_leadcode',
+        xtype: 'textfield',
+        emptyText : '账户编号'
+    },{
+        cls:'x-formpanel-btn-orange',
+        xtype:'button',
+        text:'查询',
+        listeners: {
+            click:function(b){
+                var grid = b.ownerCt.ownerCt;
+                var tbar = b.ownerCt;
+                grid.condition = '';
+                var items = [];
+                var fields = tbar.items.items.map(f => f.name);
+                Ext.each(fields, function(f, index){
+                    var field = tbar.down('[name='+f+']');
+                    if(field){
+                        items.push(field);
+                    }
+                });
+                grid.condition = grid.getCondition(items);
+                grid.store.loadPage(1);
+            }
+        }
+    },'->'],
+
+    columns : [{
+        text : 'id', 
+        width : 0, 
+        dataIndex : 'id', 
+        xtype : 'numbercolumn', 
+    },{
+        text : '账户名称', 
+        width : 200.0, 
+        dataIndex : 'mn_name', 
+        xtype : '', 
+    }, 
+    {
+        text : '账户编号', 
+        dataIndex : 'mn_leadcode', 
+        width : 120.0, 
+        xtype : '', 
+    }, 
+    {
+        text : '单据规则', 
+        dataIndex : 'mn_rule', 
+        width : 220.0,
+    },{
+        text : '流水长度', 
+        dataIndex : 'mn_number', 
+        width : 120.0, 
+        xtype : '', 
+    }],
+
+    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: 11,
+                data: [],
+                proxy: {
+                    timeout:8000,
+                    type: 'ajax',
+                    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, {
+                            number: op._page,
+                            size: 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){
+            showToast('请勾选符合条件的行进行操作。');
+            return false;
+        }
+        if(data&&data.length>0){
+            var params = JSON.stringify({baseDTOs:data});
+            form.BaseUtil.request({
+                    url: url,
+                    params: params,
+                    method: 'POST',
+                    async:false
+                })
+                .then(function() {
+                    showToast('操作成功');
+                    grid.store.load();
+                })
+                .catch(function(response) {
+                    showToast('操作失败');
+                });
+        }else{
+            showToast('请勾选至少一条明细。');
+        }
+    },
+
+    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 document = Ext.create('saas.view.document.kind.Kind',{});
+                var form = this.ownerCt;
+                this.dialog = form.getController().getView().add({
+                    xtype: 'document-kind-childwin',
+                    bind: {
+                        title: '修改单据编码规则'
+                    },
+                    dataKind:'maxnumbers',
+                    belong:document.etc['maxnumbers'],
+                    _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){
+                    grid.BaseUtil.request({
+                        url: grid.deleteUrl+id,
+                        method: 'POST',
+                    })
+                    .then(function(localJson) {
+                        if(localJson.success){
+                            //解析参数
+                            showToast('删除成功');
+                            view.ownerCt.store.load();
+                        }
+                    })
+                    .catch(function() {
+                        showToast('删除失败');
+                    });
+                }
+            }
+        }
+    },
+
+    insertFirstColumn:function(columns){
+        var me=this;
+        if(columns.length>0 && columns[0].xtype!='actioncolumn'){
+            return Ext.Array.insert(columns,0,[{
+                xtype:'actioncolumn',
+                width:50,
+                dataIndex:'actioncolumn',
+                text:'操作',
+                items: [{
+                    tooltip: '编辑',
+                    iconCls: 'x-fa fa-pencil fa-fw',
+                    scope: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;
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getCondition: function(items) {
+        var me = this,
+        conditions = [];
+
+        for(var i = 0; i < items.length; i++) {
+            var item = items[i];
+            var field = item.name,
+            func = item.getCondition,
+            value = item.value,
+            condition;
+
+            if(typeof func == 'function') {
+                condition = {
+                    type: 'condition',
+                    value: func(value)
+                }
+            }else {
+                var xtype = item.xtype || 'textfield',
+                type = item.fieldType || me.getDefaultFieldType(xtype),
+                operation = item.operation || me.getDefaultFieldOperation(xtype),
+                conditionValue = me.getConditionValue(xtype, value);
+    
+                if(!conditionValue) {
+                    continue;
+                }
+                condition = {
+                    type: type,
+                    field: field,
+                    operation: operation,
+                    value: conditionValue
+                }
+            }
+            conditions.push(condition);
+        };
+        return conditions;
+    },
+
+    getDefaultFieldType: function(xtype) {
+        var type;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            type = 'number';
+        }else if(Ext.Array.contains(['datefield', 'condatefield'], xtype)) {
+            type = 'date';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo', 'radiofield', 'radio'], xtype)) {
+            type = 'enum';
+        }else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function(xtype) {
+        var operation;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['datefield'], xtype)) {
+            operation = '=';
+        }else if(Ext.Array.contains(['condatefield'], xtype)) {
+            operation = 'between';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo'], xtype)) {
+            operation = 'in';
+        }else {
+            operation = 'like';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function(xtype, value) {
+        var conditionValue;
+        if(xtype == 'datefield') {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
+        }else if(xtype == 'condatefield') {
+            var from = value.from,
+            to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
+        }else if(xtype == 'combobox' || xtype == 'combo') {
+            conditionValue = '\'' + value + '\'';
+        }else if(xtype == 'multicombo') {
+            conditionValue = value.map(function(v) {
+                return '\'' + v.value + '\'';
+            }).join(',');
+        }else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
+    refresh:function(){
+        //debugger
+    }
+
+})
+
+

+ 10 - 0
frontend/saas-web/app/view/sys/account/DataListController.js

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

+ 4 - 0
frontend/saas-web/app/view/sys/account/DataListlModel.js

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

+ 12 - 12
frontend/saas-web/app/view/sys/config/FormPanel.js

@@ -29,16 +29,13 @@ Ext.define('saas.view.sys.config.FormPanel', {
         blankText: '该字段不能为空'
     },
 
-    tbar:{
-        style: {
-            'border-bottom': '1px solid #35baf6 !important'
-        },
+    bbar:{
         frame:true,
         items:['->',{
             text:'保存',
             formBind:true,
             name:'save'
-        }]
+        },'->']
     },
 
     items: [{
@@ -72,14 +69,14 @@ Ext.define('saas.view.sys.config.FormPanel', {
         fieldLabel: '电话',
         beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         allowBlank: false,
-        columnWidth: 0.25
+        width:500
     },{
         bind:'{en_fax}',
         xtype: 'textfield',
         name: 'en_fax',
         fieldLabel: '传真',
         allowBlank: true,
-        columnWidth: 0.5
+        width:500
     },{
         bind:'{en_begindate}',
         xtype : "datefield", 
@@ -89,13 +86,15 @@ Ext.define('saas.view.sys.config.FormPanel', {
         allowBlank : true, 
         editable:false,
         hideTrigger:true,
-        readOnly:true
+        readOnly:true,
+        width:500
     },{ 
         bind:'{en_pricemethod}',
         displayField : "display", 
         editable:false,
         hideTrigger : false, 
         maxLength : 100.0, 
+        width:500,
         minValue : null, 
         queryMode : "local", 
         valueField : "value", 
@@ -112,14 +111,14 @@ Ext.define('saas.view.sys.config.FormPanel', {
         beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         fieldLabel : "库存计算方式", 
         allowBlank : false, 
-        columnWidth : 0.25
     },{  
         bind:'{en_signet}',
         name : "en_signet", 
         fieldLabel : "打印章上传", 
         allowBlank : false, 
-        columnWidth : 0.33,
+        width:500,
         xtype: 'filefield',
+        beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         emptyText: '请选择图片',
         buttonText: '',
         buttonConfig: {
@@ -130,8 +129,9 @@ Ext.define('saas.view.sys.config.FormPanel', {
         name : "en_logo", 
         fieldLabel : "Logo上传", 
         allowBlank : false, 
-        columnWidth : 0.33,
+        width:500,
         xtype: 'filefield',
+        beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         emptyText: '请选择图片',
         buttonText: '',
         buttonConfig: {
@@ -148,7 +148,7 @@ Ext.define('saas.view.sys.config.FormPanel', {
         format:'Y-m-d H:i:s',
         editable:false,
         readOnly:true,
-        columnWidth : 0.25
+        width:500,
     }],
 
     initComponent: function () {

+ 12 - 0
frontend/saas-web/app/view/sys/finish/DataList.js

@@ -109,6 +109,18 @@ Ext.define('saas.view.sys.finish.DataList', {
 
     condition:'',
 
+    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);
+        }
+    },
+
     initComponent: function() {
         var me = this;
         if(me.columns){

+ 10 - 6
frontend/saas-web/app/view/sys/manager/FormPanel.js

@@ -4,6 +4,8 @@ Ext.define('saas.view.sys.manager.FormPanel', {
     
     layout:'fit',
 
+    cls:'sys-manager-formpanel',
+
     bodyCls:'x-manager-background',
     //工具类
     FormUtil: Ext.create('saas.util.FormUtil'),
@@ -11,26 +13,28 @@ Ext.define('saas.view.sys.manager.FormPanel', {
 
     tabBar: {
         layout: {
-            pack: 'left'
+            pack: 'center'
         },
         border: false
     },
 
     defaults: {
-        iconAlign: 'left',
+        iconAlign: 'top',
         bodyPadding: 15
     },
 
     items: [{
-        icon:'x-fa fa-key',
+        cls:'sys-config-formpanel',
+        iconCls:'x-fa fa-building',
         title: '公司设置',
         xtype:'sys-config-formpanel'
     }, {
-        icon:'x-fa fa-key',
+        iconCls:'x-fa fa-key',
         title: '账户设置',
-        xtype:'panel' 
+        xtype:'sys-account-datalist' 
     }, {
-        icon:'x-fa fa-key',
+        cls:'sys-power-formpanel',
+        iconCls:'x-fa fa-user-circle-o',
         title: '权限设置',
         xtype:'sys-power-formpanel'
     }],

+ 43 - 0
frontend/saas-web/app/view/sys/manager/FormPanel.scss

@@ -0,0 +1,43 @@
+.sys-manager-formpanel{
+    .x-tab-bar-default-top > .x-tab-bar-body-default {
+        padding: 8px 4px 8px 8px;
+    }
+    .x-tab-bar-default {
+        border-color: #35baf6;
+        border-width: 2px !important;
+        border: 1px solid #35baf6;
+        background-color: #ffffff;
+        border-bottom-width: 0 !important;
+    }
+    .x-tab.x-tab-active.x-tab-default{
+        background-color: #35baf6;
+    }
+    .x-tab.x-tab-active.x-tab-default .x-tab-icon-el {
+        color: #ffffff;
+    }
+    .x-tab.x-tab-active.x-tab-default .x-tab-inner-default {
+        color: #ffffff;
+    }
+    .x-tab-icon-el-default {
+        color: #a7a7a7;
+    }
+    .x-tab-inner-default {
+        color: #969696;
+    }
+}
+.sys-config-formpanel{
+    .x-form-item-label-default{
+        width:120px !important;
+        .x-form-item-label-inner{
+            width:100px !important;
+        }
+    }
+}
+.sys-power-formpanel{
+    .x-panel-body-default-framed{
+        padding:0 !important;
+    }
+    .x-keyboard-mode .x-grid-item-focused .x-grid-cell-inner:before{
+        border:1px solid #ffffff;
+    }
+}

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

@@ -191,6 +191,15 @@ Ext.define('saas.view.sys.maxnumbers.DataList', {
     },
 
     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;

+ 12 - 0
frontend/saas-web/app/view/sys/messagelog/DataList.js

@@ -85,6 +85,18 @@ Ext.define('saas.view.sys.messagelog.DataList', {
 
     condition:'',
 
+    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);
+        }
+    },
+
     initComponent: function() {
         var me = this;
         if(me.columns){

+ 0 - 2
frontend/saas-web/app/view/sys/power/FormPanel.js

@@ -18,7 +18,6 @@ Ext.define('saas.view.sys.power.FormPanel', {
     saveUrl:'http://192.168.253.31:8560/api/account/role/save/bind/resource',
 
     items: [{
-        title:'角色列表',
         region:'west',
         xtype: 'sys-power-treepanel',
         layout:'fit',
@@ -26,7 +25,6 @@ Ext.define('saas.view.sys.power.FormPanel', {
         width: '20%',
         useArrows: true
     },{
-        title:'权限列表',
         margin:'0 0 0 5',
         region:'center',
         layout:'fit',

+ 13 - 19
frontend/saas-web/app/view/sys/power/GroupGrid.js

@@ -3,18 +3,16 @@
  */
 Ext.define('saas.view.sys.power.GroupGrid', {
     extend: 'Ext.grid.Panel',
-    requires: [
-        'saas.view.sys.power.OtherField'
-    ],
     xtype: 'power-grid',
     bind:{
         store: '{powergrid}'
     },
-    tools:[{
+    tbar:['->',{
         xtype:'button',				
         text:'保存',
         name:'savepower',
-        margin:'0 0 0 2',
+        margin:'0 10 0 2',
+        cls:'x-formpanel-btn-orange',
         style:'background:#da8282;border-color:#cccccc'
     }],
     features : [Ext.create('Ext.grid.feature.Grouping',{
@@ -27,18 +25,19 @@ Ext.define('saas.view.sys.power.GroupGrid', {
 	})],
     initId:0,
     dataUrl:'http://192.168.253.31:8560/api/account/role/power/resource',
-    selModel:Ext.create('Ext.selection.CheckboxModel', {
-        checkOnly: true,
+    selModel: {
         showHeaderCheckbox:false,
-        listeners: {
-            'select': function (selModel, record) {
+        checkOnly:true,
+        type:'checkboxmodel',
+        listeners:{
+            select:function(selModel,record,c,d){
                 selModel.view.ownerCt.selectAllPower(record);
             },
-            'deselect': function (selModel, record) {
+            deselect:function(selModel,record){
                 selModel.view.ownerCt.deselectAllPower(record);
             }
-        }
-    }),
+         }
+    },
     viewConfig: {
      stripeRows: false,
      enableTextSelection: false,
@@ -50,7 +49,8 @@ Ext.define('saas.view.sys.power.GroupGrid', {
         dataIndex: 'groupName',
         xtype: '',
         flex: 2,
-        stopSelection: false
+        stopSelection: false,
+        menuDisabled:true,
     },{
         header: '查询',
         dataIndex: 'query',
@@ -406,12 +406,6 @@ Ext.define('saas.view.sys.power.GroupGrid', {
         me.callParent(arguments);
     },
 
-    defaultListenerScope: true,
-
-    listeners: {
-        columnshow: 'onColumnToggle',
-        columnhide: 'onColumnToggle',
-    },
     selectAllPower: function(record){
         var me = this;
         me.setAllOthers(record,true);

+ 0 - 1
frontend/saas-web/app/view/sys/power/TreePanel.js

@@ -92,7 +92,6 @@ Ext.define('saas.view.sys.power.TreePanel', {
                 var grid = view.ownerCt.ownerCt.query('power-grid')[0];
                 grid.initId = id;
                 grid.store.load();
-                grid.store.group('moduleName', 'ASC');
             }
         }
     },