|
|
@@ -32,6 +32,12 @@ module.exports = app => {
|
|
|
// 判断t_type是否为费用,且存在quantity,m_spread值
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
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表里
|
|
|
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 } });
|