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/chemistQa/projectTesting/addDetectionReport.vue |   68 +++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue b/laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue
index cbd23d0..8fcc614 100644
--- a/laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue
+++ b/laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue
@@ -24,8 +24,8 @@
             <el-form ref="form" :model="form" :rules="rules" inline label-position="top" style="margin-top: 18px">
                 <el-row :gutter="20">
                     <el-col :span="24">
-                        <el-form-item prop="reportContent" label="报告内容">
-                            <el-select v-model="form.reportContent" style="width: 100%;" placeholder="请选择报告内容">
+                        <el-form-item prop="reportContent" label="报告内容" >
+                            <el-select v-model="form.reportContent" style="width: 100%;" placeholder="请选择报告内容" :disabled="this.$route.query.type === 'detail'">
                                 <el-option label="国家标准" :value="1" />
                                 <el-option label="分析方法开发" :value="2" />
                                 <el-option label="方法验证报告" :value="3" />
@@ -57,7 +57,7 @@
                     </div>
                 </div>
                 <el-form-item prop="reportText" style="margin-top: 18px">
-                    <ai-editor ref="materialEditor" :value="form.reportText" style="width: 100%;"
+                    <ai-editor ref="materialEditor" :value="form.reportText" style="width: 100%;" :readOnly="this.$route.query.type === 'detail'"
                         placeholder="请输入报告正文" />
                 </el-form-item>
                 <div class="header-title" style="width: 100%;">
@@ -67,16 +67,10 @@
                     </div>
                 </div>
                 <el-form-item prop="name" style="margin-top: 18px">
-                    <!-- <el-upload 
-                        action="#" 
-                        :file-list="fileList"
-                        :http-request="handleUpload"
-                        :before-upload="beforeUpload"
-                        :on-remove="handleRemove">
-                        <el-button size="small" type="primary">点击上传</el-button>
-                        <div slot="tip" class="el-upload__tip">支持任意格式文件上传</div>
-                    </el-upload> -->
-                    <el-upload action="#" :file-list="fileList" :http-request="handleUpload"
+                     <el-upload action="#" 
+                     :file-list="fileList"
+                      :http-request="handleUpload"
+                       :disabled="this.$route.query.type === 'detail'"
                         :before-upload="beforeUpload" :on-remove="handleRemove">
                         <el-button size="small" type="primary">点击上传</el-button>
                         <div slot="tip" class="el-upload__tip">支持任意格式文件上传</div>
@@ -99,7 +93,7 @@
 import chooseProject from '@/components/chooseProject'
 import { addDetail, getDetailInfo, updateDetail, getDetail } from './service'
 import { customUploadRequest, getFullUrl } from '@/utils/utils'
-
+import { mapState } from "vuex";
 export default {
     components: {
         AiEditor,
@@ -118,7 +112,7 @@
                 itemId: "",
                 status: 1,
                 itemId: "",
-                qaReportFileList: [],
+                qaReportFiles: [],
                 commitPersonId: null,
             },
             tableData: [],
@@ -142,9 +136,9 @@
         this.form.commitPersonId = JSON.parse(sessionStorage.getItem('userInfo')).userId
         this.form.developDate = new Date().toISOString().split('T')[0];
 
-        this.form.itemId = this.$route.query.itemId
-        if (this.form.itemId) {
-            getDetail(this.form.itemId).then(res => {
+        // this.form.itemId = this.$route.query.itemId
+        if (this.$route.query.itemId) {
+            getDetail(this.$route.query.itemId).then(res => {
                 if (res) {
                     let item = {
                         teamName: res.projectTeamVO.teamName,
@@ -156,16 +150,20 @@
                         createBy: res.createBy,
                         createTime: res.createTime
                     }
+                    this.form.itemId = this.$route.query.itemId
+                    this.form.teamId = this.$route.query.teamId
+
                     this.tableData = [{ ...item }]
                 }
             })
         }
-        console.log('this.$route.query.itemId', this.$route.query)
-
         if (this.$route.query.id) {
             this.getDetail()
         }
     },
+    computed: {
+    ...mapState(["tagList", "isFold"]),
+  },
 
     methods: {
         getDetail() {
@@ -183,13 +181,13 @@
                             url: getFullUrl(file.fileUrl),
                             uid: file.id
                         }))
-                        this.form.qaReportFileList = res.fileList
+                        this.form.qaReportFiles = res.qaReportFileList
                     } else {
                         this.fileList = []
-                        this.form.qaReportFileList = []
+                        this.form.qaReportFiles = []
                     }
                 } else {
-                    this.$message.error(res.message || '获取详情失败')
+                    // this.$message.error(res.message || '获取详情失败')
                 }
             })
         },
@@ -215,12 +213,10 @@
 
                 this.loading = true
                 if (this.$route.query.id) {
-                    console.log('data updateDetail', data)
                     updateDetail({ ...data, id: this.$route.query.id }).then(res => {
-                        console.log('res',res)
                         if (res.code === 200) {
                             this.$message.success('修改成功')
-                            this.$router.back()
+                            this.back()
                         } else {
                             this.$message.error(res.message || '修改失败')
                         }
@@ -228,12 +224,10 @@
                         this.loading = false
                     })
                 } else {
-                    console.log('data addDetail', data)
                     addDetail(data).then(res => {
-                        console.log('res',res)
                         if (res.code === 200) {
                             this.$message.success('发布成功')
-                            this.$router.back()
+                            this.back()
                         } else {
                             this.$message.error(res.message || '发布失败')
                         }
@@ -259,7 +253,7 @@
                     updateDetail({ ...data, id: this.$route.query.id }).then(res => {
                         if (res.code === 200) {
                             this.$message.success('草稿保存成功')
-                            this.$router.back()
+                            this.back()
                         } else {
                             this.$message.error(res.message || '保存失败')
                         }
@@ -271,7 +265,7 @@
                     addDetail(data).then(res => {
                         if (res.code === 200) {
                             this.$message.success('草稿保存成功')
-                            this.$router.back()
+                            this.back()
                         } else {
                             this.$message.error(res.message || '保存失败')
                         }
@@ -281,6 +275,13 @@
                 }
             })
         },
+        back() {
+      this.$router.back();
+      this.$store.commit(
+        "SET_TAGLIST",
+        this.tagList.filter((item) => item.path !== this.$route.path)
+      );
+    },
                  // 上传前校验
                  beforeUpload(file) {
             return true;
@@ -293,7 +294,6 @@
             customUploadRequest({
                 file,
                 onSuccess: (res) => {
-                    console.log()
                     if (res.code === 200) {
                         const fileObj = {
                             id: new Date().getTime(),
@@ -311,7 +311,7 @@
                         });
 
                         // 添加到表单数据
-                        this.form.qaReportFileList.push(fileObj);
+                        this.form.qaReportFiles.push(fileObj);
 
                         this.$message.success('文件上传成功');
                         onSuccess(res);
@@ -330,7 +330,7 @@
             const index = this.fileList.findIndex(item => item.name === file.name);
             if (index !== -1) {
                 this.fileList.splice(index, 1);
-                this.form.qaReportFileList.splice(index, 1);
+                this.form.qaReportFiles.splice(index, 1);
             }
         },
     },

--
Gitblit v1.7.1