From fa60bfa07970c192c85a437e7db784eccdae2839 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期一, 16 六月 2025 20:04:15 +0800
Subject: [PATCH] 修改bug

---
 laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue |   69 +++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue b/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
index 6eec636..c9b1774 100644
--- a/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
+++ b/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
@@ -50,19 +50,11 @@
       <el-button type="primary" @click="handleSubmit">提交确认单</el-button>
       <el-button @click="handleSaveDraft">存草稿</el-button>
     </div>
-    <experimentalScheduling :show="showScheduling" @close="showScheduling = false" @submit="setSelectedScheduling"/>
-    <add-test-item
-      :dialogVisible="testItemDialogVisible"
-      :editData="currentTestItem"
-      @close="handleTestItemDialogClose"
-      @confirm="handleTestItemConfirm"
-    />
-    <confirm-dialog
-      :visible.sync="confirmDialogVisible"
-      :formData="confirmFormData"
-      :sampleData="testItems"
-      @confirm="handleConfirmSubmit"
-    />
+    <experimentalScheduling :show="showScheduling" @close="showScheduling = false" @submit="setSelectedScheduling" />
+    <add-test-item :dialogVisible="testItemDialogVisible" :editData="currentTestItem" @close="handleTestItemDialogClose"
+      @confirm="handleTestItemConfirm" />
+    <confirm-dialog :visible.sync="confirmDialogVisible" :formData="confirmFormData" :sampleData="testItems"
+      @confirm="handleConfirmSubmit" />
   </Card>
 </template>
 
@@ -132,11 +124,11 @@
   mounted() { },
   methods: {
     setSelectedScheduling(data) {
-      console.log('data',data)
+      console.log('data', data)
       if (!data || data.length === 0) return;
       const selectedData = data[0]; // 获取选中的第一条数据
       this.selectedScheduling = selectedData;
-      
+
       // 更新表格数据
       this.tableData = [{
         planCode: selectedData.projectName || '', // 所属项目课题方案
@@ -149,7 +141,7 @@
         status: this.getStatusText(selectedData.status) // 状态
       }];
       this.total = this.tableData.length;
-      
+
       // 更新确认表单数据
       this.confirmFormData = {
         planName: selectedData.projectName || '',
@@ -158,7 +150,7 @@
         sampleCode: selectedData.experimentCode || '' // 使用实验编号作为取样单编号
       };
     },
-    
+
     // 添加状态转换方法
     getStatusText(status) {
       const statusMap = {
@@ -338,7 +330,7 @@
       }).then(() => {
         this.testItems.splice(index, 1)
         this.$message.success('删除成功')
-      }).catch(() => {})
+      }).catch(() => { })
     },
     generateUniqueId() {
       return 'test_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9)
@@ -367,7 +359,7 @@
         const submitData = {
           dispatchId: this.selectedScheduling.id, // 实验调度ID
           auditStatus: 1, // 待确认状态
-          confirmSign:'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'|| signatureImage, // 签字图片
+          confirmSign: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg' || signatureImage, // 签字图片
           signTime: new Date().toISOString(), // 签字时间
           testMethodConfirmSheetTerms: this.testItems.map(item => ({
             id: item.id, // 保留原有ID(编辑时使用)
@@ -396,7 +388,7 @@
           await add(submitData)
           this.$message.success('提交成功')
         }
-        
+
         this.confirmDialogVisible = false // 关闭弹窗
         this.$router.go(-1)
       } catch (error) {
@@ -441,7 +433,7 @@
           await add(draftData)
           this.$message.success('保存草稿成功')
         }
-        
+
         this.$router.push('/dataManagement/confirmation-sheet')
       } catch (error) {
         this.$message.error((this.formData.id ? '更新' : '保存') + '草稿失败:' + (error.message || '未知错误'))
@@ -450,26 +442,41 @@
     async getDetailData(id) {
       try {
         const res = await getDetail({ id })
-        if (res.data) {
+        if (res) {
           // 设置实验调度数据
           this.selectedScheduling = {
-            id: res.data.dispatchId,
-            // ... 其他调度相关字段
+            id: res.dispatchId,
           }
-          
+          this.tableData = [{
+            // planCode: res.projectName,
+            // planName: res.experimentCode,
+            // testName: res.experimentName,
+            // notifyTime: res.experimentDate,
+
+            planCode: res.projectName || '', // 所属项目课题方案
+            planName: res.experimentCode || '', // 实验编号
+            testName: res.experimentName || '', // 实验名称
+            notifyTime: res.experimentDate || '', // 通知时间
+            startTime: res.experimentStartTime || '', // 实验开始时间
+            endTime: res.experimentEndTime || '', // 实验结束时间
+            participants: res.participantsName || '', // 参加人员
+            status: this.getStatusText(res.status) // 状态
+
+          }]
+
           // 设置检测项数据
-          this.testItems = res.data.testMethodConfirmSheetTerms.map(item => ({
+          this.testItems = res.testMethodConfirmSheetTerms.map(item => ({
             ...item,
             id: item.id // 使用后端返回的ID
           }))
 
           // 设置表单数据
           this.formData = {
-            id: res.data.id,
-            dispatchId: res.data.dispatchId,
-            auditStatus: res.data.auditStatus,
-            confirmSign: res.data.confirmSign,
-            signTime: res.data.signTime
+            id: res.id,
+            dispatchId: res.dispatchId,
+            auditStatus: res.auditStatus,
+            confirmSign: res.confirmSign,
+            signTime: res.signTime
           }
         }
       } catch (error) {

--
Gitblit v1.7.1