From 22bece93435158d575297f200454c4ef2841070f Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 05 十二月 2024 10:40:05 +0800
Subject: [PATCH] 1.模型输入参数删除逻辑调整 2.调度模型信息关联模型库 3.关联项目不能为空

---
 src/views/model/pre/item/MmPredictItemForm.vue |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue
index c7d32b1..7f653e6 100644
--- a/src/views/model/pre/item/MmPredictItemForm.vue
+++ b/src/views/model/pre/item/MmPredictItemForm.vue
@@ -147,7 +147,7 @@
       </el-row>
       <el-row v-if="dataForm.itemtypename === 'NormalItem'">
         <el-col :span="12">
-          <el-form-item label="关联项目">
+          <el-form-item label="关联项目" prop="mmPredictModel.mpkprojectid">
             <el-select v-model="dataForm.mmPredictModel.mpkprojectid" placeholder="请选择">
               <el-option
                 v-for="item in mpkProjectList"
@@ -363,7 +363,7 @@
               添加
             </el-button>
             <el-button
-              @click="deleteRow(scope.$index, dataForm.mmModelParamList)"
+              @click="deleteRow(scope.$index, scope.row, dataForm.mmModelParamList)"
               type="text"
               size="mini">
               删除
@@ -564,6 +564,7 @@
   'dmModuleItem.moduleid': [{required: true, message: '管网不能为空', trigger: 'blur'}],
   'dmModuleItem.itemorder': [{required: true, message: '排序不能为空', trigger: 'blur'}],
   'mmPredictItem.predictlength': [{required: true, message: '预测长度不能为空', trigger: 'blur'}],
+  'mmPredictModel.mpkprojectid': [{required: true, message: '关联项目不能为空', trigger: 'blur'}],
 
 })
 const formRef = ref() // 表单 Ref
@@ -835,9 +836,9 @@
   rows.splice(index, 0, row)
 }
 
-function deleteRow(index: string, rows) {
-  if (!rows || rows.length === 1) {
-    message.error('不能全部删除!')
+function deleteRow(index, row, rows) {
+  if (!rows || rows.length === 1 || rows.filter(e => e.modelparamportorder === row.modelparamportorder).length === 1) {
+    message.error('不可删除!')
     return
   }
   rows.splice(index, 1)

--
Gitblit v1.9.3