|
|
@@ -229,12 +229,12 @@ module.exports = app => {
|
|
|
const stage_list = await ctx.service.stage.getStageMsgByStageId(stage_id);
|
|
|
const calcBase = await ctx.service.stage.getMaterialCalcBase(stage_list, ctx.tender.info);
|
|
|
const old_ex_calc = ex_calc ? JSON.parse(ex_calc) : null;
|
|
|
- const new_ex_calc = materialConst.ex_calc;
|
|
|
+ const new_ex_calc = this._.cloneDeep(materialConst.ex_calc);
|
|
|
for (const bq of new_ex_calc) {
|
|
|
const calc = this._.find(calcBase, { code: bq.code }) || this._.find(calcBase, { code: 'bqwc' });
|
|
|
const oldcalc = old_ex_calc ? this._.find(old_ex_calc, { code: bq.code }) : null;
|
|
|
bq.value = calc.value;
|
|
|
- bq.select = oldcalc ? oldcalc.select : false;
|
|
|
+ bq.select = oldcalc ? oldcalc.select : bq.select;
|
|
|
}
|
|
|
await this.calcMaterialExTp(transaction, new_ex_calc, mid, msid, null, decimal, rate);
|
|
|
return new_ex_calc;
|
|
|
@@ -319,12 +319,12 @@ module.exports = app => {
|
|
|
old_ex_calc = JSON.parse(preMs.ex_calc);
|
|
|
}
|
|
|
}
|
|
|
- const new_ex_calc = materialConst.ex_calc;
|
|
|
+ const new_ex_calc = this._.cloneDeep(materialConst.ex_calc);
|
|
|
for (const bq of new_ex_calc) {
|
|
|
const calc = this._.find(calcBase, { code: bq.code }) || this._.find(calcBase, { code: 'bqwc' });
|
|
|
const oldcalc = old_ex_calc ? this._.find(old_ex_calc, { code: bq.code }) : null;
|
|
|
bq.value = calc.value;
|
|
|
- bq.select = oldcalc ? oldcalc.select : false;
|
|
|
+ bq.select = oldcalc ? oldcalc.select : bq.select;
|
|
|
}
|
|
|
await this.calcMaterialExTp(transaction, new_ex_calc, mid, ms.id, null, decimal, rate);
|
|
|
}
|