diff --git a/src/api/system/business-process.js b/src/api/system/business-process.js index 0818de1..5d0f502 100644 --- a/src/api/system/business-process.js +++ b/src/api/system/business-process.js @@ -6,8 +6,9 @@ import request from '@/axios'; * @param {string} data.templateCode 模板编码 * @param {string} data.submitIdentity 提交人(手机号) * @param {string} data.loginName 登录账号(手机号) - * @param {string} data.formInstanceId 业务表单实例 id + * @param {string} data.bizId 业务主键(后端生成/复用 formInstanceId) * @param {string} [data.subject] 流程标题 + * @param {string} [data.bizType] 业务类型 */ export const processSubmit = data => { return request({ @@ -20,7 +21,7 @@ export const processSubmit = data => { /** * 调用 MK processDelete 删除审核流(驳回后重新提交前使用) * @param {Object} data - * @param {string} data.formInstanceId 业务表单实例 id + * @param {string} data.bizId 业务主键 */ export const processDelete = data => { return request({ @@ -33,7 +34,7 @@ export const processDelete = data => { /** * 查询 MK 流程实例是否仍存在(有数据则无需删除/重新提交) * @param {Object} params - * @param {string} params.bizId 业务 id(formInstanceId) + * @param {string} params.bizId 业务主键 */ export const hasMkProcessInstance = params => { return request({ diff --git a/src/option/business/project-apply.js b/src/option/business/project-apply.js index ad46f63..0c6ed41 100644 --- a/src/option/business/project-apply.js +++ b/src/option/business/project-apply.js @@ -57,16 +57,24 @@ export const config = { action: 'submitApproval', label: '提交', statusProp: 'approvalStatus', - status: ['draft'], + status: ['draft', 'rejected', 'withdrawn'], permission: 'project_apply_submit', }, { action: 'withdraw', label: '撤回', statusProp: 'approvalStatus', - status: ['reviewing'], + status: ['draft', 'reviewing'], permission: 'project_apply_withdraw', }, + { + action: 'mkAudit', + label: '流程', + statusProp: 'approvalStatus', + status: ['reviewing', 'change_reviewing'], + permission: 'project_apply_approve', + mkOnly: true, + }, { action: 'approve', label: '通过', @@ -74,6 +82,7 @@ export const config = { statusProp: 'approvalStatus', status: ['reviewing', 'change_reviewing'], permission: 'project_apply_approve', + localOnly: true, }, { action: 'reject', @@ -82,6 +91,7 @@ export const config = { statusProp: 'approvalStatus', status: ['reviewing', 'change_reviewing'], permission: 'project_apply_reject', + localOnly: true, }, { action: 'startChange', diff --git a/src/router/page/index.js b/src/router/page/index.js index ab93bb9..e2a8ab1 100644 --- a/src/router/page/index.js +++ b/src/router/page/index.js @@ -106,17 +106,6 @@ export default [ bizType: 'contract-manage', }, }, - { - path: '/business/waybill-manage/public-view', - name: '查看运单信息', - component: () => import('@/views/business/waybill-manage-public-view.vue'), - meta: { - keepAlive: false, - isTab: false, - isAuth: false, - bizType: 'waybill-manage', - }, - }, { path: '/settlement/pre-settlement/public-view', name: '查看预结算信息', @@ -150,6 +139,39 @@ export default [ bizType: 'payment-application', }, }, + { + path: '/payment/invoice-application/public-view', + name: '查看开票申请信息', + component: () => import('@/views/payment/invoice-application-public-view.vue'), + meta: { + keepAlive: false, + isTab: false, + isAuth: false, + bizType: 'invoice-application', + }, + }, + { + path: '/payment/invoice-receipt/public-view', + name: '查看收票登记信息', + component: () => import('@/views/payment/invoice-receipt-public-view.vue'), + meta: { + keepAlive: false, + isTab: false, + isAuth: false, + bizType: 'invoice-receipt', + }, + }, + { + path: '/payment/bill-payment/public-view', + name: '查看汇票付款信息', + component: () => import('@/views/payment/bill-payment-public-view.vue'), + meta: { + keepAlive: false, + isTab: false, + isAuth: false, + bizType: 'bill-payment', + }, + }, { path: '/', name: '主页', diff --git a/src/utils/mk-approval.js b/src/utils/mk-approval.js index 9bbb524..a9071d2 100644 --- a/src/utils/mk-approval.js +++ b/src/utils/mk-approval.js @@ -18,11 +18,6 @@ export const MK_BIZ = { subjectPrefix: '合同审批', rejected: ['rejected', 'change_rejected', 'withdrawn'], }, - 'waybill-manage': { - dictName: '提交运单审核流', - subjectPrefix: '运单审批', - rejected: ['rejected', 'returned'], - }, 'pre-settlement': { dictName: '提交预结算审核流', subjectPrefix: '预结算审批', @@ -38,6 +33,21 @@ export const MK_BIZ = { subjectPrefix: '付款审批', rejected: ['returned'], }, + 'invoice-application': { + dictName: '提交开票审核流', + subjectPrefix: '开票审批', + rejected: ['returned'], + }, + 'invoice-receipt': { + dictName: '提交收票审核流', + subjectPrefix: '收票审批', + rejected: ['returned'], + }, + 'bill-payment': { + dictName: '提交汇票付款审核流', + subjectPrefix: '汇票付款审批', + rejected: ['returned'], + }, }; const MK_SWITCH_NAME = '开启MK'; @@ -70,9 +80,17 @@ export async function resolveMkTemplateCode(dictName, list) { return String(templateCode); } +/** + * 提交 MK 审核流 + * @param {Object} options + * @param {string} options.bizType 业务类型 + * @param {string|number} options.bizId 业务主键(后端据此生成/复用 formInstanceId) + * @param {string} [options.subjectName] 标题后缀 + * @param {string} [options.approvalStatus] 当前审批状态(驳回态会先 delete) + */ export async function submitMkApprovalFlow({ bizType, - formInstanceId, + bizId, subjectName = '', approvalStatus = '', }) { @@ -80,25 +98,29 @@ export async function submitMkApprovalFlow({ if (!conf) { return Promise.reject(new Error(`不支持的MK业务类型:${bizType}`)); } + if (bizId == null || bizId === '') { + return Promise.reject(new Error('业务id不能为空')); + } const list = await loadMkTemplateList(); if (!isMkEnabled(list)) { return; } + const bizIdText = String(bizId); // 先查 MK 流程实例:已有数据则不删除、不重新提交 - const existsRes = await hasMkProcessInstance({ bizId: String(formInstanceId) }); + const existsRes = await hasMkProcessInstance({ bizId: bizIdText }); if (existsRes?.data?.data) { return; } if ((conf.rejected || []).includes(approvalStatus)) { - await processDelete({ formInstanceId: String(formInstanceId) }); + await processDelete({ bizId: bizIdText }); } const templateCode = await resolveMkTemplateCode(conf.dictName, list); const subject = subjectName ? `${conf.subjectPrefix}:${subjectName}` - : `${conf.subjectPrefix}:${formInstanceId}`; + : `${conf.subjectPrefix}:${bizIdText}`; return processSubmit({ templateCode, - formInstanceId: String(formInstanceId), + bizId: bizIdText, subject, bizType, }); diff --git a/src/views/business/common-cargo.vue b/src/views/business/common-cargo.vue index 6b060f7..fe173a1 100644 --- a/src/views/business/common-cargo.vue +++ b/src/views/business/common-cargo.vue @@ -275,7 +275,12 @@ export default { return (data && data.records) || []; }, defaultDeptId() { - return (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + // 用户可能绑定多个组织(逗号分隔),搜索下拉是单选,只取当前会话第一个组织 ID。 + const raw = (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + return String(raw) + .split(',') + .map(item => item.trim()) + .filter(Boolean)[0] || ''; }, applyDefaultDeptSearch() { const deptId = this.defaultDeptId(); @@ -296,6 +301,18 @@ export default { if (deptColumn) { deptColumn.dicData = this.deptOptions; } + // dicData 异步到位后再回填,避免下拉选项为空时清空已选组织,导致请求丢失 deptId。 + const deptId = String(this.query.deptId || this.defaultDeptId() || ''); + if (!deptId) return; + if (deptColumn) { + deptColumn.searchValue = deptId; + } + this.query = { ...this.query, deptId }; + this.$nextTick(() => { + if (this.$refs.crud?.searchForm) { + this.$refs.crud.searchForm.searchDeptId = deptId; + } + }); }); }, loadPriceUnitOptions() { @@ -323,9 +340,13 @@ export default { flattenDept(tree, level = 0) { const result = []; tree.forEach(item => { + // 雪花 ID 必须保持字符串,避免 JS Number 精度丢失导致筛错组织。 + const id = + item.id === undefined || item.id === null || item.id === '' ? '' : String(item.id); + if (!id) return; result.push({ label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`, - value: item.id, + value: id, }); if (item.children && item.children.length) { result.push(...this.flattenDept(item.children, level + 1)); @@ -333,6 +354,18 @@ export default { }); return result; }, + normalizeListQuery(params = {}) { + const query = { ...params, ...this.query }; + const rawDeptId = query.deptId ?? query.searchDeptId; + delete query.searchDeptId; + if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') { + query.deptId = String(rawDeptId).split(',')[0].trim(); + } else { + delete query.deptId; + } + query.allDept = this.isAdmin ? 1 : 0; + return query; + }, normalizeCargoTypeOptions(list = []) { return list .map(item => ({ @@ -640,9 +673,9 @@ export default { this.onLoad(this.page, this.query); }, searchChange(params, done) { - this.query = params; + this.query = this.normalizeListQuery(params); this.page.currentPage = 1; - this.onLoad(this.page, params); + this.onLoad(this.page, this.query); done(); }, selectionChange(list) { @@ -665,12 +698,10 @@ export default { }, onLoad(page, params = {}) { this.loading = true; + const query = this.normalizeListQuery(params); + this.query = query; api - .getList(page.currentPage, page.pageSize, { - ...params, - ...this.query, - allDept: this.isAdmin ? 1 : 0, - }) + .getList(page.currentPage, page.pageSize, query) .then(res => { const result = res.data.data; this.page.total = result.total; @@ -683,8 +714,7 @@ export default { }, buildExportParams() { return { - ...this.query, - allDept: this.isAdmin ? 1 : 0, + ...this.normalizeListQuery(this.query), ids: this.ids, [this.website.tokenHeader]: getToken(), }; diff --git a/src/views/business/components/waybill-manage-page.vue b/src/views/business/components/waybill-manage-page.vue index ed1bd0e..b070975 100644 --- a/src/views/business/components/waybill-manage-page.vue +++ b/src/views/business/components/waybill-manage-page.vue @@ -2348,7 +2348,7 @@ -