|
|
@@ -164,7 +164,7 @@
|
|
|
<el-table-column prop="itemName" label="参数值" >
|
|
|
<template #default="scope">
|
|
|
<div style="width: 100%;">
|
|
|
- <el-input type="primary" class="noBor" v-model="scope.row.value" size="mini" text style="margin-left: 0%;"></el-input>
|
|
|
+ <el-input type="primary" class="noBor" v-model="scope.row.paramValue" size="mini" text style="margin-left: 0%;"></el-input>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -979,99 +979,7 @@ function testOne(){
|
|
|
})
|
|
|
}
|
|
|
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
-async function startTest(){
|
|
|
- messages.value = []
|
|
|
- ws.value = new WebSocket('ws://127.0.0.1:8082/websocket/message');
|
|
|
-
|
|
|
- ws.value.onopen = () => {
|
|
|
- connected.value = true;
|
|
|
- };
|
|
|
-
|
|
|
- ws.value.onmessage = (event) => {
|
|
|
- messages.value.push(event.data); // 存储接收到的消息
|
|
|
- };
|
|
|
- await delay(1000)
|
|
|
- if(messages.value.length>0){
|
|
|
- var param = []
|
|
|
- var paramEnd = []
|
|
|
- if(tableDataCanStart.value.length>0&&tableDataCanEnd.value.length>0){
|
|
|
- tableDataCanStart.value.forEach(item=>{
|
|
|
- var par = {
|
|
|
- name:item.name,
|
|
|
- dataType:item.dataType,
|
|
|
- refType:'input',
|
|
|
- description:item.description,
|
|
|
- required:item.required
|
|
|
- }
|
|
|
- param.push(par)
|
|
|
- })
|
|
|
- tableDataCanEnd.value.forEach(item=>{
|
|
|
- var par = {
|
|
|
- name:item.name,
|
|
|
- dataType:item.dataType,
|
|
|
- refType:'ref',
|
|
|
- ref:item.paramValue
|
|
|
- }
|
|
|
- paramEnd.push(par)
|
|
|
- })
|
|
|
- nodes.value.forEach(item=>{
|
|
|
- if(item.id==='1'){
|
|
|
- item.data.parameters = param
|
|
|
- }
|
|
|
- if(item.id==='2'){
|
|
|
- item.data.outputDefs = paramEnd
|
|
|
- }
|
|
|
- })
|
|
|
- var a = JSON.parse(JSON.stringify(toObject()))
|
|
|
- a.nodes.forEach(item=>{
|
|
|
- if(item.id==='1'){
|
|
|
- item.type = 'startNode'
|
|
|
- }
|
|
|
- else if(item.id==='2'){
|
|
|
- item.type = 'endNode'
|
|
|
- }
|
|
|
- else{
|
|
|
- item.type = 'serviceNode'
|
|
|
- }
|
|
|
- })
|
|
|
- var par = {}
|
|
|
- par.flowGraph = JSON.stringify(a)
|
|
|
- par.params = {}
|
|
|
- par.webSocketId = messages.value[0]
|
|
|
- tableDataCanStart.value.forEach(item=>{
|
|
|
- // par.set(item.name,item.value)
|
|
|
- par.params[item.name] = item.value
|
|
|
- })
|
|
|
- console.log(a)
|
|
|
- await runflow(par).then(res=>{
|
|
|
- if(res.code === 200){
|
|
|
- proxy.$message({
|
|
|
- message: res.msg,
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- dialogVisibleSart.value = true
|
|
|
- outputData.value = beautify(res.data, null, 2, 80)
|
|
|
- ws.value.close()
|
|
|
- ws.value = null
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- else if(tableDataCanStart.value.length===0){
|
|
|
- proxy.$message({
|
|
|
- message: '请设置输入值!',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- }
|
|
|
- else if(tableDataCanEnd.value.length===0){
|
|
|
- proxy.$message({
|
|
|
- message: '请设置输出值!',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+
|
|
|
function saveStartNode(){
|
|
|
nodeStart.value = false
|
|
|
|
|
|
@@ -1216,9 +1124,13 @@ onEdgeClick(({ edge }) => {
|
|
|
edges.value = edges.value.filter(item => item.id !== edge.id)
|
|
|
});
|
|
|
async function getTreeLeft(){
|
|
|
- await modelTreeSelect().then(res=>{
|
|
|
-
|
|
|
- dataTree.value = flatArrayToTree(res.data)
|
|
|
+ var par = {
|
|
|
+ params:{
|
|
|
+ serviceState:'1'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await modelTreeSelect(par).then(res=>{
|
|
|
+ dataTree.value = (res.data)
|
|
|
})
|
|
|
}
|
|
|
function flatArrayToTree(flatArray, rootPid = '1') {
|
|
|
@@ -1273,7 +1185,101 @@ function deepToRaw(obj) {
|
|
|
// 如果是普通对象,直接返回
|
|
|
return obj;
|
|
|
}
|
|
|
-
|
|
|
+async function startTest(){
|
|
|
+ const baseUrl = window.location.origin.toString().substring(6)
|
|
|
+ messages.value = []
|
|
|
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
|
+ const host = window.location.host;
|
|
|
+ ws.value = new WebSocket('ws://' + '192.168.2.119:8082/websocket/message');
|
|
|
+ ws.value.onopen = () => {
|
|
|
+ connected.value = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ ws.value.onmessage = (event) => {
|
|
|
+ messages.value.push(event.data); // 存储接收到的消息
|
|
|
+ };
|
|
|
+ await delay(1000)
|
|
|
+ if(messages.value.length>0){
|
|
|
+ var param = []
|
|
|
+ var paramEnd = []
|
|
|
+ if(tableDataCanStart.value.length>0&&tableDataCanEnd.value.length>0){
|
|
|
+ tableDataCanStart.value.forEach(item=>{
|
|
|
+ var par = {
|
|
|
+ name:item.name,
|
|
|
+ dataType:item.dataType,
|
|
|
+ refType:'input',
|
|
|
+ description:item.description,
|
|
|
+ required:item.required
|
|
|
+ }
|
|
|
+ param.push(par)
|
|
|
+ })
|
|
|
+ tableDataCanEnd.value.forEach(item=>{
|
|
|
+ var par = {
|
|
|
+ name:item.name,
|
|
|
+ dataType:item.dataType,
|
|
|
+ refType:'ref',
|
|
|
+ ref:item.paramValue
|
|
|
+ }
|
|
|
+ paramEnd.push(par)
|
|
|
+ })
|
|
|
+ nodes.value.forEach(item=>{
|
|
|
+ if(item.id==='1'){
|
|
|
+ item.data.parameters = param
|
|
|
+ }
|
|
|
+ if(item.id==='2'){
|
|
|
+ item.data.outputDefs = paramEnd
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var a = JSON.parse(JSON.stringify(toObject()))
|
|
|
+ a.nodes.forEach(item=>{
|
|
|
+ if(item.id==='1'){
|
|
|
+ item.type = 'startNode'
|
|
|
+ }
|
|
|
+ else if(item.id==='2'){
|
|
|
+ item.type = 'endNode'
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ item.type = 'serviceNode'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var par = {}
|
|
|
+ par.flowGraph = JSON.stringify(a)
|
|
|
+ par.params = {}
|
|
|
+ par.webSocketId = messages.value[0]
|
|
|
+ tableDataCanStart.value.forEach(item=>{
|
|
|
+ // par.set(item.name,item.value)
|
|
|
+ par.params[item.name] = item.paramValue
|
|
|
+ })
|
|
|
+ console.log(par.params)
|
|
|
+ await runflow(par).then(res=>{
|
|
|
+ if(res.code === 200){
|
|
|
+ proxy.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ dialogVisibleSart.value = true
|
|
|
+ outputData.value = beautify(res.data, null, 2, 80)
|
|
|
+ ws.value.close()
|
|
|
+ ws.value = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else if(tableDataCanStart.value.length===0){
|
|
|
+ proxy.$message({
|
|
|
+ message: '请设置输入值!',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if(tableDataCanEnd.value.length===0){
|
|
|
+ proxy.$message({
|
|
|
+ message: '请设置输出值!',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
async function saveFlow(){
|
|
|
if(tableDataCanStart.value.length>0&&tableDataCanEnd.value.length>0){
|
|
|
var param = []
|
|
|
@@ -1284,7 +1290,8 @@ async function saveFlow(){
|
|
|
dataType:item.dataType,
|
|
|
refType:'input',
|
|
|
description:item.description,
|
|
|
- required:item.required
|
|
|
+ required:item.required,
|
|
|
+ // paramValue:item.paramValue
|
|
|
}
|
|
|
param.push(par)
|
|
|
})
|
|
|
@@ -1293,16 +1300,23 @@ async function saveFlow(){
|
|
|
name:item.name,
|
|
|
dataType:item.dataType,
|
|
|
refType:'ref',
|
|
|
- ref:item.paramValue
|
|
|
+ ref:item.paramValue,
|
|
|
+ paramValue:item.paramValue
|
|
|
}
|
|
|
paramEnd.push(par)
|
|
|
})
|
|
|
nodes.value.forEach(item=>{
|
|
|
if(item.id==='1'){
|
|
|
item.data.parameters = param
|
|
|
+ if(item.erMsg){
|
|
|
+ delete item.erMsg
|
|
|
+ }
|
|
|
}
|
|
|
if(item.id==='2'){
|
|
|
item.data.outputDefs = paramEnd
|
|
|
+ if(item.erMsg){
|
|
|
+ delete item.erMsg
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
var a = JSON.parse(JSON.stringify(toObject()))
|
|
|
@@ -1645,7 +1659,7 @@ function getList() {
|
|
|
a.nodes.forEach(item=>{
|
|
|
item.type = 'special'
|
|
|
if(item.id==='2'&&item.data){
|
|
|
- tableDataCanEnd.value = item.data.parameters
|
|
|
+ tableDataCanEnd.value = item.data.outputDefs
|
|
|
}
|
|
|
if(item.id==='1'&&item.data.parameters){
|
|
|
tableDataCanStart.value = item.data.parameters
|
|
|
@@ -1657,7 +1671,11 @@ function getList() {
|
|
|
zoomTo(zoom.value)
|
|
|
parFlowId.value = res.data[0].flowId
|
|
|
}
|
|
|
+ if(tableDataCanEnd.value.length===0){
|
|
|
+ tableDataCanEnd.value = []
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
const ws = ref(null);
|
|
|
const connected = ref(false);
|