From 3c50bfdd8d605b3dd449adcb54cdf7f7c25d6c16 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 04 十一月 2022 15:46:05 +0800
Subject: [PATCH] 2022-11-04

---
 src/tabviews/custom/index.jsx |  228 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 125 insertions(+), 103 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 30f4f7a..0e4ec35 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -49,7 +49,8 @@
     Tab: PropTypes.string,       // 寮圭獥鏍囩
     MenuID: PropTypes.string,    // 鑿滃崟Id
     MenuNo: PropTypes.string,    // 鑿滃崟鍙傛暟
-    MenuName: PropTypes.string   // 鑿滃崟鍚嶇О
+    MenuName: PropTypes.string,  // 鑿滃崟鍚嶇О
+    changeTemp: PropTypes.func
   }
 
   state = {
@@ -93,21 +94,6 @@
         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瀽閿欒鏃舵彁绀�
       if (!config) {
         this.setState({
@@ -125,6 +111,36 @@
           lostmsg: this.state.dict['main.view.unenabled']
         })
         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')
+        }
       }
 
       // 鏁版嵁缂撳瓨璁剧疆
@@ -805,22 +821,21 @@
         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.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂
         component.setting.sync = 'false'
         component.setting.laypage = component.setting.laypage === 'true'
@@ -893,9 +908,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
@@ -1089,147 +1105,153 @@
     if (!config || !config.components) 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 === '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 === '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>
         )

--
Gitblit v1.8.0