|
|
@@ -457,7 +457,8 @@
|
|
|
invoiceApplyInfoV2API,
|
|
|
invoiceApplyCreateAPI,
|
|
|
invoiceApplyUpdateV2API,
|
|
|
- initInvoiceByStatementId
|
|
|
+ initInvoiceByStatementId,
|
|
|
+ splitInitAPI
|
|
|
} from '@/api/financialManage/invoiceManage';
|
|
|
import { getpurchaseorderDetail } from '@/api/purchasingManage/purchaseOrder';
|
|
|
import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
|
|
|
@@ -756,11 +757,16 @@
|
|
|
methods: {
|
|
|
//从发票管理新增发票初始化
|
|
|
async init(row = {}, type) {
|
|
|
- this.businessId = row.id || '';
|
|
|
- this.title = type == 'add' ? '新增' : '修改';
|
|
|
+ this.businessId = type == 'reissue' ? '' : row.id || '';
|
|
|
+ this.title =
|
|
|
+ type == 'add'
|
|
|
+ ? '新增'
|
|
|
+ : type == 'reissue'
|
|
|
+ ? '开发票'
|
|
|
+ : '修改';
|
|
|
console.log('row', row, type);
|
|
|
this.dialogType = type;
|
|
|
- if (type == 'add') {
|
|
|
+ if (type == 'add' || type == 'reissue') {
|
|
|
this.form.applyDeptId = this.user.info.groupId;
|
|
|
this.form.applyDeptName = this.user.info.groupName;
|
|
|
this.form.applyUserId = this.user.info.userId;
|
|
|
@@ -773,6 +779,25 @@
|
|
|
this.enterprisePage.push(...res.list);
|
|
|
this.enterpriseChange(this.enterprisePage[0]?.name);
|
|
|
});
|
|
|
+ // 开发票:根据总单ID拉取拆分初始化数据,预填到表单上
|
|
|
+ if (type == 'reissue' && row.id) {
|
|
|
+ try {
|
|
|
+ const data = await splitInitAPI(row.id);
|
|
|
+ data.type = Number(data.type);
|
|
|
+ Object.keys(data || {}).forEach((k) => {
|
|
|
+ this.$set(this.form, k, data[k]);
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.form.sourceType == 99) {
|
|
|
+ this.$refs.tableInfoNoOrderRef?.setValue(this.form);
|
|
|
+ } else {
|
|
|
+ this.$refs.tableInfoRef?.putValue(this.form);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (e) {
|
|
|
+ console.error('splitInit failed:', e);
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
await this.getInfo(row.id);
|
|
|
}
|