From 6b988bd582bfcd17fee48c476a5a6e5cc172b0d5 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期三, 12 三月 2025 10:08:33 +0800 Subject: [PATCH] dev-2 --- src/components/BpmnDesign/index.vue | 71 +++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-) diff --git a/src/components/BpmnDesign/index.vue b/src/components/BpmnDesign/index.vue new file mode 100644 index 0000000..1f84516 --- /dev/null +++ b/src/components/BpmnDesign/index.vue @@ -0,0 +1,71 @@ +<template> + <div class="design"> + <el-dialog v-model="visible" width="100%" fullscreen :title="title"> + <div class="modeler"> + <bpmn-design ref="bpmnDesignRef" @save-call-back="saveCallBack"></bpmn-design> + </div> + </el-dialog> + </div> +</template> + +<script lang="ts" setup name="Design"> +import { getInfo, editModelXml } from '@/api/workflow/model'; + +const { proxy } = getCurrentInstance() as ComponentInternalInstance; + +import { ModelForm } from '@/api/workflow/model/types'; +import BpmnDesign from '@/bpmn/index.vue'; +import useDialog from '@/hooks/useDialog'; +const bpmnDesignRef = ref<InstanceType<typeof BpmnDesign>>(); +const modelForm = ref<ModelForm>(); +const emit = defineEmits(['closeCallBack']); +const { visible, title } = useDialog({ + title: '缂栬緫娴佺▼' +}); +const modelId = ref(''); +const open = async (id) => { + visible.value = true; + modelId.value = id; + const { data } = await getInfo(id); + modelForm.value = data; + bpmnDesignRef.value.initDiagram(modelForm.value.xml); +}; +//淇濆瓨妯″瀷 +const saveCallBack = async (data) => { + await proxy?.$modal.confirm('鏄惁纭淇濆瓨锛�'); + data.loading.value = true; + modelForm.value.id = modelId.value; + modelForm.value.xml = data.xml; + modelForm.value.svg = data.svg; + modelForm.value.key = data.key; + modelForm.value.name = data.name; + editModelXml(modelForm.value).then((res) => { + if (res.code === 200) { + visible.value = false; + proxy?.$modal.msgSuccess('淇濆瓨鎴愬姛'); + emit('closeCallBack', data); + } + }); + data.loading.value = false; +}; + +/** + * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉� + */ +defineExpose({ + open +}); +</script> + +<style lang="scss" scoped> +.design { + :deep(.el-dialog .el-dialog__body) { + max-height: 100% !important; + min-height: calc(100vh - 80px); + padding: 10px 0 10px 0 !important; + } + :deep(.el-dialog__header) { + padding: 0 0 5px 0 !important; + } +} +</style> -- Gitblit v1.9.3