From 4dd63fc5fa307c477e3a8ec478876c43e70eb3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B3=89=E4=BD=B3?= <1107186916@qq.com> Date: Thu, 5 Nov 2026 12:05:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B6=E7=A5=A8=E7=99=BB=E8=AE=B0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=80=E5=B1=9E=E5=90=88=E5=90=8C=E5=B8=A6?= =?UTF-8?q?=E5=87=BA=E6=89=BF=E5=8A=9E=E9=83=A8=E9=97=A8=E6=9B=BF=E4=BB=A3?= =?UTF-8?q?=E6=89=8B=E9=80=89=E7=BB=93=E7=AE=97=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/payment/invoice-receipt-form.vue | 183 +++++++++++++-------- 1 file changed, 114 insertions(+), 69 deletions(-) diff --git a/src/views/payment/invoice-receipt-form.vue b/src/views/payment/invoice-receipt-form.vue index b9e6538..50cbfb8 100644 --- a/src/views/payment/invoice-receipt-form.vue +++ b/src/views/payment/invoice-receipt-form.vue @@ -100,18 +100,28 @@ - - - + + +
+ + + +
+
+
+
+ + + @@ -214,6 +224,48 @@ :query-api="apiQueryInvoicePool" @confirm="handleInvoicePicked" /> + + + + + + + + + + + 查询 + 重置 + + + + + + + + + + + + @@ -221,7 +273,7 @@ import { Search } from '@element-plus/icons-vue'; import { mapGetters } from 'vuex'; import * as api from '@/api/payment/invoiceReceipt'; -import { getDeptTree } from '@/api/system/dept'; +import { getList as getContractList } from '@/api/business/contract-manage'; import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue'; import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue'; import { getMkPublicDetail } from '@/api/mk-process'; @@ -247,6 +299,8 @@ const emptyForm = () => ({ customerEmails: [], departmentEmails: [], projectName: '', + contractNo: '', + contractName: '', deptId: null, deptName: '', payerName: '', @@ -269,16 +323,19 @@ export default { customerEmailOptions: [], departmentEmailOptions: [], invoiceItems: [], - deptTreeOptions: [], - deptMap: new Map(), - // 结算组织=合同承办部门:部门树级联单选(取末级 id),后端沿部门树上溯平台公司取金蝶组织 - deptCascaderProps: { checkStrictly: true, emitPath: true }, + contractDialog: { + visible: false, + loading: false, + rows: [], + page: { current: 1, size: 10, total: 0 }, + query: { contractNo: '', contractName: '' }, + }, invoiceDialog: { visible: false, }, rules: { invoiceNo: [{ required: true, validator: this.validateInvoice, trigger: 'change' }], - deptId: [{ required: true, validator: this.validateDept, trigger: 'change' }], + contractNo: [{ required: true, validator: this.validateContract, trigger: 'change' }], customerEmails: [{ validator: this.validateEmails, trigger: 'change' }], departmentEmails: [{ validator: this.validateEmails, trigger: 'change' }], }, @@ -299,12 +356,6 @@ export default { const code = this.recordId ? 'invoice_receipt_edit' : 'invoice_receipt_add'; return this.hasPermission(code); }, - deptCascaderValue() { - if (this.form.deptId === null || this.form.deptId === undefined || this.form.deptId === '') { - return []; - } - return [String(this.form.deptId)]; - }, }, created() { this.initialize(); @@ -339,7 +390,6 @@ export default { .filter(Boolean); }, async initialize() { - this.loadDepartments(); if (this.isPublicViewPage) { await this.loadPublicDetail(); return; @@ -380,9 +430,9 @@ export default { } callback(); }, - validateDept(rule, value, callback) { - if (this.form.deptId === null || this.form.deptId === undefined || this.form.deptId === '') { - callback(new Error('请选择结算组织')); + validateContract(rule, value, callback) { + if (!this.form.contractNo) { + callback(new Error('请选择所属合同')); return; } callback(); @@ -454,47 +504,43 @@ export default { this.invoiceItems = []; } }, - loadDepartments() { - // 结算组织取租户部门树(过滤外部组织),选中取末级部门 id - getDeptTree(this.userInfo?.tenantId) - .then(response => { - const rows = this.excludeExternalOrganization(this.unwrapData(response) || []); - this.deptTreeOptions = this.toDeptCascaderOptions(rows); - this.deptMap = new Map(); - this.flattenDepartments(rows).forEach(item => - this.deptMap.set(String(item.id), item.title || item.deptName || item.name) - ); - }) - .catch(() => {}); + // 所属合同=承运商合同:选择后带出承办部门(结算组织=承办部门对应平台公司金蝶编码,后端派生) + openContractDialog() { + this.contractDialog.visible = true; + this.searchContracts(); }, - excludeExternalOrganization(list = []) { - return list.reduce((result, item) => { - const deptName = item.title || item.deptName || item.name; - if (String(deptName || '').trim() === '外部组织') return result; - result.push({ - ...item, - children: item.children?.length - ? this.excludeExternalOrganization(item.children) - : item.children, + searchContracts() { + this.contractDialog.page.current = 1; + this.loadContracts(); + }, + resetContractQuery() { + this.contractDialog.query = { contractNo: '', contractName: '' }; + this.searchContracts(); + }, + async loadContracts() { + this.contractDialog.loading = true; + try { + const res = await getContractList(this.contractDialog.page.current, this.contractDialog.page.size, { + ...this.contractDialog.query, + contractCategory: '承运商合同', + approvalStatuses: 'approved,change_approved', }); - return result; - }, []); + const data = this.unwrapData(res) || {}; + this.contractDialog.rows = data.records || []; + this.contractDialog.page.total = Number(data.total || 0); + } finally { + this.contractDialog.loading = false; + } }, - toDeptCascaderOptions(list = []) { - return list.map(item => ({ - label: item.title || item.deptName || item.name, - value: item.id == null || item.id === '' ? '' : String(item.id), - children: item.children?.length ? this.toDeptCascaderOptions(item.children) : undefined, - })); - }, - flattenDepartments(rows) { - return (rows || []).flatMap(item => [item, ...this.flattenDepartments(item.children || [])]); - }, - handleDeptChange(value) { - const deptId = Array.isArray(value) ? value.at(-1) : value; - this.form.deptId = deptId || null; - this.form.deptName = deptId ? this.deptMap.get(String(deptId)) || '' : ''; - this.$refs.formRef?.validateField('deptId').catch(() => {}); + pickContract(row) { + if (!row) return; + Object.assign(this.form, { + contractNo: row.contractNo, + contractName: row.contractName, + deptName: row.organizationName, + }); + this.contractDialog.visible = false; + this.$refs.formRef?.validateField('contractNo').catch(() => {}); }, openSettlementDetail(row) { const id = row.formalSettlementId || row.settlementId || row.id; @@ -527,9 +573,8 @@ export default { departmentEmails: this.form.departmentEmails.join(';'), attachmentsJson: JSON.stringify(this.form.attachments || []), remark: this.form.remark, - // 结算组织=页面手选部门(先票后款不挂结算单,认领关系由结算单侧维护,不再传 settlements) - deptId: this.form.deptId, - deptName: this.form.deptName, + // 所属合同仅传编号,合同名称/承办部门由后端按编号带出(结算组织=合同承办部门) + contractNo: this.form.contractNo, }; }, async saveDraft() {