소스 검색

管理员标段权限和设置

laiguoran 4 년 전
부모
커밋
92be66a28f
3개의 변경된 파일11개의 추가작업 그리고 8개의 파일을 삭제
  1. 8 5
      app/controller/tender_controller.js
  2. 1 1
      app/middleware/tender_check.js
  3. 2 2
      app/middleware/uncheck_tender_check.js

+ 8 - 5
app/controller/tender_controller.js

@@ -121,7 +121,7 @@ module.exports = app => {
                 const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
                     ? JSON.parse(accountInfo.permission) : null;
 
-                const tenderList = await this.ctx.service.tender.getList('', userPermission);
+                const tenderList = await this.ctx.service.tender.getList('', userPermission, this.ctx.session.sessionUser.is_admin);
 
                 for (const t of tenderList) {
                     if (t.user_id === this.ctx.session.sessionUser.accountId && (
@@ -174,7 +174,7 @@ module.exports = app => {
         async _list(view, renderData, modal = '', list_status = '') {
             console.log(1);
             try {
-                renderData.tenderList = await this.ctx.service.tender.getList(list_status, renderData.userPermission);
+                renderData.tenderList = await this.ctx.service.tender.getList(list_status, renderData.userPermission, this.ctx.session.sessionUser.is_admin);
 
                 for (const t of renderData.tenderList) {
                     if (t.ledger_status === auditConst.ledger.status.checked) {
@@ -453,8 +453,8 @@ module.exports = app => {
                     audit: auditConst,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.tender.tenderInfo),
                 };
-                if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.xxjd) === 1 && ctx.session.sessionUser.is_admin) {
-                    // 形象进度内容
+                if (ctx.session.sessionUser.is_admin) {
+                    renderData.tourists = await ctx.service.tenderTourist.getTourists(tender.id);
                     // 获取所有项目参与者
                     const accountList = await ctx.service.projectAccount.getAllDataByCondition({
                         where: { project_id: ctx.session.sessionProject.id, enable: 1 },
@@ -464,9 +464,12 @@ module.exports = app => {
                         const groupList = accountList.filter(item => item.account_group === idx);
                         return { groupName: item, groupList };
                     });
-                    renderData.scheduleAuditList = await ctx.service.scheduleAudit.getAllDataByCondition({ where: { tid: tender.id } });
                     renderData.accountList = accountList;
                     renderData.accountGroup = accountGroupList;
+                }
+                if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.xxjd) === 1 && ctx.session.sessionUser.is_admin) {
+                    // 形象进度内容
+                    renderData.scheduleAuditList = await ctx.service.scheduleAudit.getAllDataByCondition({ where: { tid: tender.id } });
                     renderData.scPermission = scheduleConst.permission;
                 }
                 await this.layout('tender/detail.ejs', renderData, 'tender/detail_modal.ejs');

+ 1 - 1
app/middleware/tender_check.js

@@ -65,7 +65,7 @@ module.exports = options => {
                 (tenderPermission === null || tenderPermission === undefined || tenderPermission.indexOf('2') === -1) &&
                 stageAuditorsId.indexOf(accountId) === -1 && changeAuditorsId.indexOf(accountId) === -1 &&
                 reviseAuditorsId.indexOf(accountId) === -1 && materialAuditorsId.indexOf(accountId) === -1 &&
-                advanceAuditorsId.indexOf(accountId) === -1) {
+                advanceAuditorsId.indexOf(accountId) === -1 && !this.session.sessionUser.is_admin) {
                 throw '您无权查看该项目';
             }
 

+ 2 - 2
app/middleware/uncheck_tender_check.js

@@ -23,9 +23,9 @@ module.exports = options => {
     return function* uncheckTenderCheck(next) {
         try {
             if (this.tender.data.ledger_status === auditConst.status.uncheck) {
-                if (this.tender.data.user_id !== this.session.sessionUser.accountId && this.tender.advanceAuditorsId.indexOf(this.session.sessionUser.accountId) === -1) {
+                if (this.tender.data.user_id !== this.session.sessionUser.accountId && !this.session.sessionUser.is_admin && this.tender.advanceAuditorsId.indexOf(this.session.sessionUser.accountId) === -1) {
                     throw '您无权查看该项目';
-                } else if (this.tender.advanceAuditorsId.indexOf(this.session.sessionUser.accountId) !== -1) {
+                } else if (this.tender.advanceAuditorsId.indexOf(this.session.sessionUser.accountId) !== -1 && !this.session.sessionUser.is_admin) {
                     throw '您无权查看该内容';
                 }
             }