From 23c8b8154fcf7c9251d07f028f3e14737ba4cecd Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期二, 31 十二月 2024 19:04:35 +0800
Subject: [PATCH] 调度模型下发配置

---
 src/views/model/sche/model/ScheduleModelForm.vue |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/src/views/model/sche/model/ScheduleModelForm.vue b/src/views/model/sche/model/ScheduleModelForm.vue
index d9b6aa1..d09e47a 100644
--- a/src/views/model/sche/model/ScheduleModelForm.vue
+++ b/src/views/model/sche/model/ScheduleModelForm.vue
@@ -272,6 +272,83 @@
 <!--          </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="100">
+          <template #default="scope">
+            <el-input size="mini" v-model="scope.row.resultType" style="width:100%;height:100%"/>
+          </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>
       <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
@@ -284,6 +361,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 +385,8 @@
     invocation: undefined,
     status: CommonStatusEnum.ENABLE,
     paramList: [],
-    settingList: []
+    settingList: [],
+    modelOut: []
   })
   const formRules = reactive({
     modelCode: [{ required: true, message: '模型编号不能为空', trigger: 'blur' }],
@@ -413,7 +492,8 @@
       invocation: undefined,
       status: CommonStatusEnum.ENABLE,
       paramList: [],
-      settingList: []
+      settingList: [],
+      modelOut: []
     }
     formRef.value?.resetFields()
   }
@@ -490,4 +570,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