浏览代码

变更关联数据

ellisran 1 年之前
父节点
当前提交
4048d3e832

+ 62 - 12
app/controller/change_controller.js

@@ -424,10 +424,6 @@ 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 deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 
                 // 工程变更类别读取
                 const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
@@ -436,6 +432,9 @@ module.exports = app => {
                 // 获取用户人验证手机号
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const auth_mobile = pa.auth_mobile;
+                const userPermission = pa !== undefined && pa.permission !== ''
+                    ? JSON.parse(pa.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
                 const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
                 const settleBills = ctx.change.readySettle ? await ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: ctx.change.readySettle.id } }) : [];
                 const settlePos = ctx.change.readySettle ? await ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: ctx.change.readySettle.id } }) : [];
@@ -555,6 +554,40 @@ module.exports = app => {
         }
 
         /**
+         * 变更关联数据 - 操作 (Ajax)
+         * @param ctx
+         * @return {Promise<void>}
+         */
+        async relation(ctx) {
+            try {
+                // await this._getChangeAuditViewData(ctx);
+                const tender = ctx.tender;
+                const change = ctx.change;
+                const renderData = {
+                    tender,
+                    change,
+                };
+                renderData.changePlanInfo = null;
+                renderData.changeApplyInfo = null;
+                renderData.changeProjectInfo = null;
+                if (change.plan_code) {
+                    renderData.changePlanInfo = await ctx.service.changePlan.getDataByCondition({ tid: tender.id, code: change.plan_code });
+                    if (renderData.changePlanInfo && renderData.changePlanInfo.apply_code) {
+                        renderData.changeApplyInfo = await ctx.service.changeApply.getDataByCondition({ tid: tender.id, code: renderData.changePlanInfo.apply_code });
+                        if (renderData.changeApplyInfo && renderData.changeApplyInfo.project_code) {
+                            renderData.changeProjectInfo = await ctx.service.changeProject.getDataByCondition({ tid: tender.id, code: renderData.changeApplyInfo.project_code });
+                        }
+                    }
+                }
+                await this.layout('change/relation.ejs', renderData);
+            } catch (err) {
+                this.log(err);
+                ctx.session.postError = err.toString();
+                ctx.redirect('/tender/' + ctx.params.id + '/change');
+            }
+        }
+
+        /**
          * 变更清单 - 操作 (Ajax)
          * @param ctx
          * @return {Promise<void>}
@@ -2138,6 +2171,9 @@ module.exports = app => {
                 // 获取用户人验证手机号
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const auth_mobile = pa.auth_mobile;
+                const userPermission = pa !== undefined && pa.permission !== ''
+                    ? JSON.parse(pa.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
                 // 判断并更新
                 const renderData = {
                     tender: ctx.tender,
@@ -2148,6 +2184,7 @@ module.exports = app => {
                     fileList,
                     whiteList,
                     authMobile: auth_mobile,
+                    deleteFilePermission,
                     auditType,
                     shenpiConst,
                     returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/project') ? ctx.request.headers.referer : null,
@@ -2521,10 +2558,10 @@ module.exports = app => {
                     throw '数据错误';
                 }
                 if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
-                    throw '您无权上报该数据';
+                    throw '您无权上报该变更立项数据';
                 }
                 if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
-                    throw '该材料调差期数据当前无法上报';
+                    throw '该变更立项数据当前无法上报';
                 }
 
                 await ctx.service.changeProjectAudit.start(ctx.change.id, ctx.change.times);
@@ -2546,7 +2583,7 @@ module.exports = app => {
             try {
                 const auditConst = audit.changeProject;
                 if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
-                    throw '当前材料调差期数据有误';
+                    throw '当前变更立项数据有误';
                 }
                 if (ctx.change.curAuditorIds.length === 0 || ctx.change.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) === -1) {
                     throw '您无权进行该操作';
@@ -2990,6 +3027,9 @@ module.exports = app => {
                 // 获取用户人验证手机号
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const auth_mobile = pa.auth_mobile;
+                const userPermission = pa !== undefined && pa.permission !== ''
+                    ? JSON.parse(pa.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
                 const renderData = {
                     tender,
                     change: ctx.change,
@@ -3001,6 +3041,7 @@ module.exports = app => {
                     fileList,
                     whiteList,
                     authMobile: auth_mobile,
+                    deleteFilePermission,
                     auditType,
                     shenpiConst,
                     tpUnit: ctx.change.decimal ? ctx.change.decimal.tp : ctx.tender.info.decimal.tp,
@@ -3042,6 +3083,10 @@ module.exports = app => {
                 // 获取附件列表
                 const fileList = await ctx.service.changeApplyAtt.getAllChangeApplyAtt(ctx.tender.id, ctx.change.id);
                 await this._getChangeApplyAuditViewData(ctx);
+                const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
+                const userPermission = pa !== undefined && pa.permission !== ''
+                    ? JSON.parse(pa.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
                 const renderData = {
                     tender,
                     change: ctx.change,
@@ -3051,6 +3096,7 @@ module.exports = app => {
                     returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/apply') ? ctx.request.headers.referer : null,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.apply_information_notice),
                     preUrl: '/tender/' + ctx.tender.id + '/change/apply/' + ctx.change.id + '/information/notice',
+                    deleteFilePermission,
                 };
                 await this.layout('change/apply_information_notice.ejs', renderData, 'change/apply_information_notice_modal.ejs');
             } catch (err) {
@@ -3314,10 +3360,10 @@ module.exports = app => {
                     throw '数据错误';
                 }
                 if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
-                    throw '您无权上报该数据';
+                    throw '您无权上报该变更申请数据';
                 }
                 if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
-                    throw '该材料调差期数据当前无法上报';
+                    throw '该变更申请数据当前无法上报';
                 }
 
                 await ctx.service.changeApplyAudit.start(ctx.change.id, ctx.change.times);
@@ -3339,7 +3385,7 @@ module.exports = app => {
             try {
                 const auditConst = audit.changeApply;
                 if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
-                    throw '当前材料调差期数据有误';
+                    throw '当前变更申请数据有误';
                 }
                 if (ctx.change.curAuditorIds.length === 0 || ctx.change.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) === -1) {
                     throw '您无权进行该操作';
@@ -3816,6 +3862,9 @@ module.exports = app => {
                 // 获取用户人验证手机号
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const auth_mobile = pa.auth_mobile;
+                const userPermission = pa !== undefined && pa.permission !== ''
+                    ? JSON.parse(pa.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
                 const changeClass = await this._getOrUpdateClass(ctx, 'changePlan');
                 const renderData = {
                     tender,
@@ -3828,6 +3877,7 @@ module.exports = app => {
                     fileList,
                     whiteList,
                     authMobile: auth_mobile,
+                    deleteFilePermission,
                     auditType,
                     shenpiConst,
                     tpUnit: ctx.change.decimal ? ctx.change.decimal.tp : ctx.tender.info.decimal.tp,
@@ -4130,10 +4180,10 @@ module.exports = app => {
                     throw '数据错误';
                 }
                 if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
-                    throw '您无权上报该数据';
+                    throw '您无权上报该变更方案数据';
                 }
                 if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
-                    throw '该材料调差期数据当前无法上报';
+                    throw '该变更方案数据当前无法上报';
                 }
 
                 await ctx.service.changePlanAudit.start(ctx.change.id, ctx.change.times);

+ 1 - 1
app/public/js/change_apply_information.js

@@ -71,7 +71,7 @@ $(document).ready(() => {
                 //     curAuditor.audit_id === cur_uid && (showDel = true)
                 // }
                 if (change.status === auditConst.status.checked) {
-                    showDel = Boolean(file.extra_upload )
+                    showDel = Boolean(file.extra_upload ) || deleteFilePermission
                 } else {
                     showDel = true
                 }

+ 1 - 1
app/public/js/change_apply_information_notice.js

@@ -40,7 +40,7 @@ $(document).ready(() => {
                 //     curAuditor.audit_id === cur_uid && (showDel = true)
                 // }
                 if (change.status === auditConst.status.checked) {
-                    showDel = Boolean(file.extra_upload )
+                    showDel = Boolean(file.extra_upload ) || deleteFilePermission
                 } else {
                     showDel = true
                 }

+ 1 - 1
app/public/js/change_plan_information.js

@@ -65,7 +65,7 @@ $(document).ready(() => {
                 //     curAuditor.audit_id === cur_uid && (showDel = true)
                 // }
                 if (change.status === auditConst.status.checked) {
-                    showDel = Boolean(file.extra_upload )
+                    showDel = Boolean(file.extra_upload ) || deleteFilePermission
                 } else {
                     showDel = true
                 }

+ 1 - 1
app/public/js/change_project_information.js

@@ -65,7 +65,7 @@ $(document).ready(() => {
                 //     curAuditor.audit_id === cur_uid && (showDel = true)
                 // }
                 if (change.status === auditConst.status.checked) {
-                    showDel = Boolean(file.extra_upload )
+                    showDel = Boolean(file.extra_upload ) || deleteFilePermission
                 } else {
                     showDel = true
                 }

+ 1 - 0
app/router.js

@@ -555,6 +555,7 @@ module.exports = app => {
 
     // 变更令 - 新版本
     app.get('/tender/:id/change/:cid/information', sessionAuth, tenderCheck, uncheckTenderCheck, changeCheck, changeAuditCheck, 'changeController.information');
+    app.get('/tender/:id/change/:cid/relation', sessionAuth, tenderCheck, uncheckTenderCheck, changeCheck, 'changeController.relation');
     app.post('/tender/:id/change/:cid/information/save', sessionAuth, tenderCheck, uncheckTenderCheck, changeCheck, 'changeController.saveListsData');
     app.post('/tender/:id/change/:cid/information/audit/start', sessionAuth, tenderCheck, uncheckTenderCheck, changeCheck, changeAuditCheck, 'changeController.startAudit');
     app.post('/tender/:id/change/:cid/information/file/upload', sessionAuth, 'changeController.uploadFile');

+ 1 - 1
app/view/change/apply.ejs

@@ -78,7 +78,7 @@
                     <% for (const c of changes) { %>
                         <tr><td><a href="/tender/<%- tender.id %>/change/apply/<%- c.id %>/information"><%- c.code %></a></td><td><%- c.name %></td>
                             <td style="text-align: right"><%- c.total_price %></td>
-                            <td><%- c.project_code %></td>
+                            <td><% if (c.project_code) { %><% if (ctx.helper._.find(changeProjectList, { code: c.project_code })) { %><a href="/tender/<%- tender.id %>/change/project/<%- ctx.helper._.find(changeProjectList, { code: c.project_code }).id %>/information" target="_blank"><%- c.project_code %></a><% } else { %><%- c.project_code %><% } %><% } %></td>
                             <td><% if (c.notice_code) { %><a href="/tender/<%- tender.id %>/change/apply/<%- c.id %>/information/notice"><%- c.notice_code %></a><% } %></td>
                             <td><%- c.account_name %></td>
                             <td class="text-center">

+ 1 - 0
app/view/change/apply_information.ejs

@@ -199,6 +199,7 @@
     const fileTypeConst = JSON.parse(unescape('<%- escape(JSON.stringify(changeConst.file_type)) %>'));
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
+    const deleteFilePermission = <%- deleteFilePermission %>;
     const preUrl = '<%- preUrl %>';
     const change = JSON.parse(unescape('<%- escape(JSON.stringify(change)) %>'));
     let listRule = JSON.parse(unescape('<%- escape(JSON.stringify(listRule)) %>'));

+ 1 - 0
app/view/change/apply_information_notice.ejs

@@ -86,6 +86,7 @@
     const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
     const fileTypeConst = JSON.parse(unescape('<%- escape(JSON.stringify(changeConst.file_type)) %>'));
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
+    const deleteFilePermission = <%- deleteFilePermission %>;
     const preUrl = '<%- preUrl %>';
     const change = JSON.parse(unescape('<%- escape(JSON.stringify(change)) %>'));
 </script>

+ 1 - 0
app/view/change/information.ejs

@@ -9,6 +9,7 @@
                         <div class="btn-group btn-group-toggle group-tab">
                             <a class="btn btn-sm btn-light active" href="javascript:void(0);">变更详情</a>
                             <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/report">输出报表</a>
+                            <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/relation">关联数据</a>
                         </div>
                     </div>
                 </div>

+ 1 - 1
app/view/change/plan.ejs

@@ -79,7 +79,7 @@
                         <tr><td><a href="/tender/<%- tender.id %>/change/plan/<%- c.id %>/information"><%- c.code %></a></td><td><%- c.name %></td>
                             <td><%- c.quality %></td>
                             <td style="text-align: right"><%- c.total_price %></td>
-                            <td><%- c.apply_code %></td>
+                            <td><% if (c.apply_code) { %><% if (ctx.helper._.find(changeApplyList, { code: c.apply_code })) { %><a href="/tender/<%- tender.id %>/change/apply/<%- ctx.helper._.find(changeApplyList, { code: c.apply_code }).id %>/information" target="_blank"><%- c.apply_code %></a><% } else { %><%- c.apply_code %><% } %><% } %></td>
                             <td class="text-center">
                                 <% if (c.status === auditConst.status.uncheck && c.uid === ctx.session.sessionUser.accountId) { %>
                                     <a href="/tender/<%- tender.id %>/change/plan/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>

+ 1 - 0
app/view/change/plan_information.ejs

@@ -196,6 +196,7 @@
     const fileTypeConst = JSON.parse(unescape('<%- escape(JSON.stringify(changeConst.file_type)) %>'));
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
+    const deleteFilePermission = <%- deleteFilePermission %>;
     const preUrl = '<%- preUrl %>';
     const change = JSON.parse(unescape('<%- escape(JSON.stringify(change)) %>'));
     let listRule = JSON.parse(unescape('<%- escape(JSON.stringify(listRule)) %>'));

+ 1 - 0
app/view/change/project_information.ejs

@@ -169,6 +169,7 @@
     const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
+    const deleteFilePermission = <%- deleteFilePermission %>;
     const preUrl = '<%- preUrl %>';
     const change = JSON.parse(unescape('<%- escape(JSON.stringify(change)) %>'));
 </script>

+ 63 - 0
app/view/change/relation.ejs

@@ -0,0 +1,63 @@
+<% include ../tender/tender_sub_menu.ejs %>
+<div class="panel-content">
+    <div class="panel-title"><!--收起详解目录添加类名 fluid -->
+        <div class="title-main d-flex"><!--工具-->
+            <% include ../tender/tender_sub_mini_menu.ejs %>
+            <div>
+                <div class="d-inline-block">
+                    <div class="btn-group btn-group-toggle group-tab">
+                        <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/information">申请详情</a>
+                        <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/report">输出报表</a>
+                        <a class="btn btn-sm btn-light active" href="javascript:void(0);">关联数据</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="content-wrap">
+        <div class="c-body">
+            <div class="sjs-height-0">
+                <table class="table table-bordered">
+                    <thead>
+                    <tr class="text-center">
+                        <th>变更类型</th>
+                        <th>编号</th>
+                        <th>变更工程名称</th>
+                        <th>操作</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tbody>
+                    <% if (ctx.session.sessionProject.page_show.openChangeProject) { %>
+                    <tr>
+                        <td class="text-center">变更立项</td>
+                        <td><% if (changeProjectInfo) { %><%- changeProjectInfo.code %><% } %></td>
+                        <td><% if (changeProjectInfo) { %><%- changeProjectInfo.name %><% } %></td>
+                        <td class="text-center"><% if (changeProjectInfo) { %><a target="_blank" href="/tender/<%- tender.id %>/change/project/<%- changeProjectInfo.id %>/information">查看详情</a><% } %></td>
+                    </tr>
+                    <% } %>
+                    <% if (ctx.session.sessionProject.page_show.openChangeApply) { %>
+                    <tr>
+                        <td class="text-center">变更申请</td>
+                        <td><% if (changeApplyInfo) { %><%- changeApplyInfo.code %><% } %></td>
+                        <td><% if (changeApplyInfo) { %><%- changeApplyInfo.name %><% } %></td>
+                        <td class="text-center"><% if (changeApplyInfo) { %><a target="_blank" href="/tender/<%- tender.id %>/change/apply/<%- changeApplyInfo.id %>/information">查看详情</a><% } %></td>
+                    </tr>
+                    <% } %>
+                    <% if (ctx.session.sessionProject.page_show.openChangePlan) { %>
+                    <tr>
+                        <td class="text-center">变更方案</td>
+                        <td><% if (changePlanInfo) { %><%- changePlanInfo.code %><% } %></td>
+                        <td><% if (changePlanInfo) { %><%- changePlanInfo.name %><% } %></td>
+                        <td class="text-center"><% if (changePlanInfo) { %><a target="_blank" href="/tender/<%- tender.id %>/change/plan/<%- changePlanInfo.id %>/information">查看详情</a><% } %></td>
+                    </tr>
+                    <% } %>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    autoFlashHeight();
+</script>

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

@@ -9,6 +9,7 @@
                         <div class="btn-group btn-group-toggle group-tab">
                             <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/information">变更详情</a>
                             <a class="btn btn-sm btn-light active" href="javascript:void(0);">输出报表</a>
+                            <a class="btn btn-sm btn-light" href="/tender/<%- ctx.tender.id %>/change/<%- ctx.change.cid %>/relation">关联数据</a>
                         </div>
                     </div>
                 </div>

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

@@ -95,6 +95,9 @@
                     <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/apply/<%- bizId %>/information">申请详情</a>
                     <% } %>
                     <a class="btn btn-sm btn-light active" href="javascript:void(0);">输出报表</a>
+                    <% if ([-300].includes(stg_id)) { %>
+                    <a class="btn btn-sm btn-light" href="/tender/<%- tender_id %>/change/<%- bizId %>/relation">关联数据</a>
+                    <% } %>
                 </div>
                 <% } %>
                 <% if (false || ![-100, -200, -300, -301, -302, -303].includes(stg_id)) { %>