新增单挑流程删除按钮
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
businessId?: string;
|
businessId?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
columns?: BasicColumn[];
|
columns?: BasicColumn[];
|
||||||
|
onDeleteProcess?: (record: Recordable, reload: () => Promise<void>) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = ref('流程列表');
|
const title = ref('流程列表');
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
const currentBusinessId = ref('');
|
const currentBusinessId = ref('');
|
||||||
const defaultColumns = columns;
|
const defaultColumns = columns;
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
|
const onDeleteProcessRef = ref<OpenParams['onDeleteProcess']>();
|
||||||
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
|
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
|
||||||
|
|
||||||
const [registerTable, { setColumns, setTableData, setLoading, clearSelectedRowKeys }] = useTable({
|
const [registerTable, { setColumns, setTableData, setLoading, clearSelectedRowKeys }] = useTable({
|
||||||
@@ -51,7 +53,7 @@
|
|||||||
actionColumn: {
|
actionColumn: {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
width: 120,
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
slots: { customRender: 'action' },
|
slots: { customRender: 'action' },
|
||||||
},
|
},
|
||||||
@@ -85,6 +87,7 @@
|
|||||||
async function open(params: OpenParams = {}) {
|
async function open(params: OpenParams = {}) {
|
||||||
currentBusinessId.value = params.businessId || '';
|
currentBusinessId.value = params.businessId || '';
|
||||||
title.value = params.title || '流程列表';
|
title.value = params.title || '流程列表';
|
||||||
|
onDeleteProcessRef.value = params.onDeleteProcess;
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
setColumns(params.columns?.length ? params.columns : defaultColumns);
|
setColumns(params.columns?.length ? params.columns : defaultColumns);
|
||||||
@@ -94,6 +97,7 @@
|
|||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
currentBusinessId.value = '';
|
currentBusinessId.value = '';
|
||||||
|
onDeleteProcessRef.value = undefined;
|
||||||
setColumns(defaultColumns);
|
setColumns(defaultColumns);
|
||||||
setTableData([]);
|
setTableData([]);
|
||||||
clearSelectedRowKeys();
|
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) {
|
function getTableAction(record) {
|
||||||
return [
|
const actions: any[] = [
|
||||||
{
|
{
|
||||||
label: '审批历史',
|
label: '审批历史',
|
||||||
onClick: handlePreviewPic.bind(null, record),
|
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({
|
defineExpose({
|
||||||
|
|||||||
Reference in New Issue
Block a user