diff --git a/apps/web-antd/src/router/routes/modules/bpm.ts b/apps/web-antd/src/router/routes/modules/bpm.ts index 8773271bc..0287c1749 100644 --- a/apps/web-antd/src/router/routes/modules/bpm.ts +++ b/apps/web-antd/src/router/routes/modules/bpm.ts @@ -74,6 +74,18 @@ const routes: RouteRecordRaw[] = [ keepAlive: true, }, }, + { + path: 'manager/model/:type/:id', + component: () => import('#/views/bpm/model/form/index.vue'), + name: 'BpmModelUpdate', + meta: { + title: '修改流程', + activePath: '/bpm/manager/model', + icon: 'carbon:flow-connection', + hideInMenu: true, + keepAlive: true, + }, + }, ], }, ]; diff --git a/apps/web-antd/src/views/bpm/model/form/index.vue b/apps/web-antd/src/views/bpm/model/form/index.vue index 53f6251d9..8f9f79b3b 100644 --- a/apps/web-antd/src/views/bpm/model/form/index.vue +++ b/apps/web-antd/src/views/bpm/model/form/index.vue @@ -305,7 +305,7 @@ async function handleSave() { // 返回列表页(排除更新的情况) if (actionType !== 'update') { - await router.push({ name: 'BpmModel' }); + router.push({ path: '/bpm/manager/model' }); } } catch (error: any) { console.error('保存失败:', error); @@ -339,8 +339,7 @@ async function handleDeploy() { // 发布 await deployModel(formData.value.id); message.success('发布成功'); - // TODO 返回列表页 - await router.push({ name: 'BpmModel' }); + await router.push({ path: '/bpm/manager/model' }); } catch (error: any) { console.error('发布失败:', error); message.warning(error.message || '发布失败'); @@ -398,9 +397,11 @@ onBeforeUnmount(() => { diff --git a/apps/web-antd/src/views/bpm/model/form/modules/basic-info.vue b/apps/web-antd/src/views/bpm/model/form/modules/basic-info.vue index 52e3fc3d3..5ec5a0802 100644 --- a/apps/web-antd/src/views/bpm/model/form/modules/basic-info.vue +++ b/apps/web-antd/src/views/bpm/model/form/modules/basic-info.vue @@ -326,12 +326,12 @@ defineExpose({ validate });
{{ user.nickname }}
@@ -364,17 +364,17 @@ defineExpose({ validate });
{{ dept.name }}
@@ -395,7 +395,7 @@ defineExpose({ validate });
{{ user.nickname }}
diff --git a/apps/web-antd/src/views/bpm/model/form/modules/form-design.vue b/apps/web-antd/src/views/bpm/model/form/modules/form-design.vue index 71569e28e..6737e8f6f 100644 --- a/apps/web-antd/src/views/bpm/model/form/modules/form-design.vue +++ b/apps/web-antd/src/views/bpm/model/form/modules/form-design.vue @@ -91,8 +91,8 @@ defineExpose({ validate }); ref="formRef" :model="modelData" :rules="rules" - :label-col="{ span: 4 }" - :wrapper-col="{ span: 20 }" + :label-col="{ span: 3 }" + :wrapper-col="{ span: 21 }" class="mt-5" > diff --git a/apps/web-antd/src/views/bpm/model/index.vue b/apps/web-antd/src/views/bpm/model/index.vue index 22c66a1ed..10392b7a6 100644 --- a/apps/web-antd/src/views/bpm/model/index.vue +++ b/apps/web-antd/src/views/bpm/model/index.vue @@ -152,7 +152,7 @@ async function handleCategorySortSubmit() { diff --git a/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue b/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue index feb8ed05f..bd0ef836f 100644 --- a/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue +++ b/apps/web-antd/src/views/bpm/model/modules/category-draggable-model.vue @@ -2,9 +2,11 @@ import type { BpmModelApi, ModelCategoryInfo } from '#/api/bpm/model'; import { computed, ref, watchEffect } from 'vue'; +import { useRouter } from 'vue-router'; import { confirm, useVbenModal } from '@vben/common-ui'; import { IconifyIcon } from '@vben/icons'; +import { useUserStore } from '@vben/stores'; import { cloneDeep, formatDateTime, isEqual } from '@vben/utils'; import { useDebounceFn } from '@vueuse/core'; @@ -22,7 +24,7 @@ import { } from 'ant-design-vue'; import { deleteCategory } from '#/api/bpm/category'; -import { updateModelSortBatch } from '#/api/bpm/model'; +import { deployModel, updateModelSortBatch } from '#/api/bpm/model'; import { DictTag } from '#/components/dict-tag'; import { $t } from '#/locales'; import { DICT_TYPE } from '#/utils'; @@ -43,6 +45,10 @@ const [CategoryRenameModal, categoryRenameModalApi] = useVbenModal({ destroyOnClose: true, }); +const router = useRouter(); +// 获取当前登录用户Id +const userStore = useUserStore(); +const userId = userStore.userInfo?.id; const isModelSorting = ref(false); const originalData = ref([]); const modelList = ref([]); @@ -62,7 +68,7 @@ const columns = [ key: 'name', align: 'left' as const, ellipsis: true, - width: 250, + width: 230, }, { title: '可见范围', @@ -78,7 +84,7 @@ const columns = [ key: 'type', align: 'center' as const, ellipsis: true, - width: 120, + width: 150, }, { title: '表单信息', @@ -185,6 +191,68 @@ function handleFormDetail(row: any) { console.warn('待实现', row); } +/** 判断是否是流程管理员 */ +function isManagerUser(row: any) { + return row.managerUserIds && row.managerUserIds.includes(userId); +} + +async function modelOperation(type: string, id: number) { + await router.push({ + name: 'BpmModelUpdate', + params: { id, type }, + }); +} + +/** 发布流程 */ +async function handleDeploy(row: any) { + confirm({ + beforeClose: async ({ isConfirm }) => { + if (!isConfirm) return; + // 发起部署 + await deployModel(row.id); + return true; + }, + content: `确认要发布[${row.name}]流程吗?`, + icon: 'question', + }).then(async () => { + message.success(`发布[${row.name}]流程成功`); + // 刷新列表 + emit('success'); + }); +} + +/** '更多'操作按钮 */ +function handleModelCommand(command: string, row: any) { + switch (command) { + case 'handleChangeState': { + console.warn('停用/启用待实现', row); + break; + } + case 'handleClean': { + console.warn('清理待实现', row); + break; + } + case 'handleCopy': { + modelOperation('copy', row.id); + break; + } + case 'handleDefinitionList': { + console.warn('历史待实现', row); + break; + } + case 'handleDelete': { + console.warn('删除待实现', row); + break; + } + case 'handleReport': { + console.warn('报表待实现', row); + break; + } + default: { + break; + } + } +} /** 更新 modelList 模型列表 */ const updateModelList = useDebounceFn(() => { const newModelList = props.categoryInfo.modelList; @@ -450,7 +518,72 @@ const handleRenameSuccess = () => {