浏览代码

巡检功能更新

ellisran 4 天之前
父节点
当前提交
d6a7962be4
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 1 1
      app/middleware/quality_inspection_check.js
  2. 8 8
      app/service/quality_inspection.js

+ 1 - 1
app/middleware/quality_inspection_check.js

@@ -43,7 +43,7 @@ module.exports = options => {
             const permission = this.session.sessionUser.permission;
             if (accountId === inspection.uid) { // 原报
                 inspection.filePermission = true;
-            } else if (this.permission.safe_inspection.view_all) {
+            } else if (this.permission.inspection.view_all) {
                 inspection.filePermission = true;
             } else if (auditorIds.indexOf(accountId) !== -1) { // 审批人
                 if (inspection.status === status.uncheck) {

+ 8 - 8
app/service/quality_inspection.js

@@ -158,7 +158,7 @@ module.exports = app => {
         async getListByStatus(tid, status, hadlimit = 0, sortBy = '', orderBy = '') {
             let sql = '';
             let sqlParam = '';
-            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all) && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all) && status === 0) {
                 sql = 'SELECT a.* FROM ?? As a WHERE a.tid = ?';
                 sqlParam = [this.tableName, tid];
             } else {
@@ -186,7 +186,7 @@ module.exports = app => {
                         sql =
                             'SELECT a.* FROM ?? AS a WHERE ' +
                             'a.tid = ? AND (a.status = ? OR a.status = ?)' +
-                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.uid = ' + this.ctx.session.sessionUser.accountId);
+                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.uid = ' + this.ctx.session.sessionUser.accountId);
                         sqlParam = [
                             this.tableName,
                             tid,
@@ -198,7 +198,7 @@ module.exports = app => {
                         sql =
                             'SELECT a.* FROM ?? AS a WHERE ' +
                             '(a.status = ? OR a.status = ?) AND a.tid = ?' +
-                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
+                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
                         sqlParam = [this.tableName, status, auditConst.status.checkNoPre, tid, this.ctx.service.safeInspectionAudit.tableName, this.ctx.session.sessionUser.accountId];
                         break;
                     case auditConst.filter.status.rectification: // 整改中(所有的)
@@ -206,7 +206,7 @@ module.exports = app => {
                         sql =
                             'SELECT a.* FROM ?? AS a WHERE ' +
                             'a.status = ? AND a.tid = ?' +
-                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
+                            (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
                         sqlParam = [this.tableName, status, tid, this.ctx.service.safeInspectionAudit.tableName, this.ctx.session.sessionUser.accountId];
                         break;
                     case auditConst.filter.status.checked: // 已完成(所有的)
@@ -243,7 +243,7 @@ module.exports = app => {
          * @return {void}
          */
         async getCountByStatus(tid, status = 0) {
-            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all) && status === 0) {
+            if ((this.ctx.tender.isTourist || this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all) && status === 0) {
                 const sql5 = 'SELECT count(*) AS count FROM ?? AS a WHERE a.tid = ?';
                 const sqlParam5 = [this.tableName, tid];
                 const result5 = await this.db.query(sql5, sqlParam5);
@@ -273,7 +273,7 @@ module.exports = app => {
                 case auditConst.filter.status.uncheck: // 待上报(所有的)PS:取未上报,退回的变更立项
                     const sql2 =
                         'SELECT count(*) AS count FROM ?? AS a WHERE a.tid = ? AND (a.status = ? OR a.status = ?)' +
-                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.uid = ' + this.ctx.session.sessionUser.accountId);
+                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.uid = ' + this.ctx.session.sessionUser.accountId);
                     const sqlParam2 = [
                         this.tableName,
                         tid,
@@ -286,7 +286,7 @@ module.exports = app => {
                     const sql7 =
                         'SELECT count(*) AS count FROM ?? as a WHERE ' +
                         '(a.status = ? OR a.status = ?) AND a.tid = ?' +
-                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
+                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
                     const sqlParam7 = [this.tableName, status, auditConst.status.checkNoPre, tid, this.ctx.service.safeInspectionAudit.tableName, this.ctx.session.sessionUser.accountId];
                     const result7 = await this.db.query(sql7, sqlParam7);
                     return result7[0].count;
@@ -295,7 +295,7 @@ module.exports = app => {
                     const sql3 =
                         'SELECT count(*) AS count FROM ?? as a WHERE ' +
                         'a.status = ? AND a.tid = ?' +
-                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.safe_inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
+                        (this.ctx.session.sessionUser.is_admin || this.ctx.permission.inspection.view_all ? '' : ' AND a.id IN (SELECT b.qiid FROM ?? AS b WHERE b.aid = ? GROUP BY b.qiid)');
                     const sqlParam3 = [this.tableName, status, tid, this.ctx.service.safeInspectionAudit.tableName, this.ctx.session.sessionUser.accountId];
                     const result3 = await this.db.query(sql3, sqlParam3);
                     return result3[0].count;