feat: 收票登记新增所属合同带出承办部门替代手选结算组织
This commit is contained in:
@@ -100,18 +100,28 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<el-form-item label="结算组织" prop="deptId">
|
<el-form-item label="所属合同" prop="contractNo">
|
||||||
<el-cascader
|
<el-tooltip
|
||||||
v-if="!readonly"
|
:content="form.contractName"
|
||||||
:model-value="deptCascaderValue"
|
:disabled="!form.contractName"
|
||||||
:options="deptTreeOptions"
|
placement="top"
|
||||||
:props="deptCascaderProps"
|
:show-after="200"
|
||||||
placeholder="请选择结算组织(合同承办部门)"
|
>
|
||||||
filterable
|
<div class="receipt-form-page__overflow-trigger">
|
||||||
clearable
|
<el-input :model-value="form.contractNo" readonly placeholder="请选择承运商合同">
|
||||||
@change="handleDeptChange"
|
<template v-if="!readonly" #append>
|
||||||
/>
|
<el-tooltip content="选择承运商合同" placement="top">
|
||||||
<el-input v-else :model-value="form.deptName" disabled />
|
<el-button :icon="Search" @click="openContractDialog" />
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="承办部门">
|
||||||
|
<el-input :model-value="form.deptName" disabled placeholder="从所属合同带出" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -214,6 +224,48 @@
|
|||||||
:query-api="apiQueryInvoicePool"
|
:query-api="apiQueryInvoicePool"
|
||||||
@confirm="handleInvoicePicked"
|
@confirm="handleInvoicePicked"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<el-dialog v-model="contractDialog.visible" title="选择承运商合同" width="920px" append-to-body>
|
||||||
|
<el-form :model="contractDialog.query" label-position="right" label-width="auto" inline @submit.prevent>
|
||||||
|
<el-form-item label="合同编号">
|
||||||
|
<el-input
|
||||||
|
v-model="contractDialog.query.contractNo"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入"
|
||||||
|
@keyup.enter="searchContracts"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="合同名称">
|
||||||
|
<el-input
|
||||||
|
v-model="contractDialog.query.contractName"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入"
|
||||||
|
@keyup.enter="searchContracts"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" :icon="Search" @click="searchContracts">查询</el-button>
|
||||||
|
<el-button @click="resetContractQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="contractDialog.loading" :data="contractDialog.rows" border>
|
||||||
|
<el-table-column prop="contractNo" label="合同编号" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="contractName" label="合同名称" min-width="200" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="organizationName" label="承办部门" min-width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" width="80" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="pickContract(row)">选择</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="contractDialog.page.current"
|
||||||
|
v-model:page-size="contractDialog.page.size"
|
||||||
|
:total="contractDialog.page.total"
|
||||||
|
layout="total, prev, pager, next"
|
||||||
|
@current-change="loadContracts"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
</basic-container>
|
</basic-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -221,7 +273,7 @@
|
|||||||
import { Search } from '@element-plus/icons-vue';
|
import { Search } from '@element-plus/icons-vue';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import * as api from '@/api/payment/invoiceReceipt';
|
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 KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
|
||||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||||
import { getMkPublicDetail } from '@/api/mk-process';
|
import { getMkPublicDetail } from '@/api/mk-process';
|
||||||
@@ -247,6 +299,8 @@ const emptyForm = () => ({
|
|||||||
customerEmails: [],
|
customerEmails: [],
|
||||||
departmentEmails: [],
|
departmentEmails: [],
|
||||||
projectName: '',
|
projectName: '',
|
||||||
|
contractNo: '',
|
||||||
|
contractName: '',
|
||||||
deptId: null,
|
deptId: null,
|
||||||
deptName: '',
|
deptName: '',
|
||||||
payerName: '',
|
payerName: '',
|
||||||
@@ -269,16 +323,19 @@ export default {
|
|||||||
customerEmailOptions: [],
|
customerEmailOptions: [],
|
||||||
departmentEmailOptions: [],
|
departmentEmailOptions: [],
|
||||||
invoiceItems: [],
|
invoiceItems: [],
|
||||||
deptTreeOptions: [],
|
contractDialog: {
|
||||||
deptMap: new Map(),
|
visible: false,
|
||||||
// 结算组织=合同承办部门:部门树级联单选(取末级 id),后端沿部门树上溯平台公司取金蝶组织
|
loading: false,
|
||||||
deptCascaderProps: { checkStrictly: true, emitPath: true },
|
rows: [],
|
||||||
|
page: { current: 1, size: 10, total: 0 },
|
||||||
|
query: { contractNo: '', contractName: '' },
|
||||||
|
},
|
||||||
invoiceDialog: {
|
invoiceDialog: {
|
||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
invoiceNo: [{ required: true, validator: this.validateInvoice, trigger: 'change' }],
|
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' }],
|
customerEmails: [{ validator: this.validateEmails, trigger: 'change' }],
|
||||||
departmentEmails: [{ 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';
|
const code = this.recordId ? 'invoice_receipt_edit' : 'invoice_receipt_add';
|
||||||
return this.hasPermission(code);
|
return this.hasPermission(code);
|
||||||
},
|
},
|
||||||
deptCascaderValue() {
|
|
||||||
if (this.form.deptId === null || this.form.deptId === undefined || this.form.deptId === '') {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return [String(this.form.deptId)];
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initialize();
|
this.initialize();
|
||||||
@@ -339,7 +390,6 @@ export default {
|
|||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
},
|
},
|
||||||
async initialize() {
|
async initialize() {
|
||||||
this.loadDepartments();
|
|
||||||
if (this.isPublicViewPage) {
|
if (this.isPublicViewPage) {
|
||||||
await this.loadPublicDetail();
|
await this.loadPublicDetail();
|
||||||
return;
|
return;
|
||||||
@@ -380,9 +430,9 @@ export default {
|
|||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
validateDept(rule, value, callback) {
|
validateContract(rule, value, callback) {
|
||||||
if (this.form.deptId === null || this.form.deptId === undefined || this.form.deptId === '') {
|
if (!this.form.contractNo) {
|
||||||
callback(new Error('请选择结算组织'));
|
callback(new Error('请选择所属合同'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
@@ -454,47 +504,43 @@ export default {
|
|||||||
this.invoiceItems = [];
|
this.invoiceItems = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadDepartments() {
|
// 所属合同=承运商合同:选择后带出承办部门(结算组织=承办部门对应平台公司金蝶编码,后端派生)
|
||||||
// 结算组织取租户部门树(过滤外部组织),选中取末级部门 id
|
openContractDialog() {
|
||||||
getDeptTree(this.userInfo?.tenantId)
|
this.contractDialog.visible = true;
|
||||||
.then(response => {
|
this.searchContracts();
|
||||||
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(() => {});
|
|
||||||
},
|
},
|
||||||
excludeExternalOrganization(list = []) {
|
searchContracts() {
|
||||||
return list.reduce((result, item) => {
|
this.contractDialog.page.current = 1;
|
||||||
const deptName = item.title || item.deptName || item.name;
|
this.loadContracts();
|
||||||
if (String(deptName || '').trim() === '外部组织') return result;
|
},
|
||||||
result.push({
|
resetContractQuery() {
|
||||||
...item,
|
this.contractDialog.query = { contractNo: '', contractName: '' };
|
||||||
children: item.children?.length
|
this.searchContracts();
|
||||||
? this.excludeExternalOrganization(item.children)
|
},
|
||||||
: item.children,
|
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 = []) {
|
pickContract(row) {
|
||||||
return list.map(item => ({
|
if (!row) return;
|
||||||
label: item.title || item.deptName || item.name,
|
Object.assign(this.form, {
|
||||||
value: item.id == null || item.id === '' ? '' : String(item.id),
|
contractNo: row.contractNo,
|
||||||
children: item.children?.length ? this.toDeptCascaderOptions(item.children) : undefined,
|
contractName: row.contractName,
|
||||||
}));
|
deptName: row.organizationName,
|
||||||
},
|
});
|
||||||
flattenDepartments(rows) {
|
this.contractDialog.visible = false;
|
||||||
return (rows || []).flatMap(item => [item, ...this.flattenDepartments(item.children || [])]);
|
this.$refs.formRef?.validateField('contractNo').catch(() => {});
|
||||||
},
|
|
||||||
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(() => {});
|
|
||||||
},
|
},
|
||||||
openSettlementDetail(row) {
|
openSettlementDetail(row) {
|
||||||
const id = row.formalSettlementId || row.settlementId || row.id;
|
const id = row.formalSettlementId || row.settlementId || row.id;
|
||||||
@@ -527,9 +573,8 @@ export default {
|
|||||||
departmentEmails: this.form.departmentEmails.join(';'),
|
departmentEmails: this.form.departmentEmails.join(';'),
|
||||||
attachmentsJson: JSON.stringify(this.form.attachments || []),
|
attachmentsJson: JSON.stringify(this.form.attachments || []),
|
||||||
remark: this.form.remark,
|
remark: this.form.remark,
|
||||||
// 结算组织=页面手选部门(先票后款不挂结算单,认领关系由结算单侧维护,不再传 settlements)
|
// 所属合同仅传编号,合同名称/承办部门由后端按编号带出(结算组织=合同承办部门)
|
||||||
deptId: this.form.deptId,
|
contractNo: this.form.contractNo,
|
||||||
deptName: this.form.deptName,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async saveDraft() {
|
async saveDraft() {
|
||||||
|
|||||||
Reference in New Issue
Block a user