From 4e570c993e66a47ead0f83de76b63b0a2f8c5446 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 05 六月 2023 17:28:16 +0800
Subject: [PATCH] 2023-06-05

---
 src/tabviews/custom/index.jsx |  776 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 471 insertions(+), 305 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 9b9aa3b..0eef227 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -21,6 +21,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'))
@@ -36,11 +37,14 @@
 const NormalTree = asyncComponent(() => import('./components/tree/antd-tree'))
 const Balcony = asyncComponent(() => import('./components/card/balcony'))
 const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent'))
-const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage'))
 const CustomChart = asyncComponent(() => import('./components/chart/custom-chart'))
 const TimeLine = asyncComponent(() => import('./components/timeline/normal-timeline'))
+const AntvG6 = asyncComponent(() => import('./components/chart/antv-G6'))
 const Voucher = asyncComponent(() => import('./components/module/voucher'))
+const Account = asyncComponent(() => import('./components/module/account'))
+const Iframe = asyncComponent(() => import('./components/iframe'))
 const DebugTable = asyncComponent(() => import('@/tabviews/debugtable'))
+const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes'))
 const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces'))
 
 class CustomPage extends Component {
@@ -49,7 +53,8 @@
     Tab: PropTypes.string,       // 寮圭獥鏍囩
     MenuID: PropTypes.string,    // 鑿滃崟Id
     MenuNo: PropTypes.string,    // 鑿滃崟鍙傛暟
-    MenuName: PropTypes.string   // 鑿滃崟鍚嶇О
+    MenuName: PropTypes.string,  // 鑿滃崟鍚嶇О
+    changeTemp: PropTypes.func
   }
 
   state = {
@@ -65,8 +70,11 @@
     data: null,           // 鍒楄〃鏁版嵁闆�
     loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
     visible: false,       // 鏍囩椤垫帶鍒�
-    shortcuts: null       // 蹇嵎閿�
+    shortcuts: null,      // 蹇嵎閿�
+    loadinginter: false
   }
+
+  stepInter = null
 
   /**
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
@@ -88,24 +96,10 @@
         config = window.decodeURIComponent(window.atob(result.LongParam))
         config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
         config = JSON.parse(config)
+        config.MenuID = MenuID
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
-      }
-
-      // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆
-      if (result.LongParamUser && !window.GLOB.mkHS) {
-        try { // 閰嶇疆淇℃伅瑙f瀽
-          let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
-          if (userConfig) {
-            shortcuts = userConfig.action
-            userConfig.printers.forEach(item => {
-              window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item)
-            })
-          }
-        } catch (e) {
-          console.warn('Parse Failure')
-        }
       }
 
       // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀�
@@ -127,9 +121,39 @@
         return
       }
 
+      // 妯℃澘閿欒
+      if (config.Template !== 'CustomPage') {
+        if (config.Template === 'BaseTable' || config.Template === 'CommonTable') {
+          this.props.changeTemp(MenuID, config.Template)
+        } else {
+          this.setState({
+            viewlost: true,
+            loadingview: false,
+            lostmsg: '鑿滃崟淇℃伅閿欒锛屽彲鑳藉師鍥狅細1銆佸綋鍓嶇敤鎴锋棤鏉冮檺锛�2銆佹墦寮�姝よ彍鍗曠殑鎸夐挳闇�瑕佹洿鏂般��'
+          })
+        }
+        
+        return
+      }
+
+      // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆
+      if (result.LongParamUser && !window.GLOB.mkHS) {
+        try { // 閰嶇疆淇℃伅瑙f瀽
+          let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
+          if (userConfig) {
+            shortcuts = userConfig.action
+            userConfig.printers.forEach(item => {
+              window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item)
+            })
+          }
+        } catch (e) {
+          console.warn('Parse Failure')
+        }
+      }
+
       // 鏁版嵁缂撳瓨璁剧疆
       if (config.cacheUseful === 'true') {
-        if (!['day', 'hour'].includes(config.timeUnit)) {
+        if (!['day', 'hour', 'minute'].includes(config.timeUnit)) {
           config.timeUnit = 'day'
         }
         config.cacheTime = config.cacheTime || 1
@@ -172,9 +196,18 @@
         })
       }
 
-      config.interfaces = this.formatInterSetting(config.interfaces, regs)
+      let popview = 'CustomPage'
 
-      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces)
+      if (config.version === 2.0) {
+        popview = 'popview'
+      }
+
+      config.$cache = config.cacheLocal === 'true'
+
+      let initInters = []
+
+      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
+      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache)
       
       // 鑾峰彇涓绘悳绱㈡潯浠�
       let mainSearch = []
@@ -209,13 +242,34 @@
         config.components = this.filterBalcony(config.components, balMap)
       }
 
+      if (initInters.length > 0) {
+        this.stepInter = {
+          MenuID: MenuID,
+          inters: initInters,
+          params: params
+        }
+      }
+
       this.setState({
         BID: BID,
+        loadinginter: this.stepInter !== null,
         shortcuts: shortcuts.length > 0 ? shortcuts : null,
         config,
         mainSearch
       }, () => {
-        if (params.length === 0) {
+        if (config.normalcss) {
+          let node = document.getElementById(config.uuid)
+          node && node.remove()
+    
+          let ele = document.createElement('style')
+          ele.id = config.uuid
+          ele.innerHTML = config.normalcss
+          document.getElementsByTagName('head')[0].appendChild(ele)
+        }
+
+        if (this.stepInter) {
+
+        } else if (params.length === 0) {
           setTimeout(() => { // 寤舵椂鍔犺浇鐘舵��
             this.setState({
               loadingview: false
@@ -282,9 +336,10 @@
     }
   }
 
-  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces) => {
+  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) => {
     return components.filter(item => {
       item.$pageId = pageId
+      item.$cache = cache
       
       if (item.style && item.style.boxShadow) {
         delete item.style.hShadow
@@ -368,7 +423,7 @@
         item.subtabs = item.subtabs.map(tab => {
           tab.$pageId = pageId
 
-          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces)
+          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache)
           return tab
         })
 
@@ -381,7 +436,7 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces)
+        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache)
 
         return true
       } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -418,19 +473,52 @@
         item.search = Utils.initSearchVal(item.search)
       }
 
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
+        item.setting.supModule = item.supNodes[0].componentId
+      } 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
+        } else {
+          item.setting.supModule = ''
+        }
+      }
+
+      let pass = skip
+
+      if (item.wrap && item.wrap.permission === 'false') {
+        pass = true
+      }
+
+      // 鏉冮檺杩囨护
+      if (item.action && item.action.length > 0) {
+        item.action = item.action.filter(cell => {
+          if (cell.hidden === 'true') return false
+
+          cell = this.resetButton(item, cell, popview)
+
+          cell.$toolbtn = true
+
+          if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
+            cell = this.getPrinter(cell, item.uuid)
+          }
+
+          return pass || permAction[cell.uuid]
+        })
+      }
+
       if (item.type === 'table') {
         let statFields = []
         let getCols = (cols) => {
           return cols.filter(col => {
-            if (item.subtype !== 'editable') {
-              if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-                return false
-              } else if (col.Hide === 'true') {
-                return false
-              }
-            } else if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-              col.Hide = 'true'
+            if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+              return false
+            } else if (col.Hide === 'true') {
+              return false
+            } else if (col.type === 'action') {
+              col.type = 'custom'
             }
+            
             if (col.type === 'number') {
               if (col.sum === 'true' && !statFields.includes(col.field)) {
                 statFields.push(col)
@@ -441,26 +529,36 @@
                   col.decimal = col.decimal > 2 ? col.decimal - 2 : 0
                 }
               }
+            } else if (col.type === 'formula') {
+              if (typeof(col.decimal) === 'number') {
+                col.round = Math.pow(10, col.decimal)
+              }
             } else if (col.type === 'colspan') {
               col.subcols = getCols(col.subcols || [])
               if (col.subcols.length === 0) {
                 return false
               }
             } else if (col.type === 'custom') {
-              col.elements = col.elements.map(cell => {
-                if (['text', 'number', 'formula'].includes(cell.eleType)) {
-                  if (!cell.height) {
-                    cell.innerHeight = 'auto'
+              col.elements = col.elements.filter(cell => {
+                if (cell.eleType === 'button') {
+                  if (cell.hidden === 'true') return false
+
+                  cell = this.resetButton(item, cell, popview)
+
+                  if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
+                    cell = this.getPrinter(cell, item.uuid)
                   }
-                  if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
-                    cell.round = Math.pow(10, cell.decimal)
-                    if (cell.format === 'percent') {
-                      cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
-                    }
-                  }
+
+                  return pass || permAction[cell.uuid]
+                } else {
+                  cell = this.resetElement(cell)
                 }
-                return cell
+                return true
               })
+
+              if (col.elements.length === 0) {
+                return false
+              }
             }
       
             if (col.linkmenu && col.linkmenu.length > 0) {
@@ -476,54 +574,20 @@
         
         item.cols = getCols(item.cols)
         item.statFields = statFields
-      }
 
-      let mutil = false
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        mutil = true
-        item.setting.supModule = item.supNodes[0].componentId
-      } else if (item.setting && item.setting.supModule) {
-        let pid = item.setting.supModule.pop()
-        if (pid && pid !== 'empty') {
-          item.setting.supModule = pid
-        } else {
-          item.setting.supModule = ''
+        if (item.subtype === 'editable') {
+          item.submit.logLabel = item.$menuname + '-鎻愪氦'
+          item.submit.$menuId = item.uuid
+          item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : ''
+
+          if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) {
+            item.submit.syncComponentId = ''
+            if (item.submit.execSuccess === 'grid') {
+              item.submit.execSuccess = 'mainline'
+            }
+          }
         }
-      }
-
-      // 鏉冮檺杩囨护
-      let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 寮圭獥鏍囩鎸夐挳Id
-      if (item.action && item.action.length > 0) {
-        item.action = item.action.filter(cell => {
-          if (item.hidden === 'true') return false
-
-          cell.logLabel = item.$menuname + '-' + cell.label
-          cell.ContainerId = this.state.ContainerId
-          cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
-          cell.$menuId = item.uuid
-          cell.$MenuID = this.props.MenuID
-          cell.$tabId = tabId
-          cell.$view = 'CustomPage'
-          cell.$toolbtn = true
-
-          if (!mutil && cell.syncComponentId === item.setting.supModule) {
-            cell.syncComponentId = ''
-          }
-
-          if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
-            cell = this.getPrinter(cell, item.uuid)
-          }
-
-          if (cell.btnstyle) { // 鍏煎
-            cell.style = cell.style || {}
-            cell.style = {...cell.style, ...cell.btnstyle}
-          }
-
-          return skip || permAction[cell.uuid]
-        })
-      }
-
-      if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+      } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
         item.subcards && item.subcards.forEach(card => {
           if (card.style.boxShadow) {
             delete card.style.hShadow
@@ -536,39 +600,16 @@
             if (cell.eleType === 'button') {
               if (cell.hidden === 'true') return false
 
-              cell.logLabel = item.$menuname + '-' + cell.label
-              cell.Ot = cell.Ot || 'requiredSgl'
-              cell.ContainerId = this.state.ContainerId
-              cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
-              cell.$menuId = item.uuid
-              cell.$MenuID = this.props.MenuID
-              cell.$tabId = tabId
-              cell.$view = 'CustomPage'
-
-              if (!mutil && cell.syncComponentId === item.setting.supModule) {
-                cell.syncComponentId = ''
-              }
+              cell = this.resetButton(item, cell, popview)
 
               if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                 cell = this.getPrinter(cell, item.uuid)
               }
-              if (card.btnstyle) { // 鍏煎
-                card.style = card.style || {}
-                card.style = {...card.style, ...card.btnstyle}
-              }
-            } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
-              if (!cell.height) {
-                cell.innerHeight = 'auto'
-              }
-              if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
-                cell.round = Math.pow(10, cell.decimal)
-                if (cell.format === 'percent') {
-                  cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
-                }
-              }
+            } else {
+              cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
           })
 
           if (!card.backElements || card.backElements.length === 0) return
@@ -577,39 +618,16 @@
             if (cell.eleType === 'button') {
               if (cell.hidden === 'true') return false
 
-              cell.logLabel = item.$menuname + '-' + cell.label
-              cell.Ot = cell.Ot || 'requiredSgl'
-              cell.ContainerId = this.state.ContainerId
-              cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
-              cell.$menuId = item.uuid
-              cell.$MenuID = this.props.MenuID
-              cell.$tabId = tabId
-              cell.$view = 'CustomPage'
-
-              if (!mutil && cell.syncComponentId === item.setting.supModule) {
-                cell.syncComponentId = ''
-              }
+              cell = this.resetButton(item, cell, popview)
 
               if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                 cell = this.getPrinter(cell, item.uuid)
               }
-              if (card.btnstyle) { // 鍏煎
-                card.style = card.style || {}
-                card.style = {...card.style, ...card.btnstyle}
-              }
-            } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
-              if (!cell.height) {
-                cell.innerHeight = 'auto'
-              }
-              if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
-                cell.round = Math.pow(10, cell.decimal)
-                if (cell.format === 'percent') {
-                  cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
-                }
-              }
+            } else {
+              cell = this.resetElement(cell)
             }
 
-            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
           })
         })
       } else if (item.type === 'balcony') {
@@ -624,76 +642,22 @@
           if (cell.eleType === 'button') {
             if (cell.hidden === 'true') return false
 
-            cell.logLabel = item.$menuname + '-' + cell.label
-            cell.ContainerId = this.state.ContainerId
-            cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
-            cell.$menuId = item.uuid
-            cell.$MenuID = this.props.MenuID
-            cell.$tabId = tabId
-            cell.$view = 'CustomPage'
-
-            if (cell.syncComponentId === item.wrap.supModule) {
-              cell.syncComponentId = ''
-            }
+            cell = this.resetButton(item, cell, popview)
 
             if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
               cell = this.getPrinter(cell, item.uuid)
             }
-          } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
-            if (!cell.height) {
-              cell.innerHeight = 'auto'
-            }
-            if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
-              cell.round = Math.pow(10, cell.decimal)
-              if (cell.format === 'percent') {
-                cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
-              }
-            }
+          } else {
+            cell = this.resetElement(cell)
           }
 
-          return cell.eleType !== 'button' || skip || permAction[cell.uuid]
+          return cell.eleType !== 'button' || pass || permAction[cell.uuid]
         })
-      } else if (item.type === 'table') {
-        item.cols = item.cols.filter(col => {
-          if (col.type !== 'action') return true
-          col.elements = col.elements.filter(cell => {
-            if (cell.hidden === 'true') return false
-            
-            cell.logLabel = item.$menuname + '-' + cell.label
-            cell.Ot = cell.Ot || 'requiredSgl'
-            cell.ContainerId = this.state.ContainerId
-            cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
-            cell.$menuId = item.uuid
-            cell.$MenuID = this.props.MenuID
-            cell.$tabId = tabId
-            cell.$view = 'CustomPage'
-
-            if (cell.syncComponentId === item.setting.supModule) {
-              cell.syncComponentId = ''
-            }
-
-            if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
-              cell = this.getPrinter(cell, item.uuid)
-            }
-
-            if (cell.btnstyle) { // 鍏煎
-              cell.style = cell.style || {}
-              cell.style = {...cell.style, ...cell.btnstyle}
-            }
-
-            return skip || permAction[cell.uuid]
-          })
-          return col.elements.length !== 0
-        })
-
-        if (item.subtype === 'editable') {
-          item.submit.logLabel = item.$menuname + '-鎻愪氦'
-          item.submit.$menuId = item.uuid
-        }
       } else if (item.type === 'form') {
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
           group.subButton.$menuId = group.uuid
+          group.subButton.$MenuID = this.props.MenuID
           // group.subButton.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺
           group.subButton.OpenType = 'formSubmit'
           group.subButton.execError = 'never'
@@ -703,19 +667,21 @@
             group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
           }
 
-          group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : ''
+          group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
 
-          if (group.subButton.syncComponentId === item.setting.supModule) {
+          if (group.subButton.syncComponentId && 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
             }
       
@@ -730,6 +696,12 @@
 
           return group
         })
+      } else if (item.subtype === 'voucher') {
+        if (item.wrap.supModule && item.wrap.supModule.length > 0) {
+          item.wrap.supModule = item.wrap.supModule.pop()
+        } else {
+          item.wrap.supModule = ''
+        }
       }
       
       return true
@@ -774,6 +746,94 @@
     })
   }
 
+  resetButton = (item, cell, popview) => {
+    cell.logLabel = item.$menuname + '-' + cell.label
+    cell.Ot = cell.Ot || 'requiredSgl'
+    cell.ContainerId = this.state.ContainerId
+    cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
+    cell.$menuId = item.uuid
+    cell.$MenuID = this.props.MenuID
+    cell.$view = popview
+
+    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 || '')]
+      }
+    }
+
+    if (cell.syncComponentId) {
+      if (cell.syncComponentId === item.setting.supModule) {
+        cell.syncComponentId = ''
+        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+          cell.execSuccess = 'mainline'
+        }
+      } else if (cell.syncComponentId === 'multiComponent') {
+        let ids = cell.syncComponents.map(m => {
+          return m.syncComId.pop() || ''
+        })
+
+        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+            cell.execSuccess = 'mainline'
+          }
+          ids = ids.filter(id => id !== item.setting.supModule)
+        }
+        
+        if (ids.length === 0) {
+          cell.syncComponentId = ''
+        } else {
+          cell.syncComponentIds = ids
+        }
+      }
+    }
+
+    return cell
+  }
+
+  resetElement = (cell) => {
+    cell.style = cell.style || {}
+    if (['text', 'number', 'formula'].includes(cell.eleType)) {
+      if (!cell.height) {
+        cell.innerHeight = 'auto'
+      }
+
+      cell.innerHeight = cell.innerHeight || 'auto'
+      cell.alignItems = cell.height > 1 ? cell.alignItems : ''
+
+      if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
+        cell.round = Math.pow(10, cell.decimal)
+        if (cell.format === 'percent') {
+          cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
+        }
+      } else if (cell.eleType === 'formula' && typeof(cell.decimal) === 'number') {
+        cell.round = Math.pow(10, cell.decimal)
+      }
+    } else if (cell.eleType === 'icon') {
+      if (!cell.innerHeight) { // 鍏煎
+        let fontSize = 14
+        let lineHeight = 1.5
+  
+        if (cell.style.fontSize) {
+          fontSize = parseInt(cell.style.fontSize)
+        }
+        if (cell.style.lineHeight) {
+          lineHeight = parseFloat(cell.style.lineHeight)
+        }
+  
+        cell.innerHeight = fontSize * lineHeight
+      }
+    }
+
+    return cell
+  }
+
   getPrinter = (item, parentId) => {
     let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)
 
@@ -808,22 +868,25 @@
         component = {...component, ...inherit}
         return component
       } else if (component.wrap && component.wrap.datatype === 'public') {
+        component.setting.useMSearch = false
+
         return component
-      }
-
-      if (component.setting) {
-        component.setting.useMSearch = component.setting.useMSearch === 'true'
-        component.setting.syncRefresh = (component.setting.useMSearch && component.setting.syncRefresh === 'true')
-      }
-
-      if (component.wrap && component.wrap.datatype === 'static') {
+      } else if (component.wrap && component.wrap.datatype === 'static') {
         component.format = ''
         component.setting = component.setting || {}
         component.setting.useMSearch = false
-        component.setting.syncRefresh = false
+
+        return component
+      } else if (!component.setting || !component.format) {
+        return component
       }
 
-      if (!component.setting || !component.format) return component  // 1銆佷笉浣跨敤绯荤粺鍑芥暟鏃讹紱2銆� 娌℃湁鍔ㄦ�佹暟鎹�  鏁版嵁鏍煎紡 array 鎴� object
+      component.setting.useMSearch = component.setting.useMSearch === 'true'
+
+      if (component.wrap && component.wrap.goback === 'true') {
+        component.setting.sync = 'false'
+      }
+
       if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂
         component.setting.sync = 'false'
         component.setting.laypage = component.setting.laypage === 'true'
@@ -869,7 +932,7 @@
 
       // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
       if (component.setting.sync === 'true') {
-        component.dataName = Utils.getdataName()
+        component.dataName = 'mk' + component.uuid.slice(-18)
       }
 
       // floor    缁勪欢鐨勫眰绾�
@@ -896,9 +959,10 @@
         }
       } else if (params) {
         component.setting.sync = 'false'
-        component.setting.delay = delay
-        delay += 20
       }
+      
+      component.setting.delay = delay
+      delay += 20
 
       if (balMap.has(component.uuid)) {
         component.setting.$hasSyncModule = true
@@ -910,15 +974,39 @@
   }
 
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatInterSetting = (inters, regs) => {
+  formatInterSetting = (inters, regs, MenuID, initInters) => {
     if (!inters) return []
 
-    let interfaces = inters.filter(m => m.status === 'true')
+    let initlimit = false
+    let interfaces = inters.filter(m => {
+      if (m.status !== 'true') return false
+
+      if (m.setting.loadlevel === 'init') {
+        initlimit = true
+        initInters.push(m.uuid)
+      }
+
+      return true
+    })
 
     let delay = 15
     return interfaces.map(inter => {
+      inter.MenuID = MenuID
       inter.setting.delay = delay
       delay += 15
+
+      if (inter.setting.supModule) {
+        let pid = inter.setting.supModule.pop()
+        if (pid && pid !== 'empty') {
+          inter.setting.supModule = pid
+        } else {
+          inter.setting.supModule = ''
+        }
+      }
+
+      if (initlimit && inter.setting.loadlevel !== 'init') {
+        inter.setting.onload = 'false'
+      }
 
       if (inter.setting.interType !== 'system') return inter
 
@@ -968,7 +1056,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, loadingview: false})
 
@@ -978,6 +1067,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,
@@ -1023,6 +1122,7 @@
   }
 
   componentDidMount () {
+    MKEmitter.addListener('interFinish', this.interFinish)
     MKEmitter.addListener('debugChange', this.debugChange)
     MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
     MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu)
@@ -1035,6 +1135,7 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('interFinish', this.interFinish)
     MKEmitter.removeListener('debugChange', this.debugChange)
     MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
     MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu)
@@ -1045,6 +1146,30 @@
       this.state.config.interfaces.forEach(m => {
         window.GLOB.CacheData.delete(m.uuid)
       })
+    }
+  }
+
+  interFinish = (MenuID, interId) => {
+    if (!this.stepInter || this.stepInter.MenuID !== MenuID) return
+
+    this.stepInter.inters = this.stepInter.inters.filter(item => item !== interId)
+
+    if (this.stepInter.inters.length === 0) {
+      this.setState({loadinginter: false})
+
+      if (this.stepInter.params.length === 0) {
+        setTimeout(() => { // 寤舵椂鍔犺浇鐘舵��
+          this.setState({
+            loadingview: false
+          })
+        }, 1000)
+      } else {
+        this.loadmaindata(this.stepInter.params)
+      }
+
+      MKEmitter.emit('initFinish', this.stepInter.MenuID)
+
+      this.stepInter = null
     }
   }
 
@@ -1067,6 +1192,17 @@
   }
 
   reloadview = () => {
+    window.GLOB.CacheData.delete(this.props.MenuID)
+    
+    if (this.state.config) {
+      this.deleteCache(this.state.config.components)
+      this.state.config.interfaces.forEach(m => {
+        window.GLOB.CacheData.delete(m.uuid)
+      })
+    }
+
+    this.stepInter = null
+
     this.setState({
       BID: '',              // 椤甸潰璺宠浆鏃舵惡甯D
       loadingview: true,    // 椤甸潰鍔犺浇涓�
@@ -1087,153 +1223,183 @@
   }
 
   getComponents = () => {
-    const { config, BID, data, mainSearch } = this.state
+    const { config, BID, data, mainSearch, loadinginter } = this.state
 
-    if (!config || !config.components) return
+    if (!config || !config.components || loadinginter) return
 
     return config.components.map(item => {
-      if (item.type === 'bar' || item.type === 'line') {
+      let style = null
+
+      if (item.style && item.style.clear === 'left') {
+        style = {clear: 'left'}
+      }
+
+      if (item.type === 'card' && item.subtype === 'datacard') {
         return (
-          <Col span={item.width} key={item.uuid}>
-            <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} mainSearch={mainSearch}/>
-          </Col>
-        )
-      } else if (item.type === 'scatter') {
-        return (
-          <Col span={item.width} key={item.uuid}>
-            <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} mainSearch={mainSearch}/>
-          </Col>
-        )
-      } else if (item.type === 'form' && item.subtype === 'simpleform') {
-        return (
-          <Col span={item.width} key={item.uuid}>
-            <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} mainSearch={mainSearch}/>
-          </Col>
-        )
-      } else if (item.type === 'form' && item.subtype === 'tabform') {
-        return (
-          <Col span={item.width} key={item.uuid}>
-            <TabForm config={item} data={data} mainSearch={mainSearch}/>
-          </Col>
-        )
-      } else if (item.type === 'search') {
-        return (
-          <Col span={item.width} key={item.uuid}>
-            <MainSearch config={item} BID={BID} refreshdata={this.resetSearch} />
-          </Col>
-        )
-      } else if (item.type === 'tabs') {
-        return (
-          <Col span={item.width} key={item.uuid}>
-            <AntvTabs config={item} mainSearch={mainSearch} />
-          </Col>
-        )
-      } else if (item.type === 'card' && item.subtype === 'datacard') {
-        return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <DataCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'card' && item.subtype === 'propcard') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <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 === 'normaltable') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <NormalTable config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'bar' || item.type === 'line') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvBarAndLine config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'pie') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvPie config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'scatter') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvScatter config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'dashboard') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvDashboard config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'form' && item.subtype === 'simpleform') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <SimpleForm config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'form' && item.subtype === 'stepform') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <StepForm config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'form' && item.subtype === 'tabform') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <TabForm config={item} data={data} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'search') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <MainSearch config={item} BID={BID} refreshdata={this.resetSearch} />
+          </Col>
+        )
+      } else if (item.type === 'tabs') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvTabs config={item} mainSearch={mainSearch} />
           </Col>
         )
       } else if (item.type === 'balcony') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <Balcony config={item} data={data}/>
           </Col>
         )
       } else if (item.type === 'timeline') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <TimeLine config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'datacard') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'propcard') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'card' && item.subtype === 'tablecard') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <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} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'editable') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <EditTable config={item} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <NormalGroup config={item} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'editor') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <BraftEditor config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'tree') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <NormalTree config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'code') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <SandBox config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'chart') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <CustomChart 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 if (item.type === 'module' && item.subtype === 'voucher') {
         return (
-          <Col span={item.width} key={item.uuid}>
+          <Col span={item.width} style={style} key={item.uuid}>
             <Voucher config={item}/>
+          </Col>
+        )
+      } else if (item.type === 'module' && item.subtype === 'account') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <Account 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 {
@@ -1246,12 +1412,12 @@
     const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state
 
     return (
-      <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}>
-        {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null}
-        <Row className="component-wrap">{this.getComponents()}</Row>
+      <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}>
+        {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null}
+        <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row>
         {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null}
         {config && window.GLOB.breakpoint ? <DebugTable /> : null}
-        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null}
+        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null}
         {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null}
         {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
       </div>

--
Gitblit v1.8.0