From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/custom/index.jsx |  227 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 161 insertions(+), 66 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index f3d603c..29a1d27 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -23,7 +23,8 @@
 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 NormalForm = asyncComponent(() => import('./components/form/normal-form'))
+const SimpleForm = asyncComponent(() => import('./components/form/simple-form'))
+const StepForm = asyncComponent(() => import('./components/form/step-form'))
 const TabForm = asyncComponent(() => import('./components/form/tab-form'))
 const CarouselDataCard = asyncComponent(() => import('./components/carousel/data-card'))
 const CarouselPropCard = asyncComponent(() => import('./components/carousel/prop-card'))
@@ -92,7 +93,7 @@
       }
 
       // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆
-      if (result.LongParamUser && this.props.menuType !== 'HS') {
+      if (result.LongParamUser && !window.GLOB.mkHS) {
         try { // 閰嶇疆淇℃伅瑙f瀽
           let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
           if (userConfig) {
@@ -136,7 +137,7 @@
       // 鏉冮檺杩囨护
       let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
       let balMap = new Map()
-      let skip = config.permission === 'false' || this.props.menuType === 'HS'
+      let skip = config.permission === 'false' || window.GLOB.mkHS
       config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip)
       
       // 鑾峰彇涓绘悳绱㈡潯浠�
@@ -168,7 +169,6 @@
 
       let userName = sessionStorage.getItem('User_Name') || ''
       let fullName = sessionStorage.getItem('Full_Name') || ''
-      let city = sessionStorage.getItem('city') || ''
 
       if (sessionStorage.getItem('isEditState') === 'true') {
         userName = sessionStorage.getItem('CloudUserName') || ''
@@ -177,8 +177,7 @@
 
       let regs = [
         { reg: /@userName@/ig, value: `'${userName}'` },
-        { reg: /@fullName@/ig, value: `'${fullName}'` },
-        { reg: /@login_city@/ig, value: `'${city}'` }
+        { reg: /@fullName@/ig, value: `'${fullName}'` }
       ]
       
       if (window.GLOB.externalDatabase !== null) {
@@ -304,7 +303,7 @@
 
   loadOutResource = (inters) => {
     let setting = inters.shift()
-    let param = UtilsDM.getPrevQueryParams(setting, [], this.state.BID, this.props.menuType)
+    let param = UtilsDM.getPrevQueryParams(setting, [], this.state.BID)
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
@@ -405,13 +404,13 @@
       `))
       sql = sql.join('')
       
-      param = UtilsDM.getCallBackQueryParams(setting, sql, errSql)
+      param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.state.BID)
 
       if (this.state.BID) {
         param.BID = this.state.BID
       }
 
-      if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
+      if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
       }
     } else {
@@ -523,23 +522,6 @@
         }
       }
 
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        if (item.supNodes && item.supNodes[0]) {
-          item.setting.supModule = item.supNodes[0].componentId
-        } else {
-          item.wrap.supType = 'single'
-          item.supNodes = null
-          item.setting.supModule = ''
-        }
-      } 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.search && item.search.length > 0) {
         item.search = Utils.initSearchVal(item.search)
@@ -569,6 +551,18 @@
               col.elements = col.elements.map(cell => {
                 if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height) {
                   cell.innerHeight = 'auto'
+                } else if (cell.eleType === 'icon') {
+                  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
               })
@@ -589,6 +583,19 @@
         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 = ''
+        }
+      }
+
       // 鏉冮檺杩囨护
       let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 寮圭獥鏍囩鎸夐挳Id
       if (item.action && item.action.length > 0) {
@@ -602,8 +609,9 @@
           cell.$MenuID = this.props.MenuID
           cell.$tabId = tabId
           cell.$view = 'CustomPage'
+          cell.$toolbtn = true
 
-          if (cell.syncComponentId === item.uuid) {
+          if (!mutil && cell.syncComponentId === item.setting.supModule) {
             cell.syncComponentId = ''
           }
 
@@ -644,7 +652,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -657,6 +665,18 @@
               }
             } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
               cell.innerHeight = 'auto'
+            } else if (cell.eleType === 'icon') {
+              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.eleType !== 'button' || skip || permAction[cell.uuid]
@@ -674,7 +694,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -687,7 +707,20 @@
               }
             } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
               cell.innerHeight = 'auto'
+            } else if (cell.eleType === 'icon') {
+              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.eleType !== 'button' || skip || permAction[cell.uuid]
           })
         })
@@ -695,6 +728,9 @@
         if (item.wrap.linkType === 'sync') {
           item.wrap.syncModuleId = item.wrap.syncModule.pop()
           balMap.set(item.wrap.syncModuleId, true)
+        } else if (item.wrap.linkType === 'sup') {
+          item.wrap.supModule = item.wrap.supModule.pop()
+          item.setting.supModule = item.wrap.supModule
         }
         item.elements = item.elements.filter(cell => {
           if (cell.eleType === 'button') {
@@ -708,7 +744,7 @@
             cell.$tabId = tabId
             cell.$view = 'CustomPage'
 
-            if (cell.syncComponentId === item.uuid) {
+            if (cell.syncComponentId === item.wrap.supModule) {
               cell.syncComponentId = ''
             }
 
@@ -717,6 +753,18 @@
             }
           } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height) {
             cell.innerHeight = 'auto'
+          } else if (cell.eleType === 'icon') {
+            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.eleType !== 'button' || skip || permAction[cell.uuid]
@@ -737,7 +785,7 @@
               cell.$tabId = tabId
               cell.$view = 'CustomPage'
 
-              if (cell.syncComponentId === item.uuid) {
+              if (cell.syncComponentId === item.setting.supModule) {
                 cell.syncComponentId = ''
               }
 
@@ -750,6 +798,18 @@
               }
             } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
               cell.innerHeight = 'auto'
+            } else if (cell.eleType === 'icon') {
+              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.eleType !== 'button' || skip || permAction[cell.uuid]
           })
@@ -769,7 +829,7 @@
             cell.$tabId = tabId
             cell.$view = 'CustomPage'
 
-            if (cell.syncComponentId === item.uuid) {
+            if (cell.syncComponentId === item.setting.supModule) {
               cell.syncComponentId = ''
             }
 
@@ -791,14 +851,46 @@
           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.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺
+          group.subButton.OpenType = 'formSubmit'
+          group.subButton.execError = 'never'
 
-      // if (item.wrap && item.wrap.doubleClick) {
-      //   let index = item.action.findIndex((btn) => btn.uuid === item.wrap.doubleClick)
-      //   if (index === -1) {
-      //     item.wrap.doubleClick = ''
-      //   }
-      // }
+          if (!group.subButton.Ot) {
+            group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
+          }
+
+          group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : ''
+
+          if (group.subButton.syncComponentId === item.setting.supModule) {
+            group.subButton.syncComponentId = ''
+          }
+
+          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.arr_field = _option.field
+            }
+      
+            // 瀛楁鏉冮檺榛戝悕鍗�
+            if (!cell.blacklist || !roleId || cell.blacklist.length === 0) return cell
+            if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+              cell.hidden = 'true'
+            }
+      
+            return cell
+          })
+
+          return group
+        })
+      }
       
       return true
     })
@@ -975,7 +1067,7 @@
    * @description 涓昏〃鏁版嵁鍔犺浇
    */ 
   loadmaindata = (params) => {
-    let param = getStructuredParams(params, this.state.config, this.state.BID)
+    let param = getStructuredParams(params, this.state.config, this.state.BID || '')
 
     this.setState({loading: true, loadingview: false})
 
@@ -1066,7 +1158,6 @@
   }
 
   getComponents = () => {
-    const { menuType } = this.props
     const { config, BID, data, mainSearch } = this.state
 
     if (!config || !config.components) return
@@ -1080,43 +1171,49 @@
       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}/>
           </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}/>
           </Col>
         )
       } else if (item.type === 'scatter') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'dashboard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
+          </Col>
+        )
+      } else if (item.type === 'form' && item.subtype === 'simpleform') {
+        return (
+          <Col span={item.width} key={item.uuid}>
+            <SimpleForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'form' && item.subtype === 'stepform') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <StepForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'form' && item.subtype === 'tabform') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'search') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <MainSearch config={item} BID={BID} menuType={menuType} refreshdata={this.resetSearch} />
+            <MainSearch config={item} BID={BID} refreshdata={this.resetSearch} />
           </Col>
         )
       } else if (item.type === 'tabs') {
@@ -1128,85 +1225,85 @@
       } 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}/>
           </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}/>
           </Col>
         )
       } else if (item.type === 'balcony') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <Balcony config={item} data={data} BID={_bid} menuType={menuType} />
+            <Balcony config={item} data={data} BID={_bid}/>
           </Col>
         )
       } else if (item.type === 'timeline') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <TimeLine config={item} data={data} BID={_bid} menuType={menuType} />
+            <TimeLine config={item} data={data} BID={_bid}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'datacard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CarouselDataCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <CarouselDataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'carousel' && item.subtype === 'propcard') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CarouselPropCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <CarouselPropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </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}/>
           </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}/>
           </Col>
         )
       } else if (item.type === 'table' && item.subtype === 'editable') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <EditTable config={item} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <EditTable config={item} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalGroup config={item} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <NormalGroup config={item} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'editor') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'tree') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'code') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'chart') {
         return (
           <Col span={item.width} key={item.uuid}>
-            <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+            <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
           </Col>
         )
       } else if (item.type === 'module' && item.subtype === 'voucher') {
@@ -1222,15 +1319,14 @@
   }
 
   render() {
-    const { menuType } = this.props
     const { loadingview, viewlost, config, loading, shortcuts } = 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>
-        {menuType !== 'HS' && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null}
-        {menuType !== 'HS' && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : 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 && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : null}
         {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
       </div>
     )
@@ -1239,7 +1335,6 @@
 
 const mapStateToProps = (state) => {
   return {
-    menuType: state.editLevel,
     refreshTab: state.refreshTab,
     permAction: state.permAction,
     permMenus: state.permMenus

--
Gitblit v1.8.0