From 835caa28c4a48af5e9382a8045bb59e3f7e2470b Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期一, 08 十二月 2025 10:03:12 +0800
Subject: [PATCH] 修改了代码

---
 src/views/archiveManager/archiveMaterial/index.vue |   81 ++++++++++++++++++++++++++++++----------
 1 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/src/views/archiveManager/archiveMaterial/index.vue b/src/views/archiveManager/archiveMaterial/index.vue
index 90f6360..08ceddc 100644
--- a/src/views/archiveManager/archiveMaterial/index.vue
+++ b/src/views/archiveManager/archiveMaterial/index.vue
@@ -87,6 +87,7 @@
           <el-select
             v-model="form.fileStyle"
             placeholder="璇烽�夋嫨鏉愭枡绫诲瀷"
+            @change="handleFileStyleChange"
           >
             <el-option
               v-for="item in fileStyleOptions"
@@ -616,9 +617,11 @@
       <el-form-item label="鏂囦欢棰樺悕" prop="title">
         <el-input
           v-model="queryParams.title"
-          placeholder="璇疯緭鍏ユ枃浠堕鐩�"
+          placeholder="璇疯緭鍏ユ枃浠堕鍚�"
           clearable
           @keyup.enter.native="handleQuery"
+          :validate-event="false"
+          @blur="validateQueryTitle"
         />
       </el-form-item>
       <el-form-item label="鏃ユ湡" prop="date">
@@ -793,7 +796,7 @@
   </template>
 
   <script>
-  import { islegal, listMaterials, enload, getMaterials, delMaterials, addMaterials, updateMaterials } from "@/api/system/materials"
+  import {insertFile, getFileCount,islegal, listMaterials, enload, getMaterials, delMaterials, addMaterials, updateMaterials } from "@/api/system/materials"
 import { getToken } from '@/utils/auth'
 import store from '@/store'
 import { updateStatusById } from "@/api/system/records"
@@ -803,6 +806,7 @@
     name: "Materials",
     data() {
       return {
+        totalPageCount: 0,
         // 璁板綍鍏冪礌鍒濆浣嶇疆鍜岀姸鎬�
   originalOffsetLeft: 0,
         originalWidth: 0,
@@ -933,7 +937,7 @@
           ],
           title: [
             { required: true, message: "妗堝嵎棰樺悕涓嶈兘涓虹┖", trigger: "blur" },
-            // { pattern: /^[^\\/:*?"<>涓╙+$/, message: "鏂囦欢鍚嶄笉鑳藉寘鍚� \\:*?"<>涓� 绛夌壒娈婂瓧绗�", trigger: "blur" },
+             { pattern: /^[^\\/:*?"<>涓╙+$/, message: "鏂囦欢鍚嶄笉鑳藉寘鍚� \\\:*?<>涓� 绛夌壒娈婂瓧绗�", trigger: "blur" },
             { max: 85, message: "鏈�澶ч暱搴︿负85涓瓧绗�", trigger: "blur" }
           ],
           date: [
@@ -997,6 +1001,9 @@
     created() {
       //const roleId = this.$route.params && this.$route.params.roleId
       const recordId = this.$route.params && this.$route.params.recordId
+
+      this.totalPageCount = this.$route.params && this.$route.params.pageCount
+      //alert(this.totalPageCount)
       //alert(recordId)
       this.recordId = recordId;
       this.uploadUrl = process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId
@@ -1041,6 +1048,11 @@
     },
        // 鎵撳紑瀵煎叆瀵硅瘽妗�
     handleImport() {
+      //鐢熸垚鏂扮殑璁板綍
+      insertFile(this.recordId, this.totalPageCount).then(response => {
+        console.log(response)
+      //  alert(3245)
+        })
       this.importDialogVisible = true
     },
     // 鏂囦欢绉婚櫎
@@ -1063,26 +1075,31 @@
         this.$modal.msgWarning('璇峰厛閫夋嫨鏂囦欢鍐嶄笂浼�')
         return
       }
-      if(fileCount!==this.total)
-      {
-        this.$modal.msgWarning('璇烽�夋嫨涓庤褰曟暟涓�鑷寸殑鏂囦欢')
-        return
-      }
+     // alert(this.recordId)
+
+
       //鍒ゆ柇椤靛彿涓庝笂浼犱笂浼犵殑鏂囦欢鐨勯〉鍙锋槸涓嶆槸涓�涓�瀵瑰簲鐨�
-     islegal(this.recordId).then(response => {
-       console.log(response.data)
-       var res = response.data
-       if(res)
+     // islegal(this.recordId).then(response => {
+     //   console.log(response.data)
+     //   var res = response.data.res
+     //  console.log(res)
+       //alert(response.data.total)
+       if(fileCount!=this.totalPageCount)
+       {
+         this.$modal.msgWarning('璇烽�夋嫨涓庤褰曟暟涓�鑷寸殑鏂囦欢')
+         return
+       }
+       else
        {
          // 鎵ц涓婁紶
            this.$refs.upload.submit()
            this.getList()
        }
-       else
-       {
-         this.$modal.msgError("椤靛彿涓嶈繛缁紝璇蜂慨鏀逛负杩炵画姝g‘鐨勯〉鍙凤紒")
-       }
-     })
+       // else
+       // {
+       //   this.$modal.msgError("椤靛彿涓嶈繛缁紝璇蜂慨鏀逛负杩炵画姝g‘鐨勯〉鍙凤紒")
+       // }
+     //})
 
     },
     clearFileList() {
@@ -1114,10 +1131,10 @@
       /** 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� */
       getList() {
         this.loading = true
-        
+
         // 澶勭悊妗f鍙锋悳绱㈤�昏緫锛屽寘鎷寖鍥存悳绱�
         const queryParams = { ...this.queryParams }
-        
+
         // 妫�鏌ユ槸鍚﹀寘鍚寖鍥存悳绱㈢鍙�
         if (queryParams.fileNumber && queryParams.fileNumber.includes('~')) {
           const rangeParts = queryParams.fileNumber.split('~')
@@ -1128,7 +1145,7 @@
             queryParams.fileNumberEnd = rangeParts[1].trim()
           }
         }
-        
+
         listMaterials(queryParams).then(response => {
           console.log(response)
           this.materialsList = response.data.data
@@ -1280,6 +1297,14 @@
         this.showCreatorSuggestions = false;
       },
 
+      // 澶勭悊鏉愭枡绫诲瀷鍙樺寲
+      handleFileStyleChange(value) {
+        // 褰撻�夋嫨'鍏朵粬鏉愭枡'鏃讹紝娓呯┖椤电爜瀛楁
+        if (value === '鍏朵粬鏉愭枡') {
+          this.form.pageNumber = null;
+        }
+      },
+
       // 琛ㄥ崟閲嶇疆
       reset() {
         this.form = {
@@ -1312,8 +1337,24 @@
         }
         this.resetForm("form")
       },
+
+      // 楠岃瘉鏌ヨ琛ㄥ崟涓殑鏂囦欢棰樺悕
+      validateQueryTitle() {
+        const illegalCharsPattern = /[\\/:*?<>涓╙/;
+        if (this.queryParams.title && illegalCharsPattern.test(this.queryParams.title)) {
+          this.$message.error("鏂囦欢鍚嶄笉鑳藉寘鍚� \\:/:*?<>涓� 绛夌壒娈婂瓧绗�");
+          this.queryParams.title = this.queryParams.title.replace(illegalCharsPattern, '');
+        }
+      },
       /** 鎼滅储鎸夐挳鎿嶄綔 */
       handleQuery() {
+        // 鎼滅储鍓嶆牎楠屾枃浠堕鍚�
+        const illegalCharsPattern = /[\\/:*?<>涓╙/;
+        if (this.queryParams.title && illegalCharsPattern.test(this.queryParams.title)) {
+          this.$message.error("鏂囦欢鍚嶄笉鑳藉寘鍚� \\:/:*?<>涓� 绛夌壒娈婂瓧绗�");
+          this.queryParams.title = this.queryParams.title.replace(illegalCharsPattern, '');
+          return; // 闃绘鎼滅储锛岀洿鍒扮敤鎴蜂慨姝h緭鍏�
+        }
         this.queryParams.pageNum = 1
         this.getList()
       },

--
Gitblit v1.9.1