Jelajahi Sumber

指数法调差节点移除问题

ellisran 1 bulan lalu
induk
melakukan
6ac0fad9f7

+ 3 - 3
app/public/js/material_exponent.js

@@ -1004,9 +1004,9 @@ $(document).ready(() => {
                 ex_tax_tp: ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : 0,
                 ex_tax_tp: ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : 0,
             }];
             }];
             for (const ms of materialStageData) {
             for (const ms of materialStageData) {
-                if (!exponent_nodes) {
-                    $('.ex_expr_' + ms.order).attr('data-original-title', '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : ''));
-                }
+                // if (!exponent_nodes) {
+                //     $('.ex_expr_' + ms.order).attr('data-original-title', '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : ''));
+                // }
                 // $('#tj_stage_' + ms.order).children('td').eq(1).text(ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : '');
                 // $('#tj_stage_' + ms.order).children('td').eq(1).text(ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : '');
                 // $('#tj_stage_' + ms.order).children('td').eq(2).text(ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : '');
                 // $('#tj_stage_' + ms.order).children('td').eq(2).text(ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : '');
                 stage_datas.push({
                 stage_datas.push({

+ 6 - 0
app/service/material_exponent_node.js

@@ -32,6 +32,12 @@ module.exports = app => {
             // 判断t_type是否为费用,且存在quantity,m_spread值
             // 判断t_type是否为费用,且存在quantity,m_spread值
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
+                if (data.remove_node && data.remove_node.length > 0 && this.ctx.material.pre_exponent_node) {
+                    // 移除pre_exponent_node值
+                    const newPreExponentNode = this.ctx.material.pre_exponent_node ? this.ctx.material.pre_exponent_node.split(',').filter(item => !data.remove_node.includes(item)).join(',') : '';
+                    await transaction.update(this.ctx.service.material.tableName, { id: this.ctx.material.id, pre_exponent_node: newPreExponentNode });
+                    this.ctx.material.pre_exponent_node = newPreExponentNode;
+                }
                 // 清空nodes并把总金额插回到exponent_stage或者material表里
                 // 清空nodes并把总金额插回到exponent_stage或者material表里
                 if (data.exponent_node.length === 0 && this.ctx.material.pre_exponent_node) throw '上期存在已调用分项,无法清空';
                 if (data.exponent_node.length === 0 && this.ctx.material.pre_exponent_node) throw '上期存在已调用分项,无法清空';
                 const exponentList = await transaction.select(this.ctx.service.materialExponent.tableName, { where: { tid: this.ctx.tender.id } });
                 const exponentList = await transaction.select(this.ctx.service.materialExponent.tableName, { where: { tid: this.ctx.tender.id } });