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/dispatching/editDispatch.vue |   55 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/laboratory/src/views/dataManagement/dispatching/editDispatch.vue b/laboratory/src/views/dataManagement/dispatching/editDispatch.vue
index 713e385..2cb3960 100644
--- a/laboratory/src/views/dataManagement/dispatching/editDispatch.vue
+++ b/laboratory/src/views/dataManagement/dispatching/editDispatch.vue
@@ -3,7 +3,9 @@
     <el-dialog
       :title="dialogTitle"
       :visible.sync="visible"
-      width="80%"
+      width="90%"
+      @open='open'
+      top="5vh"
       :close-on-click-modal="false"
       @close="handleClose"
     >
@@ -118,7 +120,6 @@
                 <div style="padding-left: 25px">
                   <el-form-item prop="experimentTime" label="试验时间">
                     <el-date-picker
-                      style="width: 100%"
                       v-model="form.experimentTime"
                       type="datetimerange"
                       range-separator="至"
@@ -236,7 +237,7 @@
         <img
           v-if="imgSrc"
           style="width: 200px; height: 100px; margin-left: 25px"
-          :src="imgSrc"
+          :src="getFullUrl(imgSrc)"
           fit="fit"
         />
       </div>
@@ -263,6 +264,8 @@
 import SignatureCanvas from "@/components/SignatureCanvas.vue";
 import AIEditor from "@/components/AiEditor";
 import { getDetailById, sign } from "./service";
+import {queryDetail} from '@/components/service.js'
+import {getFullUrl} from '@/utils/utils.js'
 
 export default {
   name: "ApprovalDialog",
@@ -357,6 +360,14 @@
     },
   },
   methods: {
+    getFullUrl,
+    open(){
+      queryDetail().then(res=>{
+        if(res){
+          this.imgSrc=res.signPicture
+        }
+      })
+    },
     // 获取详情
     getDetail(id) {
       getDetailById({ id })
@@ -432,7 +443,7 @@
                     name: item.nickName || "",
                     status: item.status === 2 ? "已确认" : "待确认",
                     approveTime: item.status === 2 ? item.signTime : "",
-                    avatar: item.avatar || "",
+                    avatar: item.avatar,
                   })),
                 },
                 {
@@ -441,7 +452,7 @@
                     name: item.nickName || "",
                     status: item.status === 2 ? "已确认" : "待确认",
                     approveTime: item.status === 2 ? item.signTime : "",
-                    avatar: item.avatar || "",
+                    avatar: item.avatar,
                   })),
                 },
               ],
@@ -451,8 +462,8 @@
           }
         })
         .catch((err) => {
-          console.error("获取详情失败:", err);
-          this.$message.error("获取详情失败");
+          // console.error("获取详情失败:", err);
+          // this.$message.error("获取详情失败");
         });
     },
     memberList(type) {
@@ -469,24 +480,30 @@
     },
     handleClose() {
       this.$emit("close", false);
+      this.$emit("update:data", {}); // 触发事件通知父组件更新data
       this.signatureDialogVisible = false;
       this.imgSrc = '';
     },
     handleApprove() {
+      if(!this.imgSrc){
+        this.$message.error('请先签字在提交');
+        return
+      }
       // 组装签名数据
       const params = {
-        id: this.data.id, // 传递当前调度id
-        signImg: this.imgSrc, // 签名图片
+        dispatchId: this.data.id, // 传递当前调度id
+        confirmSign: this.imgSrc, // 签名图片
       };
       sign(params).then(res => {
         if (res && res.code === 200) {
           this.$message.success('签字成功');
           this.handleClose();
+          this.$emit('update:data')
         } else {
           this.$message.error(res.msg || '签字失败');
         }
       }).catch(() => {
-        this.$message.error('签字失败');
+        // this.$message.error('签字失败');
       });
     },
     openSignature() {
@@ -494,10 +511,10 @@
     },
     handleSignatureConfirm(imageData) {
       this.signatureDialogVisible = false;
-      // 模拟上传签名图片,实际应调用上传接口,成功后回显图片链接
-      // TODO: 替换为实际上传接口
-      // uploadSignature(imageData).then(url => { this.imgSrc = url })
-      this.imgSrc = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'; // 默认图片链接
+      this.imgSrc = ""; // 先清空
+      this.$nextTick(() => {
+        this.imgSrc = imageData;
+      });
     },
   },
 };
@@ -510,7 +527,7 @@
 
 .approval-dialog {
   display: flex;
-  height: 60vh;
+  height: 70vh;
 
   .approval-content {
     flex: 1;
@@ -521,8 +538,8 @@
   }
 
   .approval-flow {
-    padding: 40px 20px;
-    width: 405px;
+    padding: 20px 0px;
+    width: 305px;
     background: #ffffff;
     box-shadow: 0px 4px 12px 4px rgba(0, 0, 0, 0.08);
     border-radius: 10px;
@@ -545,11 +562,11 @@
   }
 }
 .approval-dialog-approve {
-  margin-top: 26px;
+  margin-top: 18px;
 }
 
 .approval-content-card {
-  height: calc(100% - 100px) !important;
+  height: calc(100% - 10px) !important;
   box-shadow: none !important;
 }
 

--
Gitblit v1.7.1