From d1d582c6fd35c9eccb8bff7a78f08248f48dad58 Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Thu, 28 Sep 2023 23:42:27 +0800 Subject: [PATCH] chore: compose tree --- .../platform/workflow/controller/process.ts | 6 +- .../extension/controller/processCategory.ts | 22 +-- .../extension/entity/processCategory.ts | 6 +- .../Form/src/components/ApiTreeSelect.vue | 53 +++---- .../model/helper/ProcessCategoryModal.vue | 130 ++++++++++++------ src/views/workflow/model/index.vue | 18 ++- 6 files changed, 145 insertions(+), 90 deletions(-) diff --git a/src/api/platform/workflow/controller/process.ts b/src/api/platform/workflow/controller/process.ts index 20e9007..7946a54 100644 --- a/src/api/platform/workflow/controller/process.ts +++ b/src/api/platform/workflow/controller/process.ts @@ -27,11 +27,11 @@ 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 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 = (processDefKeys: string | string[], category: string) => defHttp.put({url: Api.setProcessCategory, params: { processDefKeys, category } }); +export const getFlowChart = (processDefId: string) => defHttp.get({ url: `${Api.getFlowChart}/${processDefId}` }); +export const setProcessCategory = (params?: Recordable) => defHttp.delete({ 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 } }); diff --git a/src/api/platform/workflow/extension/controller/processCategory.ts b/src/api/platform/workflow/extension/controller/processCategory.ts index cd2f7dd..8018e3a 100644 --- a/src/api/platform/workflow/extension/controller/processCategory.ts +++ b/src/api/platform/workflow/extension/controller/processCategory.ts @@ -3,23 +3,23 @@ * Copyright © 2023-2023 海豚生态开源社区 All rights reserved. * author wangxiang4 */ -import { FormCategory, FormCategoryParams, FormCategoryResult } from '/@/api/platform/workflow/extension/entity/formCategory'; +import { ProcessCategory, ProcessCategoryParams, ProcessCategoryResult } from '/@/api/platform/workflow/extension/entity/processCategory'; import { defHttp } from '/@/utils/http/axios'; enum Api { - list = '/workflow_proxy/workflow/extension/formCategory/list', - get = '/workflow_proxy/workflow/extension/formCategory', - save = '/workflow_proxy/workflow/extension/formCategory/save', - edit = '/workflow_proxy/workflow/extension/formCategory/update', - del = '/workflow_proxy/workflow/extension/formCategory/remove', + list = '/workflow_proxy/workflow/extension/category/list', + get = '/workflow_proxy/workflow/extension/category', + save = '/workflow_proxy/workflow/extension/category/save', + edit = '/workflow_proxy/workflow/extension/category/update', + del = '/workflow_proxy/workflow/extension/category/remove', } -export const listFormCategory = (params?: Partial) => defHttp.get({ url: Api.list, params }); +export const listProcessCategory = (params?: Partial) => defHttp.get({ url: Api.list, params }); -export const addFormCategory = (params: Partial)=> defHttp.post({ url: Api.save ,data: params }); +export const addProcessCategory = (params: Partial)=> defHttp.post({ url: Api.save ,data: params }); -export const editFormCategory = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); +export const editProcessCategory = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); -export const getFormCategory = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); +export const getProcessCategory = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); -export const delFormCategory = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); +export const delProcessCategory = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/workflow/extension/entity/processCategory.ts b/src/api/platform/workflow/extension/entity/processCategory.ts index ec1ad15..713e77a 100644 --- a/src/api/platform/workflow/extension/entity/processCategory.ts +++ b/src/api/platform/workflow/extension/entity/processCategory.ts @@ -1,10 +1,10 @@ import type { R } from '/#/axios'; import type { TreeEntity, Page } from '/@/api/common/data/entity'; -export type FormCategoryParams = Page & FormCategory; +export type ProcessCategoryParams = Page & ProcessCategory; -export interface FormCategory extends TreeEntity { +export interface ProcessCategory extends TreeEntity { [key: string]: any; } -export type FormCategoryResult = R; +export type ProcessCategoryResult = R; diff --git a/src/components/Form/src/components/ApiTreeSelect.vue b/src/components/Form/src/components/ApiTreeSelect.vue index 85269ae..1b97457 100644 --- a/src/components/Form/src/components/ApiTreeSelect.vue +++ b/src/components/Form/src/components/ApiTreeSelect.vue @@ -1,5 +1,5 @@ diff --git a/src/views/workflow/model/helper/ProcessCategoryModal.vue b/src/views/workflow/model/helper/ProcessCategoryModal.vue index 8b91f87..2d410eb 100644 --- a/src/views/workflow/model/helper/ProcessCategoryModal.vue +++ b/src/views/workflow/model/helper/ProcessCategoryModal.vue @@ -1,60 +1,102 @@ - diff --git a/src/views/workflow/model/index.vue b/src/views/workflow/model/index.vue index ede2f13..698a54f 100644 --- a/src/views/workflow/model/index.vue +++ b/src/views/workflow/model/index.vue @@ -68,6 +68,7 @@ + @@ -86,6 +87,7 @@ import { columns, searchFormSchema } from './model.data'; import { useMessage } from '/@/hooks/web/useMessage'; import WorkflowModelDesign from './helper/WorkflowModelDesign.vue'; + import ProcessCategoryModal from './helper/ProcessCategoryModal.vue'; interface TableState { ids: string[]; @@ -98,6 +100,7 @@ BasicTable, TableAction, WorkflowModelDesign, + ProcessCategoryModal, }, setup() { const state = reactive({ @@ -110,7 +113,8 @@ }); const { createConfirm, createMessage } = useMessage(); const [registerWorkflowModelDesign , { openModal: openWorkflowModelDesign }] = useModal(); - const [registerTable, { reload, clearSelectedRowKeys }] = useTable({ + const [registerProcessCategory , { openModal: openProcessCategory }] = useModal(); + const [registerTable, { reload, clearSelectedRowKeys, getSelectRows }] = useTable({ api: listModel, rowKey: 'id', columns, @@ -144,8 +148,13 @@ state.multiple = !rowSelection.length; } - function setProcessCategory() { - + function setProcessCategory() { + const row = getSelectRows()[0]; + if (row?.processDefinition) { + openProcessCategory(true,{ id: row.modelKey }); + } else { + createMessage.error('未发布的流程不能设置分类,请先发布流程!'); + } } function handleModelAdd() { @@ -246,7 +255,8 @@ handleCopy, handleProcessActive, handleProcessSuspend, - handleDeploy + handleDeploy, + registerProcessCategory }; } });