Преглед изворни кода

待办页台账审批通知页面展示

laiguoran пре 5 година
родитељ
комит
bfb8d7c512
2 измењених фајлова са 5 додато и 5 уклоњено
  1. 3 3
      app/controller/dashboard_controller.js
  2. 2 2
      app/service/ledger_audit.js

+ 3 - 3
app/controller/dashboard_controller.js

@@ -29,13 +29,13 @@ module.exports = app => {
             const auditRevise = await ctx.service.reviseAudit.getAuditRevise(ctx.session.sessionUser.accountId);
             const auditMaterial = await ctx.service.materialAudit.getAuditMaterial(ctx.session.sessionUser.accountId);
             const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
-            // const lastNotice = pa.last_notice ? pa.last_notice : (pa.last_notice === 0 ? new Date() : new Date(pa.last_login * 1000));
-            // const noticeLedger = await ctx.service.ledgerAudit.getNoticeTender(ctx.session.sessionProject.id, pa.id, lastNotice);
+            const lastNotice = pa.last_notice ? pa.last_notice : (pa.last_notice === 0 ? new Date() : new Date(pa.last_login * 1000));
+            const noticeLedger = await ctx.service.ledgerAudit.getNoticeTender(ctx.session.sessionProject.id, pa.id, lastNotice);
             // const noticeStage = await ctx.service.stageAudit.getNoticeStage(ctx.session.sessionProject.id, pa.id, lastNotice);
             // const noticeChange = await ctx.service.changeAudit.getNoticeChange(ctx.session.sessionProject.id, pa.id, lastNotice);
             // const noticeRevise = await ctx.service.reviseAudit.getNoticeRevise(ctx.session.sessionProject.id, pa.id, lastNotice);
             // const noticeMaterial = await ctx.service.materialAudit.getNoticeMaterial(ctx.session.sessionProject.id, pa.id, lastNotice);
-            const noticeLedger = [];
+            // const noticeLedger = [];
             const noticeStage = [];
             const noticeChange = [];
             const noticeRevise = [];

+ 2 - 2
app/service/ledger_audit.js

@@ -376,13 +376,13 @@ module.exports = app => {
          * @returns {Promise<*>}
          */
         async getNoticeTender(projectId, auditorId, noticeTime) {
-            const sql = 'SELECT la.`audit_id`, la.`times`, la.`audit_order`, la.`end_time`, la.`status`, t.`id`, t.`name`, t.`project_id`, t.`type`, t.`user_id`, ' +
+            const sql = 'SELECT * FROM (SELECT la.`audit_id`, la.`times`, la.`audit_order`, la.`end_time`, la.`status`, t.`id`, t.`name`, t.`project_id`, t.`type`, t.`user_id`, ' +
                         '    pa.name As `lu_name`, pa.role As `lu_role`, pa.company As `lu_company`' +
                         '  FROM (SELECT * FROM ?? WHERE `user_id` = ? OR `id` in (SELECT `tender_id` FROM ?? WHERE `audit_id` = ? GROUP BY `tender_id`)) As t ' +
                         '  LEFT JOIN ?? As la ON la.`tender_id` = t.`id`' +
                         '  LEFT JOIN ?? As pa ON la.`audit_id` = pa.`id`' +
                         '  WHERE la.`end_time` > ? and t.`project_id` = ?' +
-                        '  ORDER By la.`end_time` DESC';
+                        '  ORDER By la.`end_time` DESC LIMIT 1000) as new_t GROUP BY new_t.`id` ORDER BY new_t.`end_time`';
             const sqlParam = [this.ctx.service.tender.tableName, auditorId, this.tableName, auditorId, this.tableName, this.ctx.service.projectAccount.tableName,
                 noticeTime, projectId];
             return await this.db.query(sql, sqlParam);