From 84804b405cb88f659d055b16eb3bd00b813ccb4a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 十二月 2020 10:58:38 +0800
Subject: [PATCH] 2020-12-10

---
 src/tabviews/custom/index.jsx |   71 ++++++++++++++++++++++++++++-------
 1 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 23148b7..d74da96 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -199,8 +199,8 @@
           tab.components.forEach(comp => {
             if (comp.type === 'tabs' && comp.parentIds) {
               supIds.push(...comp.parentIds)
-            } else if (comp.setting.supModule && comp.setting.supModule[0] !== 'empty') {
-              supIds.push(...comp.setting.supModule.slice(-1))
+            } else if (comp.setting.supModule) {
+              supIds.push(comp.setting.supModule)
             }
           })
         })
@@ -250,26 +250,64 @@
           return col
         })
       }
+
+      if (item.setting && item.setting.supModule) {
+        let pid = item.setting.supModule.slice(-1)[0]
+        if (pid && pid !== 'empty') {
+          item.setting.supModule = pid
+        } else {
+          item.setting.supModule = ''
+        }
+      }
+
       // 鏉冮檺杩囨护
       if (this.props.menuType !== 'HS') {
         if (item.action && item.action.length > 0) {
-          item.action = item.action.filter(cell => permAction[cell.uuid])
+          item.action = item.action.filter(cell => {
+            cell.logLabel = item.name + '-' + cell.label
+            return permAction[cell.uuid]
+          })
         }
         if (item.type === 'card') {
           item.subcards.forEach(card => {
-            card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid])
-            card.backElements = card.backElements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid])
+            card.elements = card.elements.filter(cell => {
+              if (cell.eleType === 'button') {
+                cell.logLabel = item.name + '-' + cell.label
+              }
+              return cell.eleType !== 'button' || permAction[cell.uuid]
+            })
+            card.backElements = card.backElements.filter(cell => {
+              if (cell.eleType === 'button') {
+                cell.logLabel = item.name + '-' + cell.label
+              }
+              return cell.eleType !== 'button' || permAction[cell.uuid]
+            })
           })
         } else if (item.type === 'table' && item.subtype === 'tablecard') {
           item.subcards.forEach(card => {
-            card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid])
+            card.elements = card.elements.filter(cell => {
+              if (cell.eleType === 'button') {
+                cell.logLabel = item.name + '-' + cell.label
+              }
+              return cell.eleType !== 'button' || permAction[cell.uuid]
+            })
           })
         } else if (item.type === 'table' && item.subtype === 'normaltable') {
           item.cols.forEach(col => {
             if (col.type !== 'action') return
-            col.elements = col.elements.filter(cell => permAction[cell.uuid])
+            col.elements = col.elements.filter(cell => {
+              cell.logLabel = item.name + '-' + cell.label
+              return permAction[cell.uuid]
+            })
           })
         } 
+      } else {
+        if (item.action && item.action.length > 0) {
+          item.action = item.action.map(cell => {
+            cell.logLabel = item.name + '-' + cell.label
+            return cell
+          })
+        }
       }
       return true
     })
@@ -565,22 +603,27 @@
     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} menuType={menuType} />
+            <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </Col>
         )
       } else if (item.type === 'pie') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} />
+            <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </Col>
         )
       } else if (item.type === 'search') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} />
+            <MainSearch config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} />
           </Col>
         )
       } else if (item.type === 'tabs') {
@@ -592,25 +635,25 @@
       } 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} menuType={menuType} />
+            <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </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} menuType={menuType} />
+            <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </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} menuType={menuType} />
+            <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </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} menuType={menuType} />
+            <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </Col>
         )
       } else {

--
Gitblit v1.8.0