feat(@vben/web-antd): 增加工作流关联详情展示并优化列表刷新功能

- 新增 linkDetail API 获取工作流关联详情
- 在表单中展示已关联的部门信息
- 添加操作成功后的通知提示
- 优化工作流列表的刷新功能
This commit is contained in:
Kven 2025-06-22 20:57:18 +08:00
parent 6910bd28cc
commit f32b395e27
3 changed files with 21 additions and 6 deletions

View File

@ -57,3 +57,7 @@ export function getWorkflowList(params: WorkflowApi.WorkflowLogParams) {
export function linkWorkflow(data: WorkflowApi.WorkflowLinkParams) {
return requestClient.post(`/v1/server/link`, data);
}
export function linkDetail(workflowId: string) {
return requestClient.get(`/v1/server/link/${workflowId}`);
}

View File

@ -44,7 +44,7 @@ function onActionClick({ code, row }: OnActionClickParams<any>) {
}
}
const [Grid] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
@ -82,14 +82,14 @@ const [Grid] = useVbenVxeGrid({
} as VxeTableGridOptions<UserApi.User>,
});
// function onRefresh() {
// gridApi.query();
// }
function onRefresh() {
gridApi.query();
}
</script>
<template>
<Page auto-content-height>
<FormDrawer />
<FormModal />
<FormModal @success="onRefresh" />
<Grid table-title="工作流列表">
<!-- <template #toolbar-tools>-->
<!-- <Button type="primary" @click="onDelete" danger> 批量删除 </Button>-->

View File

@ -7,8 +7,10 @@ import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui';
import { notification } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { getAllDeptTree, linkWorkflow } from '#/api';
import { getAllDeptTree, linkDetail, linkWorkflow } from '#/api';
import { useFormSchema } from '../data';
@ -46,6 +48,9 @@ const [Modal, modalApi] = useVbenModal({
workflowId: workflowId.value,
deptIds,
});
notification.success({
message: '操作成功',
});
emits('success');
modalApi.close();
} finally {
@ -55,7 +60,13 @@ const [Modal, modalApi] = useVbenModal({
async onOpenChange(isOpen) {
if (isOpen) {
workflowId.value = modalApi.getData().id;
const res = await linkDetail(workflowId.value);
const deptIds = res.map((item) => item.deptId);
await getDeptList();
// deptIds
formApi.form.setValues({
deptIds,
});
}
},
});