Browse Source

1. 删除项目相关
2. 标段列表查看调整

MaiXinRong 3 months ago
parent
commit
439a94913e

+ 5 - 0
app/controller/sub_proj_controller.js

@@ -29,6 +29,11 @@ module.exports = app => {
                 };
                 renderData.budgetStd = await ctx.service.budgetStd.getDataByProjectId(ctx.session.sessionProject.id);
                 renderData.projectList = await ctx.service.subProject.getSubProject(ctx.session.sessionProject.id, ctx.session.sessionUser.accountId, ctx.session.sessionUser.is_admin);
+                for (const p of renderData.projectList) {
+                    p.tender_count = await ctx.service.tender.count({ spid: p.id });
+                    p.contract_count = await ctx.service.contract.count({ spid: p.id });
+                    p.file_count = await ctx.service.file.count({ spid: p.id, is_deleted: 0 });
+                }
                 renderData.tenderList = await ctx.service.tender.getManageTenderList(ctx.session.sessionProject.id);
                 const accountList = await ctx.service.projectAccount.getAllDataByCondition({
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],

+ 1 - 1
app/middleware/budget_check.js

@@ -25,7 +25,7 @@ module.exports = options => {
             // 读取标段数据
             this.budget = yield this.service.budget.getCurBudget(this.subProject.budget_id);
             this.budget.name = this.subProject.name || '';
-            if (!this.budget) throw '项目不存在';
+            if (!this.budget) throw '未设置概预算标准';
             if (this.budget.pid !== this.session.sessionProject.id) throw '您无权查看该项目';
 
             if (this.session.sessionUser.is_admin) {

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

@@ -149,7 +149,7 @@ function recursiveGetTenderNodeHtml2 (node, arr, pid, this_code, this_status, ai
             if(auditList) {
                 for (const uid of auditList) {
                     const user = _.find(accountList, { id: uid });
-                    nameList.push(user.name);
+                    if (user) nameList.push(user.name);
                 }
             }
             // html.push('<i class="fa fa-question-circle text-primary" data-container="body" data-toggle="tooltip" data-placement="bottom" ' +

+ 6 - 1
app/public/js/sub_project.js

@@ -58,7 +58,12 @@ $(document).ready(function() {
                 html.push(`<td>`);
                 if (canEdit) {
                     html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="edit">编辑</button>');
-                    html.push('<button class="btn btn-outline-danger btn-sm ml-1" name="del">删除</button>');
+                    const delHint = node.tender_count > 0 ? '请先删除所有标段' : (node.contract_count > 0 ? '请先删除所有合同' : (node.file_count > 0 ? '请先删除所有资料归集文件' : ''));
+                    if (delHint) {
+                        html.push(`<button class="btn btn-outline-secondary btn-sm ml-1" data-toggle="tooltip" data-placement="top" data-original-title="${delHint}" name="del">删除</button>`);
+                    } else {
+                        html.push('<button class="btn btn-outline-danger btn-sm ml-1" name="del">删除</button>');
+                    }
                     html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="up"><i class="fa fa-arrow-up"></i></button>');
                     html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="down"><i class="fa fa-arrow-down"></i></button>');
                     html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="top">顶层</button>');

+ 4 - 2
app/service/budget.js

@@ -76,8 +76,10 @@ module.exports = app => {
 
         async getCurBudget(id) {
             const result = await this.getDataById(id);
-            result.decimal = result.decimal ? JSON.parse(result.decimal) : {};
-            this.ctx.helper._.defaults(result.decimal, defaultDecimal);
+            if (result) {
+                result.decimal = result.decimal ? JSON.parse(result.decimal) : {};
+                this.ctx.helper._.defaults(result.decimal, defaultDecimal);
+            }
             return result;
         }
 

+ 4 - 0
app/service/tender.js

@@ -145,6 +145,9 @@ module.exports = app => {
                     // 参与审批 结算期 的标段
                     '    OR (t.`ledger_status` = ' + auditConst.ledger.status.checked + ' AND ' +
                     '        t.id IN ( SELECT sa.`tid` FROM ?? As sa WHERE sa.`audit_id` = ? GROUP BY sa.`tid`))' +
+                    // 参与审批 合同支付期 的标段
+                    '    OR (t.`ledger_status` = ' + auditConst.ledger.status.checked + ' AND ' +
+                    '        t.id IN ( SELECT sa.`tid` FROM ?? As sa WHERE sa.`audit_id` = ? GROUP BY sa.`tid`))' +
                     // 参与审批 变更令 的标段
                     '    OR (t.`ledger_status` = ' + auditConst.ledger.status.checked + ' AND ' +
                     '        t.id IN ( SELECT ca.`tid` FROM ?? AS ca WHERE ca.`uid` = ? GROUP BY ca.`tid`))' +
@@ -167,6 +170,7 @@ module.exports = app => {
                     this.ctx.service.stageAudit.tableName, session.sessionUser.accountId,
                     this.ctx.service.auditAss.tableName, session.sessionUser.accountId,
                     this.ctx.service.settleAudit.tableName, session.sessionUser.accountId,
+                    this.ctx.service.phasePayAudit.tableName, session.sessionUser.accountId,
                     this.ctx.service.changeAudit.tableName, session.sessionUser.accountId,
                     this.ctx.service.reviseAudit.tableName, session.sessionUser.accountId,
                     this.ctx.service.materialAudit.tableName, session.sessionUser.accountId,

+ 2 - 2
app/view/sub_proj/modal.ejs

@@ -54,10 +54,10 @@
     <div class="modal-dialog" role="document">
         <div class="modal-content">
             <div class="modal-header">
-                <h5 class="modal-title">确认删除标段</h5>
+                <h5 class="modal-title">确认删除项目</h5>
             </div>
             <div class="modal-body">
-                <h5>删除后,数据无法恢复,请谨慎操作。</h5>
+                <h5>删除后,项目概况、动态投资等数据无法恢复,请谨慎操作。</h5>
                 <h5 id="del-hint">确定删除「<strong style="word-break: break-word;" id="del-tender-name"></strong>」?</h5>
             </div>
             <div class="modal-footer">