2022-01-08 15:42:53 +00:00
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
2022-01-20 12:03:06 +08:00
|
|
|
|
<process-designer
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
:key="`designer-${loadIndex}`"
|
2022-01-28 10:32:46 +08:00
|
|
|
|
:bpmnXml="bpmnXml"
|
|
|
|
|
|
:designerForm="designerForm"
|
2022-01-20 12:03:06 +08:00
|
|
|
|
@save="onSaveFlowEntry"
|
|
|
|
|
|
/>
|
2022-01-08 15:42:53 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-03-03 00:14:03 +08:00
|
|
|
|
import { readXml, saveXml } from "@/api/workflow/definition";
|
2022-01-08 15:42:53 +00:00
|
|
|
|
import ProcessDesigner from '@/components/ProcessDesigner';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'index',
|
|
|
|
|
|
components: { ProcessDesigner },
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
loadIndex: 0,
|
2022-01-20 12:03:06 +08:00
|
|
|
|
loading: false,
|
2022-01-28 10:32:46 +08:00
|
|
|
|
bpmnXml: '',
|
|
|
|
|
|
designerForm: {
|
|
|
|
|
|
definitionId: undefined,
|
|
|
|
|
|
processId: undefined,
|
|
|
|
|
|
processName: undefined,
|
|
|
|
|
|
category: undefined
|
|
|
|
|
|
}
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2022-01-28 10:32:46 +08:00
|
|
|
|
const query = this.$route.query
|
|
|
|
|
|
if (query) {
|
|
|
|
|
|
this.designerForm = query;
|
|
|
|
|
|
// 查询流程xml
|
|
|
|
|
|
if (query.definitionId) {
|
|
|
|
|
|
this.getModelDetail(query.definitionId);
|
|
|
|
|
|
}
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
/** xml 文件 */
|
2022-01-20 12:03:06 +08:00
|
|
|
|
getModelDetail(definitionId) {
|
|
|
|
|
|
this.loading = true;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
// 发送请求,获取xml
|
2022-01-28 10:32:46 +08:00
|
|
|
|
readXml(definitionId).then(res => {
|
|
|
|
|
|
this.bpmnXml = res.data;
|
2022-01-20 12:03:06 +08:00
|
|
|
|
this.loadIndex = definitionId;
|
|
|
|
|
|
this.loading = false;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-01-28 10:32:46 +08:00
|
|
|
|
onSaveFlowEntry (saveData) {
|
|
|
|
|
|
this.bpmnXml = saveData;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
saveXml({
|
2022-01-28 10:32:46 +08:00
|
|
|
|
name: this.designerForm.processName,
|
|
|
|
|
|
category: this.designerForm.category,
|
|
|
|
|
|
xml: this.bpmnXml
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}).then(res => {
|
|
|
|
|
|
this.$message(res.msg)
|
|
|
|
|
|
// 关闭当前标签页并返回上个页面
|
|
|
|
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
|
|
|
this.$router.go(-1)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
</style>
|