2022-01-01 22:46:54 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
2022-01-03 01:12:36 +08:00
|
|
|
|
<!-- 流程设计器,负责绘制流程等 -->
|
2022-05-28 23:23:13 +08:00
|
|
|
|
<my-process-designer v-if="xmlString !== undefined" :key="`designer-${reloadIndex}`" v-model="xmlString" v-bind="controlForm"
|
2022-01-03 01:12:36 +08:00
|
|
|
|
keyboard ref="processDesigner" @init-finished="initModeler"
|
|
|
|
|
@save="save"/>
|
|
|
|
|
|
|
|
|
|
<!-- 流程属性器,负责编辑每个流程节点的属性 -->
|
|
|
|
|
<my-properties-panel :key="`penal-${reloadIndex}`" :bpmn-modeler="modeler" :prefix="controlForm.prefix" class="process-panel"
|
|
|
|
|
:model="model" />
|
2022-01-01 22:46:54 +08:00
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-01-01 23:12:07 +08:00
|
|
|
|
import translations from "@/components/bpmnProcessDesigner/src/translations";
|
2022-01-01 22:46:54 +08:00
|
|
|
|
// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
|
|
|
|
|
import CustomContentPadProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/content-pad";
|
|
|
|
|
// 自定义左侧菜单(修改 默认任务 为 用户任务)
|
|
|
|
|
import CustomPaletteProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/palette";
|
|
|
|
|
// import xmlObj2json from "./utils/xml2json";
|
|
|
|
|
import MyProcessPalette from "@/components/bpmnProcessDesigner/package/palette/ProcessPalette";
|
2022-01-03 01:12:36 +08:00
|
|
|
|
import {createModel, getModel, updateModel} from "@/api/bpm/model";
|
2022-01-01 22:46:54 +08:00
|
|
|
|
// 自定义侧边栏
|
|
|
|
|
// import MyProcessPanel from "../package/process-panel/ProcessPanel";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "App",
|
|
|
|
|
components: { MyProcessPalette },
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-05-28 23:23:13 +08:00
|
|
|
|
xmlString: undefined, // BPMN XML
|
2022-01-01 22:46:54 +08:00
|
|
|
|
modeler: null,
|
|
|
|
|
reloadIndex: 0,
|
|
|
|
|
controlDrawerVisible: false,
|
|
|
|
|
translationsSelf: translations,
|
|
|
|
|
controlForm: {
|
|
|
|
|
simulation: true,
|
|
|
|
|
labelEditing: false,
|
|
|
|
|
labelVisible: false,
|
2022-03-24 09:45:27 +00:00
|
|
|
|
prefix: "flowable",
|
2022-01-01 22:46:54 +08:00
|
|
|
|
headerButtonSize: "mini",
|
|
|
|
|
additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
|
|
|
|
|
},
|
|
|
|
|
addis: {
|
|
|
|
|
CustomContentPadProvider,
|
|
|
|
|
CustomPaletteProvider
|
2022-01-03 01:12:36 +08:00
|
|
|
|
},
|
|
|
|
|
// 流程模型的信息
|
|
|
|
|
model: {},
|
2022-01-01 22:46:54 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
2022-01-03 01:12:36 +08:00
|
|
|
|
created() {
|
|
|
|
|
// 如果 modelId 非空,说明是修改流程模型
|
|
|
|
|
const modelId = this.$route.query && this.$route.query.modelId
|
|
|
|
|
if (modelId) {
|
|
|
|
|
getModel(modelId).then(response => {
|
|
|
|
|
this.xmlString = response.data.bpmnXml
|
|
|
|
|
this.model = {
|
|
|
|
|
...response.data,
|
|
|
|
|
bpmnXml: undefined, // 清空 bpmnXml 属性
|
|
|
|
|
}
|
2022-01-03 18:46:00 +08:00
|
|
|
|
// this.controlForm.processId = response.data.key
|
2022-01-03 01:12:36 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-01-01 22:46:54 +08:00
|
|
|
|
methods: {
|
|
|
|
|
initModeler(modeler) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.modeler = modeler;
|
|
|
|
|
console.log(modeler);
|
|
|
|
|
}, 10);
|
|
|
|
|
},
|
2022-01-03 01:12:36 +08:00
|
|
|
|
save(bpmnXml) {
|
|
|
|
|
const data = {
|
|
|
|
|
...this.model,
|
|
|
|
|
bpmnXml: bpmnXml, // this.bpmnXml 只是初始化流程图,后续修改无法通过它获得
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改的提交
|
|
|
|
|
if (data.id) {
|
|
|
|
|
updateModel(data).then(response => {
|
2022-02-17 13:11:21 +08:00
|
|
|
|
this.$modal.msgSuccess("修改成功")
|
2022-01-03 01:12:36 +08:00
|
|
|
|
// 跳转回去
|
|
|
|
|
this.close()
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 添加的提交
|
|
|
|
|
createModel(data).then(response => {
|
2022-02-17 13:11:21 +08:00
|
|
|
|
this.$modal.msgSuccess("保存成功")
|
2022-01-03 01:12:36 +08:00
|
|
|
|
// 跳转回去
|
|
|
|
|
this.close()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 关闭按钮 */
|
|
|
|
|
close() {
|
2022-02-17 15:21:46 +08:00
|
|
|
|
this.$tab.closeOpenPage({ path: "/bpm/manager/model" });
|
2022-01-03 01:12:36 +08:00
|
|
|
|
},
|
2022-01-01 22:46:54 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2022-01-02 16:06:40 +08:00
|
|
|
|
//body {
|
|
|
|
|
// overflow: hidden;
|
|
|
|
|
// margin: 0;
|
|
|
|
|
// box-sizing: border-box;
|
|
|
|
|
//}
|
|
|
|
|
//.app {
|
2022-01-01 22:46:54 +08:00
|
|
|
|
// width: 100%;
|
|
|
|
|
// height: 100%;
|
|
|
|
|
// box-sizing: border-box;
|
|
|
|
|
// display: inline-grid;
|
|
|
|
|
// grid-template-columns: 100px auto max-content;
|
|
|
|
|
//}
|
|
|
|
|
.demo-control-bar {
|
|
|
|
|
position: fixed;
|
|
|
|
|
right: 8px;
|
|
|
|
|
bottom: 8px;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
.open-control-dialog {
|
|
|
|
|
width: 48px;
|
|
|
|
|
height: 48px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
background: rgba(64, 158, 255, 1);
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-01 23:12:07 +08:00
|
|
|
|
|
|
|
|
|
// TODO 芋艿:去掉多余的 faq
|
|
|
|
|
//.info-tip {
|
|
|
|
|
// position: fixed;
|
|
|
|
|
// top: 40px;
|
|
|
|
|
// right: 500px;
|
|
|
|
|
// z-index: 10;
|
|
|
|
|
// color: #999999;
|
|
|
|
|
//}
|
|
|
|
|
|
2022-01-01 22:46:54 +08:00
|
|
|
|
.control-form {
|
|
|
|
|
.el-radio {
|
|
|
|
|
width: 100%;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.element-overlays {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
color: #fafafa;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-02 16:06:40 +08:00
|
|
|
|
.my-process-designer {
|
|
|
|
|
height: calc(100vh - 84px);
|
2022-01-01 23:12:07 +08:00
|
|
|
|
}
|
2022-01-09 21:23:59 +08:00
|
|
|
|
.process-panel__container {
|
2022-01-02 16:06:40 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 55px;
|
2022-01-02 16:27:43 +08:00
|
|
|
|
height: calc(100vh - 84px);
|
2022-01-01 23:12:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-01 22:46:54 +08:00
|
|
|
|
</style>
|