feat(@vben/web-antd): 关联部门功能

- 修改工作流数据,将'update'操作改为'edit'操作
- 实现关联部门功能,添加linkWorkflow API
- 调整工作流列表展示顺序
This commit is contained in:
Kven 2025-06-19 16:39:47 +08:00
parent 3781e6cd47
commit 6910bd28cc
5 changed files with 27 additions and 12 deletions

View File

@ -26,6 +26,10 @@ export namespace WorkflowApi {
keyword?: string;
workflowRunId?: string;
}
export interface WorkflowLinkParams {
workflowId: string;
deptIds: string[];
}
}
// 工作流
@ -49,3 +53,7 @@ export function getWorkflowList(params: WorkflowApi.WorkflowLogParams) {
params,
});
}
export function linkWorkflow(data: WorkflowApi.WorkflowLinkParams) {
return requestClient.post(`/v1/server/link`, data);
}

View File

@ -22,10 +22,12 @@ const itemMessage = ref<ResultItem[]>([]);
const getLogs = async (appid: string, limit: number) => {
loading.value = true;
hitsory.value = await getWorkflowList({
const res = await getWorkflowList({
appid,
limit,
});
// hitsory
hitsory.value = res.reverse();
loading.value = false;
};

View File

@ -68,9 +68,9 @@ export function useColumns(
},
options: [
{
code: 'update',
code: 'edit',
text: '关联部门',
permission: 'workflow:update',
// permission: 'workflow:update',
},
],
},

View File

@ -8,12 +8,12 @@ import { ref } from 'vue';
import { useVbenModal, VbenTree } from '@vben/common-ui';
import { useVbenForm } from '#/adapter/form';
import { getAllDeptTree } from '#/api';
import { getAllDeptTree, linkWorkflow } from '#/api';
import { useFormSchema } from '../data';
const emits = defineEmits(['success']);
const formData = ref<string[]>([]);
const workflowId = ref();
const deptData = ref<DataNode[]>([]);
function convertToTreeNode(item: any): DataNode {
@ -30,18 +30,22 @@ async function getDeptList() {
deptData.value = res.map((item) => convertToTreeNode(item));
}
const [Form] = useVbenForm({
const [Form, formApi] = useVbenForm({
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
// const values = await formApi.getValues();
if (!formData.value) return;
// const values = await formApi;
if (!formApi.form.values.deptIds) return;
const deptIds = formApi.form.values.deptIds;
modalApi.lock();
try {
await linkWorkflow({
workflowId: workflowId.value,
deptIds,
});
emits('success');
modalApi.close();
} finally {
@ -50,6 +54,7 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen) {
if (isOpen) {
workflowId.value = modalApi.getData().id;
await getDeptList();
}
},
@ -69,7 +74,7 @@ function getNodeClass(node: Recordable<any>) {
</script>
<template>
<Modal title="修改工作流">
<Modal title="关联部门">
<Form class="mx-4">
<template #deptIds="slotProps">
<VbenTree

View File

@ -11,8 +11,8 @@ export default defineConfig(async () => {
rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址
// target: 'http://172.16.35.190:9090/api',
// target: 'http://43.139.10.64:8082/api',
target: 'http://localhost:8081/api',
target: 'http://43.139.10.64:8082/api',
// target: 'http://localhost:8081/api',
// target: 'http://192.168.3.238:8081/api',
ws: true,
},