|
@@ -1,10 +1,10 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <!-- <el-button type="primary" @click="showData">测试</el-button> -->
|
|
|
|
|
|
|
+ <!-- <el-button type="primary" @click="saveFlow">测试</el-button> -->
|
|
|
<div style="display: flex;margin-left: 1%;padding-top: 1%;position: absolute;z-index: 1000;cursor: pointer;justify-content: space-between;width: 98%;">
|
|
<div style="display: flex;margin-left: 1%;padding-top: 1%;position: absolute;z-index: 1000;cursor: pointer;justify-content: space-between;width: 98%;">
|
|
|
<el-icon size="large" @click="back"><Back /></el-icon>
|
|
<el-icon size="large" @click="back"><Back /></el-icon>
|
|
|
<el-button style="margin-left: auto;" type="danger" size="mini">删除</el-button>
|
|
<el-button style="margin-left: auto;" type="danger" size="mini">删除</el-button>
|
|
|
- <el-button style="margin-left: 1%;" type="primary" size="mini" @click="showData">保存</el-button>
|
|
|
|
|
|
|
+ <el-button style="margin-left: 1%;" type="primary" size="mini" @click="saveFlow">保存</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="nodeDeSer" style="height: 85vh;width: 20vw;position: absolute;float: right;z-index: 1000;right: 1%;top: 1%;border: 0.1px solid #dedfe0;border-radius: 6px;background-color: white;">
|
|
<div v-if="nodeDeSer" style="height: 85vh;width: 20vw;position: absolute;float: right;z-index: 1000;right: 1%;top: 1%;border: 0.1px solid #dedfe0;border-radius: 6px;background-color: white;">
|
|
|
<div style="display: flex;margin-left: 3%;margin-top: 3%;align-items: center;justify-content: space-between;width: 95%;">
|
|
<div style="display: flex;margin-left: 3%;margin-top: 3%;align-items: center;justify-content: space-between;width: 95%;">
|
|
@@ -67,7 +67,14 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div style="display: flex;height: 85vh;width: 100%;padding-top:2%;">
|
|
<div style="display: flex;height: 85vh;width: 100%;padding-top:2%;">
|
|
|
<div style="width: 20%;margin-left: 1%;overflow-y: auto;">
|
|
<div style="width: 20%;margin-left: 1%;overflow-y: auto;">
|
|
|
- <el-tree :expand-on-click-node="false" ref="treeRef" :filter-node-method="filterNode" :current-node-key="currentNodeKey" class="treeLeft" :data="dataTree" @node-click="handleNodeClick" node-key="id" style="margin-left: 5%;margin-top: 5%;width: 90%;background-color: transparent;" default-expand-all :key="valueKet">
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="inputNode"
|
|
|
|
|
+ style="width:90%;margin-left: 5%;background-color: #ebeef5;margin-top: 1%;"
|
|
|
|
|
+ class="w-50 m-2"
|
|
|
|
|
+ :prefix-icon="Search"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-tree :expand-on-click-node="false" ref="treeRef" :filter-node-method="filterNode" :current-node-key="currentNodeKey" class="treeLeft" :data="dataTree"
|
|
|
|
|
+ @node-click="handleNodeClick" node-key="id" style="margin-left: 5%;margin-top: 2%;width: 90%;background-color: transparent;" default-expand-all :key="valueKet">
|
|
|
<template #default="{ node, data }">
|
|
<template #default="{ node, data }">
|
|
|
<span style="justify-content: space-between;display: flex;width: 100%;align-items: center;">
|
|
<span style="justify-content: space-between;display: flex;width: 100%;align-items: center;">
|
|
|
<div class="custom-tree-node":draggable="true"
|
|
<div class="custom-tree-node":draggable="true"
|
|
@@ -85,7 +92,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-tree>
|
|
</el-tree>
|
|
|
</div>
|
|
</div>
|
|
|
- <VueFlow :nodes="nodes" :edges="edges" @drop="onDrop" @dragover="onDragOver" @dragleave="onDragLeave"
|
|
|
|
|
|
|
+ <VueFlow :nodes="nodes" :viewport="zoom" :edges="edges" @drop="onDrop" @dragover="onDragOver" @dragleave="onDragLeave"
|
|
|
@node-click="onNodeClick" @connect="onConnect" fit-view-on-init>
|
|
@node-click="onNodeClick" @connect="onConnect" fit-view-on-init>
|
|
|
<template #node-special="specialNodeProps">
|
|
<template #node-special="specialNodeProps">
|
|
|
<div v-if="specialNodeProps.data.label=='开始'" class="vue-flow__node-default" style="border: 0.2px solid #c8c9cc;border-radius: 6px;min-height: 6vh;min-width: 11vw">
|
|
<div v-if="specialNodeProps.data.label=='开始'" class="vue-flow__node-default" style="border: 0.2px solid #c8c9cc;border-radius: 6px;min-height: 6vh;min-width: 11vw">
|
|
@@ -118,8 +125,7 @@
|
|
|
{{ specialNodeProps.data.label }}
|
|
{{ specialNodeProps.data.label }}
|
|
|
</div>
|
|
</div>
|
|
|
<el-icon style="cursor: pointer;margin-left: auto;"><CaretRight /></el-icon>
|
|
<el-icon style="cursor: pointer;margin-left: auto;"><CaretRight /></el-icon>
|
|
|
- <el-icon style="cursor: pointer;color: #F56C6C;margin-left: 2%;"><Delete /></el-icon>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-icon @click.stop="delNode(specialNodeProps.data)" style="cursor: pointer;color: #F56C6C;margin-left: 2%;"><Delete /></el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div style="display: flex;margin-top: 3%;">
|
|
<div style="display: flex;margin-top: 3%;">
|
|
|
<el-tag class="ml-2" style="width: 35px;height: 20px;font-size: 10px;" type="warning">服务</el-tag>
|
|
<el-tag class="ml-2" style="width: 35px;height: 20px;font-size: 10px;" type="warning">服务</el-tag>
|
|
@@ -152,6 +158,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
|
|
+import { Plus,Search } from '@element-plus/icons-vue'
|
|
|
import DynamicMap from '@/components/DynamicMap/index.vue'
|
|
import DynamicMap from '@/components/DynamicMap/index.vue'
|
|
|
import {Promotion} from '@element-plus/icons-vue'
|
|
import {Promotion} from '@element-plus/icons-vue'
|
|
|
import { onMounted, ref } from 'vue'
|
|
import { onMounted, ref } from 'vue'
|
|
@@ -161,7 +168,7 @@ import SpecialEdge from './components/SpecialEdge.vue'
|
|
|
import {getPtServiceList,getSerDe} from "@/api/service/info.js";
|
|
import {getPtServiceList,getSerDe} from "@/api/service/info.js";
|
|
|
import {getModelList2} from "@/api/register/regCom.js";
|
|
import {getModelList2} from "@/api/register/regCom.js";
|
|
|
import {copyObject} from "@/utils/index.js";
|
|
import {copyObject} from "@/utils/index.js";
|
|
|
-import {getWorkflowByModelId, saveWorkflow} from "@/api/standardization/workflow.js";
|
|
|
|
|
|
|
+import {getModelingDe,addModelingFlow,editModelingFlow} from "@/api/standardization/modeling.js";
|
|
|
import { useStore } from 'vuex';
|
|
import { useStore } from 'vuex';
|
|
|
import {Handle, Position} from '@vue-flow/core'
|
|
import {Handle, Position} from '@vue-flow/core'
|
|
|
import { computed } from 'vue';
|
|
import { computed } from 'vue';
|
|
@@ -176,15 +183,21 @@ const {
|
|
|
updateNode,
|
|
updateNode,
|
|
|
onNodeClick,
|
|
onNodeClick,
|
|
|
getNodes,
|
|
getNodes,
|
|
|
|
|
+ zoomTo,
|
|
|
toObject,
|
|
toObject,
|
|
|
getEdges,
|
|
getEdges,
|
|
|
} = useVueFlow()
|
|
} = useVueFlow()
|
|
|
snapToGrid.value = true
|
|
snapToGrid.value = true
|
|
|
|
|
+const zoom = ref();
|
|
|
|
|
+const inputNode = ref('');
|
|
|
|
|
+const treeRef = ref(null);
|
|
|
const servieName = ref()
|
|
const servieName = ref()
|
|
|
const serviceRqtype = ref()
|
|
const serviceRqtype = ref()
|
|
|
const serviceUrl = ref()
|
|
const serviceUrl = ref()
|
|
|
|
|
+const parFlowId = ref()
|
|
|
const tableDataCan = ref()
|
|
const tableDataCan = ref()
|
|
|
const nodeDeSer = ref(false)
|
|
const nodeDeSer = ref(false)
|
|
|
|
|
+const isAdd = ref(false)
|
|
|
const {proxy} = getCurrentInstance();
|
|
const {proxy} = getCurrentInstance();
|
|
|
const modelQueryParams = ref({
|
|
const modelQueryParams = ref({
|
|
|
name: undefined,
|
|
name: undefined,
|
|
@@ -203,7 +216,7 @@ const defaultEdgeStyle = {
|
|
|
style: {
|
|
style: {
|
|
|
stroke: '#79bbff',
|
|
stroke: '#79bbff',
|
|
|
strokeWidth: 2,
|
|
strokeWidth: 2,
|
|
|
- type: 'bezier',
|
|
|
|
|
|
|
+ type: 'bezier',
|
|
|
fill: 'none' // 避免截图时出现黑色背景 [4](@ref)
|
|
fill: 'none' // 避免截图时出现黑色背景 [4](@ref)
|
|
|
},
|
|
},
|
|
|
markerEnd: {
|
|
markerEnd: {
|
|
@@ -230,18 +243,58 @@ const title = ref('')
|
|
|
const open = ref(false)
|
|
const open = ref(false)
|
|
|
const store = useStore();
|
|
const store = useStore();
|
|
|
|
|
|
|
|
|
|
+watch(inputNode, (val) => {
|
|
|
|
|
+ treeRef.value?.filter(val); // 调用树的过滤方法
|
|
|
|
|
+});
|
|
|
|
|
+function delNode(node){
|
|
|
|
|
+ console.log(node)
|
|
|
|
|
+ nodes.value = nodes.value.filter(item => item.id !== node.id)
|
|
|
|
|
+}
|
|
|
onEdgeClick(({ edge }) => {
|
|
onEdgeClick(({ edge }) => {
|
|
|
- edges.value = edges.value.filter(edge => edge.id !== edgeId)
|
|
|
|
|
|
|
+ console.log(edges.value,edge)
|
|
|
|
|
+ edges.value = edges.value.filter(item => item.id !== edge.id)
|
|
|
});
|
|
});
|
|
|
async function getTreeLeft(){
|
|
async function getTreeLeft(){
|
|
|
await modelTreeSelect().then(res=>{
|
|
await modelTreeSelect().then(res=>{
|
|
|
dataTree.value = res.data
|
|
dataTree.value = res.data
|
|
|
})
|
|
})
|
|
|
- optionsMdid.value = filterModelNodes(par)
|
|
|
|
|
- console.log(optionsMdid.value)
|
|
|
|
|
}
|
|
}
|
|
|
-function showData(){
|
|
|
|
|
- console.log(toObject())
|
|
|
|
|
|
|
+function saveFlow(){
|
|
|
|
|
+ if(isAdd.value){
|
|
|
|
|
+ const count = computed(() => store.getters.id)
|
|
|
|
|
+ var par = {
|
|
|
|
|
+ appId: count.value,
|
|
|
|
|
+ flowName:'default',
|
|
|
|
|
+ flowGraph: JSON.stringify(toRaw(toObject()))
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(par)
|
|
|
|
|
+ addModelingFlow(par).then(res=>{
|
|
|
|
|
+ if(res.code===200){
|
|
|
|
|
+ proxy.$message({
|
|
|
|
|
+ message: '保存成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ const count = computed(() => store.getters.id)
|
|
|
|
|
+ var par = {
|
|
|
|
|
+ flowId: parFlowId.value,
|
|
|
|
|
+ appId: count.value,
|
|
|
|
|
+ flowName:'default',
|
|
|
|
|
+ flowGraph: JSON.stringify(toRaw(toObject()))
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(par)
|
|
|
|
|
+ editModelingFlow(par).then(res=>{
|
|
|
|
|
+ if(res.code===200){
|
|
|
|
|
+ proxy.$message({
|
|
|
|
|
+ message: '保存成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
onNodeClick(({event, node}) => {
|
|
onNodeClick(({event, node}) => {
|
|
|
console.log(node)
|
|
console.log(node)
|
|
@@ -370,87 +423,30 @@ function handleQuery() {
|
|
|
|
|
|
|
|
/** 查询流程图 */
|
|
/** 查询流程图 */
|
|
|
function getList() {
|
|
function getList() {
|
|
|
- loading.value = true;
|
|
|
|
|
- // listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
|
|
|
|
- // loading.value = false;
|
|
|
|
|
- // userList.value = res.rows;
|
|
|
|
|
- // total.value = res.total;
|
|
|
|
|
- // });
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-/** 查询服务列表 */
|
|
|
|
|
-function getServiceList() {
|
|
|
|
|
- getPtServiceList(toolQueryParams.value).then(res => {
|
|
|
|
|
- serviceList.value = res.data.map(item => {
|
|
|
|
|
- return {
|
|
|
|
|
- id: item.id,
|
|
|
|
|
- label: item.name,
|
|
|
|
|
- type: 'API',
|
|
|
|
|
- config: {
|
|
|
|
|
- url: item.url,
|
|
|
|
|
- method: item.rqtype,
|
|
|
|
|
- params: item.params,
|
|
|
|
|
- headers: item.headers,
|
|
|
|
|
- body: item.body,
|
|
|
|
|
- },
|
|
|
|
|
- errorPolicy: 'ABORT',
|
|
|
|
|
- retryCount: 0,
|
|
|
|
|
- outputMapping: null,
|
|
|
|
|
- data: item,
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function submitForm() {
|
|
|
|
|
- updateNode(nodeId.value, (node) => ({
|
|
|
|
|
- data: form.value,
|
|
|
|
|
- }))
|
|
|
|
|
- cancel()
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function cancel() {
|
|
|
|
|
- form.value = {config: {}};
|
|
|
|
|
- open.value = false;
|
|
|
|
|
- title.value = ''
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function saveStep() {
|
|
|
|
|
-
|
|
|
|
|
- if (!modelId.value) {
|
|
|
|
|
- proxy.$modal.msgError("请选择模型");
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ const count = computed(() => store.getters.id)
|
|
|
|
|
+ console.log(count.value);
|
|
|
|
|
+ var par = {
|
|
|
|
|
+ appId: count.value
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- const nodes = getNodes.value.map(res => {
|
|
|
|
|
- return {
|
|
|
|
|
- id: res.id,
|
|
|
|
|
- type: res.type,
|
|
|
|
|
- position: res.position,
|
|
|
|
|
- data: res.data,
|
|
|
|
|
|
|
+ getModelingDe(par).then(res => {
|
|
|
|
|
+ if(res.data.length===0){
|
|
|
|
|
+ isAdd.value = true
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- const edges = getEdges.value.map(res => {
|
|
|
|
|
- return {
|
|
|
|
|
- source: res.source,
|
|
|
|
|
- target: res.target,
|
|
|
|
|
|
|
+ else{
|
|
|
|
|
+ isAdd.value = false
|
|
|
|
|
+ var a = JSON.parse(JSON.parse(JSON.stringify(res.data[0].flowGraph)))
|
|
|
|
|
+ nodes.value = a.nodes
|
|
|
|
|
+ edges.value = a.edges
|
|
|
|
|
+ zoom.value = a.zoom
|
|
|
|
|
+ zoomTo(zoom.value)
|
|
|
|
|
+ parFlowId.value = res.data[0].flowId
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- const data = {
|
|
|
|
|
- mdid: modelId.value,
|
|
|
|
|
- graph: JSON.stringify({
|
|
|
|
|
- nodes: nodes,
|
|
|
|
|
- edges: edges,
|
|
|
|
|
- }),
|
|
|
|
|
- }
|
|
|
|
|
- saveWorkflow(data).then(res => {
|
|
|
|
|
- // 测试
|
|
|
|
|
- proxy.$modal.msgError("请输入建表语句");
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getTreeLeft()
|
|
getTreeLeft()
|
|
|
|
|
+ getList();
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
watch(nodes, (newNodes) => {
|
|
watch(nodes, (newNodes) => {
|