Kaynağa Gözat

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

Tony Kang 1 hafta önce
ebeveyn
işleme
5a08cd1799

+ 1 - 1
app/controller/dashboard_controller.js

@@ -306,7 +306,7 @@ module.exports = app => {
                             if (!sp.page_show.safePayment) closeType = true;
                             calcTime = t.create_time;
                             break;
-                        case 'safeStage':
+                        case 'phasePay':
                             if (!sp.page_show.phasePay) closeType = true;
                             calcTime = t.create_time;
                             break;

+ 1 - 1
app/controller/pay_controller.js

@@ -170,7 +170,7 @@ module.exports = app => {
                     lockPayExpr: projectFunInfo.lockPayExpr,
                     auditConst: audit.common,
                     deadlineType: this.ctx.service.phasePayDetail.deadlineType,
-                    maxStageOrder: lastStage.order,
+                    maxStageOrder: lastStage ? lastStage.order : 0,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.phasePay.detail),
                     accountList,
                     accountGroup,

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

@@ -465,7 +465,7 @@ $(document).ready(() => {
                 $(`dd[templateId=${id}]`).remove();
                 const tIndex = templates.findIndex(x => { return x.id === id; });
                 templates.splice(tIndex, 1);
-                if (curTemplate.id === id) {
+                if (curTemplate && curTemplate.id === id) {
                     curTemplate = null;
                     refreshTemplate();
                 }

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

@@ -343,7 +343,7 @@ $(document).ready(() => {
                 $(`dd[templateId=${id}]`).remove();
                 const tIndex = templates.findIndex(x => { return x.id === id; });
                 templates.splice(tIndex, 1);
-                if (curTemplate.id === id) {
+                if (curTemplate && curTemplate.id === id) {
                     curTemplate = null;
                     refreshTemplate();
                 }

+ 3 - 2
app/service/calc_tmpl.js

@@ -312,7 +312,6 @@ module.exports = app => {
             const templates = template instanceof Array ? template : [template];
             templates.forEach(x => { x.used = []; x.used_count = 0; });
             const tender = await this.ctx.service.tender.getAllDataByCondition({ columns: ['id'], where: { project_id: templates[0].pid }});
-            console.log(tender.length);
             for (const t of tender) {
                 const used = await this.ctx.service.ledgerExtra.getUsedCalcTemplate(t.id);
                 templates.forEach(x => {
@@ -364,7 +363,9 @@ module.exports = app => {
             if (!template) throw '编辑的模板不存在';
             if (template.pid !== this.ctx.session.sessionProject.id) throw '模板不属于当前项目,请刷新后重试';
             if (template.create_user_id !== this.ctx.session.sessionUser.accountId) throw '非您创建的模板';
-            if (template.is_locked) throw '模板已被锁定,不可修改';
+            if (template.is_locked) throw '模板已被锁定';
+            await this.checkTemplateUsed(template, template.type);
+            if (template.used.length > 0) throw '模板已被使用';
             return template;
         }
         _getCalcLeaf(cur, cols, parentField) {