将 BPMNJS 全局引入,改成局部引入

This commit is contained in:
YunaiV 2023-04-15 17:28:33 +08:00 committed by shizhong
parent 8542bd8025
commit f9c2850d6b
7 changed files with 17 additions and 49 deletions

View File

@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=false
VITE_SOURCEMAP=true VITE_SOURCEMAP=true
# 打包路径 # 打包路径
VITE_BASE_PATH=/dist-test/ VITE_BASE_PATH=/
# 输出路径 # 输出路径
VITE_OUT_DIR=dist-test VITE_OUT_DIR=dist-test

View File

@ -1,37 +1,11 @@
import { App } from 'vue'
import MyProcessDesigner from './designer' import MyProcessDesigner from './designer'
import MyProcessPenal from './penal' import MyProcessPenal from './penal'
import MyProcessViewer from './designer/index2' import MyProcessViewer from './designer/index2'
const components = [MyProcessDesigner, MyProcessPenal, MyProcessViewer] import './theme/index.scss'
import 'bpmn-js/dist/assets/diagram-js.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
// const install = function (Vue) { export { MyProcessDesigner, MyProcessPenal, MyProcessViewer }
// components.forEach(component => {
// Vue.component(component.name, component)
// })
// }
// if (typeof window !== "undefined" && window.Vue) {
// install(window.Vue)
// }
// components.forEach(component => {
// Vue.component(component.name, component)
// })
const componentss = {
install: (Vue: App): void => {
components.forEach((component) => {
Vue.component(component.name, component)
})
}
}
// let version = "0.0.1"
export const MyPD = (app) => {
// export default {
// app.use(version)
// app.use(install)
// app.use(MyProcessDesigner)
// app.use(MyProcessPenal)
// app.use(MyProcessViewer)
// app.use(components)
app.use(componentss)
}

View File

@ -40,13 +40,6 @@ import App from './App.vue'
import './permission' import './permission'
import { MyPD } from '@/components/bpmnProcessDesigner/package/index.js'
import '@/components/bpmnProcessDesigner/package/theme/index.scss'
import 'bpmn-js/dist/assets/diagram-js.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
import hljs from 'highlight.js' //导入代码高亮文件 import hljs from 'highlight.js' //导入代码高亮文件
import 'highlight.js/styles/github.css' //导入代码高亮样式 新版 import 'highlight.js/styles/github.css' //导入代码高亮样式 新版
@ -66,8 +59,6 @@ const setupAll = async () => {
await setupI18n(app) await setupI18n(app)
MyPD(app)
setupStore(app) setupStore(app)
setupGlobCom(app) setupGlobCom(app)

View File

@ -49,7 +49,7 @@
</XModal> </XModal>
<!-- 流程模型图的预览 --> <!-- 流程模型图的预览 -->
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%"> <XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
<my-process-viewer <MyProcessViewer
key="designer" key="designer"
v-model="bpmnXML" v-model="bpmnXML"
:value="bpmnXML" :value="bpmnXML"
@ -66,6 +66,7 @@ import * as DefinitionApi from '@/api/bpm/definition'
import { allSchemas } from './definition.data' import { allSchemas } from './definition.data'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
const bpmnXML = ref(null) const bpmnXML = ref(null)
const showBpmnOpen = ref(false) const showBpmnOpen = ref(false)

View File

@ -305,7 +305,7 @@
<!-- 流程模型图的预览 --> <!-- 流程模型图的预览 -->
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%"> <XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
<my-process-viewer <MyProcessViewer
key="designer" key="designer"
v-model="bpmnXML" v-model="bpmnXML"
:value="bpmnXML" :value="bpmnXML"
@ -319,6 +319,7 @@
<script setup lang="ts"> <script setup lang="ts">
// import // import
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
import { FormInstance, UploadInstance } from 'element-plus' import { FormInstance, UploadInstance } from 'element-plus'
// import // import

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<!-- 流程设计器负责绘制流程等 --> <!-- 流程设计器负责绘制流程等 -->
<!-- <myProcessDesigner --> <!-- <myProcessDesigner -->
<my-process-designer <MyProcessDesigner
:key="`designer-${reloadIndex}`" :key="`designer-${reloadIndex}`"
v-if="xmlString !== undefined" v-if="xmlString !== undefined"
v-model="xmlString" v-model="xmlString"
@ -16,7 +16,7 @@
/> />
<!-- 流程属性器负责编辑每个流程节点的属性 --> <!-- 流程属性器负责编辑每个流程节点的属性 -->
<!-- <MyProcessPalette --> <!-- <MyProcessPalette -->
<my-properties-panel <MyProcessPenal
:key="`penal-${reloadIndex}`" :key="`penal-${reloadIndex}`"
:bpmnModeler="modeler" :bpmnModeler="modeler"
:prefix="controlForm.prefix" :prefix="controlForm.prefix"
@ -27,7 +27,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
// import { translations } from '@/components/bpmnProcessDesigner/src/translations' import { MyProcessDesigner, MyProcessPenal } from '@/components/bpmnProcessDesigner/package'
// import { translations } from '@/components/bpmnProcessDesigner/src/translations'
// //
import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad' import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad'
// //

View File

@ -3,7 +3,7 @@
<template #header> <template #header>
<span class="el-icon-picture-outline">流程图</span> <span class="el-icon-picture-outline">流程图</span>
</template> </template>
<my-process-viewer <MyProcessViewer
key="designer" key="designer"
:value="bpmnXml" :value="bpmnXml"
v-bind="bpmnControlForm" v-bind="bpmnControlForm"
@ -17,7 +17,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import * as ActivityApi from '@/api/bpm/activity' import * as ActivityApi from '@/api/bpm/activity'
// import * as DefinitionApi from '@/api/bpm/definition' import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
const props = defineProps({ const props = defineProps({
loading: propTypes.bool, // loading: propTypes.bool, //