|
@@ -1336,17 +1336,22 @@
|
|
|
]],
|
|
|
done: function (res, curr, count) {
|
|
|
that.mergeCells();
|
|
|
- that.setValueClass(['total_amounts', 'total_invoiced', 'estimated_invoice_amount', 'estimated_invoice_amount_total', 'invoice_remaining_amount', 'invoice_needed_amount']);
|
|
|
that.setRole();
|
|
|
+ that.setEditCell();
|
|
|
+ that.updateTable();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ updateTable() {
|
|
|
+ this.setValueClass(['total_amounts', 'total_invoiced', 'estimated_invoice_amount', 'estimated_invoice_amount_total', 'invoice_remaining_amount', 'invoice_needed_amount']);
|
|
|
+ }
|
|
|
+
|
|
|
mergeCells() {
|
|
|
const tbRoot = $('#' + this.tableId);
|
|
|
const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
|
|
|
- const mergeColumns = ['estimated_invoice_amount_total'];
|
|
|
+ const mergeColumns = ['estimated_invoice_amount_total', 'invoice_remaining_amount'];
|
|
|
for (let col of mergeColumns) {
|
|
|
trs.eq(0).find('td[data-field="' + col + '"]').attr('rowspan', this.lines);
|
|
|
for (let j = 1; j < this.lines; j++) {
|
|
@@ -1356,6 +1361,7 @@
|
|
|
}
|
|
|
|
|
|
setEditCell() {
|
|
|
+ const that = this;
|
|
|
const tbRoot = $('#' + this.tableId);
|
|
|
const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
trs.each(function (i, tr) {
|
|
@@ -1386,12 +1392,38 @@
|
|
|
const index = $(this).parent().parent().data('index');
|
|
|
await that.saveEdit(index);
|
|
|
|
|
|
- updateTable();
|
|
|
+ that.updateTable();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ async saveEdit(index) {
|
|
|
+ const summaryData = dataHelper.getSummaryList();
|
|
|
+ if (index >= summaryData.length) {
|
|
|
+ console.error('主体数据错误:编辑索引大于主体总数');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
|
+ const total_invoiced = tr.find('td[data-field="total_invoiced"]').find('div').text().trim();
|
|
|
+ const month_opened = tr.find('td[data-field="month_opened"]').find('div').text().trim();
|
|
|
+ const last_invoice_date = tr.find('td[data-field="last_invoice_date"]').find('div').find('input').val().trim();
|
|
|
+ const remark = tr.find('td[data-field="remark"]').find('div').text().trim();
|
|
|
+
|
|
|
+ let item = channelData[index];
|
|
|
+ item.total_invoiced = total_invoiced || "0";
|
|
|
+ item.month_opened = month_opened || "0";
|
|
|
+ item.last_invoice_date = last_invoice_date || "0";
|
|
|
+ item.remark = remark;
|
|
|
+
|
|
|
+ await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_CHANNEL, item, 2);
|
|
|
+
|
|
|
+ setTimeout(function () {
|
|
|
+ summaryTable.renderTable();
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+
|
|
|
channelTableData() {
|
|
|
const data = [];
|
|
|
|