From c4143d291e70b3ccff023a5a3e09f49889f5daa0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 十一月 2023 21:48:34 +0800
Subject: [PATCH] 2023-11-03

---
 src/tabviews/basetable/index.jsx |  263 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 161 insertions(+), 102 deletions(-)

diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx
index a64ab5f..565fea4 100644
--- a/src/tabviews/basetable/index.jsx
+++ b/src/tabviews/basetable/index.jsx
@@ -13,6 +13,7 @@
 // 閫氱敤缁勪欢
 const AntvTabs = asyncComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs'))
 const MkBaseTable = asyncComponent(() => import('@/tabviews/custom/components/table/base-table'))
+const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat'))
 const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent'))
 const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes'))
 const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic'))
@@ -35,7 +36,6 @@
     lostmsg: '',          // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅
     config: null,         // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑
     userConfig: null,     // 鐢ㄦ埛鑷畾涔夎缃�
-    loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
     visible: false,       // 鏍囩椤垫帶鍒�
     shortcuts: null,      // 蹇嵎閿�
     autoMatic: null
@@ -102,8 +102,49 @@
         return
       }
 
+      if (config.process === 'true') {
+        let unset = true
+        if (result.works_flow_code && result.works_long_param) {
+          try { // 娴佺▼淇℃伅瑙f瀽
+            let flowConfig = JSON.parse(window.decodeURIComponent(window.atob(result.works_long_param)))
+            flowConfig.flow_code = result.works_flow_code
+            flowConfig.flow_name = result.works_flow_name
+            config.flow_code = result.works_flow_code
+            config.flow_name = result.works_flow_name
+            unset = false
+            window.GLOB.UserCacheMap.set('flow' + MenuID, flowConfig)
+          } catch (e) {
+            unset = true
+            console.warn('Parse Failure')
+          }
+        }
+        
+        if (unset) {
+          this.setState({
+            config: config,
+            viewlost: true,
+            loadingview: false,
+            lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭璁剧疆宸ヤ綔娴侊紝璇疯仈绯荤鐞嗗憳銆�'
+          })
+          return
+        }
+      } else if (result.works_flow_code) {
+        Api.getSystemConfig({
+          func: 's_works_flow_param_sso_menu_upt_v6',
+          upt_type: 'del',
+          works_flow_code: '',
+          works_flow_name: '',
+          long_param: '',
+          flow_id: '',
+          menuid: config.MenuID,
+          menuname: config.MenuName,
+          username: sessionStorage.getItem('User_Name') || '',
+          fullName: sessionStorage.getItem('Full_Name') || ''
+        })
+      }
+
       // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆
-      if (result.LongParamUser && !window.GLOB.mkHS) {
+      if (result.LongParamUser) {
         try { // 閰嶇疆淇℃伅瑙f瀽
           let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
           if (userConfig) {
@@ -148,7 +189,11 @@
         })
       }
 
-      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName)
+      if (config.flow_code) {
+        regs.push({ reg: /@works_flow_code@/ig, value: `'${config.flow_code}'` })
+      }
+
+      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true')
 
       let autoMatic = null
       if (config.autoMatic && config.autoMatic.enable === 'true') {
@@ -170,7 +215,7 @@
 
         if (param.$searchkey) {
           component.search = component.search.map(item => {
-            if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) {
+            if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) {
               item.initval = param.$searchval
             }
   
@@ -263,10 +308,15 @@
     }
   }
 
-  filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName) => {
+  filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName, process) => {
     return components.filter(item => {
       item.$pageId = pageId
       item.$searchId = pageId
+
+      if (process) {
+        item.$process = process
+        item.$flowId = 'flow' + this.props.MenuID
+      }
 
       item.$menuname = (MenuName || '') + '-' + (item.name || '涓昏〃')
 
@@ -287,7 +337,7 @@
           if (tab.permission !== 'true') { // 鏉冮檺鏈紑鍚笉鍋氭潈闄愭帶鍒�
             skip = true
           }
-          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName)
+          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName, process)
           return tab
         })
 
@@ -341,50 +391,10 @@
               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.$view = 'popview'
-
-                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
-                    }
-                  }
-                }
+                cell = this.resetButton(item, cell)
 
                 if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
                   cell = this.getPrinter(cell, item.uuid)
-                }
-
-                if (cell.controlField) {
-                  if (/,/ig.test(cell.controlVal)) {
-                    cell.controlVals = cell.controlVal.split(',')
-                  } else {
-                    cell.controlVals = [(cell.controlVal || '')]
-                  }
                 }
 
                 return skip || permAction[cell.uuid]
@@ -409,7 +419,7 @@
     
           if (col.linkmenu && col.linkmenu.length > 0) {
             let menu_id = col.linkmenu.pop()
-            col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || ''
+            col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || ''
           } else {
             col.linkThdMenu = ''
           }
@@ -426,51 +436,12 @@
         item.action = item.action.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.$view = 'popview'
-          cell.$toolbtn = true
+          cell = this.resetButton(item, cell)
 
-          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
-              }
-            }
-          }
+          cell.$toolbtn = true
 
           if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃�
             cell = this.getPrinter(cell, item.uuid)
-          }
-
-          if (cell.controlField) {
-            if (/,/ig.test(cell.controlVal)) {
-              cell.controlVals = cell.controlVal.split(',')
-            } else {
-              cell.controlVals = [(cell.controlVal || '')]
-            }
           }
 
           return skip || permAction[cell.uuid]
@@ -481,9 +452,72 @@
     })
   }
 
+  resetButton = (item, cell) => {
+    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 (item.$process) {
+      cell.$process = true
+      cell.$flowId = 'flow' + this.props.MenuID
+    }
+
+    if (cell.controlField) {
+      if (/,/ig.test(cell.controlVal)) {
+        cell.controlVals = cell.controlVal.split(',')
+      } else {
+        cell.controlVals = [(cell.controlVal || '')]
+      }
+    }
+
+    if (cell.OpenType === 'excelOut') { // 瀵煎嚭
+      cell.$menuName = item.name
+
+      if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
+        cell.errorType = 'error1'
+      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom' && item.setting.interType !== 'system') {
+        cell.errorType = 'error2'
+      }
+    }
+
+    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
+  }
+
   getPrinter = (item, parentId) => {
     let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)
 
+    item.verify.logLabel = item.logLabel
+    
     if (_item) {
       item.printer = _item.printer || ''
       item.verify.defaultPrinter = _item.printer || ''
@@ -511,6 +545,7 @@
         return component
       }
 
+      component.setting.arr_field = component.columns.map(col => col.field).join(',')
       component.setting.useMSearch = component.setting.useMSearch === 'true'
       if (component.setting.useMSearch) {
         if (!window.GLOB.SearchBox.has(component.$searchId)) {
@@ -527,9 +562,15 @@
       }
 
       let _customScript = ''
+      let _tailScript = ''
       component.scripts && component.scripts.forEach(script => {
-        if (script.status !== 'false') {
+        if (script.status === 'false') return
+        if (script.position !== 'back') {
           _customScript += `
+          ${script.sql}
+          `
+        } else {
+          _tailScript += `
           ${script.sql}
           `
         }
@@ -549,22 +590,28 @@
       if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
         component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
         _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
+        _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
       } else {
         component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
         _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
+        _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
       }
 
       regs.forEach(cell => {
         component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value)
         _customScript = _customScript.replace(cell.reg, cell.value)
+        _tailScript = _tailScript.replace(cell.reg, cell.value)
       })
 
       component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
+      component.setting.tailScript = _tailScript     // 鍚庣疆鑷畾涔夎剼鏈�
 
-      if (component.setting.laypage) {
-        component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript)
+      component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript)
+
+      if (!component.setting.execute || component.setting.custompage) {
+        component.forbidLine = true
       }
-
+      
       component.setting.delay = delay
       delay += 20
 
@@ -650,7 +697,6 @@
       loadingview: true,    // 椤甸潰鍔犺浇涓�
       viewlost: false,      // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤
       config: null,         // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑
-      loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
       shortcuts: null,
     }, () => {
       this.loadconfig()
@@ -680,17 +726,30 @@
   }
 
   render() {
-    const { loadingview, viewlost, config, loading, shortcuts, autoMatic } = this.state
+    const { loadingview, viewlost, config, shortcuts, autoMatic } = this.state
+
+    if (!config || viewlost) {
+      return (
+        <div className="custom-table-wrap">
+          {loadingview ? <Spin className="view-spin" size="large" /> : null}
+          {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
+          <div className="user-tools">
+            {config && config.process === 'true' ? <FlowFloat init={true} config={config}/> : null}
+          </div>
+        </div>
+      )
+    }
 
     return (
-      <div className={'custom-table-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}>
-        {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null}
+      <div className="custom-table-wrap" id={this.state.ContainerId} style={config.style}>
         <Row className="component-wrap">{this.getComponents()}</Row>
-        {config && window.GLOB.breakpoint ? <DebugTable /> : null}
-        {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null}
-        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null}
-        {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null}
-        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
+        {window.GLOB.breakpoint ? <DebugTable /> : null}
+        <div className="user-tools">
+          {autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null}
+          {config.process === 'true' ? <FlowFloat config={config}/> : null}
+          <SettingComponent config={config} shortcuts={shortcuts || []}/>
+          <TableNodes config={config} />
+        </div>
       </div>
     )
   }

--
Gitblit v1.8.0