From 36730eac964e814a4fc9a0879c499e326fc00ac8 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期六, 14 九月 2024 11:41:07 +0800
Subject: [PATCH] 预测项配置

---
 src/views/model/mcs/sche/model/ScheduleModelForm.vue |  100 +++++++++++++++++++++++++++++---------------------
 1 files changed, 58 insertions(+), 42 deletions(-)

diff --git a/src/views/model/mcs/sche/model/ScheduleModelForm.vue b/src/views/model/mcs/sche/model/ScheduleModelForm.vue
index 7fb2af6..19518d5 100644
--- a/src/views/model/mcs/sche/model/ScheduleModelForm.vue
+++ b/src/views/model/mcs/sche/model/ScheduleModelForm.vue
@@ -1,5 +1,5 @@
 <template>
-  <Dialog v-model="dialogVisible" :title="dialogTitle" width="50%">
+  <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
     <el-form
       ref="formRef"
       v-loading="formLoading"
@@ -22,12 +22,26 @@
       <el-row>
         <el-col :span="12">
           <el-form-item label="模型类型" prop="modelType">
-            <el-input v-model="formData.modelType" placeholder="请输入模型类型" />
+            <el-select v-model="formData.modelType" placeholder="请选择">
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.SCHE_MODEL_TYPE)"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="调用方式" prop="invocation">
-            <el-input v-model="formData.invocation" placeholder="调用方式" />
+            <el-select v-model="formData.invocation" placeholder="请选择">
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.SCHE_MODEL_INVOCATION)"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
           </el-form-item>
         </el-col>
       </el-row>
@@ -46,7 +60,7 @@
         </el-col>
         <el-col :span="12">
           <el-form-item label="参数数量" prop="portLength">
-            <el-input v-model="formData.portLength" placeholder="请输入参数数量 " />
+            <el-input-number v-model="formData.portLength" :min="0" controls-position="right" />
           </el-form-item>
         </el-col>
       </el-row>
@@ -60,7 +74,7 @@
       <el-row>
         <el-col :span="24">
           <el-form-item label="模型路径" prop="modelPath">
-            <el-input v-model="formData.modelPath" placeholder="模型路径 " />
+            <el-input v-model="formData.modelPath" placeholder="模型路径" />
           </el-form-item>
         </el-col>
       </el-row>
@@ -74,9 +88,9 @@
           label="端口"
           width="100"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.modelparamportorder" maxlength="5" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%; hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
@@ -84,9 +98,9 @@
           label="序号"
           width="100"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.modelparamorder" maxlength="5" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
@@ -94,10 +108,10 @@
           label="类型"
           width="150"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-select v-model="scope.row.modelparamtype" placeholder="请选择">
               <el-option
-                v-for="dict in getIntDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)"
+                v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)"
                 :key="dict.value"
                 :label="dict.label"
                 :value="dict.value"
@@ -109,19 +123,18 @@
           prop=""
           label="参数名称"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-select
               size="mini"
               v-model="scope.row.modelparamid"
               filterable
               placeholder="请选择">
               <el-option
-                v-for="(item, index) in modelparamListMap[scope.row.modelparamtype]"
+                v-for="(item, index) in modelparamListMap['k']"
                 :key="index"
                 :label="item.name"
                 :value="item.id"
-                :disabled="!(item.type === scope.row.modelparamtype)">
-              </el-option>
+                :disabled="!(item.type === scope.row.modelparamtype)"/>
             </el-select>
           </template>
         </el-table-column>
@@ -130,9 +143,9 @@
           label="参数长度"
           width="120"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.datalength" maxlength="50" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
@@ -140,16 +153,18 @@
           label="操作"
           width="100"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-button
-              @click.native.prevent="addRow(scope.$index, formData.paramList)"
-              type="text"
+              link
+              @click.prevent="addRow(scope.$index, formData.paramList)"
+              type="primary"
               size="small">
               添加
             </el-button>
             <el-button
-              @click.native.prevent="deleteRow(scope.$index, formData.paramList)"
-              type="text"
+              link
+              @click.prevent="deleteRow(scope.$index, formData.paramList)"
+              type="primary"
               size="small">
               删除
             </el-button>
@@ -159,43 +174,43 @@
 
       <el-divider content-position="left">设置参数</el-divider>
       <el-table
-        :data="formData.paramList"
+        :data="formData.settingList"
         border
         style="width: 100%; margin-top: 5px;">
         <el-table-column
           prop=""
           label="键"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.key" maxlength="256" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
           prop=""
           label="名称"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.name" maxlength="256" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
           prop=""
           label="类型"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.valuetype" maxlength="256" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
           prop=""
           label="值"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-input size="mini" v-model="scope.row.value" maxlength="256" clearable
-                      style="width:100%;hight:100%"></el-input>
+                      style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
         <el-table-column
@@ -203,16 +218,18 @@
           label="操作"
           width="100"
           align="center">
-          <template slot-scope="scope">
+          <template #default="scope">
             <el-button
-              @click.native.prevent="addRow(scope.$index, formData.settingList)"
-              type="text"
+              @click.prevent="addRow(scope.$index, formData.settingList)"
+              link
+              type="primary"
               size="small">
               添加
             </el-button>
             <el-button
-              @click.native.prevent="deleteRow(scope.$index, formData.settingList)"
-              type="text"
+              @click.prevent="deleteRow(scope.$index, formData.settingList)"
+              link
+              type="primary"
               size="small">
               删除
             </el-button>
@@ -227,10 +244,9 @@
   </Dialog>
 </template>
 <script lang="ts" setup>
-  import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+  import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
   import * as ScheduleModelApi from '@/api/model/sche/model'
   import { CommonStatusEnum } from '@/utils/constants'
-  import * as DataSourceConfigApi from "@/api/infra/dataSourceConfig";
 
   defineOptions({ name: 'ScheduleModelForm' })
 
@@ -252,7 +268,7 @@
     modelPath: undefined,
     resultStrId: undefined,
     invocation: undefined,
-    status: undefined,
+    status: CommonStatusEnum.ENABLE,
     paramList: [{
       modelparamportorder: '1',
       modelparamorder: '1',
@@ -273,7 +289,7 @@
     modelType: [{ required: true, message: '模型类型不能为空', trigger: 'blur' }]
   })
   const formRef = ref() // 表单 Ref
-  const modelparamListMap = ref([] as ScheduleModelApi.ModelParamVO[])
+  const modelparamListMap = ref({})
 
   const addRow = function (index, rows) {
     let row = JSON.parse(JSON.stringify(rows[index]))
@@ -319,7 +335,7 @@
       }
 
       // 加载数据源列表
-      modelparamListMap.value = await ScheduleModelApi.getModelParamList()
+      await ScheduleModelApi.getModelParamList(modelparamListMap)
     }
   }
   defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -364,7 +380,7 @@
       modelPath: undefined,
       resultStrId: undefined,
       invocation: undefined,
-      status: undefined,
+      status: CommonStatusEnum.ENABLE,
       paramList: [{
         modelparamportorder: '1',
         modelparamorder: '1',

--
Gitblit v1.9.3