From 1fa9bbd032749dc07f98d21b7403b041053d0bed Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 25 三月 2024 10:29:19 +0800
Subject: [PATCH] 2024-03-25

---
 src/tabviews/zshare/topSearch/index.jsx |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index 8a3fb52..355e75a 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -42,7 +42,7 @@
   sign = ''
 
   UNSAFE_componentWillMount () {
-    const { config, BID } = this.props
+    const { config } = this.props
 
     let _searchlist = []
     let fieldMap = new Map()
@@ -54,6 +54,7 @@
     let record = {}
     let forbid = false // header涓笉璁剧疆楂樼骇鎼滅储
     let _setting = {showAdv: false, show: false, style: null}
+    let BID = this.props.BID
     
     if (config.wrap) {
       _setting.show = config.wrap.show !== 'false'
@@ -69,6 +70,11 @@
 
       if (config.wrap.searchBtn === 'show') {
         _setting.showBtn = true
+      }
+
+      if (config.wrap.supModule) {
+        let BData = window.GLOB.CacheData.get(config.wrap.supModule)
+        BID = BData ? (BData.$BID || '') : ''
       }
     }
     
@@ -282,19 +288,42 @@
       searchlist: _list
     }, () => {
       if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') {
-        this.improveSimpleSearch(deForms, false)
+        this.improveSimpleSearch(deForms, false, null, BID)
       } else if (mainItems.length > 0 || localItems.length > 0) {
-        this.improveSearch(mainItems, localItems)
+        this.improveSearch(mainItems, localItems, BID)
       }
     })
+  }
+
+  componentDidMount () {
+    const { config } = this.props
+
+    if (config.type === 'search' && config.wrap.supModule) {
+      MKEmitter.addListener('resetSelectLine', this.resetParentParam)
+    }
+  }
+
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
   }
 
   UNSAFE_componentWillReceiveProps(nextProps) {
     const { config, BID } = this.props
 
-    if (config.checkBid && nextProps.BID !== BID) {
+    if (config.checkBid && config.type !== 'search' && nextProps.BID !== BID) {
       this.resetOptions(nextProps.BID)
     }
+  }
+
+  resetParentParam = (MenuID, id) => {
+    const { config } = this.props
+
+    if (config.wrap.supModule !== MenuID) return
+
+    this.resetOptions(id)
   }
 
   resetOptions = (BID) => {
@@ -350,7 +379,7 @@
     })
 
     if (deForms.length > 0) {
-      this.improveSimpleSearch(deForms, true, searchlist)
+      this.improveSimpleSearch(deForms, true, searchlist, BID)
     } else {
       this.setState({
         searchlist: searchlist
@@ -395,8 +424,7 @@
   }
 
   // 鏌ヨ涓嬫媺鑿滃崟
-  improveSearch = (mainItems, localItems) => {
-    const { BID } = this.props
+  improveSearch = (mainItems, localItems, BID) => {
     let deffers = []
 
     // 鏈湴璇锋眰
@@ -499,7 +527,7 @@
   }
 
   // 娴嬭瘯绯荤粺鍗曚釜璇锋眰涓嬫媺閫夐」
-  improveSimpleSearch = (deForms, trigger, searchlist) => {
+  improveSimpleSearch = (deForms, trigger, searchlist, BID) => {
     if (deForms.length === 0) return
 
     let deffers = deForms.map((item, index) => {
@@ -510,8 +538,8 @@
         arr_field: item.arr_field
       }
 
-      if (this.props.BID) {
-        param.BID = this.props.BID
+      if (BID) {
+        param.BID = BID
       }
 
       if (window.GLOB.execType === 'x') {

--
Gitblit v1.8.0