From 6f81691ab09d586470426ee0bfa99cec83797f7b Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期一, 23 六月 2025 15:52:24 +0800
Subject: [PATCH] 实验运行模块 图片换真实上传

---
 laboratory/src/views/dataManagement/schemeManagement/addPlan.vue |   49 ++++++++++++++++++++++++-------------------------
 1 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue b/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
index 4201208..f3fac56 100644
--- a/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
+++ b/laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
@@ -198,7 +198,7 @@
 import AiEditor from "@/components/AiEditor";
 import { getGroupByDispatchId, getParticipantsByDispatchId, getDetail } from "./service";
 import moment from 'moment';
-import { add,update } from "./service";
+import { add,update,updateTester } from "./service";
 
 export default {
   name: "AddProject",
@@ -271,7 +271,7 @@
     this.userRole=userInfo.roleType || '';
     // 检查是否为编辑模式
     if (this.$route.query.type === 'edit' && this.$route.query.id) {
-      this.isEdit = true;
+      this.isEdit = this.userRole==3?false:true;
       this.editId = this.$route.query.id;
       await this.loadEditData();
     }
@@ -396,19 +396,17 @@
           formData.experimentMaterial = JSON.stringify(this.form.experimentMaterial);
           
           // 编辑模式下添加id参数
-          if (this.isEdit && this.editId) {
+          if (this.editId) {
             formData.id = this.editId;
           }
           
           // 根据是否为编辑模式调用不同接口
-          const apiCall = this.isEdit ? update(formData) : add(formData);
+          const apiCall = this.editId ? update(formData) : this.isEdit? updateTester(formData): add(formData);
           
           apiCall.then(res => {
             if (res.code === 200) {
               this.$message.success(status === 1 ? '保存成功' : '草稿保存成功');
-              if (status === 1) {
-                this.$router.go(-1);
-              }
+              this.$router.go(-1);
             } else {
               this.$message.error(res.msg || (status === 1 ? '保存失败' : '草稿保存失败'));
             }
@@ -549,6 +547,7 @@
         // 填充实验调度信息
         if (data.experimentDispatch?.id) {
           this.form.dispatchId = data.experimentDispatch.id;
+          console.log('experimentStepRecord experimentStepRecord',JSON.parse(data.experimentStepRecord))
           this.groupTableData = [{ ...data.experimentDispatch }];
           
           // 获取组别信息
@@ -614,25 +613,25 @@
           }
 
           // 设置动态组件的初始数据
-          if (!this.isEdit) {
-            if (this.$refs.materialComponent && this.form.experimentMaterial) {
-              this.$refs.materialComponent.setInitialData(this.form.experimentMaterial);
-            }
-            if (this.$refs.equipmentComponent && this.form.experimentDevice) {
-              this.$refs.equipmentComponent.setInitialData(this.form.experimentDevice);
-            }
+          // if (!this.isEdit) {
+          //   // if (this.$refs.materialComponent && this.form.experimentMaterial) {
+          //   //   this.$refs.materialComponent.setInitialData(this.form.experimentMaterial);
+          //   // }
+          //   // if (this.$refs.equipmentComponent && this.form.experimentDevice) {
+          //   //   this.$refs.equipmentComponent.setInitialData(this.form.experimentDevice);
+          //   // }
 
-            // 设置步骤内容的初始数据
-            this.stepList.forEach((step, index) => {
-              const stepContentRef = this.$refs['stepContent' + index];
-              if (stepContentRef && step.content) {
-                const editor = Array.isArray(stepContentRef) ? stepContentRef[0] : stepContentRef;
-                if (editor?.setInitialData) {
-                  editor.setInitialData(step.content);
-                }
-              }
-            });
-          }
+          //   // 设置步骤内容的初始数据
+          //   this.stepList.forEach((step, index) => {
+          //     const stepContentRef = this.$refs['stepContent' + index];
+          //     if (stepContentRef && step.content) {
+          //       const editor = Array.isArray(stepContentRef) ? stepContentRef[0] : stepContentRef;
+          //       if (editor?.setInitialData) {
+          //         editor.setInitialData(step.content);
+          //       }
+          //     }
+          //   });
+          // }
         });
 
       } catch (error) {

--
Gitblit v1.7.1