|
@@ -128,7 +128,7 @@ module.exports = app => {
|
|
|
* 添加台账清单(从新增部位页新增)
|
|
|
* @return {void}
|
|
|
*/
|
|
|
- async adds(datas, data = null) {
|
|
|
+ async adds(datas) {
|
|
|
if (!this.ctx.tender || !this.ctx.change) {
|
|
|
throw '数据错误';
|
|
|
}
|
|
@@ -136,8 +136,9 @@ module.exports = app => {
|
|
|
try {
|
|
|
let order = null;
|
|
|
if (this.ctx.change.order_by) {
|
|
|
+ const data = this.ctx.change.order_site ? await this.getDataById(this.ctx.change.order_site) : null;
|
|
|
if (data) {
|
|
|
- order = parseInt(data) + 1;
|
|
|
+ order = parseInt(data.order) + 1;
|
|
|
// order以下的清单+1
|
|
|
await this._syncOrder(transaction, this.ctx.change.cid, order, '+');
|
|
|
} else {
|
|
@@ -286,7 +287,8 @@ module.exports = app => {
|
|
|
await transaction.delete(this.tableName, { id: data.ids });
|
|
|
// // order以下的清单-1
|
|
|
if (this.ctx.change.order_by) {
|
|
|
- await this._syncOrder(transaction, this.ctx.change.cid, data.postData, '-', data.ids.length);
|
|
|
+ const postData = this.ctx.change.order_site ? await this.getDataById(this.ctx.change.order_site) : null;
|
|
|
+ await this._syncOrder(transaction, this.ctx.change.cid, (postData ? postData.order : null), '-', data.ids.length);
|
|
|
}
|
|
|
// 重新算变更令总额
|
|
|
await this.calcCamountSum(transaction);
|