nanjingliujinyu 4 luni în urmă
părinte
comite
0ec51f523b

+ 1 - 1
ruoyi-ui/src/views/service/info/index.vue

@@ -62,7 +62,7 @@
         </el-tree>
     </div>
     <div style="width: 84%;margin-left: 1%;padding-top: 0.5%;" class="tab-container">
-      <div>
+        <div>
         <el-table 
           :data="tableData" 
           style="width: 98%;margin-left: 1%;margin-top: 0.5%;"

+ 1 - 1
ruoyi-ui/src/views/service/info/shenhe.vue

@@ -1,5 +1,5 @@
 <template>
-    审核devkind = 'APP'
+    <!-- 审核devkind = 'APP' -->
   <div style="width: 100%;;display: flex;">
     <div style="width: 15%;;background-color: #F2F6FC;max-height: 85vh;overflow: auto;">
       <div style="display: flex;padding-top: 1%;padding-top: 5%;">

+ 1 - 1
ruoyi-ui/src/views/service/info/test.vue

@@ -1,5 +1,5 @@
 <template>
-    测试devkind = 'APP'
+    <!-- 测试devkind = 'APP' -->
   <div style="width: 100%;;display: flex;">
     <div style="width: 15%;;background-color: #F2F6FC;max-height: 85vh;overflow: auto;">
       <div style="display: flex;padding-top: 1%;padding-top: 5%;">

+ 1 - 1
ruoyi-ui/src/views/service/shenhe/index.vue

@@ -1,5 +1,5 @@
 <template>
-    审核devkind = 'SYS'
+    <!-- 审核devkind = 'SYS' -->
   <div style="width: 100%;;display: flex;">
     <div style="width: 15%;;background-color: #F2F6FC;max-height: 85vh;overflow: auto;">
       <div style="display: flex;padding-top: 1%;padding-top: 5%;">

+ 1 - 1
ruoyi-ui/src/views/service/test/index.vue

@@ -1,5 +1,5 @@
 <template>
-    测试devkind = 'SYS'
+    <!-- 测试devkind = 'SYS' -->
   <div style="width: 100%;;display: flex;">
     <div style="width: 15%;;background-color: #F2F6FC;max-height: 85vh;overflow: auto;">
       <div style="display: flex;padding-top: 1%;padding-top: 5%;">

+ 258 - 87
ruoyi-ui/src/views/standardization/modeling/index.vue

@@ -6,9 +6,9 @@
       <el-button @click="delWholeFlow" style="margin-left: auto;" type="danger" size="mini">删除</el-button>
       <el-button style="margin-left: 1%;" type="info" size="mini" plain @click="toImage">导出为图片</el-button>
       <el-button style="margin-left: 1%;" type="primary" size="mini" @click="saveFlow">保存</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="startTest">试运行</el-button>
     </div>
-    <div v-if="nodeDeSer" style="height: 85vh;overflow-y: auto;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: 82vh;overflow-y: auto;width: 20vw;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>
         <div style="margin-left: 4%;">
@@ -93,6 +93,145 @@
       </div>
       </div>
     </div>
+    <div v-if="nodeStart" style="height: 82vh;overflow-y: auto;width: 40vw;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="saveStartNode" style="margin-left: auto;cursor: pointer;"><Close /></el-icon>
+      </div>
+      <div>
+        <el-button  @click="addStart" style="margin-top: 5%;margin-left: 1%;" type="success" size="mini" :disabled="isEdit" plain>新增参数</el-button>
+        <div style="display: flex;width: 98%;margin-left: 1%;margin-top:2%;align-items: center;justify-content: space-between;">
+        <el-table 
+        style="margin-top: 1%;width: 100%;"
+        :data="tableDataCanStart" 
+        :cell-style="{ textAlign: 'center',padding:'2px 0' }"
+        :header-cell-style="{ textAlign: 'center'}"
+        :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
+        border >
+            <el-table-column prop="itemName" label="参数名称(必填)">
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-input  placeholder="请填写参数名称" type="primary" class="noBor" v-model="scope.row.name" size="mini" text style="margin-left: 0%;"></el-input>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="itemName" label="参数类型(必填)" width="200">
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-select
+                        v-model="scope.row.dataType"
+                        class="noBorSel"
+                        
+                        placeholder=""
+                        style="width: 100%;margin-left: 0%;"
+                        >
+                            <el-option
+                            v-for="item in optionsType"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value"
+                            />
+                </el-select>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="itemName" label="参数说明" >
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-input type="primary"  class="noBor" v-model="scope.row.description" size="mini" text style="margin-left: 0%;"></el-input>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="itemName" label="是否必填" >
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-checkbox v-model="scope.row.required" size="large" />
+                    </div>
+                </template>
+            </el-table-column>
+            <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>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="address" label="操作" width="100">
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-button type="danger" @click="delCanStart(scope.$index)" size="mini" text style="margin-left: 0%;">删除</el-button>
+                    </div>
+                </template>
+            </el-table-column>
+        </el-table>
+      </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 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>
+      </div>
+      <div>
+        <el-button  @click="addEnd" style="margin-top: 5%;margin-left: 1%;" type="success" size="mini" :disabled="isEdit" plain>新增参数</el-button>
+        <div style="display: flex;width: 98%;margin-left: 1%;margin-top:2%;align-items: center;justify-content: space-between;">
+        <el-table :data="tableDataCanEnd" border style="width: 100%">
+          <el-table-column prop="paramCode" label="参数名(必填)" width="">
+           <template #default="scope">
+                <div style="width: 100%;">
+                    <el-input  placeholder="" type="primary" class="noBor" v-model="scope.row.name" size="mini" text style="margin-left: 0%;"></el-input>
+                </div>
+            </template>
+          </el-table-column>
+          <el-table-column prop="itemName" label="参数类型(必填)">
+              <template #default="scope">
+                  <div style="width: 100%;">
+                      <el-select
+                      v-model="scope.row.dataType"
+                      class="noBorSel"
+                      placeholder=""
+                      style="width: 100%;margin-left: 0%;"
+                      >
+                          <el-option
+                          v-for="item in optionsType"
+                          :key="item.value"
+                          :label="item.label"
+                          :value="item.value"
+                          />
+              </el-select>
+                  </div>
+              </template>
+          </el-table-column>
+          <el-table-column prop="paramValue" label="参数值" width="">
+            <template #default="scope">
+              <div style="width:100%;">
+                  <el-select
+                    v-model="scope.row.paramValue"
+                    filterable
+                    default-first-option
+                    :reserve-keyword="false"
+                    style="width: 100%"
+                  >
+                    <el-option
+                      v-for="item in optionsCan"
+                      :label="item.name"
+                      :value="item.ref"
+                    />
+                  </el-select>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column prop="address" label="操作" width="100">
+                <template #default="scope">
+                    <div style="width: 100%;">
+                        <el-button type="danger" @click="delEnd(scope.$index)" size="mini" text style="margin-left: 0%;">删除</el-button>
+                    </div>
+                </template>
+            </el-table-column>
+        </el-table>
+      </div>
+      </div>
+    </div>
     <div style="display: flex;height: 87vh;width: 100%;padding-top:2%;justify-items: center;">
       <div style="width: 20%;margin-left: 1%;overflow-y: auto;margin-top: 0.5%;">
         <el-checkbox-group v-model="checkboxGroup1" size="" style="margin-left: 5%;" @change="oneSel">
@@ -513,77 +652,17 @@
           </span>
         </template>
       </el-dialog>
-      <el-dialog @close="clearSt" title="输入开始节点参数" v-model="dialogVisibleSart" width="50%" destroy-on-close :key="tableKey">
-        <el-button  @click="addStart" style="margin-top: 1%;" type="success" size="mini" :disabled="isEdit" plain>新增参数</el-button>
-        <el-table 
-        style="margin-top: 1%;width: 98%;"
-        :data="tableDataCanStart" 
-        :cell-style="{ textAlign: 'center',padding:'2px 0' }"
-        :header-cell-style="{ textAlign: 'center'}"
-        :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
-        border >
-            <el-table-column prop="itemName" label="参数名称(必填)">
-                <template #default="scope">
-                    <div style="width: 100%;">
-                        <el-input  placeholder="请填写参数名称" type="primary" class="noBor" v-model="scope.row.name" size="mini" text style="margin-left: 0%;"></el-input>
-                    </div>
-                </template>
-            </el-table-column>
-            <el-table-column prop="itemName" label="参数类型(必填)" width="200">
-                <template #default="scope">
-                    <div style="width: 100%;">
-                        <el-select
-                        v-model="scope.row.dataType"
-                        class="noBorSel"
-                        
-                        placeholder=""
-                        style="width: 100%;margin-left: 0%;"
-                        >
-                            <el-option
-                            v-for="item in optionsType"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value"
-                            />
-                </el-select>
-                    </div>
-                </template>
-            </el-table-column>
-            <el-table-column prop="itemName" label="参数说明" >
-                <template #default="scope">
-                    <div style="width: 100%;">
-                        <el-input type="primary"  class="noBor" v-model="scope.row.description" size="mini" text style="margin-left: 0%;"></el-input>
-                    </div>
-                </template>
-            </el-table-column>
-            <el-table-column prop="itemName" label="是否必填" >
-                <template #default="scope">
-                    <div style="width: 100%;">
-                        <el-checkbox v-model="scope.row.required" size="large" />
-                    </div>
-                </template>
-            </el-table-column>
-            <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>
-                    </div>
-                </template>
-            </el-table-column>
-            <el-table-column prop="address" label="操作" width="100">
-                <template #default="scope">
-                    <div style="width: 100%;">
-                        <el-button type="danger" @click="delCanStart(scope.$index)" size="mini" text style="margin-left: 0%;">删除</el-button>
-                    </div>
-                </template>
-            </el-table-column>
-        </el-table>
-        
+      <el-dialog @close="" title="试运行结果" v-model="dialogVisibleSart" width="50%" destroy-on-close :key="tableKey">
+         <el-input
+          v-model="outputData"
+          :autosize="{ minRows: 2, maxRows: 4 }"
+          type="textarea"
+          placeholder="Please input"
+        />
         <template #footer>
             <span class="dialog-footer">
-              <el-button size="mini" @click="dialogVisibleSart = false">取消</el-button>
-              <el-button type="primary" @click="startTest" size="mini">
-                提交
+              <el-button type="primary" @click="dialogVisibleSart = false" size="mini">
+                确定
               </el-button>
           </span>
         </template>
@@ -639,6 +718,8 @@ const formAdd = ref({
 const tableDataCanStart = ref([])
 const dialogVisibleSart = ref(false)
 const testAttention = ref()
+const tableDataCanEnd = ref([])
+const outputData = ref()
 const dialogVisibleTest = ref(false)
 const dialogVisibleCsv = ref(false)
 const formAddref = ref()
@@ -673,6 +754,8 @@ const formJi = ref({
   rptype:'',
   intro:'',
 });
+const nodeEnd = ref(false)
+const nodeStart = ref(false)
 const optionsCan = ref()
 const parTitle = ref()
 const rulesJi = reactive({
@@ -857,9 +940,16 @@ const handleSelectChange = (selectedValue) => {
     scope.row.paramValue = newValue; // 同步更新绑定值[10](@ref)
   }
 };
+function addEnd(){
+  tableDataCanEnd.value.push([])
+}
+function delEnd(index){
+  tableDataCanEnd.value.splice(index,1)
+}
 function startTest(){
   var param = []
-  if(tableDataCanStart.value.length>0){
+  var paramEnd = []
+  if(tableDataCanStart.value.length>0&&tableDataCanEnd.value.length>0){
     tableDataCanStart.value.forEach(item=>{
       var par = {
         name:item.name,
@@ -870,14 +960,75 @@ function startTest(){
       }
       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 = 'printNode'
+      }
+    })
+    var par = {}
+    par.flowGraph = JSON.stringify(a)
+    par.params = {}
+    tableDataCanStart.value.forEach(item=>{
+      // par.set(item.name,item.value)
+      par.params[item.name] = item.value
+    })
+    console.log(a)
+    runflow(par).then(res=>{
+      if(res.code === 200){
+        proxy.$message({
+            message: res.msg,
+            type: 'success'
+        });
+        dialogVisibleSart.value = true
+        outputData.value = JSON.stringify(res.data)
+      }
+    })
+    
+  }
+  else if(tableDataCanStart.value.length===0){
+    proxy.$message({
+        message: '请设置输入值!',
+        type: 'warning'
+    });
+  }
+  else if(tableDataCanEnd.value.length===0){
+    proxy.$message({
+        message: '请设置输出值!',
+        type: 'warning'
+    });
   }
-  nodes.value.forEach(item=>{
-    if(item.id==='1'){
-      item.data.data = param
-    }
-  })
   
 }
+function saveStartNode(){
+  nodeStart.value = false
+}
+function saveEndNode(){
+  nodeEnd.value = false
+}
 function addStart(){
   tableDataCanStart.value.push([])
 }
@@ -887,7 +1038,7 @@ function delCanStart(index){
 function saveNode(){
   // console.log(tableDataCan.value)
   var par = {
-    title:parTitle.value,
+    title:parTitle.value, 
     parameters:[]
   }
   tableDataCan.value.forEach(item=>{
@@ -1096,31 +1247,52 @@ function removeDuplicatesAndEmptyItems(arr) {
     return false;
   });
 }
-
+function parseJSONWithComments(jsonString) {
+    // 移除单行注释(//)和多行注释(/* */)
+    const cleanedJson = jsonString.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, '');
+    try {
+        return JSON.parse(cleanedJson);
+    } catch (error) {
+        console.error("解析失败:", error.message);
+        return null;
+    }
+}
 onNodeClick(({event, node}) => {
+  nodeEnd.value = false
+  nodeStart.value = false
+  nodeDeSer.value = false
   console.log(node)
   parNodeid.value = node.id
   parTitle.value = node.data.name
   tableDataCan.value = []
   optionsCan.value = []
   var parNode = getPredecessorsNodes(node.id)
-  parNode.forEach((item,index) => {
-    if(item.data.rpcontent){
-      var parShu = Object.keys(JSON.parse(item.data.rpcontent))
+  console.log((JSON.parse(JSON.stringify(parNode))))
+  var a = JSON.parse(JSON.stringify(parNode))
+  a.forEach((item,index) => {
+    console.log(item.data)
+    if(item.data.label!=='开始'&&item.data.service&&item.data.service.rpcontent){
+      item.data.service.rpcontent = parseJSONWithComments(item.data.service.rpcontent)
+      // console.log((item.data.service.rpcontent))
+      var parShu = Object.keys((item.data.service.rpcontent))
       parShu.forEach(item1=>{
         var count = index+1
         var par = {
           ref:count.toString() + ':' + item1,
-          name:item.data.name + ':' + item1
+          name:item.data.label + ':' + item1
         }
         optionsCan.value.push(par)
       })
     }
   })
-  console.log((node.data.rpcontent))
+  console.log(optionsCan.value)
+  if(node.data.label==='结束'){
+    nodeEnd.value = true
+  }
+  if(node.data.label==='开始'){
+    nodeStart.value = true
+  }
   if(node.data.nodeType==='SERVICE'){
-    console.log(222)
-    // console.log(getPredecessorsNodes(node.id))
     getSerDe(node.data.id).then(res=>{
       serviceRqtype.value = res.data.ptService.rqtype
       servieName.value = res.data.ptService.name
@@ -1129,7 +1301,6 @@ onNodeClick(({event, node}) => {
       serviceUrl.value = res.data.ptService.url
       nodeDeSer.value = true
     })
-    
   }
   if(node.data.nodeType==='tool'){
     console.log(node.data.value)