diff --git a/src/api/accounting/invoices.js b/src/api/accounting/invoices.js index 6602f447..2b0f9717 100644 --- a/src/api/accounting/invoices.js +++ b/src/api/accounting/invoices.js @@ -18,6 +18,15 @@ export function updateInvoices(data) { }) } +// 关联会计凭证 +export function updateArrayInvoices(data) { + return request({ + url: '/accounting/invoices/update/array', + method: 'put', + data: data + }) +} + // 删除发票 export function deleteInvoices(id) { return request({ diff --git a/src/views/accounting/invoices/index.vue b/src/views/accounting/invoices/index.vue index 3d20084f..01aa1ba9 100644 --- a/src/views/accounting/invoices/index.vue +++ b/src/views/accounting/invoices/index.vue @@ -106,7 +106,7 @@ plain icon="el-icon-delete" size="mini" - :disabled="multiple1" + :disabled="multiple" @click="handleDelete" >删除 @@ -746,12 +746,12 @@ width="800px" append-to-body > - + - + @@ -793,6 +793,7 @@ import { outTemplate, downloadXml, getInvoicesPageTime, + updateArrayInvoices, } from "@/api/accounting/invoices"; import { getVoucherPage } from "@/api/accounting/voucher"; import { listData } from "@/api/system/dict/data"; @@ -810,10 +811,8 @@ export default { optType: undefined, // 遮罩层 loading: true, - // 多个禁用 - multiple: true, // 非多个禁用 - multiple1: true, + multiple: true, // 导出遮罩层 exportLoading: false, downloadLoading: false, @@ -901,6 +900,10 @@ export default { }, // 表单参数 form: {}, + PZform: { + voucherId: undefined, + voucherNum: undefined, + }, uploadUrl: process.env.VUE_APP_BASE_API + "/admin-api/accounting/invoices/identify", // 上传地址地址 @@ -1178,13 +1181,7 @@ export default { handleSelectionChange(selection) { console.log(selection); this.ids = selection.map((item) => item.id); - if (selection.length == 1) { - this.multiple = false; - this.form = selection[0]; - } else { - this.multiple = true; - } - this.multiple1 = !selection.length; + this.multiple = !selection.length; }, /** 新增按钮操作 */ handleAdd() { @@ -1287,16 +1284,19 @@ export default { }, //关联凭证 handleGLPZ() { - this.form.voucherId = null; this.open2 = true; - console.log(this.form); + this.PZform = { + voucherId: undefined, + voucherNum: undefined, + }; }, submitForm2() { - this.$refs["form"].validate((valid) => { + this.$refs["PZform"].validate((valid) => { if (!valid) { return; } - updateInvoices(this.form).then((response) => { + const data = { id: this.ids, voucherId: this.PZform.voucherId }; + updateArrayInvoices(data).then((response) => { this.$modal.msgSuccess("关联成功"); this.open2 = false; this.multiple = true; @@ -1387,7 +1387,8 @@ export default { onVoucherSelected(obj) { console.log(obj); if (obj != undefined && obj != null) { - this.form.voucherId = obj.id; + this.PZform.voucherId = obj.id; + this.PZform.voucherNum = obj.voucherNum; } }, },