|
@@ -840,34 +840,35 @@ module.exports = app => {
|
|
|
* @param {int} order_by - 表单提交的数据
|
|
|
* @return {void}
|
|
|
*/
|
|
|
- async saveOrderBy(order_by, newLedgerList = []) {
|
|
|
+ async saveOrderBy(order_by) {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
let result = [];
|
|
|
try {
|
|
|
const postData = { order_by };
|
|
|
- let changeList = await this.ctx.service.changeAuditList.getList(this.ctx.change.cid);
|
|
|
- if (order_by) {
|
|
|
- let i = 1;
|
|
|
- const updateArray = [];
|
|
|
- for (const cl of changeList) {
|
|
|
- updateArray.push({
|
|
|
- id: cl.id,
|
|
|
- order: i,
|
|
|
- });
|
|
|
- cl.order = i;
|
|
|
- i++;
|
|
|
- }
|
|
|
- if (updateArray.length > 0) await transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateArray);
|
|
|
- } else {
|
|
|
- await this.ctx.service.changeAuditList.saveLedgerListDatas(newLedgerList, null, order_by);
|
|
|
- changeList = await this.ctx.service.changeAuditList.getList(this.ctx.change.cid, order_by);
|
|
|
- }
|
|
|
+ // let changeList = await this.ctx.service.changeAuditList.getList(this.ctx.change.cid);
|
|
|
+ // if (order_by) {
|
|
|
+ // let i = 1;
|
|
|
+ // const updateArray = [];
|
|
|
+ // for (const cl of changeList) {
|
|
|
+ // updateArray.push({
|
|
|
+ // id: cl.id,
|
|
|
+ // order: i,
|
|
|
+ // });
|
|
|
+ // cl.order = i;
|
|
|
+ // i++;
|
|
|
+ // }
|
|
|
+ // if (updateArray.length > 0) await transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateArray);
|
|
|
+ // } else {
|
|
|
+ // // await this.ctx.service.changeAuditList.saveLedgerListDatas(newLedgerList, null, order_by);
|
|
|
+ // changeList = await this.ctx.service.changeAuditList.getList(this.ctx.change.cid);
|
|
|
+ // }
|
|
|
const options = {
|
|
|
where: {
|
|
|
cid: this.ctx.change.cid,
|
|
|
},
|
|
|
};
|
|
|
await transaction.update(this.tableName, postData, options);
|
|
|
+ const changeList = await this.ctx.service.changeAuditList.getList(this.ctx.change.cid, order_by);
|
|
|
await transaction.commit();
|
|
|
result = { changeList,
|
|
|
usedList: await this.ctx.service.stageChange.getAllFinalUsedData(this.ctx.tender.id, this.ctx.change.cid) };
|