| | |
| | | // 自定义左侧菜单(修改 默认任务 为 用户任务) |
| | | import CustomPaletteProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/palette' |
| | | import * as ModelApi from '@/api/bpm/model' |
| | | import { getForm, FormVO } from '@/api/bpm/form' |
| | | |
| | | defineOptions({ name: 'BpmModelEditor' }) |
| | | |
| | | const router = useRouter() // 路由 |
| | | const { query } = useRoute() // 路由的查询 |
| | | const message = useMessage() // 国际化 |
| | | |
| | | // 表单信息 |
| | | const formFields = ref<string[]>([]) |
| | | const formType = ref(20) |
| | | provide('formFields', formFields) |
| | | provide('formType', formType) |
| | | |
| | | const xmlString = ref(undefined) // BPMN XML |
| | | const modeler = ref(null) // BPMN Modeler |
| | |
| | | } |
| | | |
| | | /** 添加/修改模型 */ |
| | | const save = async (bpmnXml) => { |
| | | const save = async (bpmnXml: string) => { |
| | | const data = { |
| | | ...model.value, |
| | | bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得 |
| | | } as unknown as ModelApi.ModelVO |
| | | // 提交 |
| | | if (data.id) { |
| | | await ModelApi.updateModel(data) |
| | | await ModelApi.updateModelBpmn(data) |
| | | message.success('修改成功') |
| | | } else { |
| | | await ModelApi.createModel(data) |
| | | await ModelApi.updateModelBpmn(data) |
| | | message.success('新增成功') |
| | | } |
| | | // 跳转回去 |
| | |
| | | </bpmndi:BPMNDiagram> |
| | | </definitions>` |
| | | } |
| | | |
| | | formType.value = data.formType |
| | | if (data.formType === 10) { |
| | | const bpmnForm = (await getForm(data.formId)) as unknown as FormVO |
| | | formFields.value = bpmnForm?.fields |
| | | } |
| | | |
| | | model.value = { |
| | | ...data, |
| | | bpmnXml: undefined // 清空 bpmnXml 属性 |