Bladeren bron

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 1 jaar geleden
bovenliggende
commit
7c5394f0bb

+ 20 - 16
app/middleware/change_apply_audit_check.js

@@ -47,24 +47,28 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changeApply.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
-                    // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
-                    let sameAudit = auditList.length === shenpiList.length;
-                    if (sameAudit) {
-                        for (const audit of auditList) {
-                            const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
-                            if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
-                                sameAudit = false;
-                                break;
+                    if (change.sp_group === 0) {
+                        this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
+                    } else {
+                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                        // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
+                        let sameAudit = auditList.length === shenpiList.length;
+                        if (sameAudit) {
+                            for (const audit of auditList) {
+                                const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
+                                if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
+                                    sameAudit = false;
+                                    break;
+                                }
                             }
                         }
-                    }
-                    if (!sameAudit) {
-                        yield this.service.changeApplyAudit.updateNewAuditList(change, shenpiList);
-                        yield this.service.changeApply.loadChangeUser(change);
-                        yield this.service.changeApply.doCheckChangeCanCancel(change);
+                        if (!sameAudit) {
+                            yield this.service.changeApplyAudit.updateNewAuditList(change, shenpiList);
+                            yield this.service.changeApply.loadChangeUser(change);
+                            yield this.service.changeApply.doCheckChangeCanCancel(change);
+                        }
                     }
                 } else if (shenpi_status === shenpiConst.sp_status.gdzs) {
                     const shenpiInfo = yield this.service.shenpiAudit.getDataByCondition({ tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status });

+ 20 - 16
app/middleware/change_audit_check.js

@@ -49,24 +49,28 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.change.defaultUpdate({ sp_group: change.sp_group }, { where: { cid: change.cid } });
                     }
-                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition });
-                    // const shenpiIdList = _.map(shenpiList, 'audit_id');
-                    // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
-                    let sameAudit = auditList.length === shenpiList.length;
-                    if (sameAudit) {
-                        for (const audit of auditList) {
-                            const shenpi = shenpiList.find(x => { return x.audit_id === audit.uid; });
-                            if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
-                                sameAudit = false;
-                                break;
+                    if (change.sp_group === 0) {
+                        this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
+                    } else {
+                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition });
+                        // const shenpiIdList = _.map(shenpiList, 'audit_id');
+                        // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
+                        let sameAudit = auditList.length === shenpiList.length;
+                        if (sameAudit) {
+                            for (const audit of auditList) {
+                                const shenpi = shenpiList.find(x => { return x.audit_id === audit.uid; });
+                                if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
+                                    sameAudit = false;
+                                    break;
+                                }
                             }
                         }
-                    }
-                    if (!sameAudit) {
-                        yield this.service.changeAudit.updateNewAuditList(change, shenpiList);
-                        yield this.service.change.loadChangeUser(change);
-                        yield this.service.change.doCheckChangeCanCancel(change);
+                        if (!sameAudit) {
+                            yield this.service.changeAudit.updateNewAuditList(change, shenpiList);
+                            yield this.service.change.loadChangeUser(change);
+                            yield this.service.change.doCheckChangeCanCancel(change);
+                        }
                     }
                 } else if (shenpi_status === shenpiConst.sp_status.gdzs) {
                     const shenpiInfo = yield this.service.shenpiAudit.getDataByCondition({ tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status });

+ 20 - 16
app/middleware/change_plan_audit_check.js

@@ -47,24 +47,28 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changePlan.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
-                    // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
-                    let sameAudit = auditList.length === shenpiList.length;
-                    if (sameAudit) {
-                        for (const audit of auditList) {
-                            const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
-                            if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
-                                sameAudit = false;
-                                break;
+                    if (change.sp_group === 0) {
+                        this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
+                    } else {
+                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                        // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
+                        let sameAudit = auditList.length === shenpiList.length;
+                        if (sameAudit) {
+                            for (const audit of auditList) {
+                                const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
+                                if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
+                                    sameAudit = false;
+                                    break;
+                                }
                             }
                         }
-                    }
-                    if (!sameAudit) {
-                        yield this.service.changePlanAudit.updateNewAuditList(change, shenpiList);
-                        yield this.service.changePlan.loadChangeUser(change);
-                        yield this.service.changePlan.doCheckChangeCanCancel(change);
+                        if (!sameAudit) {
+                            yield this.service.changePlanAudit.updateNewAuditList(change, shenpiList);
+                            yield this.service.changePlan.loadChangeUser(change);
+                            yield this.service.changePlan.doCheckChangeCanCancel(change);
+                        }
                     }
                 } else if (shenpi_status === shenpiConst.sp_status.gdzs) {
                     const shenpiInfo = yield this.service.shenpiAudit.getDataByCondition({ tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status });

+ 22 - 16
app/middleware/change_project_audit_check.js

@@ -47,24 +47,30 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changeProject.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
-                    // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
-                    let sameAudit = auditList.length === shenpiList.length;
-                    if (sameAudit) {
-                        for (const audit of auditList) {
-                            const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
-                            if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
-                                sameAudit = false;
-                                break;
+                    if (change.sp_group === 0) {
+                        this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
+                    } else {
+                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                        // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
+                        let sameAudit = auditList.length === shenpiList.length;
+                        if (sameAudit) {
+                            for (const audit of auditList) {
+                                const shenpi = shenpiList.find(x => {
+                                    return x.audit_id === audit.aid;
+                                });
+                                if (!shenpi || shenpi.audit_order !== audit.audit_order || shenpi.audit_type !== audit.audit_type) {
+                                    sameAudit = false;
+                                    break;
+                                }
                             }
                         }
-                    }
-                    if (!sameAudit) {
-                        yield this.service.changeProjectAudit.updateNewAuditList(change, shenpiList);
-                        yield this.service.changeProject.loadChangeUser(change);
-                        yield this.service.changeProject.doCheckChangeCanCancel(change);
+                        if (!sameAudit) {
+                            yield this.service.changeProjectAudit.updateNewAuditList(change, shenpiList);
+                            yield this.service.changeProject.loadChangeUser(change);
+                            yield this.service.changeProject.doCheckChangeCanCancel(change);
+                        }
                     }
                 } else if (shenpi_status === shenpiConst.sp_status.gdzs) {
                     const shenpiInfo = yield this.service.shenpiAudit.getDataByCondition({ tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status });

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

@@ -82,13 +82,13 @@
                             <td><%- 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/project/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
+                                    <a href="/tender/<%- tender.id %>/change/plan/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
                                 <% } else if ((c.status === auditConst.status.checkNo || c.status === auditConst.status.revise) && c.curAuditors && c.aid === ctx.session.sessionUser.accountId) { %>
-                                    <a href="/tender/<%- tender.id %>/change/project/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
+                                    <a href="/tender/<%- tender.id %>/change/plan/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
                                 <% } else if (c.status === auditConst.status.checking && c.curAuditors && c.curAuditors.findIndex(x => { return x.aid === ctx.session.sessionUser.accountId; }) >= 0) { %>
                                     <% const curAudit = c.curAuditors.find(x => { return x.aid === ctx.session.sessionUser.accountId; }); %>
                                     <% if (curAudit.status === auditConst.status.checking) { %>
-                                        <a href="/tender/<%- tender.id %>/change/project/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
+                                        <a href="/tender/<%- tender.id %>/change/plan/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>
                                     <% } else { %>
                                         <span class="<%- auditConst.auditStringClass[curAudit.status] %>"><%- auditConst.auditString[curAudit.status] %></span>
                                     <% } %>