nanjingliujinyu 4 сар өмнө
parent
commit
eda542ef23

+ 2 - 2
ruoyi-ui/.env.development

@@ -10,8 +10,8 @@ VITE_APP_BASE_Title = '/sh'
 # 若依管理系统/生产环境
 VITE_APP_BASE_API = '/sh-api'
 
-# VITE_DEV_PATH = 'http://localhost:8082'
-VITE_DEV_PATH = 'http://39.98.38.2:18082/sh-api'
+VITE_DEV_PATH = 'http://localhost:8082'
+# VITE_DEV_PATH = 'http://39.98.38.2:18082/sh-api'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip

+ 13 - 0
ruoyi-ui/src/views/service/info/editModel.vue

@@ -1334,6 +1334,11 @@ function flattenTreeWithArrayIndex(treeData, parentId = 0, result = []) {
     }
     return result;
 }
+function generateTimestampId() {
+  const timestamp = Date.now(); // 13位毫秒时间戳
+  const randomNum = Math.floor(Math.random() * 1000); // 3位随机数
+  return parseInt(`${timestamp}${randomNum}`); // 拼接后转为整数
+}
 async function addSer(){
   console.log(JsonAdd.value)
   var valid
@@ -1402,6 +1407,14 @@ async function handleNodeClick(node,data,event){
     });
     dataTreeReturn.value = fullTree
     console.log(dataTreeReturn.value)
+    if(dataTreeReturn.value.length<1){
+      dataTreeReturn.value  = [
+        {
+          id:generateTimestampId(),
+          paramCode: 'data'
+        }
+      ]
+    }
     // var par = JSON.parse(JSON.stringify(fullTree))
     // var par1 = transformDynamicDataToTree(par)
     // par1.length = par1.length - 1

+ 227 - 21
ruoyi-ui/src/views/standardization/modeling/index.vue

@@ -6,7 +6,7 @@
       <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">ceshi</el-button>
+      <el-button style="margin-left: 1%;" type="primary" size="mini" @click="showData">试运行</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 style="display: flex;margin-left: 3%;margin-top: 3%;align-items: center;justify-content: space-between;width: 95%;">
@@ -38,8 +38,8 @@
               <div style="width:100%;">
                   <el-select
                     v-model="scope.row.paramValue"
-                    multiple
                     filterable
+                    @change="handleSelectChange"
                     allow-create
                     default-first-option
                     :reserve-keyword="false"
@@ -47,8 +47,8 @@
                   >
                     <el-option
                       v-for="item in optionsCan"
-                      :label="item.paramCode"
-                      :value="item.paramValue"
+                      :label="item.name"
+                      :value="item.ref"
                     />
                   </el-select>
               </div>
@@ -240,7 +240,7 @@
       <el-dialog @close="clearFromLev" title="" v-model="dialogVisibleBiao" width="50%" destroy-on-close :key="tableKey">
         <el-form size="mini" :key="tableKey" style="margin-top: 1%;width: 98%;"  :model="formJi" label-position="right" ref="formRefJi" label-width="120px" :rules="rulesJi">
           <el-form-item label="连接方式:" prop="" style="display: flex; align-items: center;">
-            <el-radio-group :disabled="isEdit" v-model="formJi.rptype" class="ml-4" style="display: inline-flex; align-items: center;">
+            <el-radio-group  v-model="formJi.rptype" class="ml-4" style="display: inline-flex; align-items: center;">
               <el-radio label="1" size="large" style="display: inline-flex; align-items: center;">
                 <span style="position: relative; top: -1px">资产表</span>
               </el-radio>
@@ -256,7 +256,7 @@
             <div style="display: flex;width: 30%;justify-content: space-between;">
               <el-select
                 v-model="formJi.type"
-                :disabled="isEdit"
+                
                     style="width: 100%;margin-left: 0%;"
                 >
                     <el-option
@@ -269,7 +269,7 @@
             </div>
             </el-form-item>
             <el-form-item label="读取模式:" prop="" style="display: flex; align-items: center;">
-            <el-radio-group :disabled="isEdit" v-model="formJi.rptype" class="ml-4" style="display: inline-flex; align-items: center;">
+            <el-radio-group  v-model="formJi.rptype" class="ml-4" style="display: inline-flex; align-items: center;">
               <el-radio label="1" size="large" style="display: inline-flex; align-items: center;">
                 <span style="position: relative; top: -1px">全量</span>
               </el-radio>
@@ -513,6 +513,81 @@
           </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>
+        
+        <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>
+          </span>
+        </template>
+      </el-dialog>
     </div>
 
   </div>
@@ -561,7 +636,9 @@ const formAdd = ref({
     appTitle: '',
     appNote: '',
 });
-const testAttention = ref("{\n  \"data\": [\n        {\n            \"typhoonId\": \"202317\",\n            \"typhoonName\": \"杰拉华\",\n           \"test\": \"1123\"\n        },\n        {\n            \"typhoonId\": \"202316\",\n            \"typhoonName\": \"三巴\",\n           \"test\": \"1123\"\n           \n        }\n    ],\n    \"succeeded\": true,\n    \"statusCode\": 200,\n    \"remark\": \"获取该年台风信息成功\",\n    \"callParameters\": null\n}")
+const tableDataCanStart = ref([])
+const dialogVisibleSart = ref(false)
+const testAttention = ref()
 const dialogVisibleTest = ref(false)
 const dialogVisibleCsv = ref(false)
 const formAddref = ref()
@@ -597,11 +674,47 @@ const formJi = ref({
   intro:'',
 });
 const optionsCan = ref()
+const parTitle = ref()
 const rulesJi = reactive({
   name: [{ required: true, message: '必填', trigger: 'blur' }],
   url: [{ required: true, message: '必填', trigger: 'blur' }],
   cateCode: [{ required: true, message: '必填', trigger: 'blur' }],
 });
+const optionsType = ref([
+  {
+    label:"string",
+    value:'string'
+  },
+  {
+    label:"int",
+    value:'int'
+  },
+  {
+    label:"boolean",
+    value:'boolean'
+  },
+  {
+    label:"array",
+    value:'array'
+  },
+  {
+    label:"object",
+    value:'object'
+  },
+  {
+    label:"number",
+    value:'number'
+  },
+  {
+    label:"null",
+    value:'null'
+  },
+  {
+    label:"any",
+    value:'any'
+  },
+  
+])
 const dataTreeTool = ref([
   {
     label:'输入',
@@ -720,19 +833,105 @@ const store = useStore();
 watch(inputNode, (val) => {
   treeRef.value?.filter(val); // 调用树的过滤方法
 });
+function clearSt(){
+  tableDataCanStart.value = []
+}
 function showData(){
-  console.log(nodes.value)
+  dialogVisibleSart.value = true
 }
 function handleInputClick(){
   console.log(nodes.value)
 }
+const handleSelectChange = (selectedValue) => {
+  const lastValue = Array.isArray(selectedValue) 
+    ? selectedValue[selectedValue.length - 1] 
+    : selectedValue;
+
+  const isNewOption = !optionsCan.value.some(item => item.ref === lastValue);
+  
+  if (isNewOption) {
+    const newValue = `${lastValue}:fixed`; // 生成新值
+    // 1. 更新数据源
+    optionsCan.value.push({ name: lastValue, ref: newValue });
+    // 2. ⭐ 关键:手动更新 v-model 绑定值
+    scope.row.paramValue = newValue; // 同步更新绑定值[10](@ref)
+  }
+};
+function startTest(){
+  var param = []
+  if(tableDataCanStart.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)
+    })
+  }
+  nodes.value.forEach(item=>{
+    if(item.id==='1'){
+      item.data.data = param
+    }
+  })
+  
+}
+function addStart(){
+  tableDataCanStart.value.push([])
+}
+function delCanStart(index){
+  tableDataCanStart.value.splice(index,1)
+}
 function saveNode(){
+  // console.log(tableDataCan.value)
+  var par = {
+    title:parTitle.value,
+    parameters:[]
+  }
+  tableDataCan.value.forEach(item=>{
+    if(item.paramValue!==null){
+      var parSplit = item.paramValue.split(':')
+      if(parSplit[1]==='fixed'){
+        var par1 = {
+          name:item.paramName,
+          value:parSplit[0],
+          dataType:item.paramType,
+          refType:'fixed'
+        }
+        par.parameters.push(par1)
+      }
+      else{
+        var par1 = {
+          name:item.paramName,
+          ref:item.paramValue,
+          dataType:item.paramType,
+          refType:'ref'
+        }
+        par.parameters.push(par1)
+      }
+    }
+    else{
+      var par1 = {
+        name:item.paramName,
+        value:null,
+        dataType:item.paramType,
+        refType:'fixed'
+      }
+      par.parameters.push(par1)
+    }
+    
+  })
   nodeDeSer.value = false
   const node = findNode(parNodeid.value)
-  node.data.returnList = tableDataCanOut.value
-  updateNode(parNodeid.value, {
-    data: node.data
-  });
+ 
+  node.data.data = par
+  // updateNode(node.id, { data: { ...node.data, ...par } });
+  // updateNodeInternals(node.id);
+  // updateNode(parNodeid.value, {
+  //   data: par
+  // });
 }
 function delWholeFlow(){
   proxy.$confirm('是否删除该模型流程?', '提示', {
@@ -901,19 +1100,26 @@ function removeDuplicatesAndEmptyItems(arr) {
 onNodeClick(({event, node}) => {
   console.log(node)
   parNodeid.value = node.id
+  parTitle.value = node.data.name
   tableDataCan.value = []
   optionsCan.value = []
   var parNode = getPredecessorsNodes(node.id)
-  var parOp = []
-  parNode.forEach(item => {
-    parOp = parOp.concat(item.data.returnList) 
-    // console.log(item.data.returnList)
+  parNode.forEach((item,index) => {
+    if(item.data.rpcontent){
+      var parShu = Object.keys(JSON.parse(item.data.rpcontent))
+      parShu.forEach(item1=>{
+        var count = index+1
+        var par = {
+          ref:count.toString() + ':' + item1,
+          name:item.data.name + ':' + item1
+        }
+        optionsCan.value.push(par)
+      })
+    }
   })
-  var a = JSON.parse(JSON.stringify(parOp));
-  optionsCan.value = removeDuplicatesAndEmptyItems(a)
-  console.log(a)
-  console.log(parNode)
+  console.log((node.data.rpcontent))
   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