diff --git a/src/components/semri/process/BusinessProcessListModal.vue b/src/components/semri/process/BusinessProcessListModal.vue index 3ec7c2f..be3e4a5 100644 --- a/src/components/semri/process/BusinessProcessListModal.vue +++ b/src/components/semri/process/BusinessProcessListModal.vue @@ -31,6 +31,7 @@ businessId?: string; title?: string; columns?: BasicColumn[]; + onDeleteProcess?: (record: Recordable, reload: () => Promise) => Promise; } const title = ref('流程列表'); @@ -38,6 +39,7 @@ const currentBusinessId = ref(''); const defaultColumns = columns; const { createMessage } = useMessage(); + const onDeleteProcessRef = ref(); 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({