diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index f0ce322e..22a0c3e5 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -330,6 +330,18 @@ const remainingRouter: AppRouteRecordRaw[] = [ title: '查看 OA 请假', activeMenu: '/bpm/oa/leave' } + }, + { + path: 'manager/model/create-update', + component: () => import('@/views/bpm/model/CreateUpdate.vue'), + name: 'BpmModelCreateUpdate', + meta: { + noCache: true, + hidden: true, + canTo: true, + title: '创建/修改流程', + activeMenu: '/bpm/manager/model' + } } ] }, diff --git a/src/views/bpm/model/CategoryDraggableModel.vue b/src/views/bpm/model/CategoryDraggableModel.vue index 35465935..f01c7d18 100644 --- a/src/views/bpm/model/CategoryDraggableModel.vue +++ b/src/views/bpm/model/CategoryDraggableModel.vue @@ -339,21 +339,22 @@ const handleChangeState = async (row: any) => { /** 设计流程 */ const handleDesign = (row: any) => { - if (row.type == BpmModelType.BPMN) { - push({ - name: 'BpmModelEditor', - query: { - modelId: row.id - } - }) - } else { - push({ - name: 'SimpleModelDesign', - query: { - modelId: row.id - } - }) - } + // if (row.type == BpmModelType.BPMN) { + // push({ + // name: 'BpmModelEditor', + // query: { + // modelId: row.id + // } + // }) + // } else { + // push({ + // name: 'SimpleModelDesign', + // query: { + // modelId: row.id + // } + // }) + // } + push(`/bpm/manager/model/create-update?id=${row.id}`) } /** 发布流程 */ @@ -496,7 +497,11 @@ const handleDeleteCategory = async () => { /** 添加流程模型弹窗 */ const modelFormRef = ref() const openModelForm = (type: string, id?: number) => { - modelFormRef.value.open(type, id) + if (type === 'create') { + push('/bpm/manager/model/create-update') + } else { + push(`/bpm/manager/model/create-update?id=${id}`) + } } watch(() => props.categoryInfo.modelList, updateModeList, { immediate: true }) diff --git a/src/views/bpm/model/CreateUpdate.vue b/src/views/bpm/model/CreateUpdate.vue new file mode 100644 index 00000000..c412d9d0 --- /dev/null +++ b/src/views/bpm/model/CreateUpdate.vue @@ -0,0 +1,582 @@ + + + + + + {{ formData.name || '创建流程' }} + + + + + + + {{ index + 1 }} + + {{ step.title }} + + + + + + 保 存 + 发 布 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + + {{ dict.label }} + + + + + + + + + + + + + + {{ user.nickname.substring(0, 1) }} + + {{ user.nickname }} + + + + 选择人员 + + + + + + + + + + + + + + {{ user.nickname.substring(0, 1) }} + + {{ user.nickname }} + + + + 选择人员 + + + + + + + + + + + + + {{ dict.label }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/bpm/model/editor/index.vue b/src/views/bpm/model/editor/index.vue index 3e773691..232f2bff 100644 --- a/src/views/bpm/model/editor/index.vue +++ b/src/views/bpm/model/editor/index.vue @@ -34,6 +34,10 @@ import * as ModelApi from '@/api/bpm/model' defineOptions({ name: 'BpmModelEditor' }) +const props = defineProps<{ + modelId: string +}>() +const emit = defineEmits(['success']) const router = useRouter() // 路由 const { query } = useRoute() // 路由的查询 const message = useMessage() // 国际化 @@ -59,36 +63,28 @@ const initModeler = (item) => { /** 添加/修改模型 */ const save = async (bpmnXml: string) => { - const data = { - ...model.value, - bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得 - } as unknown as ModelApi.ModelVO - // 提交 - if (data.id) { + try { + const data = { + ...model.value, + bpmnXml: bpmnXml + } as unknown as ModelApi.ModelVO + // 提交 await ModelApi.updateModelBpmn(data) - message.success('修改成功') - } else { - await ModelApi.updateModelBpmn(data) - message.success('新增成功') + emit('success') + } catch (error) { + console.error('保存失败:', error) + message.error('保存失败') } - // 跳转回去 - close() -} - -/** 关闭按钮 */ -const close = () => { - router.push({ path: '/bpm/manager/model' }) } /** 初始化 */ onMounted(async () => { - const modelId = query.modelId as unknown as number - if (!modelId) { + if (!props.modelId) { message.error('缺少模型 modelId 编号') return } // 查询模型 - const data = await ModelApi.getModel(modelId) + const data = await ModelApi.getModel(String(props.modelId)) if (!data.bpmnXml) { // 首次创建的 Model 模型,它是没有 bpmnXml,此时需要给它一个默认的 data.bpmnXml = ` diff --git a/src/views/bpm/model/index.vue b/src/views/bpm/model/index.vue index bf43d292..d779a9f2 100644 --- a/src/views/bpm/model/index.vue +++ b/src/views/bpm/model/index.vue @@ -106,6 +106,7 @@ import CategoryDraggableModel from './CategoryDraggableModel.vue' defineOptions({ name: 'BpmModel' }) +const { push } = useRouter() const message = useMessage() // 消息弹窗 const loading = ref(true) // 列表的加载中 const isCategorySorting = ref(false) // 是否 category 正处于排序状态 @@ -124,7 +125,11 @@ const handleQuery = () => { /** 添加/修改操作 */ const formRef = ref() const openForm = (type: string, id?: number) => { - formRef.value.open(type, id) + if (type === 'create') { + push('/bpm/manager/model/create-update') + } else { + push(`/bpm/manager/model/create-update?id=${id}`) + } } /** 流程表单的详情按钮操作 */ diff --git a/src/views/bpm/simple/SimpleModelDesign.vue b/src/views/bpm/simple/SimpleModelDesign.vue index 1740e03f..5029ad0f 100644 --- a/src/views/bpm/simple/SimpleModelDesign.vue +++ b/src/views/bpm/simple/SimpleModelDesign.vue @@ -1,6 +1,6 @@ - +