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}`"
|
|
|
|
|
|
:flowEntryInfo="formFlowEntryData"
|
|
|
|
|
|
@save="onSaveFlowEntry"
|
|
|
|
|
|
/>
|
2022-01-08 15:42:53 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import {readXml, roleList, saveXml, userList} from "@/api/workflow/definition";
|
|
|
|
|
|
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-08 15:42:53 +00:00
|
|
|
|
formFlowEntryData: {
|
|
|
|
|
|
entryId: undefined,
|
|
|
|
|
|
processDefinitionName: undefined,
|
|
|
|
|
|
processDefinitionKey: undefined,
|
|
|
|
|
|
categoryId: undefined,
|
|
|
|
|
|
bindFormType: [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 0,
|
|
|
|
|
|
name: '动态表单',
|
|
|
|
|
|
symbol: 'ONLINE_FORM'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: '路由表单',
|
|
|
|
|
|
symbol: 'ROUTER_FORM'
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
pageId: undefined,
|
|
|
|
|
|
defaultFormId: undefined,
|
|
|
|
|
|
defaultRouterName: undefined,
|
|
|
|
|
|
bpmnXml: undefined
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2022-01-20 12:03:06 +08:00
|
|
|
|
const definitionId = this.$route.query && this.$route.query.definitionId;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
// 查询流程xml
|
2022-01-20 12:03:06 +08:00
|
|
|
|
if (definitionId) {
|
|
|
|
|
|
this.getModelDetail(definitionId);
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
this.getDicts("sys_process_category").then(res => {
|
|
|
|
|
|
this.categorys = res.data;
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
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-20 12:03:06 +08:00
|
|
|
|
readXml(definitionId).then(res =>{
|
2022-01-08 15:42:53 +00:00
|
|
|
|
this.formFlowEntryData.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
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
onSaveFlowEntry ({ saveData, modeler }) {
|
|
|
|
|
|
this.formFlowEntryData.bpmnXml = saveData;
|
|
|
|
|
|
// TODO 2022/01/05 改进获取流程名称的方式
|
|
|
|
|
|
const process = modeler.get('elementRegistry').find(el => el.type === 'bpmn:Process');
|
|
|
|
|
|
saveXml({
|
|
|
|
|
|
name: process.businessObject.name,
|
2022-01-18 13:16:15 +00:00
|
|
|
|
category: process.businessObject.processCategory,
|
2022-01-08 15:42:53 +00:00
|
|
|
|
xml: this.formFlowEntryData.bpmnXml
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
this.$message(res.msg)
|
|
|
|
|
|
// 关闭当前标签页并返回上个页面
|
|
|
|
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
|
|
|
this.$router.go(-1)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
</style>
|