From 2b2fa317c30ee2de7a8b6f5fc964532031adea66 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期日, 20 九月 2026 13:48:54 +0800
Subject: [PATCH] fix: 优化报告功能

---
 src/views/CNAS/process/method/standardMethod/index.vue |  160 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 106 insertions(+), 54 deletions(-)

diff --git a/src/views/CNAS/process/method/standardMethod/index.vue b/src/views/CNAS/process/method/standardMethod/index.vue
index 187794b..801222f 100644
--- a/src/views/CNAS/process/method/standardMethod/index.vue
+++ b/src/views/CNAS/process/method/standardMethod/index.vue
@@ -30,13 +30,14 @@
       </div>
     </div>
     <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
-      :height="'calc(100vh - 250px)'" @pagination="pagination"></lims-table>
+                :height="'calc(100vh - 250px)'" @pagination="pagination"></lims-table>
     <!-- 鏂板/缂栬緫 -->
     <el-dialog :title="title" :visible.sync="addDlog" width="500px">
       <el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
         <el-form-item label="琛屼笟" prop="industryIds">
-          <el-select v-model="addForm.industryIds" multiple filterable clearable collapse-tags placeholder="璇烽�夋嫨琛屼笟" style="width: 100%">
-            <el-option v-for="item in industryOptions" :key="item.id" :label="item.laboratoryName" :value="item.id" />
+          <el-select v-model="addForm.industryIds" multiple filterable clearable collapse-tags placeholder="璇烽�夋嫨琛屼笟"
+                     style="width: 100%">
+            <el-option v-for="item in industryOptions" :key="item.id" :label="item.laboratoryName" :value="item.id"/>
           </el-select>
         </el-form-item>
         <el-form-item label="鏍囧噯缂栧彿" prop="code">
@@ -59,21 +60,22 @@
         </el-form-item>
         <el-form-item label="鏄惁浜у搧鏍囧噯" prop="isProduct">
           <el-select v-model="addForm.isProduct" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%">
-            <el-option label="鍚�" :value="0"> </el-option>
-            <el-option label="鏄�" :value="1"> </el-option>
+            <el-option label="鍚�" :value="0"></el-option>
+            <el-option label="鏄�" :value="1"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="鏄惁鍚敤" prop="isUse">
           <el-select v-model="addForm.isUse" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%">
-            <el-option label="鍚�" :value="0"> </el-option>
-            <el-option label="鏄�" :value="1"> </el-option>
+            <el-option label="鍚�" :value="0"></el-option>
+            <el-option label="鏄�" :value="1"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item v-if="title === '鏂板'" label="闄勪欢">
           <el-upload ref="addUpload" action="#" :auto-upload="false" multiple :file-list="pendingFiles"
-            :on-change="pendingFileChange" :on-remove="pendingFileRemove" :before-upload="beforeFileUpload"
-            accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
-            <el-button size="small" type="primary">閫夋嫨闄勪欢</el-button><div slot="tip" class="el-upload__tip">鏀寔澶氫釜闄勪欢锛屽崟涓笉瓒呰繃10MB</div>
+                     :on-change="pendingFileChange" :on-remove="pendingFileRemove" :before-upload="beforeFileUpload"
+                     accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
+            <el-button size="small" type="primary">閫夋嫨闄勪欢</el-button>
+            <div slot="tip" class="el-upload__tip">鏀寔澶氫釜闄勪欢锛屽崟涓笉瓒呰繃200MB</div>
           </el-upload>
         </el-form-item>
       </el-form>
@@ -83,18 +85,27 @@
       </span>
     </el-dialog>
     <el-dialog title="鏍囧噯闄勪欢" :visible.sync="attachmentDialog" width="760px">
-      <el-upload v-if="currentMethod.id" :action="attachmentAction" :headers="uploadHeader" multiple :show-file-list="false"
-        :before-upload="beforeFileUpload" :on-success="attachmentUploadSuccess"
-        accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
+      <el-upload v-if="currentMethod.id" :action="attachmentAction" :headers="uploadHeader" multiple
+                 :show-file-list="false"
+                 :before-upload="beforeFileUpload" :on-success="attachmentUploadSuccess"
+                 accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar">
         <el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
       </el-upload>
       <el-table :data="attachmentList" border size="small" style="margin-top:12px">
-        <el-table-column label="鏂囦欢鍚嶇О" prop="fileName" min-width="280" />
-        <el-table-column label="涓婁紶鏃堕棿" prop="createTime" width="170" />
-        <el-table-column label="鎿嶄綔" width="180"><template slot-scope="scope"><el-button type="text" @click="previewAttachment(scope.row)">棰勮</el-button><el-button type="text" @click="downloadAttachment(scope.row)">涓嬭浇</el-button><el-button type="text" style="color:#f56c6c" @click="removeAttachment(scope.row)">鍒犻櫎</el-button></template></el-table-column>
+        <el-table-column label="鏂囦欢鍚嶇О" prop="fileName" min-width="280"/>
+        <el-table-column label="涓婁紶鏃堕棿" prop="createTime" width="170"/>
+        <el-table-column label="鎿嶄綔" width="180">
+          <template slot-scope="scope">
+            <el-button type="text" @click="previewAttachment(scope.row)">棰勮</el-button>
+            <el-button type="text" @click="downloadAttachment(scope.row)">涓嬭浇</el-button>
+            <el-button type="text" style="color:#f56c6c" @click="removeAttachment(scope.row)">鍒犻櫎</el-button>
+          </template>
+        </el-table-column>
       </el-table>
     </el-dialog>
-    <el-dialog title="棰勮闄勪欢" :visible.sync="previewDialog" fullscreen><file-preview v-if="previewDialog" :current-file="currentAttachment" :file-url="previewUrl" /></el-dialog>
+    <el-dialog title="棰勮闄勪欢" :visible.sync="previewDialog" fullscreen>
+      <file-preview v-if="previewDialog" :current-file="currentAttachment" :file-url="previewUrl"/>
+    </el-dialog>
   </div>
 </template>
 
@@ -107,6 +118,7 @@
   addStandardMethod,
   upStandardMethod, selectIndustryOptions, selectAttachments, uploadAttachment, deleteAttachment,
 } from "@/api/cnas/process/method/standardMethod";
+
 export default {
   name: 'StandardMethod',
   components: {
@@ -120,11 +132,11 @@
       queryParams: {},
       tableData: [],
       column: [
-        { label: "琛屼笟", prop: "industryNames", width: "140px" },
-        { label: "鏍囧噯缂栧彿", prop: "code", width: "100px" },
-        { label: "鏍囧噯鎻忚堪", prop: "name", width: "100px" },
-        { label: "澶囨敞", prop: "remark" },
-        { label: "璧勮川", prop: "qualificationId" },
+        {label: "琛屼笟", prop: "industryNames", width: "140px"},
+        {label: "鏍囧噯缂栧彿", prop: "code", width: "100px"},
+        {label: "鏍囧噯鎻忚堪", prop: "name", width: "100px"},
+        {label: "澶囨敞", prop: "remark"},
+        {label: "璧勮川", prop: "qualificationId"},
         {
           label: "鏄惁浜у搧鏍囧噯",
           prop: "isProduct",
@@ -163,10 +175,10 @@
             }
           },
         },
-        { label: "鍒涘缓浜�", prop: "createUserName" },
-        { label: "鍒涘缓鏃堕棿", prop: "createTime" },
-        { label: "鏇存柊浜�", prop: "updateUserName" },
-        { label: "鏇存柊鏃堕棿", prop: "updateTime" },
+        {label: "鍒涘缓浜�", prop: "createUserName"},
+        {label: "鍒涘缓鏃堕棿", prop: "createTime"},
+        {label: "鏇存柊浜�", prop: "updateUserName"},
+        {label: "鏇存柊鏃堕棿", prop: "updateTime"},
         {
           dataType: "action",
           fixed: "right",
@@ -212,13 +224,13 @@
       pendingFiles: [], attachmentDialog: false, attachmentList: [], currentMethod: {},
       previewDialog: false, currentAttachment: {}, previewUrl: '',
       addRules: {
-        code: [{ required: true, message: "璇疯緭鍏ユ爣鍑嗙紪鍙�", trigger: "blur" }],
-        name: [{ required: true, message: "璇疯緭鍏ユ爣鍑嗘弿杩�", trigger: "blur" }],
+        code: [{required: true, message: "璇疯緭鍏ユ爣鍑嗙紪鍙�", trigger: "blur"}],
+        name: [{required: true, message: "璇疯緭鍏ユ爣鍑嗘弿杩�", trigger: "blur"}],
         isProduct: [
-          { required: true, message: "璇烽�夋嫨鏄惁浜у搧鏍囧噯", trigger: "change" },
+          {required: true, message: "璇烽�夋嫨鏄惁浜у搧鏍囧噯", trigger: "change"},
         ],
         isUse: [
-          { required: true, message: "璇烽�夋嫨鏄惁鍚敤", trigger: "change" },
+          {required: true, message: "璇烽�夋嫨鏄惁鍚敤", trigger: "change"},
         ],
       },
     };
@@ -231,9 +243,9 @@
   methods: {
     getList() {
       this.tableLoading = true;
-      let param = { ...this.queryParams, ...this.page };
+      let param = {...this.queryParams, ...this.page};
       delete param.total;
-      selectStandardMethodList({ ...param })
+      selectStandardMethodList({...param})
         .then((res) => {
           this.tableLoading = false;
           if (res.code === 200) {
@@ -245,7 +257,7 @@
           this.tableLoading = false;
         });
     },
-    pagination({ page, limit }) {
+    pagination({page, limit}) {
       this.page.current = page;
       this.page.size = limit;
       this.getList();
@@ -263,7 +275,7 @@
     },
     openAdd() {
       this.title = "鏂板";
-      this.addForm = { industryIds: [], isProduct: 1, isUse: 1 };
+      this.addForm = {industryIds: [], isProduct: 1, isUse: 1};
       this.pendingFiles = [];
       this.addDlog = true;
     },
@@ -284,7 +296,11 @@
         this.qualificationList = arr;
       });
     },
-    loadIndustryOptions() { selectIndustryOptions().then(res => { this.industryOptions = res.data || []; }); },
+    loadIndustryOptions() {
+      selectIndustryOptions().then(res => {
+        this.industryOptions = res.data || [];
+      });
+    },
     submitProduct(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
@@ -301,11 +317,11 @@
                   return uploadAttachment(formData, id);
                 }));
               }).then(() => {
-                this.addLoading = false;
-                this.$message.success("鎻愪氦鎴愬姛");
-                this.getList();
-                this.addDlog = false;
-              })
+              this.addLoading = false;
+              this.$message.success("鎻愪氦鎴愬姛");
+              this.getList();
+              this.addDlog = false;
+            })
               .catch((err) => {
                 this.addLoading = false;
               });
@@ -329,12 +345,26 @@
         }
       });
     },
-    beforeFileUpload(file) { if (file.size > 10 * 1024 * 1024) { this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10MB'); return false; } return true; },
-    pendingFileChange(file, files) { this.pendingFiles = files; },
-    pendingFileRemove(file, files) { this.pendingFiles = files; },
-    openAttachments(row) { this.currentMethod = row; this.attachmentDialog = true; this.loadAttachments(); },
+    beforeFileUpload(file) {
+      if (file.size > 200 * 1024 * 1024) {
+        this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�200MB');
+        return false;
+      }
+      return true;
+    },
+    pendingFileChange(file, files) {
+      this.pendingFiles = files;
+    },
+    pendingFileRemove(file, files) {
+      this.pendingFiles = files;
+    },
+    openAttachments(row) {
+      this.currentMethod = row;
+      this.attachmentDialog = true;
+      this.loadAttachments();
+    },
     downloadAttachments(row) {
-      selectAttachments({ standardMethodId: row.id }).then(res => {
+      selectAttachments({standardMethodId: row.id}).then(res => {
         const attachments = res.data || [];
         if (!attachments.length) this.$message.warning('鏆傛棤闄勪欢');
         else if (attachments.length === 1) this.downloadAttachment(attachments[0]);
@@ -342,18 +372,35 @@
       });
     },
     previewAttachments(row) {
-      selectAttachments({ standardMethodId: row.id }).then(res => {
+      selectAttachments({standardMethodId: row.id}).then(res => {
         const attachments = res.data || [];
         if (!attachments.length) this.$message.warning('鏆傛棤闄勪欢');
         else if (attachments.length === 1) this.previewAttachment(attachments[0]);
         else this.openAttachments(row);
       });
     },
-    loadAttachments() { selectAttachments({ standardMethodId: this.currentMethod.id }).then(res => { this.attachmentList = res.data || []; }); },
-    attachmentUploadSuccess(res) { if (res.code === 200) { this.$message.success('涓婁紶鎴愬姛'); this.loadAttachments(); } },
-    downloadAttachment(row) { this.$download.saveAs(row.fileUrl, row.fileName); },
-    previewAttachment(row) { this.currentAttachment = row; this.previewUrl = /\.(jpg|jpeg|png|gif)$/i.test(row.fileUrl) ? this.javaApi + '/img/' + row.fileUrl : this.javaApi + '/word/' + row.fileUrl; this.previewDialog = true; },
-    removeAttachment(row) { this.$confirm('鏄惁鍒犻櫎璇ラ檮浠讹紵', '鎻愮ず', { type: 'warning' }).then(() => deleteAttachment({ id: row.id })).then(() => this.loadAttachments()); },
+    loadAttachments() {
+      selectAttachments({standardMethodId: this.currentMethod.id}).then(res => {
+        this.attachmentList = res.data || [];
+      });
+    },
+    attachmentUploadSuccess(res) {
+      if (res.code === 200) {
+        this.$message.success('涓婁紶鎴愬姛');
+        this.loadAttachments();
+      }
+    },
+    downloadAttachment(row) {
+      this.$download.saveAs(row.fileUrl, row.fileName);
+    },
+    previewAttachment(row) {
+      this.currentAttachment = row;
+      this.previewUrl = /\.(jpg|jpeg|png|gif)$/i.test(row.fileUrl) ? this.javaApi + '/img/' + row.fileUrl : this.javaApi + '/word/' + row.fileUrl;
+      this.previewDialog = true;
+    },
+    removeAttachment(row) {
+      this.$confirm('鏄惁鍒犻櫎璇ラ檮浠讹紵', '鎻愮ず', {type: 'warning'}).then(() => deleteAttachment({id: row.id})).then(() => this.loadAttachments());
+    },
     // 鍒犻櫎
     handleDelete(row) {
       this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
@@ -362,14 +409,19 @@
         type: "warning",
       })
         .then(() => {
-          delStandardMethod({ id: row.id }).then((res) => {
+          delStandardMethod({id: row.id}).then((res) => {
             this.$message.success("鍒犻櫎鎴愬姛");
             this.getList();
           });
         })
-        .catch(() => { });
+        .catch(() => {
+        });
     },
   },
-  computed: { attachmentAction() { return this.javaApi + '/standardMethod/uploadAttachment?standardMethodId=' + this.currentMethod.id; } },
+  computed: {
+    attachmentAction() {
+      return this.javaApi + '/standardMethod/uploadAttachment?standardMethodId=' + this.currentMethod.id;
+    }
+  },
 };
 </script>

--
Gitblit v1.9.3