Skip to content

Commit

Permalink
fix(frontend): 单据详情 loading #6976
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Sep 18, 2024
1 parent d69720c commit ffd5804
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@
const isLoading = ref(true);
const flowInfoRef = ref<InstanceType<typeof FlowInfo>>();

const { run: fetchTicketDetails, data: ticketData } = useRequest(
const { runAsync: fetchTicketDetails, data: ticketData } = useRequest(
(params: ServiceParameters<typeof getTicketDetails>) =>
getTicketDetails(params, {
permission: 'catch',
}),
{
onSuccess(_, params) {
isLoading.value = false;
if (params[0].id !== props.ticketId) {
return;
}
Expand All @@ -117,6 +116,8 @@
ticketData.value = undefined;
fetchTicketDetails({
id: props.ticketId,
}).finally(() => {
isLoading.value = false;
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,26 @@
return CommonFlows;
});

const { run: fetchTicketFlows, cancel: cancelFetchTicketFlows } = useRequest(getTicketFlows, {
const { runAsync: fetchTicketFlows, cancel: cancelFetchTicketFlows } = useRequest(getTicketFlows, {
manual: true,
onSuccess(data, params) {
if (params[0].id !== props.data.id) {
return;
}
isLoading.value = false;
flowList.value = data;
},
});

watch(
() => props.data,
() => props.data.id,
() => {
if (props.data.id) {
isLoading.value = true;
cancelFetchTicketFlows();
fetchTicketFlows({
id: props.data.id,
}).finally(() => {
isLoading.value = false;
});
}
},
Expand Down

0 comments on commit ffd5804

Please sign in to comment.