chore: 流程删除/撤销

This commit is contained in:
dap 2024-12-17 15:41:07 +08:00
parent 7d9ddd4698
commit 3c1df9c880
3 changed files with 61 additions and 12 deletions

View File

@ -39,7 +39,7 @@ export function deleteByBusinessIds(businessIds: IDS) {
*/ */
export function deleteByInstanceIds(instanceIds: IDS) { export function deleteByInstanceIds(instanceIds: IDS) {
return requestClient.deleteWithMsg<void>( return requestClient.deleteWithMsg<void>(
`/workflow/instance/deleteByInstanceIds${instanceIds}`, `/workflow/instance/deleteByInstanceIds/${instanceIds}`,
); );
} }
@ -47,7 +47,10 @@ export function deleteByInstanceIds(instanceIds: IDS) {
* *
* @param data * @param data
*/ */
export function cancelProcessApply(data: any) { export function cancelProcessApply(data: {
businessId: string;
message?: string;
}) {
return requestClient.putWithMsg<void>( return requestClient.putWithMsg<void>(
'/workflow/instance/cancelProcessApply', '/workflow/instance/cancelProcessApply',
data, data,

View File

@ -17,14 +17,17 @@ import {
Menu, Menu,
MenuItem, MenuItem,
Modal, Modal,
Popconfirm,
Skeleton, Skeleton,
Space, Space,
TabPane, TabPane,
Tabs, Tabs,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { flowInfo } from '#/api/workflow/instance'; import {
cancelProcessApply,
deleteByInstanceIds,
flowInfo,
} from '#/api/workflow/instance';
import { import {
getTaskByTaskId, getTaskByTaskId,
taskOperation, taskOperation,
@ -118,8 +121,42 @@ watch(() => props.task, handleLoadInfo);
onUnmounted(() => (currentFlowInfo.value = undefined)); onUnmounted(() => (currentFlowInfo.value = undefined));
//
const revocable = computed(() => props.task?.flowStatus === 'waiting');
async function handleCancel() { async function handleCancel() {
// await cancelProcessApply() Modal.confirm({
title: '提示',
content: '确定要撤销该申请吗?',
centered: true,
okButtonProps: { danger: true },
onOk: async () => {
await cancelProcessApply({
businessId: props.task!.businessId,
message: '申请人撤销流程!',
});
emit('reload');
},
});
}
const editableAndRemoveable = computed(() => {
if (!props.task) {
return false;
}
return ['back', 'cancel', 'draft'].includes(props.task.flowStatus);
});
function handleRemove() {
Modal.confirm({
title: '提示',
content: '确定删除该申请吗?',
centered: true,
okButtonProps: { danger: true },
onOk: async () => {
await deleteByInstanceIds([props.task!.id]);
emit('reload');
},
});
} }
/** /**
@ -321,13 +358,23 @@ function handleReductionSignature(userList: User[]) {
> >
<div class="flex justify-end"> <div class="flex justify-end">
<Space v-if="type === 'myself'"> <Space v-if="type === 'myself'">
<Popconfirm <a-button
placement="topRight" v-if="revocable"
title="确定要撤销该申请吗?" danger
@confirm="handleCancel" type="primary"
@click="handleCancel"
> >
<a-button danger type="primary">撤销申请</a-button> 撤销申请
</Popconfirm> </a-button>
<a-button
v-if="editableAndRemoveable"
danger
type="primary"
@click="handleRemove"
>
删除
</a-button>
</Space> </Space>
<Space v-if="type === 'approve'"> <Space v-if="type === 'approve'">
<a-button type="primary" @click="handleApproval">通过</a-button> <a-button type="primary" @click="handleApproval">通过</a-button>

View File

@ -32,7 +32,6 @@ onMounted(async () => {
* 获取待办任务列表 * 获取待办任务列表
*/ */
const resp = await pageByCurrent({ pageSize: 10, pageNum: page.value }); const resp = await pageByCurrent({ pageSize: 10, pageNum: page.value });
console.log(resp);
taskList.value = resp.rows.map((item) => ({ ...item, active: false })); taskList.value = resp.rows.map((item) => ({ ...item, active: false }));
taskTotal.value = resp.total; taskTotal.value = resp.total;
}); });