Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

guq 7 years ago
parent
commit
96782e65d0
22 changed files with 113 additions and 34 deletions
  1. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaybalanceMapper.java
  2. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecbalanceMapper.java
  3. 0 1
      applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml
  4. 0 6
      applications/money/money-server/src/main/resources/mapper/PaybalancedetMapper.xml
  5. 6 0
      applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml
  6. 1 1
      base-servers/gateway-server/src/main/resources/application.yml
  7. 6 3
      frontend/saas-web/app/util/BaseUtil.js
  8. 1 1
      frontend/saas-web/app/util/FormUtil.js
  9. 26 0
      frontend/saas-web/app/view/auth/ReLoginController.js
  10. 4 1
      frontend/saas-web/app/view/core/base/GridPanel.js
  11. 4 1
      frontend/saas-web/app/view/core/form/FormPanel.js
  12. 6 4
      frontend/saas-web/app/view/core/form/SettingWin.js
  13. 27 6
      frontend/saas-web/app/view/core/form/SettingWinController.js
  14. 13 2
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  15. 4 1
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  16. 4 1
      frontend/saas-web/app/view/core/report/ReportPanel.js
  17. 1 1
      frontend/saas-web/app/view/document/customer/FormPanel.js
  18. 1 1
      frontend/saas-web/app/view/money/payBalance/QueryPanel.js
  19. 3 0
      frontend/saas-web/app/view/money/verification/FormPanel.js
  20. 1 1
      frontend/saas-web/app/view/stock/report/ProdinoutCount.js
  21. 2 0
      frontend/saas-web/app/view/viewport/Viewport.js
  22. 1 1
      frontend/saas-web/overrides/data/Connection.js

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaybalanceMapper.java

@@ -50,5 +50,5 @@ public interface PaybalanceMapper extends CommonBaseMapper<Paybalance> {
     String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 
     String validateAudit(List<DocBaseDTO> baseDTOs);
-    Double updateByAmount(@Param("id") Long id, @Param("companyId") Long companyId);
+    void updateByAmount(@Param("id") Long id, @Param("companyId") Long companyId);
 }

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecbalanceMapper.java

@@ -58,5 +58,5 @@ public interface RecbalanceMapper extends CommonBaseMapper<Recbalance> {
 
     String validateAudit(List<DocBaseDTO> baseDTOs);
 
-    Double updateByAmount(@Param("id") Long id, @Param("companyId") Long companyId);
+    void updateByAmount(@Param("id") Long id, @Param("companyId") Long companyId);
 }

+ 0 - 1
applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml

@@ -141,7 +141,6 @@
   <update id="updateByAmount">
     update paybalance set pb_amount = (select sum(ifnull(pd_amount,0.0)) from paybalancedet where pd_pbid = pb_id )
  where  pb_id = #{id,jdbcType=INTEGER} and companyId =#{companyId}
-  exists (select 1 from  paybalancedet where pd_pbid = pb_id );
   </update>
 
   <insert id="insert" parameterType="com.usoftchina.saas.money.po.Paybalance">

+ 0 - 6
applications/money/money-server/src/main/resources/mapper/PaybalancedetMapper.xml

@@ -44,12 +44,6 @@
     where pd_pbid = #{id,jdbcType=INTEGER}
   </delete>
 
-  <update id="updateByAmount">
-    update recbalance set rb_amount = (select sum(ifnull(rd_amount,0.0)) from recbalancedet where rd_rbid = rb_id )
- where  rb_id = #{id,jdbcType=INTEGER} and companyId =#{companyId}
-  exists (select 1 from  recbalancedet where rd_rbid = rb_id );
-  </update>
-
   <!--<insert id="insert" parameterType="com.usoftchina.saas.money.po.Paybalancedet" >-->
   <insert id="insert" parameterType="com.usoftchina.saas.money.po.Paybalancedet" >
     insert into paybalancedet (pd_id, pd_pbid, pd_detno,

+ 6 - 0
applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml

@@ -130,6 +130,12 @@
       order by ${orderByClause}
     </if>
   </select>
+
+  <update id="updateByAmount">
+    update recbalance set rb_amount = (select sum(ifnull(rd_amount,0.0)) from recbalancedet where rd_rbid = rb_id )
+ where  rb_id = #{id,jdbcType=INTEGER} and companyId =#{companyId}
+  </update>
+
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />,

+ 1 - 1
base-servers/gateway-server/src/main/resources/application.yml

@@ -187,7 +187,7 @@ auth:
     - /ws/**
     - /api/file/download
     - /api/commons/excel/import/templet
-    - /api/commons/share/valid/param
+    - /api/commons/share/valid/**
     - /api/commons/share/weixin/ticket
     - /api/commons/share/getSmsCode
     - /api/commons/share/submit

+ 6 - 3
frontend/saas-web/app/util/BaseUtil.js

@@ -164,7 +164,7 @@ Ext.define('saas.util.BaseUtil', {
                             return resolve(res);
                         } else {
                             res.message = res.message || '未知错误';
-                            throw new Error(res.message);
+                            return reject(res);
                         }
                     },
                     failure: function (response, opts) {
@@ -202,10 +202,13 @@ Ext.define('saas.util.BaseUtil', {
         },
 
         showLoginWin: function() {
-            var win = Ext.getCmp('relogin');
+            var main = Ext.getCmp('rootView'),
+            win = Ext.getCmp('relogin');
 
             if(!win) {
-                win = Ext.create('saas.view.auth.ReLogin');
+                win = main.add({
+                    xtype: 'relogin'
+                });
             }
 
             win.show();

+ 1 - 1
frontend/saas-web/app/util/FormUtil.js

@@ -3,7 +3,7 @@ Ext.define('saas.util.FormUtil', {
     statics: {
 
         // 主表允许自定义的配置名
-        MAIN_ALLOW_CUS_FIELDS: ['fieldLabel', 'hidden', 'index', 'columnWidth', 'group'],
+        MAIN_ALLOW_CUS_FIELDS: ['fieldLabel', 'hidden', 'index', 'columnWidth', 'group', 'html'],
         // 从表允许自定义的配置名
         DETAIL_ALLOW_CUS_FIELDS: ['text', 'hidden', 'index', 'width'],
 

+ 26 - 0
frontend/saas-web/app/view/auth/ReLoginController.js

@@ -61,8 +61,34 @@ Ext.define('saas.view.auth.ReLoginController', {
             }
             me.successReLogin();
         })
+        .then(function() {
+            let account = viewModel.get('account'),
+            companyId = account.companyId;
+            return saas.util.BaseUtil.request({
+                url: '/api/auth/switch/company',
+                params: {
+                    companyId: companyId
+                },
+                method: 'GET'
+            }).then(function(res) {
+                if (res.success) {
+                    var newSession = saas.model.Session.loadData(res.data);
+                    newSession.set('account', account);
+                    // 服务端与本地存在时间差
+                    newSession.set('span', newSession.get('timestamp') - new Date().getTime());
+                    if (!newSession.isValid()) {
+                        throw new Error('切换失败,无效身份令牌');
+                    } else {
+                        return newSession;
+                    }
+                } else {
+                    Ext.log.error('request failure with code: ', res.code, ', message: ', res.message);
+                }
+            });
+        })
         .catch(function (error) {
             view.isMasked() && view.unmask();
+            console.error(error);
             saas.util.BaseUtil.showErrorToast('登录失败: ' + error.message);
             me.failureReLogin();
         });

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

@@ -185,7 +185,10 @@ Ext.define('saas.view.core.base.GridPanel', {
                     items: [{
                         iconCls: 'x-sa sa-setting',
                         text: '列设置',
-                        handler: 'onColSetting'
+                        handler: 'onColSetting',
+                        bind: {
+                            hidden: '{!isAdmin}'
+                        }
                     }]
                 }]
             });

+ 4 - 1
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -125,7 +125,10 @@ Ext.define('saas.view.core.form.FormPanel', {
             cls:'x-formpanel-btn-white',
             text: '界面设置',
             target: 'main',
-            handler: 'onSetting'
+            handler: 'onSetting',
+            bind: {
+                hidden: '{!isAdmin}'
+            }
         }];
 
         Ext.apply(me, {

+ 6 - 4
frontend/saas-web/app/view/core/form/SettingWin.js

@@ -44,11 +44,11 @@ Ext.define('saas.view.core.form.SettingWin', {
                 return v;
             }
         }, {
-            text: '显示名称',
+            text: '自定义显示名称',
             dataIndex: 'alias',
             width: 150,
             editor: {
-                xtype: 'textfield'
+                xtype: 'textfield',
             }
         }, {
             text: '类型',
@@ -219,7 +219,7 @@ Ext.define('saas.view.core.form.SettingWin', {
                 for(let k in d) {
                     r.set(k, d[k]);
                 }
-                r.commit();
+                // r.commit();
             }
         }else {
             store.loadData(data);
@@ -288,6 +288,8 @@ Ext.define('saas.view.core.form.SettingWin', {
         if(settype == 'main') {
             if(item._init_fieldLabel) {
                 text = item.fieldLabel;
+            }else if(item._init_html) {
+                text = item.html;
             }
         }else {
             if(item._init_text) {
@@ -386,7 +388,7 @@ Ext.define('saas.view.core.form.SettingWin', {
         cusConfig = storeData.map(function(d) {
             let modified = d.modified || {},
             nameField = settype == 'main' ? 'name' : 'dataIndex',
-            textField = settype == 'main' ? 'fieldLabel' : 'text',
+            textField = settype == 'main' ? (d.get('type') == 'group' ? 'html' : 'fieldLabel') : 'text',
             name = d.get('name');
 
             // 强行保存序号

+ 27 - 6
frontend/saas-web/app/view/core/form/SettingWinController.js

@@ -14,12 +14,13 @@ Ext.define('saas.view.core.form.SettingWinController', {
     onBeforeEdit: function(editor, context, eOpts) {
         let record = context.record,
         column = context.column,
-        name = record.get('name'),
+        disabled = record.get('disabled'),
         type = record.get('type'),
         flag = true;
 
         if(
-            ['detailGridField'].indexOf(name) != -1 ||
+            (disabled && column.dataIndex == 'enable') ||
+            ['grid'].indexOf(type) != -1 ||
             (['group'].indexOf(type) != -1 && column.dataIndex == 'width')
         ) {
             flag = false;
@@ -29,8 +30,10 @@ Ext.define('saas.view.core.form.SettingWinController', {
     },
 
     onToggleEnable: function(grid, rowIndex, colIndex, actionItem, event, record, row) {
-        let checked = record.get('enable');
-        record.set('enable', !checked);
+        if(this.onBeforeEdit(null, {record: record, column: grid.up('grid').columns[colIndex]})) {
+            let checked = record.get('enable');
+            record.set('enable', !checked);
+        }
     },
 
     onDrop: function() {
@@ -40,7 +43,16 @@ Ext.define('saas.view.core.form.SettingWinController', {
         store = grid.getStore();
 
         store.each(function(r, idx) {
+            let type = r.get('type');
             r.set('index', idx + 1);
+            if(type == 'group') {
+                let flag = store.getAt(idx + 1) && store.getAt(idx + 1).get('type') == 'group';
+
+                if(flag)  {
+                    r.set('enable', !flag);
+                }
+                r.set('disabled', flag);
+            }
         });
     },
 
@@ -56,8 +68,13 @@ Ext.define('saas.view.core.form.SettingWinController', {
         win = me.getView(),
         grid = win.down('grid');
 
-        win.fieldItems = me.resetItems();
-        win.setStoreData();
+        // saas.util.BaseUtil.showConfirm('警告', '即将清空所有自定义配置,是否继续?<br/>'+'<span style="color: red;font-size: 12px;">(*保存后生效)</span>')
+        // .then(function(bid) {
+        //     if(bid == 'yes') {
+                win.fieldItems = me.resetItems();
+                win.setStoreData();
+        //     }
+        // })
     },
 
     resetItems: function() {
@@ -114,5 +131,9 @@ Ext.define('saas.view.core.form.SettingWinController', {
         .catch(function(res) {
             saas.util.BaseUtil.showErrorToast('保存失败:' + res.message);
         });
+    },
+
+    onAliasEdit: function(value, thview, column, editor, context, eOpts) {
+        var flag = false
     }
 });

+ 13 - 2
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -136,7 +136,10 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
         indexColumn = {
             // text : "序号", 
-            text: '<div class="x-sa sa-setting" style="cursor: pointer;" title="列设置"></div>',
+            // text: '<div class="x-sa sa-setting" style="cursor: pointer;" title="列设置"></div>',
+            bind: {
+                text: "{isAdmin ? ('<div class=\"x-sa sa-setting\" style=\"cursor: pointer;\" title=\"列设置\"></div>') : '序号'}"
+            },
             dataIndex : detnoField, 
             width : 60, 
             xtype : "numbercolumn",
@@ -153,7 +156,15 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                 '</div>';
             },
             listeners: {
-                headerclick: 'onColSetting'
+                headerclick: function() {
+                    let form = this.up('core-form-formpanel'),
+                    controller = form.getController(),
+                    text = this.text;
+
+                    if(text != '序号') {
+                        controller.onColSetting(arguments[0]);
+                    }
+                }
             }
         };
 

+ 4 - 1
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -258,7 +258,10 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 items: [{
                     iconCls: 'x-sa sa-setting',
                     text: '列设置',
-                    handler: 'onColSetting'
+                    handler: 'onColSetting',
+                    bind: {
+                        hidden: '{!isAdmin}'
+                    }
                 }]
             }]
         });

+ 4 - 1
frontend/saas-web/app/view/core/report/ReportPanel.js

@@ -136,7 +136,10 @@ Ext.define('saas.view.core.report.ReportPanel', {
                     items: me.allowCust ? [{
                         iconCls: 'x-sa sa-setting',
                         text: '列设置',
-                        handler: 'onColSetting'
+                        handler: 'onColSetting',
+                        bind: {
+                            hidden: '{!isAdmin}'
+                        }
                     }] : null
                 } : null],
 

+ 1 - 1
frontend/saas-web/app/view/document/customer/FormPanel.js

@@ -210,7 +210,7 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 defaultValue: saas.util.BaseUtil.getCurrentUser().realname,
                 group: '交易信息',
             }, {
-                xtype: "numberfield",
+                xtype: "hidden",
                 hideTrigger: true,
                 name: "cu_credit",
                 fieldLabel: "额度",

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

@@ -92,7 +92,7 @@ Ext.define('saas.view.money.paybalance.QueryPanel', {
                     }, {
                         text: '付款金额(元)',
                         xtype: 'numbercolumn',
-                        dataIndex: 'pd_amount',
+                        dataIndex: 'pb_amount',
                         width: 120,
                         renderer: function (v) {
                             return saas.util.BaseUtil.numberFormat(v, 2, true);

+ 3 - 0
frontend/saas-web/app/view/money/verification/FormPanel.js

@@ -48,6 +48,9 @@ Ext.define('saas.view.money.verification.FormPanel', {
                 items = FormUtil.initItems(items);
                 items = FormUtil.applyCusMainItemConfig(items, cfg);
                 items = FormUtil.applyCusDetailItemConfig(items, cfg);
+                
+                me.configItems = items;
+
                 items = FormUtil.applyDefaultItems(me, items);
                 me.removeAll();
                 return me.addItems(items);

+ 1 - 1
frontend/saas-web/app/view/stock/report/ProdinoutCount.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.stock.report.ProdinoutCount', {
     searchItems: [{		
         xtype: 'textfield',
         name: 'wh_description',
-        emptyText:'输入仓库编号',
+        emptyText:'输入仓库名称',
         columnWidth: 0.2,
         getCondition: function(value) {
            return  ' (wh_description like\'%' + value + '%\' or wh_code like \'%'+value+'%\') ';

+ 2 - 0
frontend/saas-web/app/view/viewport/Viewport.js

@@ -4,6 +4,8 @@ Ext.define('saas.view.viewport.Viewport', {
     controller: 'viewport',
     viewModel: 'viewport',
 
+    id: 'rootView',
+
     layout: {
         type: 'card',
         anchor: '100%'

+ 1 - 1
frontend/saas-web/overrides/data/Connection.js

@@ -61,7 +61,7 @@ Ext.define('saas.override.data.Connection', {
         if(res && res.code == 40001) {
             // 如果token超时则显示重新登陆弹窗
             saas.util.BaseUtil.showLoginWin();
-            throw new Error('话已过期');
+            throw new Error('话已过期');
         }
 
         if(Authorization) {