From 51a60b5cb00fdeaf9e42c29341242460bf2154e8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 18 九月 2020 09:37:22 +0800
Subject: [PATCH] 2020-09-18

---
 src/tabviews/custom/index.jsx |  135 ++++++++++++++++++++++++--------------------
 1 files changed, 73 insertions(+), 62 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 0f4623d..01d96fd 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -130,65 +130,8 @@
         }
       })
 
-      // 鏉冮檺杩囨护
-      if (this.props.menuType !== 'HS') {
-        config.components.forEach(component => {
-          if (component.action) {
-            component.action = component.action.filter(item => permAction[item.uuid])
-          }
-        })
-      }
-
       let params = []
-      config.components.forEach(component => {
-        if (!component.format) return // 娌℃湁鍔ㄦ�佹暟鎹�
-
-        let _customScript = ''
-        component.scripts && component.scripts.forEach(script => {
-          if (script.status !== 'false') {
-            _customScript += `
-            ${script.sql}
-            `
-          }
-        })
-        delete component.scripts
-
-        if (component.setting && component.setting.interType === 'system') { // 浣跨敤绯荤粺鍑芥暟
-          component.setting.execute = component.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
-          component.setting.laypage = component.setting.laypage === 'true'   // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
-
-          if (!component.setting.execute) {
-            component.setting.dataresource = ''
-          }
-          if (/\s/.test(component.setting.dataresource)) {
-            component.setting.dataresource = '(' + component.setting.dataresource + ') tb'
-          }
-      
-          if (this.props.dataManager) { // 鏁版嵁鏉冮檺
-            component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*')
-            component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
-            _customScript = _customScript.replace(/\$@/ig, '/*')
-            _customScript = _customScript.replace(/@\$/ig, '*/')
-          } else {
-            component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
-            _customScript = _customScript.replace(/@\$|\$@/ig, '')
-          }
-        }
-
-        if (component.setting) {
-          component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
-        }
-
-        // format   鏁版嵁鏍煎紡 array 鎴� object
-        // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
-        // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
-        if (component.format && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') {
-          let param = this.getDefaultParam(component, mainSearch)
-          params.push(param)
-        } else {
-          component.setting.sync = 'false'
-        }
-      })
+      config.components = this.formatSetting(config.components, params, mainSearch, permAction)
 
       this.setState({
         BID: param && param.BID ? param.BID : '',
@@ -211,6 +154,75 @@
         duration: 5
       })
     }
+  }
+
+  // 鏍煎紡鍖栭粯璁よ缃�
+  formatSetting = (components, params, mainSearch, permAction) => {
+    return components.map(component => {
+      if (component.type === 'tabs') {
+        component.subtabs = component.subtabs.map(tab => {
+          tab.components = this.formatSetting(tab.components, [], [], permAction)
+          return tab
+        })
+      }
+
+      // 鏉冮檺杩囨护
+      if (this.props.menuType !== 'HS') {
+        if (component.action) {
+          component.action = component.action.filter(item => permAction[item.uuid])
+        }
+      }
+
+      if (!component.format) return component // 娌℃湁鍔ㄦ�佹暟鎹�  鏁版嵁鏍煎紡 array 鎴� object
+
+      let _customScript = ''
+      component.scripts && component.scripts.forEach(script => {
+        if (script.status !== 'false') {
+          _customScript += `
+          ${script.sql}
+          `
+        }
+      })
+      delete component.scripts
+
+      if (component.setting && component.setting.interType === 'system') { // 浣跨敤绯荤粺鍑芥暟
+        component.setting.execute = component.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
+        component.setting.laypage = component.setting.laypage === 'true'   // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
+
+        if (!component.setting.execute) {
+          component.setting.dataresource = ''
+        }
+        if (/\s/.test(component.setting.dataresource)) {
+          component.setting.dataresource = '(' + component.setting.dataresource + ') tb'
+        }
+    
+        if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+          component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*')
+          component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
+          _customScript = _customScript.replace(/\$@/ig, '/*')
+          _customScript = _customScript.replace(/@\$/ig, '*/')
+        } else {
+          component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
+          _customScript = _customScript.replace(/@\$|\$@/ig, '')
+        }
+      }
+
+      if (component.setting) {
+        component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
+      }
+
+      // floor    缁勪欢鐨勫眰绾�
+      // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
+      // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
+      if (component.floor === 1 && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') {
+        let param = this.getDefaultParam(component, mainSearch)
+        params.push(param)
+      } else {
+        component.setting.sync = 'false'
+      }
+
+      return component
+    })
   }
 
   /**
@@ -310,7 +322,6 @@
         LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`)
       })
       return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
-      // return `Select '${item.name}' as tablename,'${_sql}' as LText,'${_script}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
     })
 
     let param = {
@@ -427,7 +438,7 @@
     return config.components.map(item => {
       if (item.type === 'bar' || item.type === 'line') {
         return (
-          <Col key={item.uuid}>
+          <Col span={item.setting.span} key={item.uuid}>
             <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} />
           </Col>
         )
@@ -442,9 +453,9 @@
     const { loadingview, viewlost } = this.state
 
     return (
-      <div className="calendar-page" id={this.state.ContainerId}>
+      <div className="custom-page-wrap" id={this.state.ContainerId}>
         {loadingview && <Spin size="large" />}
-        <Row>{this.getComponents()}</Row>
+        <Row gutter={8}>{this.getComponents()}</Row>
         {options.sysType !== 'cloud' ? <Button
           icon="copy"
           shape="circle"

--
Gitblit v1.8.0