From 5e26f4e419440a810d66d2f3a5c978da5581f56f Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 06 一月 2025 13:30:00 +0800
Subject: [PATCH] pyFile可编辑

---
 src/views/model/sche/model/ScheduleModelForm.vue |  139 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 114 insertions(+), 25 deletions(-)

diff --git a/src/views/model/sche/model/ScheduleModelForm.vue b/src/views/model/sche/model/ScheduleModelForm.vue
index d9b6aa1..42d96b3 100644
--- a/src/views/model/sche/model/ScheduleModelForm.vue
+++ b/src/views/model/sche/model/ScheduleModelForm.vue
@@ -210,6 +210,7 @@
         <el-table-column
           prop=""
           label="键"
+          min-width="150"
           align="center">
           <template #default="scope">
             <el-input v-model="scope.row.key" maxlength="20" clearable :disabled="true"
@@ -219,6 +220,7 @@
         <el-table-column
           prop=""
           label="名称"
+          min-width="150"
           align="center">
           <template #default="scope">
             <el-input v-model="scope.row.name" maxlength="20" clearable :disabled="true"
@@ -228,6 +230,7 @@
         <el-table-column
           prop=""
           label="类型"
+          min-width="100"
           align="center">
           <template #default="scope">
             <el-select v-model="scope.row.valuetype" placeholder="请选择" :disabled="true">
@@ -243,34 +246,98 @@
         <el-table-column
           prop=""
           label="值"
+          min-width="300"
           align="center">
           <template #default="scope">
-            <el-input v-model="scope.row.value" maxlength="256" clearable  :disabled="scope.row.key === 'pyFile'"
+            <el-input v-model="scope.row.value" maxlength="256" clearable
+                      :disabled="scope.row.key === 'pyFile_BAK'"
                       style="width:100%;hight:100%"/>
           </template>
         </el-table-column>
-<!--        <el-table-column-->
-<!--          prop=""-->
-<!--          label="操作"-->
-<!--          width="100"-->
-<!--          align="center">-->
-<!--          <template #default="scope">-->
-<!--            <el-button-->
-<!--              @click.prevent="addRow(scope.$index, formData.settingList)"-->
-<!--              link-->
-<!--              type="primary"-->
-<!--              size="small">-->
-<!--              添加-->
-<!--            </el-button>-->
-<!--            <el-button-->
-<!--              @click.prevent="deleteRow(scope.$index, formData.settingList)"-->
-<!--              link-->
-<!--              type="primary"-->
-<!--              size="small">-->
-<!--              删除-->
-<!--            </el-button>-->
-<!--          </template>-->
-<!--        </el-table-column>-->
+      </el-table>
+      <el-divider content-position="left">模型下发配置</el-divider>
+      <el-row :gutter="20">
+        <el-col :span="4">
+          <el-button type="primary" size="small" @click="addRowOut()" >新增</el-button>
+        </el-col>
+      </el-row>
+      <el-table
+        :data="formData.modelOut"
+        border
+        style="width: 100%; margin-top: 5px;">
+        <el-table-column prop="resultKey" label="输出key" align="center" min-width="100">
+          <template #default="scope">
+            <el-input size="mini" v-model="scope.row.resultKey" style="width:100%;height:100%"/>
+          </template>
+        </el-table-column>
+        <el-table-column prop="resultType" label="数据类型" align="center" min-width="150">
+          <template #default="scope">
+            <el-select v-model="scope.row.resultType" placeholder="请选择">
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.RESULT_TYPE)"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column prop="resultPort" label="角标1" align="center" min-width="100">
+          <template #default="scope">
+            <el-input-number :min="0" clearable controls-position="right" size="mini" v-model="scope.row.resultPort" style="width:100%;height:100%"/>
+          </template>
+        </el-table-column>
+        <el-table-column prop="resultIndex" label="角标2" align="center" min-width="100">
+          <template #default="scope">
+            <el-input-number :min="0" clearable controls-position="right" size="mini" v-model="scope.row.resultIndex" style="width:100%;height:100%"/>
+          </template>
+        </el-table-column>
+        <el-table-column prop="isWrite" label="是否下发" align="center" min-width="100">
+          <template #default="scope">
+            <el-switch size="small" v-model="scope.row.isWrite" :active-value="1"
+                       :inactive-value="0"/>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop=""
+          label="测点名称"
+          align="center" min-width="200">
+          <template #default="scope">
+            <el-select v-model="scope.row.pointNo"
+                       filterable
+                       placeholder="请选择">
+              <el-option
+                v-for="(item, index) in modelparamListMap['DATAPOINT']"
+                :key="index"
+                :label="item.name"
+                :value="item.itemNo"/>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column prop="disturbancePointNo’" label="无扰切换点位" align="center" min-width="200">
+          <template #default="scope">
+            <el-select v-model="scope.row.disturbancePointNo"
+                       filterable
+                       placeholder="请选择">
+              <el-option
+                v-for="(item, index) in modelparamListMap['DATAPOINT']"
+                :key="index"
+                :label="item.name"
+                :value="item.itemNo"/>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" fixed="right" header-align="center" align="center" width="100">
+          <template #default="scope">
+            <el-button
+              @click="deleteModelOutRow(scope.$index)"
+              key="danger"
+              type="danger"
+              link
+            >删除
+            </el-button>
+          </template>
+        </el-table-column>
       </el-table>
     </el-form>
     <template #footer>
@@ -284,6 +351,7 @@
   import * as ScheduleModelApi from '@/api/model/sche/model'
   import { CommonStatusEnum } from '@/utils/constants'
   import * as MpkApi from "@/api/model/mpk/mpk";
+  import {generateUUID} from "@/utils";
 
   defineOptions({ name: 'ScheduleModelForm' })
 
@@ -307,7 +375,8 @@
     invocation: undefined,
     status: CommonStatusEnum.ENABLE,
     paramList: [],
-    settingList: []
+    settingList: [],
+    modelOut: []
   })
   const formRules = reactive({
     modelCode: [{ required: true, message: '模型编号不能为空', trigger: 'blur' }],
@@ -413,7 +482,8 @@
       invocation: undefined,
       status: CommonStatusEnum.ENABLE,
       paramList: [],
-      settingList: []
+      settingList: [],
+      modelOut: []
     }
     formRef.value?.resetFields()
   }
@@ -490,4 +560,23 @@
   function changeModelparamtype(row) {
     row.modelparamid = ''
   }
+  const addRowOut= function () {
+    if(formData.value.modelOut===undefined) {
+      formData.value.modelOut = []
+    }
+    formData.value.modelOut.push({
+      id: generateUUID(),
+      resultKey: undefined,
+      resultType: "double[][]",
+      port: 0,
+      index: 0,
+      isWrite: 1,
+      pointNo:undefined,
+      sort:undefined,
+      disturbancePointNo:undefined,
+    })
+  }
+  const deleteModelOutRow = function (index) {
+    formData.value.modelOut.splice(index, 1)
+  }
 </script>

--
Gitblit v1.9.3