✨ 角色权限联动与临时额度/项目备案/司机车辆审核MK

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-11 01:09:35 +08:00
co-authored by Cursor
parent f081ccd3f0
commit 0da0c6f493
14 changed files with 656 additions and 75 deletions
+63 -4
View File
@@ -329,8 +329,10 @@ import {
getDetail as getProjectDetail,
getList as getProjectList,
} from '@/api/business/project-apply';
import { getMKApprovalUrl } from '@/api/system/business-process';
import { config, option } from '@/option/business/temporary-credit-limit';
import { getToken, isAdministrator } from '@/utils/auth';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
@@ -426,6 +428,7 @@ export default {
flowBox: false,
flowUrl: '',
processInstanceId: '',
mkEnabled: false,
};
},
computed: {
@@ -455,6 +458,13 @@ export default {
},
created() {
this.loadProjectOptions();
loadMkEnabled()
.then(enabled => {
this.mkEnabled = !!enabled;
})
.catch(() => {
this.mkEnabled = false;
});
},
methods: {
buildTableOption() {
@@ -543,11 +553,19 @@ export default {
},
customOperations(row) {
return (this.config.operations || []).filter(operation => {
if (operation.mkOnly && !this.mkEnabled) return false;
if (operation.localOnly && this.mkEnabled) return false;
const permission = operation.permission || `${this.config.permission}_${operation.action}`;
const statusProp = operation.statusProp || this.config.statusProp || 'status';
// MK「流程」入口允许只读行查看审核页;本地审批/提交/撤回仍禁止只读
if (
row.readonly &&
['submitApproval', 'withdraw', 'approve', 'reject'].includes(operation.action)
) {
return false;
}
return (
this.hasPermission(permission) &&
!row.readonly &&
(!operation.status?.length || operation.status.includes(row[statusProp]))
);
});
@@ -736,6 +754,10 @@ export default {
});
},
handleOperation(operation, row) {
if (operation.action === 'mkAudit') {
this.handleMkAudit(row);
return;
}
if (operation.action === 'flow') {
this.openFlow(row);
return;
@@ -744,12 +766,49 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => this.api[operation.action](row.id))
.then(() => {
}).then(() => {
const previousApprovalStatus = row.approvalStatus || '';
const request = () => this.api[operation.action](row.id);
// 先本地提交再调 MK,避免 MK 回写 reviewing 后本地 submitApproval 被编辑校验拦住
const afterMk =
operation.action === 'submitApproval'
? request().then(() =>
submitMkApprovalFlow({
bizType: 'temporary-credit-limit',
bizId: row.id,
subjectName: row.projectName || row.applicationNo || '',
approvalStatus: previousApprovalStatus,
mkEnabled: this.mkEnabled,
})
)
: request();
return afterMk.then(res => {
if (res?.data?.success === false) {
this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`);
return;
}
this.$message.success(`${operation.label}成功`);
this.onLoad(this.page, this.query);
});
});
},
handleMkAudit(row) {
if (!row?.id) {
this.$message.warning('临时额度申请ID为空,无法打开审核页');
return;
}
getMKApprovalUrl({ bizId: String(row.id) })
.then(res => {
const url = res?.data?.data;
if (!url) {
this.$message.error('获取审核跳转地址失败');
return;
}
window.open(url, '_blank');
})
.catch(() => {
this.$message.error('获取审核跳转地址失败');
});
},
openFlow(row, loaded = false) {
const processInstanceId = row.processInstanceId || row.processInstanceID || row.procInstId;