From 527efb36f35b471710e445972673abff45bacdac Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期五, 12 九月 2025 17:36:09 +0800
Subject: [PATCH] 401跳转登录

---
 laboratory/src/views/dataManagement/schemeManagement/addPlan.vue |   71 +++++++++++++++++++++++++----------
 1 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue b/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
index 783da87..ab8bbfa 100644
--- a/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
+++ b/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
@@ -223,7 +223,7 @@
             ref="purposeEditor"
             :readOnly="isEdit"
             :value="editorContents.purpose"
-            height="200px"
+            height="400px"
             placeholder="请输入实验目的..."
           />
         </div>
@@ -239,7 +239,7 @@
             ref="processEditor"
             :readOnly="isEdit"
             :value="editorContents.process"
-            height="200px"
+            height="400px"
             placeholder="请输入工艺参数及路线..."
           />
         </div>
@@ -576,7 +576,7 @@
           }
 
           // 根据是否为编辑模式调用不同接口
-          const apiCall = this.editId
+          const apiCall = (this.editId && !this.isEdit)
             ? update(formData)
             : this.isEdit
             ? updateTester(formData)
@@ -631,13 +631,11 @@
         this.$message.error("请选择实验调度");
         return false;
       }
-
       // 校验实验日期
       if (!this.form.experimentDate) {
         this.$message.error("请填写实验日期");
         return false;
       }
-
       // 校验参与人员
       if (
         !this.selectedParticipants ||
@@ -646,46 +644,67 @@
         this.$message.error("请选择参与人员");
         return false;
       }
-
       // 校验实验目的
       const purpose = this.$refs.purposeEditor.getContent();
       if (!purpose || purpose === "<p></p>" || purpose.trim() === "<p></p>") {
         this.$message.error("请填写实验目的");
         return false;
       }
-
       // 校验工艺参数及路线
       const process = this.$refs.processEditor.getContent();
       if (!process || process === "<p></p>" || process.trim() === "<p></p>") {
         this.$message.error("请填写工艺参数及路线");
         return false;
       }
-
+      // 校验 DynamicComponent 里的表格
+      function checkDynamicComponentTables(list, label) {
+        if (!Array.isArray(list)) return true;
+        for (const comp of list) {
+          if (comp.type === 'customTable') {
+            if (!comp.data || !Array.isArray(comp.data.headers) || comp.data.headers.length === 0) {
+              this.$message.error(`${label}中有表格未添加表头`);
+              return false;
+            }
+            if (!Array.isArray(comp.data.rows) || comp.data.rows.length === 0) {
+              this.$message.error(`${label}中有表格未添加数据`);
+              return false;
+            }
+          }
+        }
+        return true;
+      }
       // 校验实验材料
       if (!this.form.experimentMaterial) {
         this.$message.error("请添加实验材料");
         return false;
       }
-
+      if (!checkDynamicComponentTables.call(this, this.form.experimentMaterial, '实验材料')) {
+        return false;
+      }
       // 校验实验设备
       if (!this.form.experimentDevice) {
         this.$message.error("请添加实验设备");
         return false;
       }
-
+      if (!checkDynamicComponentTables.call(this, this.form.experimentDevice, '实验设备')) {
+        return false;
+      }
       // 校验实验步骤记录
       if (!this.stepList || this.stepList.length === 0) {
         this.$message.error("请添加实验操作步骤");
         return false;
       }
-
-      // 校验每个步骤是否都有内容
-      const invalidStep = this.stepList.findIndex((step) => !step.content);
-      if (invalidStep !== -1) {
-        this.$message.error(`请完善第${invalidStep + 1}个步骤的内容`);
-        return false;
+      // 校验每个步骤是否都有内容及表格
+      for (let i = 0; i < this.stepList.length; i++) {
+        const step = this.stepList[i];
+        if (!step.content) {
+          this.$message.error(`请完善第${i + 1}个步骤的内容`);
+          return false;
+        }
+        if (!checkDynamicComponentTables.call(this, step.content, `第${i + 1}个步骤`)) {
+          return false;
+        }
       }
-
       return true;
     },
     handleStopExperiment() {
@@ -757,6 +776,18 @@
           } catch (err) {
             console.error("获取组别列表失败:", err);
           }
+          getParticipantsByDispatchId({ dispatchId: data.experimentDispatch.id })
+          .then((res) => {
+            if (res) {
+              this.participantsData = res || [];
+            } else {
+              this.$message.error(res.msg || "获取参加人员列表失败");
+            }
+          })
+          .catch((err) => {
+            this.$message.error("获取参加人员列表失败");
+            console.error("获取参加人员列表失败:", err);
+          });
         }
 
         // 填充参与人员
@@ -956,12 +987,12 @@
 }
 
 .groupTable {
-  width: 65%;
+  width: 100%;
   padding-left: 40px;
 }
 
 .rwuTable {
-  width: 85%;
+  width: 100%;
   padding-left: 40px;
 }
 
@@ -1169,7 +1200,7 @@
 .content-box {
   padding: 0 25px;
   margin-bottom: 20px;
-  width: 65%;
+  width: 95%;
   display: flex;
   .content-box-left {
     flex: 1;

--
Gitblit v1.7.1