瀏覽代碼

调整支付审批报表界面及签名输出

Tony Kang 2 年之前
父節點
當前提交
1500d07fab
共有 1 個文件被更改,包括 19 次插入50 次删除
  1. 19 50
      app/controller/report_controller.js

+ 19 - 50
app/controller/report_controller.js

@@ -225,44 +225,6 @@ module.exports = app => {
                 const materialList = await ctx.service.material.getValidMaterials(ctx.tender.id);
 
 
-                // const allTpls = await ctx.service.rptTpl.getAllTplByIds(tmpRptIds);
-                // for (const tpl of allTpls) {
-                //     const fName = tpl.id + '_' + tpl.rpt_tpl_name + '.js';
-                //     console.log('fName: ' + fName);
-                //     fsUtil.writeObjToFile(tpl, 'D:/Temp/计量临时/' + fName);
-                // }
-                // 完成历史任务,下一批
-                // const filePath = 'D:/Temp/计量临时/';
-                // const tplFiles = [];
-                // fs.readdir(filePath, (err, files) => {
-                //     if (err) throw err;
-                //     files.forEach(file => {
-                //         const fPath = filePath + file;
-                //         // console.log('\'' + fPath + '\'');
-                //         tplFiles.push(fPath);
-                //     });
-                // });
-                //
-                // setTimeout(function() {
-                //     console.log(tplFiles);
-                // }, 2000);
-                // 下一批
-                // let cnt = 0;
-                // for (const file of rptFiles) {
-                //     const tplObj = JSON.parse(fs.readFileSync(file, 'utf-8'));
-                //     const rst = await ctx.service.rptTpl.insertRptTpl(tplObj);
-                //     cnt++;
-                //     console.log(file);
-                // }
-                // console.log(cnt + ' 完成!');
-
-                // console.log(maxStageAmt[0].maxAmt);
-                // 备注:在报表界面初始化的时候,暂时不需要check stage,只有在点中某张表的时候才需要(签名交互需要)
-                // if ((stage === null || stage === undefined) && stageList.length > 0) {
-                //     await ctx.service.stage.checkStage(stageList[stageList.length - 1].id);
-                //     stage = ctx.stage;
-                //     console.log(stage);
-                // }
                 if (stage !== null && stage !== undefined) {
                     stage_id = stage.id;
                     stage_order = stage.order;
@@ -372,6 +334,7 @@ module.exports = app => {
                 const pageShow = ctx.session.sessionProject.page_show;
                 pageShow.showArchive = 1;
                 pageShow.closeWatermark = 1;
+                pageShow.showArchive = 0;
                 const tenderId = ctx.params.id;
                 const paymentDetail_id = ctx.params.did;
                 // 支付审批: ctx.params.did 是 zh_payment_detail表的id, 通过这个did在 zh_payment_detail_audit表里找审核信息(td_id = ctx.params.did)
@@ -411,12 +374,8 @@ module.exports = app => {
                 const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
                 const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
                 // 获取用户可查看的标段
-                const tenderList = await this.ctx.service.tender.getList('', userPermission);
-                for (const t of tenderList) {
-                    if (t.ledger_status === auditConst.ledger.status.checked) {
-                        t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
-                    }
-                }
+                // ...
+                const tenderList = [];
                 const cid = this.ctx.helper._.map(treeNodes, 'id');
                 const customSelects = null;
                 const dataSelects = {};
@@ -591,12 +550,22 @@ module.exports = app => {
             // console.log(pageRst);
             // 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);
-            const stageList = await ctx.service.stage.getValidStagesShort(params.tender_id);
-            // console.log('after role stage!');
-            // console.log(roleRel);
-            const stageFlow = await ctx.service.stageAudit.getAuditGroupByListWithOwner(params.stage_id, params.stage_times);
+
+            let stgAudit = null,
+                stgAuditForOrg = null,
+                stageFlow = null,
+                stageList = [];
+            if (![-100, -200, -300].includes(params.stage_id)) {
+                stgAudit = await ctx.service.stageAudit.getStageAudit(params.stage_id, params.stage_times);
+                stgAuditForOrg = await ctx.service.stageAudit.getStageAudit(params.stage_id, 1);
+                stageList = await ctx.service.stage.getValidStagesShort(params.tender_id);
+                stageFlow = await ctx.service.stageAudit.getAuditGroupByListWithOwner(params.stage_id, params.stage_times);
+            } else {
+                stgAudit = await ctx.service.paymentDetailAudit.getAuditors(params.detail_id);
+                stgAuditForOrg = await ctx.service.paymentDetailAudit.getAuditors(params.detail_id, 1);
+                stageFlow = await ctx.service.paymentDetailAudit.getAuditorsWithOwner(params.detail_id);
+            }
+
             stageFlow.forEach(x => {
                 if (!x) return;
                 x.visible = (!ctx.session.sessionUser.is_admin && ctx.session.sessionProject.page_show.individualSign === 1)