From 29be8639dc16b5d82bddc6099b1fa5cdca75f77a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 20 十月 2026 16:28:22 +0800
Subject: [PATCH] feat(import): 统一导入弹框与模板,修复模板日期格式及上传报错

---
 src/views/CNAS/process/method/standardNoveltyRetrieval/index.vue |  117 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 81 insertions(+), 36 deletions(-)

diff --git a/src/views/CNAS/process/method/standardNoveltyRetrieval/index.vue b/src/views/CNAS/process/method/standardNoveltyRetrieval/index.vue
index 51f8f15..06292dc 100644
--- a/src/views/CNAS/process/method/standardNoveltyRetrieval/index.vue
+++ b/src/views/CNAS/process/method/standardNoveltyRetrieval/index.vue
@@ -3,13 +3,18 @@
     <div style="display: flex;justify-content: space-between">
       <div style="display: flex;">
         <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;" v-if="tabIndex === '0'">
-          <span style="width: 68px;font-size: 14px;font-weight: 700;color: #606266;">鏍囧噯鍙�</span>
+          <span style="width: 68px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">鏍囧噯鍙�</span>
           <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="searchForm.standardNo"
                     @keyup.enter="searchList"></el-input>
         </div>
-        <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;" v-if="tabIndex === '1'">
-          <span style="width: 88px;font-size: 14px;font-weight: 700;color: #606266;">瀛樻。鍚嶇О</span>
+        <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;" v-if="tabIndex === '1' && historyType === 'manual'">
+          <span style="width: 88px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">瀛樻。鍚嶇О</span>
           <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="searchForm.archivedName"
+                    @keyup.enter="searchList"></el-input>
+        </div>
+        <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;" v-if="tabIndex === '1' && historyType === 'auto'">
+          <span style="width: 68px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">鏍囧噯鍙�</span>
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="searchForm.standardNo"
                     @keyup.enter="searchList"></el-input>
         </div>
         <div style="line-height: 30px;">
@@ -17,14 +22,10 @@
           <el-button size="small" @click="resetSearchForm">閲嶇疆</el-button>
         </div>
       </div>
-      <div style="line-height: 30px;">
+      <div style="line-height: 30px;" v-if="tabIndex === '0'">
         <el-button size="small" type="primary" @click="openApprovalDialog1">寤� 妗�</el-button>
-        <el-upload ref='upload' :action="action" :before-upload="beforeUpload" :headers="uploadHeader" :on-error="onError"
-                   :on-success="handleSuccessUp" :show-file-list="false"
-                   accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
-                   style="display: inline-block; margin-left: 10px;">
-          <el-button :loading="upLoading" size="small" type="primary">瀵煎叆</el-button>
-        </el-upload>
+        <el-button size="small" type="primary" style="margin-left: 10px;"
+                   @click="$refs.importDialog.open()">瀵煎叆</el-button>
         <el-button size="small" style="margin-left: 10px;" type="primary" @click="openFormDia">鏂� 澧�</el-button>
       </div>
     </div>
@@ -42,8 +43,15 @@
           </lims-table>
         </div>
         <div v-if="tabIndex === '1'">
-          <lims-table :column="oldTableColumn" :height="'calc(100vh - 20em)'" :table-data="oldTableData"
+          <el-radio-group v-model="historyType" size="small" style="margin-bottom: 10px" @change="switchHistoryType">
+            <el-radio-button value="manual">鎵嬪姩妗f</el-radio-button>
+            <el-radio-button value="auto">鑷姩褰掓。璁板綍</el-radio-button>
+          </el-radio-group>
+          <lims-table v-if="historyType === 'manual'" :column="oldTableColumn" :height="'calc(100vh - 23em)'" :table-data="oldTableData"
                       :table-loading="oldTableLoading" :page="oldPage" @pagination="oldPagination">
+          </lims-table>
+          <lims-table v-else :column="autoArchivedColumn" :height="'calc(100vh - 23em)'" :table-data="autoArchivedData"
+                      :table-loading="autoArchivedLoading" :page="autoArchivedPage" @pagination="autoArchivedPagination">
           </lims-table>
         </div>
       </div>
@@ -76,17 +84,33 @@
                    @pagination="pagination1">
         </limsTable>
       </el-dialog>
+      <import-dialog
+        ref="importDialog"
+        title="瀵煎叆鏍囧噯鏌ユ柊"
+        :action="action"
+        accept=".xls,.xlsx"
+        template-url="/import-templates/鏍囧噯鏌ユ柊瀵煎叆妯℃澘.xlsx"
+        template-name="鏍囧噯鏌ユ柊瀵煎叆妯℃澘.xlsx"
+        :tips="[
+          '琛ㄥご涓轰袱琛岋紝璇蜂粠绗� 3 琛屽紑濮嬪~鍐欐暟鎹�',
+          '鏍囧噯鍚嶇О銆佹爣鍑嗗彿璇峰~鍐欑幇琛屾爣鍑嗙殑鍚嶇О鍜岀紪鍙�',
+          '鏌ユ柊鏉ユ簮鎸夆�滄爣鍑嗙綉 鈫� 濮旀墭鎯呮姤鎵� 鈫� 鏍囧噯涔﹀簵 鈫� 鍏朵粬鈥濈殑椤哄簭鍙栫涓�涓潪绌洪」',
+          '澶囨敞鍒楀彧鑳藉~鍐欌�滄浛鎹⑩�濇垨鈥滀綔搴熲�濓紝鐣欑┖琛ㄧず鏃犲娉�'
+        ]"
+        @success="searchList"
+      />
     </div>
   </div>
 </template>
 
 <script>
 import limsTable from '@/components/Table/lims-table.vue'
+import ImportDialog from '@/components/ImportDialog/index.vue'
 import FormDialog from './component/FormDialog.vue';
 import EditFormDia from './component/EditFormDia.vue';
 import {
   addSearchNewArchived, exportMethodSearchNew,
-  pageMethodSearchNew, pageSearchNewArchived, pageSearchNewBackups, ratifySearchNewArchivedr
+  pageMethodSearchNew, pageSearchNewArchived, pageSearchNewBackups, pageAutoArchived, ratifySearchNewArchivedr
 } from '@/api/cnas/process/method/standardNoveltyRetrieval'
 
 export default {
@@ -95,6 +119,7 @@
   components: {
     FormDialog,
     limsTable,
+    ImportDialog,
     EditFormDia
   },
   data() {
@@ -450,9 +475,27 @@
       oldTableData: [],
       oldTableLoading: false,
       tabIndex: '0',
+      historyType: 'manual',
+      autoArchivedData: [],
+      autoArchivedLoading: false,
+      autoArchivedPage: {size: 10, current: 1, total: 0},
+      autoArchivedColumn: [
+        {label: '鏍囧噯鍚嶇О', prop: 'methodName', minWidth: '120'},
+        {label: '鏍囧噯鍙�', prop: 'standardNo', minWidth: '100'},
+        {label: '鏂囦欢缂栧彿', prop: 'fileNo', minWidth: '110'},
+        {
+          dataType: 'tag', label: '鏄惁鏄柊鏍囧噯', prop: 'isNewStandard', minWidth: '110',
+          formatData: () => '鍚�', formatType: () => 'danger'
+        },
+        {
+          dataType: 'tag', label: '鏌ヨ璁板綍鏉ユ簮', prop: 'searchNewSource', minWidth: '110',
+          formatData: (value) => ({0: '鏍囧噯缃�', 1: '濮旀墭鎯呮姤', 2: '鏍囧噯鏁�', 3: '鍏朵粬'}[value] || ''),
+          formatType: (value) => ({0: 'success', 1: 'danger', 2: 'warning', 3: 'info'}[value] || 'info')
+        },
+        {label: '鑷姩褰掓。鏃堕棿', prop: 'autoArchivedTime', minWidth: '150'}
+      ],
       formDialog: false,
       editFormDialog: false,
-      upLoading: false,
       outLoading: false,
       ratifyInfo: {
         writeUserId: '',
@@ -488,7 +531,7 @@
           console.log('err---', err);
           this.tableLoading = false
         })
-      } else {
+      } else if (this.historyType === 'manual') {
         this.oldTableLoading = true
         pageSearchNewArchived({archivedName: this.searchForm.archivedName, ...this.oldPage}).then(res => {
           this.oldTableLoading = false
@@ -500,6 +543,18 @@
         }).catch(err => {
           console.log('err---', err);
           this.oldTableLoading = false
+        })
+      } else {
+        this.autoArchivedLoading = true
+        pageAutoArchived({standardNo: this.searchForm.standardNo, ...this.autoArchivedPage}).then(res => {
+          this.autoArchivedLoading = false
+          if (res.code === 200) {
+            this.autoArchivedData = res.data.records
+            this.autoArchivedPage.total = res.data.total
+          }
+        }).catch(err => {
+          console.log('err---', err);
+          this.autoArchivedLoading = false
         })
       }
     },
@@ -575,6 +630,12 @@
     // 閲嶇疆鏌ヨ鏉′欢
     resetSearchForm() {
       this.searchForm.standardNo = '';
+      this.searchForm.archivedName = '';
+      this.searchList()
+    },
+    switchHistoryType() {
+      this.oldPage.current = 1
+      this.autoArchivedPage.current = 1
       this.searchList()
     },
     // 鎿嶄綔鏂板妗�
@@ -609,28 +670,6 @@
         this.$download.saveAs(blob, '鏍囧噯鏌ユ柊瀵煎嚭.xlsx')
       })
     },
-    // 瀵煎叆
-    beforeUpload(file) {
-      if (file.size > 1024 * 1024 * 10) {
-        this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
-        this.$refs.upload.clearFiles()
-        return false;
-      } else {
-        this.upLoading = true;
-        return true;
-      }
-    },
-    onError(err, file, fileList) {
-      this.$message.error('涓婁紶澶辫触')
-      this.$refs.upload.clearFiles()
-    },
-    handleSuccessUp(response) {
-      this.upLoading = false;
-      if (response.code == 200) {
-        this.$message.success('涓婁紶鎴愬姛');
-        this.searchList()
-      }
-    },
     // 鍒嗛〉
     pagination(page) {
       this.page.size = page.limit
@@ -642,6 +681,12 @@
     },
     oldPagination(page) {
       this.oldPage.size = page.limit
+      this.oldPage.current = page.page
+      this.searchList();
+    },
+    autoArchivedPagination(page) {
+      this.autoArchivedPage.size = page.limit
+      this.autoArchivedPage.current = page.page
       this.searchList();
     },
   },

--
Gitblit v1.9.3