TonyKang пре 5 година
родитељ
комит
eb5719c648

+ 3 - 1
app/controller/report_controller.js

@@ -173,17 +173,19 @@ module.exports = app => {
             // const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
             const roleRel = await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id, params.stage_id); // 新需求中,允许在非审核状态下设置签名
             const stgAudit = await ctx.service.stageAudit.getStageAudit(params.stage_id, params.stage_times);
+            const stgAuditForOrg = await ctx.service.stageAudit.getStageAudit(params.stage_id, 1);
             // console.log('after role stage!');
             // console.log(roleRel);
             await encodeSignatureDataUri(roleRel, this.app.baseDir);
             await encodeDummySignatureDataUri(pageRst, this.app.baseDir);
-            const stageFlow = await ctx.service.stageAudit.getAuditors(params.stage_id, 1);
+            const stageFlow = await ctx.service.stageAudit.getAuditGroupByListWithOwner(params.stage_id, params.stage_times);
 
             // console.log('encodeSignatureDataUri!');
             return {
                 data: pageRst,
                 signatureRelInfo: roleRel,
                 stageAudit: stgAudit,
+                stageAuditOrg: stgAuditForOrg,
                 debugInfo: ctx.app.config.is_debug ? ctx.debugInfo : null,
                 customDefine: rptTpl[JV.NODE_CUSTOM_DEFINE],
                 stageFlow,

+ 2 - 0
app/public/report/js/rpt_main.js

@@ -291,7 +291,9 @@ let zTreeOprObj = {
                 // hintBox.unWaitBox();
                 let pageRst = result.data;
                 STAGE_AUDIT = result.stageAudit;
+                STAGE_AUDIT_ORG = result.stageAuditOrg;
                 STAGE_FLOW = result.stageFlow;
+                //stageAuditOrg
                 if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
                     CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
                     ROLE_REL_LIST = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);

+ 25 - 12
app/public/report/js/rpt_signature.js

@@ -283,7 +283,8 @@ let rptSignatureHelper = {
             for (const stga of STAGE_AUDIT) {
                 if (stga.aid === userAccId) {
                     hasAudit = true;
-                    if (stga.end_time && stga.end_time !== '' && stga.end_time.length > 20) {
+                    if (stga.status === 3 && stga.end_time && stga.end_time !== '' && stga.end_time.length > 20) {
+                        //只有在审批人通过后才获取审批时间
                         // let dt = new Date(stga.end_time);
                         dftDate = (new Date(stga.end_time)).Format('yyyy-MM-dd');
                     }
@@ -291,18 +292,30 @@ let rptSignatureHelper = {
                 }
             }
         }
-        if (!hasAudit && STAGE_FLOW && STAGE_FLOW.length > 0 && STAGE_FLOW[0].aid === userAccId) {
-            if (STAGE_FLOW[0].begin_time && STAGE_FLOW[0].begin_time !== '' && STAGE_FLOW[0].begin_time.length > 20) {
-                dftDate = (new Date(STAGE_FLOW[0].begin_time)).Format('yyyy-MM-dd');
+        let isOrgRpt = false;
+        for (const stg of STAGE_LIST) {
+            if (stg.id === current_stage_id) {
+                if (stg.user_id === userAccId) {
+                    isOrgRpt = true;
+                }
+                break;
+            }
+        }
+        if (isOrgRpt && !hasAudit && STAGE_AUDIT_ORG && STAGE_AUDIT_ORG.length > 0) {
+            if (STAGE_AUDIT_ORG[0].begin_time && STAGE_AUDIT_ORG[0].begin_time !== '' && STAGE_AUDIT_ORG[0].begin_time.length > 20) {
+                dftDate = (new Date(STAGE_AUDIT_ORG[0].begin_time)).Format('yyyy-MM-dd');
+            }
+        }
+        if (!isOrgRpt && !hasAudit) {
+            //非审批流程人员以及非原报,则显示期截至时间
+            for (const stg of STAGE_LIST) {
+                if (stg.id === current_stage_id && stg.period) {
+                    const period = stg.period.split(' ~ ');
+                    if (period.length === 2) {
+                        dftDate = period[1];
+                    }
+                }
             }
-            // for (const stg of STAGE_LIST) {
-            //     if (stg.id === current_stage_id && stg.period) {
-            //         const period = stg.period.split(' ~ ');
-            //         if (period.length === 2) {
-            //             dftDate = period[1];
-            //         }
-            //     }
-            // }
         }
         if (dftDate !== '') {
             elementsStrArr.push('<input id="' + idSuffixStr + '" class="form-control form-control-sm mt-0" placeholder="选择签名日期" type="date" value="' + dftDate + '"');

+ 4 - 2
app/service/stage_audit.js

@@ -865,9 +865,11 @@ module.exports = app => {
          * @return {Promise<boolean>}
          */
         async getStageAudit(stageId, times = 1) {
-            const sql = 'SELECT a1.aid, a1.end_time, a1.opinion ' +
+            const sql = 'SELECT a1.aid, a1.begin_time, a1.end_time, a1.status, a1.opinion ' +
                 'FROM ?? AS a1 ' +
-                'WHERE a1.`sid` = ? and a1.`status` = 3 and a1.`times` = ?';
+                'WHERE a1.`sid` = ? and a1.`times` = ? ' +
+                'ORDER BY a1.order'
+            ;
             const sqlParam = [this.tableName, stageId, times];
             const rst = await this.db.query(sql, sqlParam);
             return rst;

+ 1 - 0
app/view/report/index.ejs

@@ -219,6 +219,7 @@
     let USED_LIST = <%- used_list %>;
     const STAGE_STATUS = <%- stg_status %>;
     let STAGE_AUDIT = [];
+    let STAGE_AUDIT_ORG = [];
     let STAGE_FLOW = [];
     let ROLE_REL_LIST = [];
     let CURRENT_ROLE_REL_ID = -1;