新增单挑流程删除按钮

This commit is contained in:
wsm
2026-05-18 15:45:32 +08:00
parent e0f77f2e76
commit 2fa084569f
@@ -31,6 +31,7 @@
businessId?: string;
title?: string;
columns?: BasicColumn[];
onDeleteProcess?: (record: Recordable, reload: () => Promise<void>) => Promise<void>;
}
const title = ref('流程列表');
@@ -38,6 +39,7 @@
const currentBusinessId = ref('');
const defaultColumns = columns;
const { createMessage } = useMessage();
const onDeleteProcessRef = ref<OpenParams['onDeleteProcess']>();
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
const [registerTable, { setColumns, setTableData, setLoading, clearSelectedRowKeys }] = useTable({
@@ -51,7 +53,7 @@
actionColumn: {
title: '操作',
dataIndex: 'action',
width: 120,
width: 180,
fixed: 'right',
slots: { customRender: 'action' },
},
@@ -85,6 +87,7 @@
async function open(params: OpenParams = {}) {
currentBusinessId.value = params.businessId || '';
title.value = params.title || '流程列表';
onDeleteProcessRef.value = params.onDeleteProcess;
visible.value = true;
await nextTick();
setColumns(params.columns?.length ? params.columns : defaultColumns);
@@ -94,6 +97,7 @@
function handleCancel() {
visible.value = false;
currentBusinessId.value = '';
onDeleteProcessRef.value = undefined;
setColumns(defaultColumns);
setTableData([]);
clearSelectedRowKeys();
@@ -106,13 +110,34 @@
});
}
async function handleDeleteProcess(record) {
if (typeof onDeleteProcessRef.value === 'function') {
await onDeleteProcessRef.value(record, loadData);
} else {
createMessage.warning('未配置删除流程回调');
}
}
function getTableAction(record) {
return [
const actions: any[] = [
{
label: '审批历史',
onClick: handlePreviewPic.bind(null, record),
},
];
if (typeof onDeleteProcessRef.value === 'function') {
actions.push({
label: '删除流程',
popConfirm: {
title: '确定删除该流程吗?',
confirm: handleDeleteProcess.bind(null, record),
placement: 'topLeft',
},
});
}
return actions;
}
defineExpose({