From 2d5d60d5f165546299d1b42004b1469cb6d2b3ef Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 三月 2023 11:53:13 +0800
Subject: [PATCH] 2023-03-09

---
 src/tabviews/custom/popview/index.jsx |  116 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 99 insertions(+), 17 deletions(-)

diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index 04863e0..6149fc0 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -20,6 +20,7 @@
 const AntvScatter = asyncComponent(() => import('../components/chart/antv-scatter'))
 const DataCard = asyncComponent(() => import('../components/card/data-card'))
 const PropCard = asyncComponent(() => import('../components/card/prop-card'))
+const DoubleDataCard = asyncComponent(() => import('../components/card/double-data-card'))
 const SimpleForm = asyncComponent(() => import('../components/form/simple-form'))
 const StepForm = asyncComponent(() => import('../components/form/step-form'))
 const TabForm = asyncComponent(() => import('../components/form/tab-form'))
@@ -38,6 +39,8 @@
 const CustomChart = asyncComponent(() => import('../components/chart/custom-chart'))
 const TimeLine = asyncComponent(() => import('../components/timeline/normal-timeline'))
 const Voucher = asyncComponent(() => import('../components/module/voucher'))
+const Iframe = asyncComponent(() => import('../components/iframe'))
+const AntvG6 = asyncComponent(() => import('../components/chart/antv-G6'))
 
 class CustomPage extends Component {
   static propTpyes = {
@@ -127,7 +130,9 @@
       })
     }
 
-    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab)
+    config.$cache = config.cacheLocal === 'true'
+
+    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, config.$cache)
     
     // 鑾峰彇涓绘悳绱㈡潯浠�
     let mainSearch = []
@@ -173,9 +178,10 @@
     })
   }
 
-  filterComponent = (components, roleId, balMap, urlparam, Tab) => {
+  filterComponent = (components, roleId, balMap, urlparam, Tab, cache) => {
     return components.filter(item => {
       item.$pageId = Tab.uuid
+      item.$cache = cache
       
       if (item.style && item.style.boxShadow) {
         delete item.style.hShadow
@@ -259,7 +265,7 @@
         item.subtabs = item.subtabs.map(tab => {
           tab.$pageId = Tab.uuid
 
-          tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab)
+          tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, cache)
           return tab
         })
 
@@ -272,7 +278,7 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab)
+        item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, cache)
 
         return true
       } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -357,7 +363,7 @@
       if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
         mutil = true
         item.setting.supModule = item.supNodes[0].componentId
-      } else if (item.setting && item.setting.supModule) {
+      } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
         let pid = item.setting.supModule.pop()
         if (pid && pid !== 'empty') {
           item.setting.supModule = pid
@@ -379,11 +385,22 @@
 
           if (!mutil && cell.syncComponentId === item.setting.supModule) {
             cell.syncComponentId = ''
+            if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+              cell.execSuccess = 'mainline'
+            }
           }
 
           if (cell.btnstyle) { // 鍏煎
             cell.style = cell.style || {}
             cell.style = {...cell.style, ...cell.btnstyle}
+          }
+
+          if (cell.controlField) {
+            if (/,/ig.test(cell.controlVal)) {
+              cell.controlVals = cell.controlVal.split(',')
+            } else {
+              cell.controlVals = [(cell.controlVal || '')]
+            }
           }
 
           return true
@@ -411,10 +428,16 @@
 
               if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
+                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                  cell.execSuccess = 'mainline'
+                }
               }
-              if (card.btnstyle) { // 鍏煎
-                card.style = card.style || {}
-                card.style = {...card.style, ...card.btnstyle}
+              if (cell.controlField) {
+                if (/,/ig.test(cell.controlVal)) {
+                  cell.controlVals = cell.controlVal.split(',')
+                } else {
+                  cell.controlVals = [(cell.controlVal || '')]
+                }
               }
             } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
               if (!cell.height) {
@@ -445,11 +468,17 @@
 
               if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
+                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                  cell.execSuccess = 'mainline'
+                }
               }
 
-              if (card.btnstyle) { // 鍏煎
-                card.style = card.style || {}
-                card.style = {...card.style, ...card.btnstyle}
+              if (cell.controlField) {
+                if (/,/ig.test(cell.controlVal)) {
+                  cell.controlVals = cell.controlVal.split(',')
+                } else {
+                  cell.controlVals = [(cell.controlVal || '')]
+                }
               }
             } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
               if (!cell.height) {
@@ -485,6 +514,16 @@
 
             if (cell.syncComponentId === item.wrap.supModule) {
               cell.syncComponentId = ''
+              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                cell.execSuccess = 'mainline'
+              }
+            }
+            if (cell.controlField) {
+              if (/,/ig.test(cell.controlVal)) {
+                cell.controlVals = cell.controlVal.split(',')
+              } else {
+                cell.controlVals = [(cell.controlVal || '')]
+              }
             }
           } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
             if (!cell.height) {
@@ -514,11 +553,22 @@
 
             if (cell.syncComponentId === item.setting.supModule) {
               cell.syncComponentId = ''
+              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                cell.execSuccess = 'mainline'
+              }
             }
 
             if (cell.btnstyle) { // 鍏煎
               cell.style = cell.style || {}
               cell.style = {...cell.style, ...cell.btnstyle}
+            }
+
+            if (cell.controlField) {
+              if (/,/ig.test(cell.controlVal)) {
+                cell.controlVals = cell.controlVal.split(',')
+              } else {
+                cell.controlVals = [(cell.controlVal || '')]
+              }
             }
 
             return true
@@ -534,6 +584,7 @@
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
           group.subButton.$menuId = group.uuid
+          group.subButton.$MenuID = Tab.$MenuID
           group.subButton.OpenType = 'formSubmit'
           group.subButton.execError = 'never'
           group.subButton.logLabel = item.$menuname + '-' + group.subButton.label
@@ -546,15 +597,17 @@
 
           if (group.subButton.syncComponentId === item.setting.supModule) {
             group.subButton.syncComponentId = ''
+            if (group.subButton.execSuccess === 'grid') {
+              group.subButton.execSuccess = 'mainline'
+            }
           }
 
           group.fields = group.fields.map(cell => {
             // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
             if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
               let _option = Utils.getSelectQueryOptions(cell)
-      
-              cell.data_sql = Utils.formatOptions(_option.sql)
-              cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
+
+              cell.base_sql = _option.sql
               cell.arr_field = _option.field
             }
       
@@ -707,7 +760,7 @@
 
       // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
       if (component.setting.sync === 'true') {
-        component.dataName = Utils.getdataName()
+        component.dataName = 'mk' + component.uuid.slice(-18)
       }
 
       // floor    缁勪欢鐨勫眰绾�
@@ -752,7 +805,8 @@
    * @description 涓昏〃鏁版嵁鍔犺浇
    */ 
   loadmaindata = (params) => {
-    let param = getStructuredParams(params, this.state.config, this.state.BID || '')
+    const { config } = this.state
+    let param = getStructuredParams(params, config, this.state.BID || '')
 
     this.setState({loading: true})
 
@@ -762,6 +816,16 @@
         delete result.message
         delete result.ErrMesg
         delete result.ErrCode
+
+        if (config.$cache) {
+          params.forEach((item) => {
+            let _data = result[item.name] || ''
+            if (_data && !Array.isArray(_data)) {
+              _data = [_data]
+            }
+            Api.writeCacheConfig(item.uuid, _data)
+          })
+        }
 
         this.setState({
           data: result,
@@ -846,6 +910,12 @@
         return (
           <Col span={item.width} style={style} key={item.uuid}>
             <PropCard config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'card' && item.subtype === 'dualdatacard') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <DoubleDataCard config={item} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'basetable') {
@@ -986,6 +1056,18 @@
             <Voucher config={item}/>
           </Col>
         )
+      } else if (item.type === 'iframe') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <Iframe config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'antvG6') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvG6 config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
       } else {
         return null
       }
@@ -997,7 +1079,7 @@
 
     return (
       <div className={'pop-page-wrap ' + (loading ? 'loading' : '')} style={config ? config.style : null}>
-        {loading ? <Spin className="view-spin" size="large" /> : null}
+        {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null}
         <Row className="component-wrap">{this.getComponents()}</Row>
         {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
       </div>

--
Gitblit v1.8.0