Skip to content

Commit 7c7fbba

Browse files
authored
Merge pull request #114 from GoldenZqqq/feature/bpm
工作流流程新增/修改/设计页面路由与子组件拆分、样式与逻辑优化bug修复
2 parents 5e38633 + 36157a8 commit 7c7fbba

File tree

9 files changed

+894
-672
lines changed

9 files changed

+894
-672
lines changed

src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ const props = defineProps({
315315
}
316316
})
317317
318+
// 监听value变化,重新加载流程图
319+
watch(() => props.value, (newValue) => {
320+
if (newValue && bpmnModeler) {
321+
createNewDiagram(newValue)
322+
}
323+
}, { immediate: true })
324+
325+
// 监听processId和processName变化
326+
watch([() => props.processId, () => props.processName], ([newId, newName]) => {
327+
if (newId && newName && !props.value) {
328+
createNewDiagram(null)
329+
}
330+
}, { immediate: true })
331+
318332
provide('configGlobal', props)
319333
let bpmnModeler: any = null
320334
const defaultZoom = ref(1)
@@ -666,18 +680,17 @@ const previewProcessJson = () => {
666680
}
667681
/* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */
668682
const processSave = async () => {
669-
// console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler')
670-
const { err, xml } = await bpmnModeler.saveXML()
671-
// console.log(err, 'errerrerrerrerr')
672-
// console.log(xml, 'xmlxmlxmlxmlxml')
673-
// 读取异常时抛出异常
674-
if (err) {
675-
// this.$modal.msgError('保存模型失败,请重试!')
676-
alert('保存模型失败,请重试!')
677-
return
683+
try {
684+
const { err, xml } = await bpmnModeler.saveXML()
685+
if (err) {
686+
ElMessage.error('保存流程设计失败,请重试!')
687+
return
688+
}
689+
emit('save', xml)
690+
} catch (error) {
691+
console.error(error)
692+
ElMessage.error('保存流程设计失败,请重试!')
678693
}
679-
// 触发 save 事件
680-
emit('save', xml)
681694
}
682695
/** 高亮显示 */
683696
// const highlightedCode = (previewType, previewResult) => {

src/router/modules/remaining.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,26 @@ const remainingRouter: AppRouteRecordRaw[] = [
332332
}
333333
},
334334
{
335-
path: 'manager/model/create-update', // TODO @goldenzqqq:是不是拆分成两个,一个 create 创建流程;一个 update 修改流程?
336-
component: () => import('@/views/bpm/model/CreateUpdate.vue'), // TODO @goldenzqqq:是不是放到 '@/views/bpm/model/form/index.vue'。然后,原本的 editor/index.vue 是不是可以清理了呀?
337-
name: 'BpmModelCreateUpdate',
335+
path: 'manager/model/create',
336+
component: () => import('@/views/bpm/model/form/index.vue'),
337+
name: 'BpmModelCreate',
338338
meta: {
339339
noCache: true,
340340
hidden: true,
341341
canTo: true,
342-
title: '创建/修改流程',
342+
title: '创建流程',
343+
activeMenu: '/bpm/manager/model'
344+
}
345+
},
346+
{
347+
path: 'manager/model/update/:id',
348+
component: () => import('@/views/bpm/model/form/index.vue'),
349+
name: 'BpmModelUpdate',
350+
meta: {
351+
noCache: true,
352+
hidden: true,
353+
canTo: true,
354+
title: '修改流程',
343355
activeMenu: '/bpm/manager/model'
344356
}
345357
}

src/views/bpm/model/CategoryDraggableModel.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ const handleChangeState = async (row: any) => {
339339
340340
/** 设计流程 */
341341
const handleDesign = (row: any) => {
342-
// TODO @goldenzqqq:最好使用 name 哈
343-
push(`/bpm/manager/model/create-update?id=${row.id}`)
342+
push({
343+
name: 'BpmModelUpdate',
344+
params: { id: row.id }
345+
})
344346
}
345347
346348
/** 发布流程 */
@@ -483,11 +485,13 @@ const handleDeleteCategory = async () => {
483485
/** 添加流程模型弹窗 */
484486
const modelFormRef = ref()
485487
const openModelForm = (type: string, id?: number) => {
486-
// TODO @goldenzqqq:最好使用 name 哈
487488
if (type === 'create') {
488-
push('/bpm/manager/model/create-update')
489+
push({ name: 'BpmModelCreate' })
489490
} else {
490-
push(`/bpm/manager/model/create-update?id=${id}`)
491+
push({
492+
name: 'BpmModelUpdate',
493+
params: { id }
494+
})
491495
}
492496
}
493497

0 commit comments

Comments
 (0)