From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 07 四月 2021 23:25:29 +0800
Subject: [PATCH] 2021-04-07

---
 src/tabviews/custom/index.jsx |  100 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 81 insertions(+), 19 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index f6c7e40..97b6365 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -23,6 +23,9 @@
 const AntvTabs = asyncComponent(() => import('./components/tabs/antv-tabs'))
 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 CarouselDataCard = asyncComponent(() => import('./components/carousel/data-card'))
+const CarouselPropCard = asyncComponent(() => import('./components/carousel/prop-card'))
 const TableCard = asyncComponent(() => import('./components/card/table-card'))
 const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch'))
 const NormalTable = asyncComponent(() => import('./components/table/normal-table'))
@@ -134,14 +137,8 @@
 
         component.search = component.search.map(item => {
           item.oriInitval = item.initval
-          if (['text', 'select', 'link'].includes(item.type) && param) {
-            if (param.searchkey === item.field) {
-              item.initval = param.searchval
-            } else if (param.BID && item.field.toLowerCase() === 'bid') {
-              item.initval = param.BID
-            } else if (param.data && param.data[item.field]) {
-              item.initval = param.data[item.field]
-            }
+          if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) {
+            item.initval = param.$searchval
           }
 
           return item
@@ -151,7 +148,7 @@
       })
 
       let params = []
-      let BID = param && param.BID ? param.BID : ''
+      let BID = param && param.$BID ? param.$BID : ''
       let inherit = {}
 
       if (config.cacheUseful === 'true') { // 缂撳瓨缁ф壙
@@ -160,7 +157,38 @@
         inherit.cacheTime = config.cacheTime
       }
 
-      config.components = this.formatSetting(config.components, params, mainSearch, inherit)
+      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') || ''
+        fullName = sessionStorage.getItem('CloudFullName') || ''
+      }
+
+      let regs = [
+        { reg: /@userName@/ig, value: userName },
+        { reg: /@fullName@/ig, value: fullName },
+        { reg: /@login_city@/ig, value: city }
+      ]
+      
+      if (window.GLOB.externalDatabase !== null) {
+        regs.push({
+          reg: /@db@/ig,
+          value: window.GLOB.externalDatabase
+        })
+      }
+      if (config.urlFields) {
+        config.urlFields.forEach(field => {
+          let val = `'${param ? (param[field] || '') : ''}'`
+          regs.push({
+            reg: new RegExp(field, 'ig'),
+            value: val
+          })
+        })
+      }
+
+      config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs)
 
       this.setState({
         BID: BID,
@@ -265,7 +293,7 @@
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
-        if (res.mk_ex_invoke === 'false') {
+        if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) {
           if (inters.length > 0) {
             this.loadOutResource(inters)
           }
@@ -307,7 +335,7 @@
       param[key] = result[key]
     })
 
-    Api.directRequest(url, setting.method, param).then(res => {
+    Api.directRequest(url, setting.method, param, setting.cross).then(res => {
       if (typeof(res) !== 'object' || Array.isArray(res)) {
         let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒'
 
@@ -413,6 +441,16 @@
         ) {
           return false
         }
+
+        item.subtabs = item.subtabs.filter(tab => {
+          if (
+            tab.blacklist && tab.blacklist.length > 0 &&
+            tab.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0
+          ) {
+            return false
+          }
+          return true
+        })
 
         item.subtabs = item.subtabs.map(tab => {
           tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus)
@@ -537,7 +575,7 @@
             return cell.eleType !== 'button' || isHS || permAction[cell.uuid]
           })
         })
-      } else if (item.type === 'table' && item.subtype === 'tablecard') {
+      } else if ((item.type === 'table' && item.subtype === 'tablecard') || item.type === 'carousel') {
         item.subcards.forEach(card => {
           let _hasheight = card.style.height && card.style.height !== 'auto'
           card.elements = card.elements.filter(cell => {
@@ -644,22 +682,22 @@
   }
 
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatSetting = (components, params, mainSearch, inherit) => {
+  formatSetting = (components, params, mainSearch, inherit, regs) => {
     return components.map(component => {
       if (component.type === 'tabs') {
         component.subtabs = component.subtabs.map(tab => {
-          tab.components = this.formatSetting(tab.components, [], [], inherit)
+          tab.components = this.formatSetting(tab.components, [], [], inherit, regs)
           tab = {...tab, ...inherit}
           return tab
         })
         return component
       } else if (component.type === 'group') {
-        component.components = this.formatSetting(component.components, [], [], inherit)
+        component.components = this.formatSetting(component.components, [], [], inherit, regs)
         component = {...component, ...inherit}
         return component
       }
 
-      if (['propcard', 'brafteditor', 'sandbox'].includes(component.subtype) && component.wrap.datatype === 'static') {
+      if (['propcard', 'brafteditor', 'sandbox', 'stepform'].includes(component.subtype) && component.wrap.datatype === 'static') {
         component.format = ''
       }
 
@@ -700,6 +738,11 @@
         component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
         _customScript = _customScript.replace(/@\$|\$@/ig, '')
       }
+
+      regs.forEach(cell => {
+        component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value)
+        _customScript = _customScript.replace(cell.reg, cell.value)
+      })
 
       component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
 
@@ -798,6 +841,7 @@
     let diffUser = false
     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') || ''
@@ -808,8 +852,8 @@
       let _script = item.script
 
       if (index === 0) {
-        _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50)
-          select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}'
+        _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
+          select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
           ${_script}
         `
       }
@@ -961,6 +1005,12 @@
             <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </Col>
         )
+      } else if (item.type === 'form') {
+        return (
+          <Col span={item.width} key={item.uuid}>
+            <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
+          </Col>
+        )
       } else if (item.type === 'search') {
         return (
           <Col span={item.width} key={item.uuid}>
@@ -985,6 +1035,18 @@
             <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
           </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} />
+          </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} />
+          </Col>
+        )
       } else if (item.type === 'table' && item.subtype === 'tablecard') {
         return (
           <Col span={item.width} key={item.uuid}>

--
Gitblit v1.8.0