update 优化设计器

This commit is contained in:
LiuHao 2024-02-03 23:31:22 +08:00
parent c4e69956a3
commit ff0943e971
2 changed files with 29 additions and 36 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="containers"> <div class="containers">
<el-dialog v-model="visible" width="100%" fullscreen :title="title" @close="closeCallBack" @opened="designOpened"> <el-dialog v-model="visible" width="100%" fullscreen :title="title" @close="emit('closeCallBack')">
<div class="app-containers"> <div class="app-containers">
<el-container class="h-full"> <el-container class="h-full">
<el-container style="align-items: stretch"> <el-container style="align-items: stretch">
@ -68,13 +68,16 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
<el-dialog v-model="perviewXMLShow" title="XML预览" width="80%"> <div class="preview-XML">
<highlightjs :code="xmlStr" language="XML" /> <el-dialog v-model="perviewXMLShow" title="XML预览" width="80%">
</el-dialog> <highlightjs :code="xmlStr" language="XML" />
</el-dialog>
<el-dialog v-model="perviewSVGShow" title="SVG预览" width="80%"> </div>
<div style="text-align: center" v-html="svgData" /> <div>
</el-dialog> <el-dialog v-model="perviewSVGShow" title="SVG预览" width="80%">
<div style="text-align: center" v-html="svgData" />
</el-dialog>
</div>
</template> </template>
<script lang="ts" setup name="BpmnDesign"> <script lang="ts" setup name="BpmnDesign">
@ -91,14 +94,7 @@ import Modules from './assets/module/index';
import useModelerStore from '@/store/modules/modeler'; import useModelerStore from '@/store/modules/modeler';
import useDialog from '@/hooks/useDialog'; import useDialog from '@/hooks/useDialog';
interface PropType { const emit = defineEmits(['closeCallBack', 'saveCallBack']);
closeCallBack?: () => void;
xml?: string;
}
const prop = withDefaults(defineProps<PropType>(), {
closeCallBack: () => {},
xml: defaultXML
});
const { visible, title, openDialog, closeDialog } = useDialog({ const { visible, title, openDialog, closeDialog } = useDialog({
title: '编辑流程' title: '编辑流程'
@ -118,12 +114,6 @@ const perviewSVGShow = ref(false);
const xmlStr = ref(''); const xmlStr = ref('');
const svgData = ref(''); const svgData = ref('');
const designOpened = () => {
// initCanvas();
// initModel();
// initDiagram();
};
const panelBarClick = () => { const panelBarClick = () => {
// //
panelFlag.value = !panelFlag.value; panelFlag.value = !panelFlag.value;
@ -295,6 +285,8 @@ const saveXml = async () => {
console.log(xml); console.log(xml);
console.log(svg); console.log(svg);
console.log(process); console.log(process);
emit('saveCallBack');
}; };
const open = (xml?: string) => { const open = (xml?: string) => {
@ -371,20 +363,23 @@ defineExpose({
} }
.process-toolbar { .process-toolbar {
pre { }
margin: 0; }
height: 100%; .preview-XML {
max-height: calc(80vh - 32px); pre {
overflow-x: hidden; margin: 0;
overflow-y: auto; height: 100%;
:deep(.hljs) { max-height: calc(80vh - 32px);
word-break: break-word; overflow-x: hidden;
white-space: pre-wrap; overflow-y: auto;
padding: 0.5em; :deep(.hljs) {
} word-break: break-word;
white-space: pre-wrap;
padding: 0.5em;
} }
} }
} }
.open-bar { .open-bar {
font-size: 20px; font-size: 20px;
cursor: pointer; cursor: pointer;

View File

@ -99,7 +99,7 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- 设计流程开始 --> <!-- 设计流程开始 -->
<BpmnDesign ref="bpmnDesignRef" :xml="xmlStr"></BpmnDesign> <BpmnDesign ref="bpmnDesignRef"></BpmnDesign>
<!-- 设计流程结束 --> <!-- 设计流程结束 -->
<!-- 添加模型对话框 --> <!-- 添加模型对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="650px" append-to-body :close-on-click-modal="false"> <el-dialog v-model="dialog.visible" :title="dialog.title" width="650px" append-to-body :close-on-click-modal="false">
@ -164,7 +164,6 @@ const modelList = ref<ModelVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref(''); const categoryName = ref('');
const modelId = ref<string>(''); const modelId = ref<string>('');
const xmlStr = ref('');
const dialog = reactive<DialogOption>({ const dialog = reactive<DialogOption>({
visible: false, visible: false,
@ -323,7 +322,6 @@ const reset = () => {
// //
const clickDesign = async (id: string) => { const clickDesign = async (id: string) => {
const res = await getInfo(id); const res = await getInfo(id);
xml.value = res.data.xml;
bpmnDesignRef.value?.open(res.data.xml); bpmnDesignRef.value?.open(res.data.xml);
}; };
// //