chore: 审批完成后刷新当前页

This commit is contained in:
dap 2024-12-17 15:08:31 +08:00
parent 2e3d385747
commit 7d9ddd4698
5 changed files with 22 additions and 6 deletions

View File

@ -125,8 +125,8 @@ async function handleSubmit() {
variables: {}, variables: {},
} as CompleteTaskReqData; } as CompleteTaskReqData;
await completeTask(requestData); await completeTask(requestData);
emit('complete');
modalApi.close(); modalApi.close();
emit('complete');
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} finally { } finally {

View File

@ -43,6 +43,11 @@ defineOptions({
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
const props = defineProps<{ task?: TaskInfo; type: ApprovalType }>(); const props = defineProps<{ task?: TaskInfo; type: ApprovalType }>();
/**
* 下面按钮点击后会触发的事件
*/
const emit = defineEmits<{ reload: [] }>();
const currentTask = ref<TaskInfo>(); const currentTask = ref<TaskInfo>();
/** /**
* 是否显示 加签/减签操作 * 是否显示 加签/减签操作
@ -142,6 +147,7 @@ function handleTermination() {
okButtonProps: { danger: true }, okButtonProps: { danger: true },
onOk: async () => { onOk: async () => {
await terminationTask({ taskId: props.task!.id }); await terminationTask({ taskId: props.task!.id });
emit('reload');
}, },
}); });
} }
@ -179,6 +185,7 @@ function handleDelegation(userList: User[]) {
{ taskId: props.task!.id, userId: current!.userId }, { taskId: props.task!.id, userId: current!.userId },
'delegateTask', 'delegateTask',
); );
emit('reload');
}, },
}); });
} }
@ -201,6 +208,7 @@ function handleTransfer(userList: User[]) {
{ taskId: props.task!.id, userId: current!.userId }, { taskId: props.task!.id, userId: current!.userId },
'transferTask', 'transferTask',
); );
emit('reload');
}, },
}); });
} }
@ -217,6 +225,7 @@ function handleAddSignature(userList: User[]) {
centered: true, centered: true,
onOk: async () => { onOk: async () => {
await taskOperation({ taskId: props.task!.id, userIds }, 'addSignature'); await taskOperation({ taskId: props.task!.id, userIds }, 'addSignature');
emit('reload');
}, },
}); });
} }
@ -236,6 +245,7 @@ function handleReductionSignature(userList: User[]) {
{ taskId: props.task!.id, userIds }, { taskId: props.task!.id, userIds },
'reductionSignature', 'reductionSignature',
); );
emit('reload');
}, },
}); });
} }
@ -357,8 +367,8 @@ function handleReductionSignature(userList: User[]) {
</template> </template>
<a-button> 其他 </a-button> <a-button> 其他 </a-button>
</Dropdown> </Dropdown>
<ApprovalModal /> <ApprovalModal @complete="$emit('reload')" />
<RejectionModal /> <RejectionModal @complete="$emit('reload')" />
<DelegationModal mode="single" @finish="handleDelegation" /> <DelegationModal mode="single" @finish="handleDelegation" />
<TransferModal mode="single" @finish="handleTransfer" /> <TransferModal mode="single" @finish="handleTransfer" />
<AddSignatureModal mode="multiple" @finish="handleAddSignature" /> <AddSignatureModal mode="multiple" @finish="handleAddSignature" />

View File

@ -113,8 +113,8 @@ async function handleSubmit() {
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
console.log(data); console.log(data);
await backProcess(data); await backProcess(data);
emit('complete');
modalApi.close(); modalApi.close();
emit('complete');
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} finally { } finally {

View File

@ -5,6 +5,7 @@ import type { TaskInfo } from '#/api/workflow/task/model';
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useTabs } from '@vben/hooks';
import { Empty, InputSearch } from 'ant-design-vue'; import { Empty, InputSearch } from 'ant-design-vue';
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
@ -77,6 +78,8 @@ async function handleCardClick(item: TaskInfo) {
const resp = await flowInfo(businessId); const resp = await flowInfo(businessId);
currentInstance.value = resp; currentInstance.value = resp;
} }
const { refreshTab } = useTabs();
</script> </script>
<template> <template>
@ -115,7 +118,7 @@ async function handleCardClick(item: TaskInfo) {
</div> </div>
</div> </div>
</div> </div>
<ApprovalPanel :task="currentTask" type="myself" /> <ApprovalPanel :task="currentTask" type="myself" @reload="refreshTab" />
</div> </div>
</Page> </Page>
</template> </template>

View File

@ -5,6 +5,7 @@ import type { TaskInfo } from '#/api/workflow/task/model';
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useTabs } from '@vben/hooks';
import { Empty, InputSearch } from 'ant-design-vue'; import { Empty, InputSearch } from 'ant-design-vue';
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
@ -78,6 +79,8 @@ async function handleCardClick(item: TaskInfo) {
const resp = await flowInfo(businessId); const resp = await flowInfo(businessId);
currentInstance.value = resp; currentInstance.value = resp;
} }
const { refreshTab } = useTabs();
</script> </script>
<template> <template>
@ -116,7 +119,7 @@ async function handleCardClick(item: TaskInfo) {
</div> </div>
</div> </div>
</div> </div>
<ApprovalPanel :task="currentTask" type="approve" /> <ApprovalPanel :task="currentTask" type="approve" @reload="refreshTab" />
</div> </div>
</Page> </Page>
</template> </template>