Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 3 years ago
parent
commit
e3bba6b357
2 changed files with 12 additions and 3 deletions
  1. 4 1
      app/controller/stage_controller.js
  2. 8 2
      app/public/js/stage.js

+ 4 - 1
app/controller/stage_controller.js

@@ -203,7 +203,7 @@ module.exports = app => {
                 }
                 renderData.sfData = sfData;
                 // 收方单附件删除权限
-                renderData.sfAttDelPower = ctx.session.sessionUser.accountId === ctx.stage.user_id || ctx.helper._.find(ctx.stage.auditors2, { aid: ctx.session.sessionUser.accountId }) !== -1;
+                renderData.sfAttDelPower = ctx.session.sessionUser.accountId === ctx.stage.user_id || ctx.helper._.findIndex(ctx.stage.auditors2, { aid: ctx.session.sessionUser.accountId }) !== -1;
                 await this.layout('stage/index.ejs', renderData, 'stage/modal.ejs');
             } catch (err) {
                 this.log(err);
@@ -1887,6 +1887,9 @@ module.exports = app => {
          */
         async saveShoufang(ctx) {
             try {
+                if (ctx.session.sessionUser.accountId !== ctx.stage.user_id) {
+                    throw '没有权限操作收方单';
+                }
                 const data = JSON.parse(ctx.request.body.data);
                 const responseData = { err: 0, msg: '', data: {} };
                 switch (data.type) {

+ 8 - 2
app/public/js/stage.js

@@ -1571,9 +1571,12 @@ $(document).ready(() => {
             shoufangdanSpr: '---',
             shoufangdan: {
                 name: '生成收方单',
+                visible: function(key, opt) {
+                   if (cur_uid === stage.user_id) return true;
+                },
                 disabled: function (key, opt) {
                     const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
-                    if (!node || !node.b_code || !node.is_leaf) return true;
+                    if (!node || !node.b_code || !node.is_leaf || cur_uid !== stage.user_id) return true;
                 },
                 callback: function (key, opt) {
                     const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
@@ -2206,9 +2209,12 @@ $(document).ready(() => {
             },
             'shoufangdan': {
                 name: '生成收方单',
+                visible: function(key, opt) {
+                    if (cur_uid === stage.user_id) return true;
+                },
                 disabled: function (key, opt) {
                     const node = SpreadJsObj.getSelectObject(spSpread.getActiveSheet());
-                    if (!node) return true;
+                    if (!node || cur_uid !== stage.user_id) return true;
                 },
                 callback: function (key, opt) {
                     const node = SpreadJsObj.getSelectObject(spSpread.getActiveSheet());