From 92664ef80a97a63fde223b14097ccda3ae6ff183 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 24 四月 2025 14:31:57 +0800
Subject: [PATCH] Merge branch 'positec' into dms

---
 src/tabviews/custom/popview/index.jsx |  536 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 333 insertions(+), 203 deletions(-)

diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index edc4113..57a2d3f 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -2,6 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { notification, Spin, Row, Col, Modal } from 'antd'
+import moment from 'moment'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -61,7 +62,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { Tab } = this.props
+    const { Tab, param } = this.props
 
     let config = Tab.config || ''
 
@@ -70,6 +71,7 @@
         config = JSON.stringify(config)
         config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
         config = JSON.parse(config)
+        config.MenuName = Tab.logLabel || Tab.label || ''
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
@@ -104,9 +106,19 @@
     // 鏉冮檺杩囨护
     let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
     let balMap = new Map()
-    let param = this.props.param || {} // url鍙傛暟
+    let tbMap = new Map()
+    let urlparam = {} // url鍙傛暟
+    if (param) {
+      Object.keys(param).forEach(key => {
+        if (/^\$/.test(key)) {
+          urlparam[key] = param[key]
+        } else {
+          urlparam[key.toLowerCase()] = param[key]
+        }
+      })
+    }
 
-    window.GLOB.CacheData.set(Tab.uuid, param)
+    window.GLOB.CacheData.set(Tab.uuid, urlparam)
 
     let userName = sessionStorage.getItem('User_Name') || ''
     let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -123,23 +135,16 @@
       })
     }
 
-    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid)
+    if (Tab.$process && window.GLOB.UserCacheMap.has(Tab.$flowId)) {
+      let flow = window.GLOB.UserCacheMap.get(Tab.$flowId)
+      regs.push({ reg: /@works_flow_code@/ig, value: `'${flow.flow_code || ''}'` })
+    }
+
+    config.components = this.filterComponent(config.components, roleId, balMap, tbMap, urlparam, Tab, Tab.uuid, Tab.uuid, regs)
     
     // 鑾峰彇涓绘悳绱㈡潯浠�
     config.components.forEach(component => {
       if (component.type !== 'search') return
-
-      if (param.$searchkey) {
-        component.search = component.search.map(item => {
-          if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) {
-            item.initval = param.$searchval
-          }
-
-          return item
-        })
-
-        component.$searches = Utils.initMainSearch(component.search)
-      }
 
       window.GLOB.SearchBox.set(Tab.uuid, component.$searches)
 
@@ -149,13 +154,9 @@
     })
 
     let params = []
-    let BID = param.$BID || ''
+    let BID = urlparam.$BID || ''
 
-    config.components = this.formatSetting(config.components, params, regs, balMap)
-
-    if ([...balMap.keys()].length > 0) {
-      config.components = this.filterBalcony(config.components, balMap)
-    }
+    config.components = this.formatSetting(config.components, params, balMap, tbMap, BID)
 
     this.setState({
       BID: BID,
@@ -167,11 +168,16 @@
     })
   }
 
-  filterComponent = (components, roleId, balMap, urlparam, Tab, searchId, syncId) => {
+  filterComponent = (components, roleId, balMap, tbMap, urlparam, Tab, searchId, syncId, regs) => {
     return components.filter(item => {
       item.$pageId = Tab.uuid
       item.$searchId = searchId
       item.$syncId = syncId
+
+      if (Tab.$process) {
+        item.$process = true
+        item.$flowId = Tab.$flowId
+      }
       
       if (item.style && item.style.boxShadow) {
         delete item.style.hShadow
@@ -180,7 +186,7 @@
         delete item.style.shadowColor
       }
 
-      item.$menuname = (Tab.label || '') + '-' + (item.name || '')
+      item.$menuname = (Tab.logLabel || Tab.label || '') + '-' + (item.name || '')
 
       if (item.type === 'tabs') {
         if (
@@ -217,6 +223,8 @@
             }
           }
 
+          tab.$menuname = (Tab.logLabel || Tab.label || '') + '-' + (tab.label || '')
+
           return true
         })
 
@@ -225,12 +233,7 @@
 
           if (item.setting.supModule === 'preview') {
             item.setting.supModule = ''
-            let val = ''
-            Object.keys(urlparam).forEach(key => {
-              if (key.toLowerCase() === item.setting.controlField) {
-                val = urlparam[key]
-              }
-            })
+            let val = urlparam[item.setting.controlField] || ''
 
             item.subtabs = item.subtabs.filter(tab => {
               if (tab.$pass) return true
@@ -243,12 +246,7 @@
         if (item.setting.selectField) {
           item.setting.selectField = item.setting.selectField.toLowerCase()
 
-          let val = ''
-          Object.keys(urlparam).forEach(key => {
-            if (key.toLowerCase() === item.setting.selectField) {
-              val = urlparam[key]
-            }
-          })
+          let val = urlparam[item.setting.selectField] || ''
 
           let activeKey = ''
 
@@ -270,7 +268,7 @@
             _searchId = tab.uuid
           }
 
-          tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, _searchId, tab.uuid)
+          tab.components = this.filterComponent(tab.components, roleId, balMap, tbMap, urlparam, Tab, _searchId, tab.uuid, regs)
 
           if (_searchId === tab.uuid) {
             tab.components.forEach(cell => {
@@ -294,7 +292,7 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, searchId, syncId)
+        item.components = this.filterComponent(item.components, roleId, balMap, tbMap, urlparam, Tab, searchId, syncId, regs)
 
         return true
       } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -313,15 +311,14 @@
         }
       }
 
-      // 鎼滅储鏉′欢鍒濆鍖�
-      if (item.search) {
-        Utils.initSearchVal(item)
-
-        item.$searches = Utils.initMainSearch(item.search)
-      }
-
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        item.setting.supModule = item.supNodes[0].componentId
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗°�乼able澶氫笂绾х粍浠�
+        item.supNodes = item.supNodes.map(node => node.componentId)
+        if (item.supNodes[0]) {
+          item.setting.supModule = item.supNodes[0]
+        } else {
+          item.supNodes = null
+          item.setting.supModule = ''
+        }
       } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
         let pid = item.setting.supModule.pop()
         if (pid && pid !== 'empty') {
@@ -329,6 +326,13 @@
         } else {
           item.setting.supModule = ''
         }
+      }
+
+      // 鎼滅储鏉′欢鍒濆鍖�
+      if (item.search) {
+        Utils.initSearchVal(item)
+
+        item.$searches = Utils.initMainSearch(item.search)
       }
 
       // 鏉冮檺杩囨护
@@ -344,7 +348,6 @@
       }
 
       if (item.type === 'table') {
-        let statFields = []
         let getCols = (cols) => {
           return cols.filter(col => {
             if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
@@ -355,10 +358,10 @@
               col.type = 'custom'
             }
             
-            if (col.type === 'number') {
-              if (col.sum === 'true' && !statFields.includes(col.field)) {
-                statFields.push(col)
-              }
+            if (col.type === 'index') {
+              col.field = '$Index'
+              col.type = 'text'
+            } else if (col.type === 'number') {
               if (typeof(col.decimal) === 'number') {
                 col.round = Math.pow(10, col.decimal)
                 if (col.format === 'percent') {
@@ -394,9 +397,13 @@
       
             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 = ''
+            }
+
+            if (col.marks && col.marks.length === 0) {
+              col.marks = null
             }
 
             return true
@@ -404,7 +411,20 @@
         }
         
         item.cols = getCols(item.cols)
-        item.statFields = statFields
+
+        if (item.hasExtend) {
+          item.setting.hasExtend = true
+          item.setting.sync = 'false'
+          item.setting.tableMode = 'compatible'
+          item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss')
+          item.colsCtrls = null
+        }
+
+        if (item.wrap.tree === 'true') {
+          item.setting.sync = 'false'
+          item.$cache = false
+          item.setting.$tree = true
+        }
 
         if (item.subtype === 'editable') {
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
@@ -419,6 +439,9 @@
           }
         }
       } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+        if (item.wrap.datatype === 'public') {
+          balMap.set(item.wrap.publicId + 'public', true)
+        }
         item.subcards && item.subcards.forEach(card => {
           if (card.style.boxShadow) {
             delete card.style.hShadow
@@ -485,6 +508,9 @@
           item.wrap.supModule = item.wrap.supModule.pop()
           item.setting.supModule = item.wrap.supModule
         }
+        if (item.wrap.datatype === 'public') {
+          balMap.set(item.wrap.publicId + 'public', true)
+        }
         item.elements = item.elements.filter(cell => {
           if (cell.eleType === 'button') {
             if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
@@ -497,26 +523,25 @@
           return true
         })
       } else if (item.type === 'form') {
+        if (item.wrap.datatype === 'public') {
+          balMap.set(item.wrap.publicId + 'public', true)
+        }
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
-          group.subButton.$menuId = group.uuid
-          group.subButton.$MenuID = Tab.$MenuID
           group.subButton.OpenType = 'formSubmit'
           group.subButton.execError = 'never'
-          group.subButton.logLabel = item.$menuname + '-' + group.subButton.label
-          group.subButton.$tabId = Tab.uuid
 
           if (!group.subButton.Ot) {
             group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
           }
 
-          group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
+          group.subButton = this.resetButton(item, group.subButton, Tab)
 
-          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
-            group.subButton.syncComponentId = ''
-            if (group.subButton.execSuccess === 'grid') {
-              group.subButton.execSuccess = 'mainline'
+          if (group.subButton.linkmenu) {
+            if (Array.isArray(group.subButton.linkmenu) && group.subButton.linkmenu.length > 0) {
+              group.subButton.openmenu = group.subButton.linkmenu
             }
+            delete group.subButton.linkmenu
           }
 
           group.fields = group.fields.map(cell => {
@@ -540,43 +565,97 @@
           return group
         })
       }
+
+      // 鏁寸悊鏁版嵁婧�
+      if (item.setting && item.format && (!item.wrap || !['public', 'static'].includes(item.wrap.datatype))) {
+        item.setting.arr_field = item.columns ? item.columns.map(col => col.field).join(',') : ''
+        item.setting.useMSearch = item.setting.useMSearch === 'true'
+        item.setting.laypage = item.setting.laypage === 'true'   // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
+
+        if (item.wrap && item.wrap.goback === 'true') {
+          item.setting.sync = 'false'
+        }
+
+        if (item.format === 'object') {
+          item.setting.laypage = false
+          item.setting.$top = true
+        }
+
+        if (item.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂
+          item.setting.sync = 'false'
+          item.setting.dataresource = ''
+        } else {
+          let _customScript = ''
+          let _tailScript = ''
+          item.scripts && item.scripts.forEach(script => {
+            if (script.status === 'false') return
+            if (script.position !== 'back') {
+              _customScript += `
+              ${script.sql}
+              `
+            } else {
+              _tailScript += `
+              ${script.sql}
+              `
+            }
+          })
+          delete item.scripts
+          item.setting.$name = item.$menuname || ''
+          item.setting.execute = item.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
+
+          if (!item.setting.execute) {
+            item.setting.dataresource = ''
+          }
       
-      return true
-    })
-  }
+          if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
+            item.setting.dataresource = item.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 {
+            item.setting.dataresource = item.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
+            _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
+            _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
+          }
 
-  filterBalcony = (components, balMap) => {
-    return components.filter(item => {
-      if (item.type === 'tabs') {
-        item.subtabs = item.subtabs.map(tab => {
-          tab.components = this.filterBalcony(tab.components, balMap)
-          return tab
-        })
-      } else if (item.type === 'group') {
-        item.components = this.filterBalcony(item.components, balMap)
-      }
+          regs.forEach(cell => {
+            item.setting.dataresource = item.setting.dataresource.replace(cell.reg, cell.value)
+            _customScript = _customScript.replace(cell.reg, cell.value)
+            _tailScript = _tailScript.replace(cell.reg, cell.value)
+          })
 
-      if (item.type === 'balcony' && item.wrap.linkType === 'sync') {
-        let conf = balMap.get(item.wrap.syncModuleId)
+          item.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
+          item.setting.tailScript = _tailScript     // 鍚庣疆鑷畾涔夎剼鏈�
+          item.setting.custompage = false
 
-        if (!conf || conf === true) {
-          return false
-        }
-        
-        item.syncConfig = {
-          uuid: conf.uuid,
-          wrap: conf.wrap,
-          setting: conf.setting,
-          columns: conf.columns
-        }
+          if (/order\s+by\s+sort_id\s*$/i.test(item.setting.dataresource)) {
+            item.setting.custompage = true
+          } else if (item.setting.$tree || /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)) {
+            item.setting.custompage = true
+          }
 
-        if (item.wrap.checkAll === 'show') {
-          if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') {
-            item.wrap.checkAll = 'hidden'
-          } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') {
-            item.wrap.checkAll = 'hidden'
+          if (/\s/.test(item.setting.dataresource)) {
+            item.setting.dataresource = '(' + item.setting.dataresource + ') tb'
+          }
+          
+          if (!item.setting.execute || item.setting.custompage) {
+            item.forbidLine = true
+          }
+
+          if (item.setting.sync === 'true') {
+            // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
+            if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) {
+
+            } else {
+              item.setting.sync = 'false'
+            }
           }
         }
+      }
+
+      if (item.type === 'card' && item.subtype === 'datacard') {
+        tbMap.set(item.uuid, item)
+      } else if (item.type === 'table' && item.subtype !== 'editable') {
+        tbMap.set(item.uuid, item)
       }
       
       return true
@@ -590,6 +669,11 @@
     cell.$menuId = item.uuid
     cell.$MenuID = Tab.$MenuID
     cell.$tabId = Tab.uuid
+
+    if (Tab.$process) {
+      cell.$process = true
+      cell.$flowId = Tab.$flowId
+    }
 
     if (cell.btnstyle) { // 鍏煎
       cell.style = cell.style || {}
@@ -605,15 +689,62 @@
     }
 
     if (cell.OpenType === 'excelOut') { // 瀵煎嚭
-      cell.$menuName = item.name
+      cell.$menuName = item.$menuname
+    } else if (cell.OpenType === 'pop' && cell.modal) {
+      cell.modal.uuid = cell.uuid + '_pop'
+    }
 
-      if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
-        cell.errorType = 'error1'
-      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') {
-        if (item.setting.interType !== 'system') {
-          cell.errorType = 'error2'
-        } else if (item.type === 'balcony' || item.subtype === 'propcard') {
-          cell.errorType = 'error2'
+    if (cell.verify) {
+      let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')
+      if (cell.verify.invalid === 'true') {
+        if (isStatic) {
+          cell.verify.invalid = 'false'
+        } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) {
+          cell.verify.invalid = 'false'
+        } else if (cell.intertype !== 'system' && cell.procMode !== 'system') {
+          cell.verify.invalid = 'false'
+        } else if (cell.sqlType === 'insert') {
+          cell.verify.invalid = 'false'
+        } else if (cell.Ot === 'notRequired') {
+          cell.verify.invalid = 'false'
+        }
+      }
+
+      if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) {
+        cell.verify.uniques = []
+      }
+
+      if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) {
+        cell.returnValue = 'true'
+      }
+
+      if (cell.verify.preHandle === 'true') {
+        let script = cell.verify.pre_func
+        if (!/#position-/.test(script) || /#position-init/.test(script)) {
+          try {
+            // eslint-disable-next-line
+            let func = new Function('btn', 'position', 'systemType', script)
+            func(cell, 'init', window.GLOB.systemType)
+          } catch (e) {
+            console.warn(e)
+          }
+        }
+        if (/#position-inner/.test(script)) {
+          cell.$innerScript = script
+
+          if (window.backend && window.GLOB.CacheData.has('sql_' + cell.uuid) && !/\$backend/.test(script)) {
+            window.GLOB.CacheData.delete('sql_' + cell.uuid)
+          }
+        }
+        if (/#position-outer/.test(script)) {
+          cell.$outerScript = script
+        }
+        if (/#position-callback/.test(script)) {
+          cell.$callbackScript = script
+
+          if (window.backend && window.GLOB.CacheData.has('sql_back_' + cell.uuid) && !/\$backend/.test(script)) {
+            window.GLOB.CacheData.delete('sql_back_' + cell.uuid)
+          }
         }
       }
     }
@@ -621,16 +752,26 @@
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
-        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
           cell.execSuccess = 'mainline'
         }
       } else if (cell.syncComponentId === 'multiComponent') {
         let ids = cell.syncComponents.map(m => {
+          if (Array.isArray(m)) return m.pop() || ''
           return m.syncComId.pop() || ''
         })
 
-        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
-          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (item.supNodes) {
+          item.supNodes.forEach(node => {
+            if (!ids.includes(node)) return
+
+            if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
+              cell.execSuccess = 'mainline'
+            }
+            ids = ids.filter(id => id !== node)
+          })
+        } else if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
             cell.execSuccess = 'mainline'
           }
           ids = ids.filter(id => id !== item.setting.supModule)
@@ -649,6 +790,26 @@
 
   resetElement = (cell) => {
     cell.style = cell.style || {}
+
+    if (cell.style.display === 'inline-block') {
+      cell.style.verticalAlign = 'top'
+    }
+
+    if (cell.marks && cell.marks.length === 0) {
+      cell.marks = null
+    }
+    if (cell.anchors && cell.anchors.length === 0) {
+      cell.anchors = null
+    }
+
+    if (cell.linkmenu && cell.linkmenu.length > 0) {
+      let menu_id = cell.linkmenu.pop()
+      cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || ''
+      if (!cell.linkThdMenu) {
+        cell.link = ''
+      }
+    }
+
     if (['text', 'number', 'formula'].includes(cell.eleType)) {
       if (!cell.height) {
         cell.innerHeight = 'auto'
@@ -684,41 +845,62 @@
     return cell
   }
 
-  getPrinter = (item, parentId) => {
-    let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)
-
-    if (_item) {
-      item.printer = _item.printer || ''
-      item.verify.defaultPrinter = _item.printer || ''
-      if (item.verify.printerTypeList && _item.printerList) {
-        item.verify.printerTypeList = item.verify.printerTypeList.map(cell => {
-          cell.printer = _item.printerList[cell.Value] || ''
-
-          return cell
-        })
-      }
-    }
-
-    return item
-  }
-
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatSetting = (components, params, regs, balMap) => {
+  formatSetting = (components, params, balMap, tbMap, BID) => {
     let delay = 20
     return components.map(component => {
       if (component.type === 'tabs') {
         component.subtabs = component.subtabs.map(tab => {
-          tab.components = this.formatSetting(tab.components, null, regs, balMap)
+          tab.components = this.formatSetting(tab.components, null, balMap, tbMap, BID)
           return tab
         })
         return component
       } else if (component.type === 'group') {
-        component.components = this.formatSetting(component.components, params, regs, balMap)
+        component.components = this.formatSetting(component.components, params, balMap, tbMap, BID)
         return component
-      } else if (component.wrap && component.wrap.datatype === 'public') {
-        component.setting.useMSearch = false
-        component.setting.sync = 'false'
+      }
 
+      if (component.type === 'balcony') {
+        if (component.wrap.linkType === 'sync') {
+          let conf = tbMap.get(component.wrap.syncModuleId)
+  
+          if (conf) {
+            component.syncConfig = {
+              uuid: conf.uuid,
+              wrap: conf.wrap,
+              setting: conf.setting,
+              columns: conf.columns
+            }
+    
+            if (component.wrap.checkAll === 'show') {
+              if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') {
+                component.wrap.checkAll = 'hidden'
+              } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') {
+                component.wrap.checkAll = 'hidden'
+              }
+            }
+          }
+        }
+      } else if (balMap.has(component.uuid)) {
+        component.setting.$hasSyncModule = true
+      }
+
+      if (balMap.has(component.uuid + 'public')) {
+        component.$hasTopModule = true
+      }
+      
+      if (component.wrap && component.wrap.datatype === 'public') {
+        if (tbMap.has(component.wrap.publicId)) {
+          let tb = tbMap.get(component.wrap.publicId)
+          component.setting = {...tb.setting}
+          component.$searchId = tb.$searchId
+          component.wrap.publicId = component.wrap.publicId + 'tb'
+        } else {
+          component.wrap.datatype = 'static'
+          component.setting = component.setting || {}
+          component.setting.useMSearch = false
+          component.setting.sync = 'false'
+        }
         return component
       } else if (component.wrap && component.wrap.datatype === 'static') {
         component.format = ''
@@ -731,8 +913,6 @@
         return component
       }
 
-      component.setting.arr_field = component.columns ? 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)) {
           component.setting.useMSearch = false
@@ -741,68 +921,10 @@
         }
       }
 
-      if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂
-        component.setting.sync = 'false'
-        component.setting.laypage = component.setting.laypage === 'true'
-        return component
-      }
+      if (component.setting.interType !== 'system') return component
 
-      let _customScript = ''
-      let _tailScript = ''
-      component.scripts && component.scripts.forEach(script => {
-        if (script.status === 'false') return
-        if (script.position !== 'back') {
-          _customScript += `
-          ${script.sql}
-          `
-        } else {
-          _tailScript += `
-          ${script.sql}
-          `
-        }
-      })
-      delete component.scripts
-      component.setting.$name = component.$menuname || ''
-      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 (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     // 鍚庣疆鑷畾涔夎剼鏈�
-
-      component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript)
-
-      if (component.setting.sync === 'true') {
-        // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
-        if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') {
-
-        } else {
-          component.setting.sync = 'false'
-        }
-      }
-
+      component.setting.uuid = component.uuid
+      
       // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
       if (component.setting.sync === 'true') {
         component.dataName = 'mk' + component.uuid.slice(-18)
@@ -824,18 +946,24 @@
             component.setting.sync = 'false'
             component.setting.onload = 'false'
           } else {
-            params.push(getStructDefaultParam(component, searchlist, params.length === 0))
+            let backend = false
+            if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) {
+              backend = true
+            } else if (window.backend && params[0] && params[0].exps) {
+              backend = true
+            }
+
+            if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) {
+              component.setting.sync = 'false'
+            } else {
+              params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID))
+            }
           }
         }
       }
 
-      component.setting.delay = delay
+      component.setting.delay = delay + (component.setting.delay || 0)
       delay += 20
-
-      if (balMap.has(component.uuid)) {
-        component.setting.$hasSyncModule = true
-        balMap.set(component.uuid, component)
-      }
 
       return component
     })
@@ -872,11 +1000,11 @@
         }
 
         params.forEach((item) => {
-          let _data = result[item.name] || ''
+          let _data = result[item.dataName] || ''
           if (_data && !Array.isArray(_data)) {
             _data = [_data]
           }
-          window.GLOB.SyncData.set(item.name, _data)
+          window.GLOB.SyncData.set(item.dataName, _data)
         })
 
         MKEmitter.emit('transferSyncData', Tab.uuid)
@@ -884,6 +1012,10 @@
         MKEmitter.emit('transferSyncData', Tab.uuid)
 
         if (!result.message) return
+
+        if (/灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(result.message)) {
+          result.message = result.message + '璇锋鏌ュ瓧娈甸泦'
+        }
         if (result.ErrCode === 'N') {
           Modal.error({
             title: result.message,
@@ -1078,9 +1210,7 @@
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
-          <Col span={item.width} style={style} key={item.uuid}>
-            <NormalGroup config={item}/>
-          </Col>
+          <NormalGroup config={item} style={style} key={item.uuid}/>
         )
       } else if (item.type === 'editor') {
         return (

--
Gitblit v1.8.0