|
|
@@ -167,7 +167,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-if="nodeEnd" style="height: 82vh;overflow-y: auto;width: 25vw;position: absolute;float: right;z-index: 1000;right: 1%;top:6%;border: 0.1px solid #dedfe0;border-radius: 6px;background-color: white;">
|
|
|
+ <div v-show="nodeEnd" style="height: 82vh;overflow-y: auto;width: 25vw;position: absolute;float: right;z-index: 1000;right: 1%;top:6%;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%;">
|
|
|
<el-tag class="ml-2" style="" type="warning">结束节点</el-tag>
|
|
|
<el-icon @click="saveEndNode" style="margin-left: auto;cursor: pointer;"><Close /></el-icon>
|
|
|
@@ -677,6 +677,7 @@ import { Controls } from '@vue-flow/controls'
|
|
|
import '@vue-flow/controls/dist/style.css'
|
|
|
import '@vue-flow/core/dist/theme-default.css';
|
|
|
import { Plus,Search } from '@element-plus/icons-vue'
|
|
|
+import { toRaw, isReactive, isProxy } from 'vue';
|
|
|
import DynamicMap from '@/components/DynamicMap/index.vue'
|
|
|
import {Promotion} from '@element-plus/icons-vue'
|
|
|
import { onMounted, ref,onBeforeUnmount } from 'vue'
|
|
|
@@ -692,6 +693,7 @@ import { useStore } from 'vuex';
|
|
|
import {Handle, Position} from '@vue-flow/core'
|
|
|
import { computed } from 'vue';
|
|
|
import { modelTreeSelect } from "@/api/service/info";
|
|
|
+// import { toRaw, isReactive, isProxy } from 'vue';
|
|
|
const {
|
|
|
snapToGrid,
|
|
|
addEdges,
|
|
|
@@ -940,8 +942,9 @@ const handleSelectChange = (selectedValue) => {
|
|
|
scope.row.paramValue = newValue; // 同步更新绑定值[10](@ref)
|
|
|
}
|
|
|
};
|
|
|
-function addEnd(){
|
|
|
- tableDataCanEnd.value.push([])
|
|
|
+async function addEnd(){
|
|
|
+ tableDataCanEnd.value.push({})
|
|
|
+ await nextTick();
|
|
|
}
|
|
|
function delEnd(index){
|
|
|
tableDataCanEnd.value.splice(index,1)
|
|
|
@@ -1025,12 +1028,17 @@ function startTest(){
|
|
|
}
|
|
|
function saveStartNode(){
|
|
|
nodeStart.value = false
|
|
|
+
|
|
|
}
|
|
|
function saveEndNode(){
|
|
|
nodeEnd.value = false
|
|
|
+ var par = tableDataCanEnd.value
|
|
|
+ const node = findNode('2')
|
|
|
+ node.data.data = par
|
|
|
+ console.log(nodes)
|
|
|
}
|
|
|
function addStart(){
|
|
|
- tableDataCanStart.value.push([])
|
|
|
+ tableDataCanStart.value.push({})
|
|
|
}
|
|
|
function delCanStart(index){
|
|
|
tableDataCanStart.value.splice(index,1)
|
|
|
@@ -1076,7 +1084,6 @@ function saveNode(){
|
|
|
})
|
|
|
nodeDeSer.value = false
|
|
|
const node = findNode(parNodeid.value)
|
|
|
-
|
|
|
node.data.data = par
|
|
|
// updateNode(node.id, { data: { ...node.data, ...par } });
|
|
|
// updateNodeInternals(node.id);
|
|
|
@@ -1155,6 +1162,22 @@ async function getTreeLeft(){
|
|
|
dataTree.value = res.data
|
|
|
})
|
|
|
}
|
|
|
+function deepToRaw(obj) {
|
|
|
+ // 如果是数组,遍历每个元素并递归处理
|
|
|
+ if (Array.isArray(obj)) {
|
|
|
+ return obj.map(item => deepToRaw(item));
|
|
|
+ }
|
|
|
+ // 如果是对象且可能是响应式代理,获取其原始对象并递归处理其属性
|
|
|
+ else if (obj !== null && typeof obj === 'object' && (isProxy(obj) || isReactive(obj))) {
|
|
|
+ const rawObj = toRaw(obj);
|
|
|
+ return Object.fromEntries(
|
|
|
+ Object.entries(rawObj).map(([key, value]) => [key, deepToRaw(value)])
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // 如果是普通对象,直接返回
|
|
|
+ return obj;
|
|
|
+}
|
|
|
+
|
|
|
function saveFlow(){
|
|
|
var parFlow = toRaw(toObject())
|
|
|
parFlow.nodes.forEach(item => {
|
|
|
@@ -1163,9 +1186,15 @@ function saveFlow(){
|
|
|
}
|
|
|
if(item.id==='2'){
|
|
|
item.type='endNode'
|
|
|
+ item.data.parameters = tableDataCanEnd.value;
|
|
|
+ // item.data.parameters.splice(0, 0, ...tableDataCanEnd.value);
|
|
|
+ console.log(item)
|
|
|
+ // item.data.parameters.splice(0, item.data.parameters.length, ...tableDataCanEnd.value);
|
|
|
+ // item.data.parameters = JSON.parse(JSON.stringify(item.data.parameters))
|
|
|
}
|
|
|
});
|
|
|
- console.log(parFlow)
|
|
|
+
|
|
|
+ // console.log(JSON.parse(JSON.stringify(parFlow)))
|
|
|
if(isAdd.value){
|
|
|
const count = computed(() => store.getters.id)
|
|
|
var par = {
|
|
|
@@ -1278,12 +1307,21 @@ onNodeClick(({event, node}) => {
|
|
|
parShu.forEach(item1=>{
|
|
|
var count = index+1
|
|
|
var par = {
|
|
|
- ref:count.toString() + ':' + item1,
|
|
|
+ ref:item.data.id + '.' + item1,
|
|
|
name:item.data.label + ':' + item1
|
|
|
}
|
|
|
optionsCan.value.push(par)
|
|
|
})
|
|
|
}
|
|
|
+ if(tableDataCanStart.value.length>0){
|
|
|
+ tableDataCanStart.value.forEach(item=>{
|
|
|
+ var par = {
|
|
|
+ ref:item.value,
|
|
|
+ name:item.name
|
|
|
+ }
|
|
|
+ optionsCan.value.push(par)
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
console.log(optionsCan.value)
|
|
|
if(node.data.label==='结束'){
|
|
|
@@ -1291,6 +1329,7 @@ onNodeClick(({event, node}) => {
|
|
|
}
|
|
|
if(node.data.label==='开始'){
|
|
|
nodeStart.value = true
|
|
|
+
|
|
|
}
|
|
|
if(node.data.nodeType==='SERVICE'){
|
|
|
getSerDe(node.data.id).then(res=>{
|
|
|
@@ -1445,6 +1484,9 @@ function getList() {
|
|
|
console.log(a)
|
|
|
a.nodes.forEach(item=>{
|
|
|
item.type = 'special'
|
|
|
+ if(item.id==='2'&&item.data){
|
|
|
+ tableDataCanEnd.value = item.data.parameters
|
|
|
+ }
|
|
|
})
|
|
|
nodes.value = a.nodes
|
|
|
edges.value = a.edges
|