|
|
@@ -760,7 +760,7 @@
|
|
|
},
|
|
|
methods: {
|
|
|
//从发票管理新增发票初始化
|
|
|
- async init(row = {}, type) {
|
|
|
+ async init(row = {}, type, splitData = null) {
|
|
|
// 重置冲红标记,避免上次编辑状态污染本次
|
|
|
this.ifRedReversalInvoice = 0;
|
|
|
this.businessId = type == 'reissue' ? '' : row.id || '';
|
|
|
@@ -793,7 +793,8 @@
|
|
|
// 开发票:根据总单ID拉取拆分初始化数据,预填到表单上
|
|
|
if (type == 'reissue' && row.id) {
|
|
|
try {
|
|
|
- const data = await splitInitAPI(row.id);
|
|
|
+ // 优先使用调用方传入的 splitData(handleReissue 已检查过接口),避免重复调用
|
|
|
+ const data = splitData ?? (await splitInitAPI(row.id));
|
|
|
data.type = Number(data.type);
|
|
|
Object.keys(data || {}).forEach((k) => {
|
|
|
this.$set(this.form, k, data[k]);
|
|
|
@@ -807,6 +808,7 @@
|
|
|
});
|
|
|
} catch (e) {
|
|
|
console.error('splitInit failed:', e);
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -815,6 +817,7 @@
|
|
|
this.$nextTick(async () => {
|
|
|
// await this.getUser List(this.form.applyDeptId);
|
|
|
});
|
|
|
+ return true;
|
|
|
},
|
|
|
updateInvoiceAmount(row) {
|
|
|
// row.invoiceAmount = Number(row.invoiceAmount).toFixed(2);
|