diff --git a/src/api/platform/workflow/controller/process.ts b/src/api/platform/workflow/controller/process.ts index f9e40e6..af48646 100644 --- a/src/api/platform/workflow/controller/process.ts +++ b/src/api/platform/workflow/controller/process.ts @@ -27,17 +27,31 @@ enum Api { } export const listProcessDef = (params?: Recordable) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); + export const exist = (processDefKey: string) => defHttp.get({ url: `${Api.exist}/${processDefKey}` }); + export const listProcessRun = (params?: Recordable) => defHttp.get({ url: Api.runList, params }, { isReturnResultResponse: true }); + export const listProcessHistory = (params?: Recordable) => defHttp.get({ url: Api.historyList, params }, { isReturnResultResponse: true }); + export const getFlowChart = (processDefId: string) => defHttp.get({ url: `${Api.getFlowChart}/${processDefId}` }); + export const setProcessCategory = (params?: Recordable) => defHttp.put({ url: Api.setProcessCategory, params }); + export const setProcessInstanceStatus = (processDefKeys: string | string[], status: string) => defHttp.put({url: Api.setProcessInstanceStatus, params: { processDefKeys, status } }); + export const removeDeployment = (ids: string) => defHttp.delete({ url: `${Api.removeDeployment}/${ids}` }); + export const removeProcessInstance = (processDefKeys: string | string[], reason: string) => defHttp.delete({url: Api.removeProcessInstance, params: { processDefKeys, reason } }); + export const undoProcessInstance = (processInsId: string) => defHttp.put({ url: `${Api.undoProcessInstance}/${processInsId}` }); + export const stopProcessInstance = (processInsId: string, message: string) => defHttp.put({ url: Api.stopProcessInstance, params: { processInsId, message } }); + export const queryProcessStatus = (processInsId: string) => defHttp.get({ url: `${Api.queryProcessStatus}/${processInsId}`} ); + export const selfProcessInstanceList = (params: Recordable) => defHttp.get({ url: Api.selfProcessInstanceList, params }); + export const startProcessDefinition = (workflow: Workflow) => defHttp.post({ url: Api.startProcessDefinition, data: workflow }); + export const removeHistoryProcessIns = (ids: string) => defHttp.delete({ url: `${Api.removeHistoryProcessIns}${ids}` }); diff --git a/src/components/Tree/src/BasicTree.vue b/src/components/Tree/src/BasicTree.vue index f9df902..4986c01 100644 --- a/src/components/Tree/src/BasicTree.vue +++ b/src/components/Tree/src/BasicTree.vue @@ -129,7 +129,7 @@ getSelectedNode, } = useTree(treeDataRef, getFieldNames); - function getIcon(params: Recordable, icon?: string) { + function getIcon(params: TreeItem, icon?: string) { if (!icon) { if (props.renderIcon && isFunction(props.renderIcon)) { return props.renderIcon(params); @@ -278,11 +278,14 @@ onMounted(() => { const level = parseInt(props.defaultExpandLevel); - if (level > 0) { - state.expandedKeys = filterByLevel(level); - } else if (props.defaultExpandAll) { - expandAll(true); - } + // fix: 修复Tree组件defaultExpandAll配置失效,数据初始化太慢 + setTimeout(() => { + if (level > 0) { + state.expandedKeys = filterByLevel(level); + } else if (props.defaultExpandAll) { + expandAll(true); + } + }, 200); }); watchEffect(() => { diff --git a/src/components/Tree/src/TreeIcon.ts b/src/components/Tree/src/TreeIcon.ts index 900d6bf..431a6eb 100644 --- a/src/components/Tree/src/TreeIcon.ts +++ b/src/components/Tree/src/TreeIcon.ts @@ -1,5 +1,4 @@ import type { VNode, FunctionalComponent } from 'vue'; - import { h } from 'vue'; import { isString } from '@vue/shared'; import { Icon } from '/@/components/Icon'; diff --git a/src/components/Tree/src/hooks/useTree.ts b/src/components/Tree/src/hooks/useTree.ts index d0e176c..6bd0539 100644 --- a/src/components/Tree/src/hooks/useTree.ts +++ b/src/components/Tree/src/hooks/useTree.ts @@ -141,6 +141,8 @@ export function useTree(treeDataRef: Ref, getFieldNames: Compute for (let i = 0; i < list.length; i++) { treeData[push](list[i]); } + treeDataRef.value = treeData; + return; } else { const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return; @@ -178,9 +180,9 @@ export function useTree(treeDataRef: Ref, getFieldNames: Compute } // Get selected node - function getSelectedNode(key: KeyType, treeList?: TreeItem[], selectedNode?: TreeItem | null) { + function getSelectedNode(key: KeyType, list?: TreeItem[], selectedNode?: TreeItem | null) { if (!key && key !== 0) return null; - const treeData = treeList || unref(treeDataRef); + const treeData = list || unref(treeDataRef); const { key: keyField, children: childrenField } = unref(getFieldNames); if (!keyField) return; treeData.forEach((item) => { diff --git a/src/components/Tree/src/types/tree.ts b/src/components/Tree/src/types/tree.ts index 815cce9..994434b 100644 --- a/src/components/Tree/src/types/tree.ts +++ b/src/components/Tree/src/types/tree.ts @@ -191,5 +191,5 @@ export interface TreeActionType { key: KeyType, treeList?: TreeItem[], selectNode?: TreeItem | null, - ) => TreeItem | null | undefined; + ) => TreeItem | null; } diff --git a/src/views/workflow/process/index.vue b/src/views/workflow/process/index.vue new file mode 100644 index 0000000..b4da507 --- /dev/null +++ b/src/views/workflow/process/index.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/views/workflow/process/process.data.ts b/src/views/workflow/process/process.data.ts new file mode 100644 index 0000000..b4b1d84 --- /dev/null +++ b/src/views/workflow/process/process.data.ts @@ -0,0 +1,68 @@ +import { BasicColumn, FormSchema } from '/@/components/Table'; +import { h } from 'vue'; +import { Tag } from 'ant-design-vue'; +import { listProcessCategory } from '/@/api/platform/workflow/extension/controller/processCategory'; + +export const columns: BasicColumn[] = [ + { + title: '流程名称', + dataIndex: 'name', + width: 200, + }, + { + title: '流程KEY', + dataIndex: 'key', + width: 200, + }, + { + title: '流程分类', + dataIndex: 'category', + width: 150, + customRender: ({ record }) => { + const category = record.category; + return h(Tag, { color: 'processing' }, () => String(record.category).split(',')[1] || '未分类'); + } + }, + { + title: '流程版本', + dataIndex: 'version', + width: 150, + customRender: ({ record }) => { + const version = record.version; + return h(Tag, { color: version ? 'success' : 'warning' }, () => version || '版本未发布'); + } + }, + { + title: '上次发布时间', + dataIndex: 'deploymentTime', + width: 200 + } +]; + +export const searchFormSchema: FormSchema[] = [ + { + field: 'categoryId', + label: '流程分类', + component: 'ApiTreeSelect', + componentProps: { + placeholder: '请选择流程分类', + fieldNames:{ + label: 'name', + key: 'id', + value: 'id' + }, + api: listProcessCategory, + listToTree: true + }, + colProps: { span: 8 } + }, + { + field: 'name', + label: '流程名称', + component: 'Input', + componentProps: { + placeholder: '请输入流程名称' + }, + colProps: { span: 8 } + } +];