Jelajahi Sumber

管理员展示所有变更及里面查看权限

ellisran 1 tahun lalu
induk
melakukan
816e37066d

+ 1 - 1
app/middleware/change_apply_check.js

@@ -58,7 +58,7 @@ module.exports = options => {
                     throw '您无权查看该数据';
                 }
                 change.filePermission = true;
-            } else if (this.tender.isTourist) {
+            } else if (this.tender.isTourist || this.session.sessionUser.is_admin) {
                 change.curTimes = change.times;
                 change.filePermission = this.tender.touristPermission.file || auditorIds.indexOf(accountId) !== -1;
             } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人

+ 1 - 1
app/middleware/change_check.js

@@ -55,7 +55,7 @@ module.exports = options => {
             if (accountId === change.uid) { // 原报
                 change.curTimes = change.times;
                 change.filePermission = true;
-            } else if (this.tender.isTourist) {
+            } else if (this.tender.isTourist || this.session.sessionUser.is_admin) {
                 change.curTimes = change.times;
                 change.filePermission = this.tender.touristPermission.file || change.auditorIds.indexOf(accountId) !== -1;
             } else if (change.auditorIds.indexOf(accountId) !== -1) { // 审批人

+ 1 - 1
app/middleware/change_plan_check.js

@@ -59,7 +59,7 @@ module.exports = options => {
                     throw '您无权查看该数据';
                 }
                 change.filePermission = true;
-            } else if (this.tender.isTourist) {
+            } else if (this.tender.isTourist || this.session.sessionUser.is_admin) {
                 change.curTimes = change.times;
                 change.filePermission = this.tender.touristPermission.file || change.auditorIds.indexOf(accountId) !== -1;
             } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人

+ 1 - 1
app/middleware/change_project_check.js

@@ -59,7 +59,7 @@ module.exports = options => {
                     throw '您无权查看该数据';
                 }
                 change.filePermission = true;
-            } else if (this.tender.isTourist) {
+            } else if (this.tender.isTourist || this.session.sessionUser.is_admin) {
                 change.curTimes = change.times;
                 change.filePermission = this.tender.touristPermission.file || change.auditorIds.indexOf(accountId) !== -1;
             } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人

+ 3 - 3
app/service/change_apply.js

@@ -157,7 +157,7 @@ module.exports = app => {
         async getListByStatus(tenderId, status = 0, hadlimit = 1, sortBy = '', orderBy = '') {
             let sql = '';
             let sqlParam = '';
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 sql = 'SELECT a.*, p.name as account_name FROM ?? As a LEFT JOIN ?? AS p On a.notice_uid = p.id WHERE a.tid = ?';
                 sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId];
             } else {
@@ -246,7 +246,7 @@ module.exports = app => {
          * @return {void}
          */
         async getCountByStatus(tenderId, status) {
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 const sql5 = 'SELECT count(*) AS count FROM ?? WHERE tid = ? ORDER BY in_time DESC';
                 const sqlParam5 = [this.tableName, tenderId];
                 const result5 = await this.db.query(sql5, sqlParam5);
@@ -319,7 +319,7 @@ module.exports = app => {
          * @return {void}
          */
         async getTp(tenderId, status) {
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 const sql5 = 'SELECT SUM(cast (total_price as decimal(18,6))) AS total_price FROM ?? WHERE tid = ?';
                 const sqlParam5 = [this.tableName, tenderId];
                 const result5 = await this.db.query(sql5, sqlParam5);

+ 3 - 3
app/service/change_plan.js

@@ -178,7 +178,7 @@ module.exports = app => {
         async getListByStatus(tenderId, status = 0, hadlimit = 1, sortBy = '', orderBy = '') {
             let sql = '';
             let sqlParam = '';
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 sql = 'SELECT a.*, p.name as account_name FROM ?? As a LEFT JOIN ?? AS p On a.uid = p.id WHERE a.tid = ?';
                 sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId];
             } else {
@@ -267,7 +267,7 @@ module.exports = app => {
          * @return {void}
          */
         async getCountByStatus(tenderId, status) {
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 const sql5 = 'SELECT count(*) AS count FROM ?? WHERE tid = ? ORDER BY in_time DESC';
                 const sqlParam5 = [this.tableName, tenderId];
                 const result5 = await this.db.query(sql5, sqlParam5);
@@ -340,7 +340,7 @@ module.exports = app => {
          * @return {void}
          */
         async getTp(tenderId, status) {
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 const sql5 = 'SELECT SUM(cast (total_price as decimal(18,6))) AS total_price FROM ?? WHERE tid = ?';
                 const sqlParam5 = [this.tableName, tenderId];
                 const result5 = await this.db.query(sql5, sqlParam5);

+ 2 - 2
app/service/change_project.js

@@ -148,7 +148,7 @@ module.exports = app => {
         async getListByStatus(tenderId, status = 0, hadlimit = 1, sortBy = '', orderBy = '') {
             let sql = '';
             let sqlParam = '';
-            if (this.ctx.tender.isTourist && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin) && status === 0) {
                 sql = 'SELECT a.*, p.name as account_name FROM ?? As a LEFT JOIN ?? AS p On a.uid = p.id WHERE a.tid = ?';
                 sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId];
             } else {
@@ -250,7 +250,7 @@ module.exports = app => {
          * @return {void}
          */
         async getCountByStatus(tenderId, status) {
-            if (this.ctx.tender.isTourist) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin)) {
                 let touristSql;
                 let touristSqlParam;
                 let touristResult;