From bfcd7f5b405e431a5c07fe3fa77d74c892d4e66b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期四, 19 三月 2026 15:52:42 +0800
Subject: [PATCH] fix: 修复出入库冲突拦截,系统位置与实际位置的映射和修复

---
 项目代码/WMS/WIDESEA_WMSClient/src/views/system/txt_log.vue |  251 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 238 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/system/txt_log.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/system/txt_log.vue"
index 0c2ccba..14ae389 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/system/txt_log.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/system/txt_log.vue"
@@ -2,16 +2,21 @@
     <div class="mian_log">
         <div class="log_tree">
             <div class="log_search">
-                <el-input v-model.lazy="filterText" placeholder="璇疯緭鍏ユ煡璇㈠叧閿瓧" clearable />
+                <el-input v-model.lazy="filterText" placeholder="璇疯緭鍏ョ洰褰曞悕绉�" clearable />
                 <el-button type="success" @click="ReloadTree()">鍒� 鏂�</el-button>
             </div>
-            <el-tree class="log_el_tree" ref="treeRef" :data="treeData" :props="treeProps" :filter-node-method="treeFilter">
+            <!-- 娣诲姞鏍戣妭鐐规悳绱㈢粨鏋滄彁绀� -->
+            <div class="search-tip" v-if="filterText && filteredCount !== null">
+                鎵惧埌 {{ filteredCount }} 涓尮閰嶇殑鐩綍
+            </div>
+            <el-tree class="log_el_tree" ref="treeRef" :data="treeData" :props="treeProps" 
+                :filter-node-method="treeFilter" node-key="dirPath" highlight-current>
                 <template #default="{ node, data }">
                     <div class="treeItem">
-                        <div>{{ node.label }}</div>
+                        <!-- 楂樹寒鍖归厤鐨勫叧閿瓧 -->
+                        <div v-html="highlightText(node.label)"></div>
                         <div style="padding-left: 10px;" v-if="isFile(data)">
                             <a href="javascript:;" @click="GetContent(data)"> 鎵撳紑 </a>
-                            <!-- ||<a href="javascript:;" @click="DonwLog(data)"> 涓嬭浇 </a> -->
                         </div>
                     </div>
                 </template>
@@ -27,11 +32,26 @@
                 <el-checkbox v-model="keepRead">淇濇寔璇诲彇</el-checkbox>
             </div>
 
+            <!-- 娣诲姞鍐呭鎼滅储鏍� -->
+            <div class="content-search" v-if="content">
+                <el-input v-model="contentSearchText" placeholder="鍦ㄦ棩蹇椾腑鎼滅储..." size="small" clearable 
+                    @keyup.enter="searchInContent" />
+                <el-button type="primary" size="small" @click="searchInContent">鎼滅储</el-button>
+                <span v-if="searchResults.length > 0" class="search-info">
+                    {{ currentMatchIndex + 1 }}/{{ searchResults.length }}
+                </span>
+                <el-button v-if="searchResults.length > 0" type="info" size="small" 
+                    @click="prevMatch">涓婁竴澶�</el-button>
+                <el-button v-if="searchResults.length > 0" type="info" size="small" 
+                    @click="nextMatch">涓嬩竴澶�</el-button>
+            </div>
+
             <div ref="pre" v-if="content">
                 <el-progress :percentage="percentage" @click="ChangePercent($event)" color="#f56c6c" />
             </div>
-            <div ref="showdata" @scroll="handleScroll($event)" style="white-space: pre-wrap;word-break: break-all">{{
-                content }}</div>
+            <!-- 淇敼鍐呭鏄剧ず鍖哄煙锛屾敮鎸侀珮浜� -->
+            <div ref="showdata" @scroll="handleScroll($event)" class="content-display" 
+                v-html="highlightContent"></div>
         </div>
     </div>
 </template>
@@ -56,12 +76,21 @@
             content: "",
             isClick: false,
 
-            keepReadTimer: null
+            keepReadTimer: null,
+            
+            // 鏂板鎼滅储鐩稿叧灞炴��
+            contentSearchText: "",
+            searchResults: [],
+            currentMatchIndex: -1,
+            searchHighlights: [],
+            filteredCount: null,
+            originalContent: "", // 淇濆瓨鍘熷鍐呭鐢ㄤ簬鎼滅储
         }
     },
     watch: {
         filterText(val) {
             this.$refs.treeRef.filter(val)
+            this.updateFilteredCount()
         },
         keepRead(val) {
             if (val) {
@@ -75,9 +104,14 @@
                         this.percentage = 100;
                         this.http.post('/api/Sys_Log/GetLogData', parm).then((res) => {
                             this.content = res.data.content;
+                            this.originalContent = res.data.content;
                             this.topStartPos = res.data.startIndex;
                             this.$nextTick(function () {
                                 this.$refs.showdata.scrollTo(0, this.$refs.showdata.scrollHeight)
+                                // 閲嶆柊搴旂敤鎼滅储楂樹寒
+                                if (this.contentSearchText) {
+                                    this.searchInContent();
+                                }
                             })
                         })
                     }
@@ -85,13 +119,159 @@
             } else {
                 clearInterval(this.keepReadTimer);
             }
+        },
+        content(newVal) {
+            this.originalContent = newVal;
+            if (this.contentSearchText) {
+                this.searchInContent();
+            } else {
+                this.clearHighlights();
+            }
+        }
+    },
+    computed: {
+        // 璁$畻楂樹寒鍚庣殑鍐呭
+        highlightContent() {
+            if (!this.content || !this.contentSearchText || this.searchResults.length === 0) {
+                return this.content;
+            }
+            
+            let highlightedContent = this.content;
+            const searchText = this.contentSearchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+            const regex = new RegExp(`(${searchText})`, 'gi');
+            
+            // 浣跨敤鍏ㄥ眬鏇挎崲娣诲姞楂樹寒鏍囪
+            highlightedContent = highlightedContent.replace(regex, (match, p1, offset) => {
+                // 妫�鏌ユ槸鍚﹀綋鍓嶅尮閰嶉」
+                const isCurrentMatch = this.searchResults.some((result, index) => 
+                    result.index === offset && index === this.currentMatchIndex
+                );
+                
+                if (isCurrentMatch) {
+                    return `<span class="highlight-current">${match}</span>`;
+                } else {
+                    return `<span class="highlight">${match}</span>`;
+                }
+            });
+            
+            return highlightedContent;
         }
     },
     methods: {
+        // 鏍戣妭鐐硅繃婊ゆ柟娉�
         treeFilter(value, data) {
             if (!value) return true
-            return data.dirName.includes(value)
+            return data.dirName.toLowerCase().includes(value.toLowerCase())
         },
+        
+        // 鏇存柊杩囨护璁℃暟
+        updateFilteredCount() {
+            if (!this.filterText) {
+                this.filteredCount = null;
+                return;
+            }
+            
+            // 閫掑綊璁$畻鍖归厤鐨勮妭鐐规暟
+            const countMatches = (nodes) => {
+                let count = 0;
+                for (const node of nodes) {
+                    if (node.dirName.toLowerCase().includes(this.filterText.toLowerCase())) {
+                        count++;
+                    }
+                    if (node.dirs && node.dirs.length) {
+                        count += countMatches(node.dirs);
+                    }
+                }
+                return count;
+            };
+            
+            this.filteredCount = countMatches(this.treeData);
+        },
+        
+        // 楂樹寒鏍戣妭鐐逛腑鐨勬枃鏈�
+        highlightText(text) {
+            if (!this.filterText || !text) return text;
+            
+            const index = text.toLowerCase().indexOf(this.filterText.toLowerCase());
+            if (index === -1) return text;
+            
+            const before = text.substring(0, index);
+            const match = text.substring(index, index + this.filterText.length);
+            const after = text.substring(index + this.filterText.length);
+            
+            return `${before}<span class="highlight">${match}</span>${after}`;
+        },
+        
+        // 鍦ㄥ唴瀹逛腑鎼滅储
+        searchInContent() {
+            if (!this.contentSearchText || !this.content) {
+                this.clearHighlights();
+                return;
+            }
+            
+            const searchText = this.contentSearchText.toLowerCase();
+            const content = this.content;
+            
+            // 鏌ユ壘鎵�鏈夊尮閰嶉」鐨勪綅缃�
+            const results = [];
+            let index = content.toLowerCase().indexOf(searchText);
+            
+            while (index !== -1) {
+                results.push({
+                    index: index,
+                    length: this.contentSearchText.length
+                });
+                index = content.toLowerCase().indexOf(searchText, index + 1);
+            }
+            
+            this.searchResults = results;
+            
+            if (results.length > 0) {
+                this.currentMatchIndex = 0;
+                this.scrollToMatch(this.currentMatchIndex);
+            } else {
+                this.currentMatchIndex = -1;
+                this.$message.info('鏈壘鍒板尮閰嶅唴瀹�');
+            }
+        },
+        
+        // 婊氬姩鍒版寚瀹氬尮閰嶉」
+        scrollToMatch(matchIndex) {
+            if (matchIndex < 0 || matchIndex >= this.searchResults.length) return;
+            
+            const match = this.searchResults[matchIndex];
+            const preContent = this.content.substring(0, match.index);
+            const lines = preContent.split('\n');
+            
+            // 浼拌婊氬姩浣嶇疆锛堢畝鍖栫増锛�
+            const lineHeight = 20; // 鍋囪姣忚楂樺害
+            const estimatedScrollTop = lines.length * lineHeight;
+            
+            this.$nextTick(() => {
+                this.$refs.showdata.scrollTop = estimatedScrollTop - 100;
+            });
+        },
+        
+        // 涓婁竴澶勫尮閰�
+        prevMatch() {
+            if (this.searchResults.length === 0) return;
+            this.currentMatchIndex = (this.currentMatchIndex - 1 + this.searchResults.length) % this.searchResults.length;
+            this.scrollToMatch(this.currentMatchIndex);
+        },
+        
+        // 涓嬩竴澶勫尮閰�
+        nextMatch() {
+            if (this.searchResults.length === 0) return;
+            this.currentMatchIndex = (this.currentMatchIndex + 1) % this.searchResults.length;
+            this.scrollToMatch(this.currentMatchIndex);
+        },
+        
+        // 娓呴櫎楂樹寒
+        clearHighlights() {
+            this.searchResults = [];
+            this.currentMatchIndex = -1;
+        },
+        
         isFile(data) {
             if (data.dirPath) {
                 return data.dirPath.indexOf(".log") != -1 || data.dirPath.indexOf(".txt") != -1;
@@ -118,6 +298,7 @@
             this.http.post('/api/Sys_Log/GetLogData', parm).then((res) => {
                 this.isClick = true;
                 this.content = res.data.content;
+                this.originalContent = res.data.content;
                 this.topStartPos = res.data.startIndex;
                 this.$nextTick(function () {
                     if (percent == 100) {
@@ -140,8 +321,12 @@
             this.filePath = data.dirPath;
             this.fileName = data.dirName;
             this.percentage = parm.percent;
+            this.contentSearchText = ""; // 娓呯┖鎼滅储
+            this.clearHighlights();
+            
             this.http.post('/api/Sys_Log/GetLogData', parm).then((res) => {
                 this.content = res.data.content;
+                this.originalContent = res.data.content;
                 this.topStartPos = res.data.startIndex;
                 this.fileSize = res.data.len;
                 this.$nextTick(function () {
@@ -170,8 +355,13 @@
                         this.percentage = 0.1;
                     }
                     this.content = res.data.content + this.content;
+                    this.originalContent = res.data.content + this.originalContent;
                     this.$nextTick(function () {
                         this.$refs.showdata.scrollTo(0, 1)
+                        // 閲嶆柊鎼滅储
+                        if (this.contentSearchText) {
+                            this.searchInContent();
+                        }
                     })
                 })
             }
@@ -185,6 +375,7 @@
             this.http.post("/api/Sys_Log/GetLogList", {}, "鍔犺浇鐩綍涓�︹��")
                 .then(res => {
                     this.treeData = res.data.dirs;
+                    this.updateFilteredCount();
                 })
         },
         GetSize(size) {
@@ -233,12 +424,17 @@
     margin-left: 5px;
 }
 
+.search-tip {
+    font-size: 12px;
+    color: #909399;
+    padding: 5px 0;
+}
+
 .log_el_tree {
     width: 100%;
     overflow-x: auto;
     flex: 1;
 }
-
 
 .treeItem {
     overflow-x: auto;
@@ -252,12 +448,10 @@
 }
 
 .treeItem::-webkit-scrollbar-thumb {
-    /* 瀹氫箟婊氬姩鏉℃粦鍧楅鑹� */
     background: #ccc;
 }
 
 .treeItem::-webkit-scrollbar-thumb:hover {
-    /* 瀹氫箟婊氬姩鏉℃粦鍧楁偓鍋滈鑹� */
     background: orange;
 }
 
@@ -283,15 +477,46 @@
     color: #bbb;
 }
 
-.log_content>div:last-child {
+.content-search {
+    display: flex;
+    gap: 5px;
+    align-items: center;
+    padding: 10px 0;
+    border-bottom: 1px solid #eee;
+}
+
+.search-info {
+    font-size: 12px;
+    color: #666;
+    margin: 0 5px;
+}
+
+.content-display {
     flex: 1;
     overflow-y: scroll;
     margin-top: 5px;
     padding-top: 5px;
     border-top: 1px solid black;
+    white-space: pre-wrap;
+    word-break: break-all;
 }
 
 a {
     color: blue;
 }
-</style>
+
+:deep(.highlight) {
+    background-color: #ffeb3b;
+    color: #000;
+    padding: 0;
+    border-radius: 2px;
+}
+
+:deep(.highlight-current) {
+    background-color: #ff9800;
+    color: #000;
+    padding: 0;
+    border-radius: 2px;
+    font-weight: bold;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3