From 5d41cbe3722ff40b65bfa4de82d62a79f171f5a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 八月 2022 17:41:55 +0800
Subject: [PATCH] 2022-08-15

---
 src/tabviews/custom/index.jsx |   97 +++++++++++++++++++++++++-----------------------
 1 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 5b729ce..8391658 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -73,11 +73,11 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { permAction } = this.props
+    const { permAction, MenuID } = this.props
 
     let _param = {
       func: 'sPC_Get_LongParam',
-      MenuID: this.props.MenuID
+      MenuID: MenuID
     }
     let result = await Api.getCacheConfig(_param)
 
@@ -140,7 +140,9 @@
       let skip = config.permission === 'false' || window.GLOB.mkHS
       let param = this.props.param || {} // url鍙傛暟
 
-      config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param)
+      window.GLOB.CacheData.set(MenuID, param)
+
+      config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param, MenuID)
       
       // 鑾峰彇涓绘悳绱㈡潯浠�
       let mainSearch = []
@@ -443,8 +445,9 @@
     })
   }
 
-  filterComponent = (components, roleId, permAction, balMap, skip, urlparam) => {
+  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId) => {
     return components.filter(item => {
+      item.$pageId = pageId
       
       if (item.style && item.style.boxShadow) {
         delete item.style.hShadow
@@ -526,21 +529,11 @@
         }
 
         item.subtabs = item.subtabs.map(tab => {
-          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam)
+          tab.$pageId = pageId
+
+          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId)
           return tab
         })
-
-        let supIds = []
-        item.subtabs.forEach(tab => {
-          tab.components.forEach(comp => {
-            if (comp.type === 'tabs' && comp.parentIds) {
-              supIds.push(...comp.parentIds)
-            } else if (comp.setting && comp.setting.supModule) {
-              supIds.push(comp.setting.supModule)
-            }
-          })
-        })
-        item.parentIds = supIds
 
         return true
       } else if (item.type === 'group') {
@@ -551,7 +544,7 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam)
+        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId)
 
         return true
       } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -1183,6 +1176,23 @@
     }
     MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
     MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu)
+
+    window.GLOB.CacheData.delete(this.props.MenuID)
+    this.deleteCache(this.state.config.components)
+  }
+
+  deleteCache = (components) => {
+    components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          this.deleteCache(tab.components)
+        })
+      } else if (item.type === 'group') {
+        this.deleteCache(item.components)
+      } else {
+        window.GLOB.CacheData.delete(item.uuid)
+      }
+    })
   }
 
   reloadview = () => {
@@ -1211,51 +1221,46 @@
     if (!config || !config.components) return
 
     return config.components.map(item => {
-      let _bid = BID
-      if (item.setting && item.setting.supModule) {
-        _bid = ''
-      }
-
       if (item.type === 'bar' || item.type === 'line') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <AntvBarAndLine config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'pie') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <AntvPie config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'scatter') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <AntvScatter config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'dashboard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <AntvDashboard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'form' && item.subtype === 'simpleform') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <SimpleForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <SimpleForm config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'form' && item.subtype === 'stepform') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <StepForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <StepForm config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'form' && item.subtype === 'tabform') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <TabForm config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'search') {
@@ -1267,97 +1272,97 @@
       } else if (item.type === 'tabs') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvTabs config={item} BID={BID} mainSearch={mainSearch} />
+            <AntvTabs config={item} mainSearch={mainSearch} />
           </Col>
         )
       } else if (item.type === 'card' && item.subtype === 'datacard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <DataCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'card' && item.subtype === 'propcard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <PropCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'balcony') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <Balcony config={item} data={data} BID={_bid}/>
+            <Balcony config={item} data={data}/>
           </Col>
         )
       } else if (item.type === 'timeline') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <TimeLine config={item} data={data} BID={_bid}/>
+            <TimeLine config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'datacard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CarouselDataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'propcard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CarouselPropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'tablecard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <TableCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'normaltable') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <NormalTable config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'editable') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <EditTable config={item} BID={_bid} mainSearch={mainSearch}/>
+            <EditTable config={item} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalGroup config={item} BID={_bid} mainSearch={mainSearch}/>
+            <NormalGroup config={item} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'editor') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <BraftEditor config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'tree') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <NormalTree config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'code') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <SandBox config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'chart') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+            <CustomChart config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'module' && item.subtype === 'voucher') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <Voucher config={item} BID={_bid} />
+            <Voucher config={item}/>
           </Col>
         )
       } else {

--
Gitblit v1.8.0