Browse Source

TASK #4040 “开启个人「签字」功能”。

TonyKang 3 years atrás
parent
commit
f637576c6d
1 changed files with 14 additions and 1 deletions
  1. 14 1
      app/controller/report_controller.js

+ 14 - 1
app/controller/report_controller.js

@@ -148,10 +148,23 @@ module.exports = app => {
                     }
                 }
                 // const archiveList = await ctx.service.rptArchive.getPrjStgArchive(tender.data.project_id, ctx.stage.id);
-                const prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(tender.data.project_id);
+                let prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(tender.data.project_id);
                 const roleList = await ctx.service.signatureRole.getSignatureRolesByTenderId(tender.id);
                 const usedList = await ctx.service.signatureUsed.getSignatureUsedByTenderId(tender.id);
 
+                // ctx.session.sessionUser.is_admin
+                // const pageShow = ctx.session.sessionProject.page_show;
+                // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
+                if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
+                    // 削减其他account
+                    const newAccList = [];
+                    for (const acc of prjAccList) {
+                        if (acc.id === this.ctx.session.sessionUser.accountId) {
+                            newAccList.push(acc);
+                        }
+                    }
+                    prjAccList = newAccList;
+                }
 
                 // 分类列表
                 const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);