king
8 天以前 a1e9b18a4dbfd21e1bf4d5cb60974ac2f0115efd
src/tabviews/custom/index.jsx
@@ -2,6 +2,8 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { notification, Spin, Row, Col, Modal } from 'antd'
import moment from 'moment'
import md5 from 'md5'
import Api from '@/api'
import Utils from '@/utils/utils.js'
@@ -41,11 +43,13 @@
const AntvX6 = asyncComponent(() => import('./components/chart/antv-X6'))
const Voucher = asyncComponent(() => import('./components/module/voucher'))
const Account = asyncComponent(() => import('./components/module/account'))
const Invoice = asyncComponent(() => import('./components/module/invoice'))
const Iframe = asyncComponent(() => import('./components/iframe'))
const Calendar = asyncComponent(() => import('./components/calendar'))
const DebugTable = asyncComponent(() => import('@/tabviews/debugtable'))
const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat'))
const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes'))
const DeepSeek = asyncComponent(() => import('@/tabviews/zshare/deepseek'))
const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces'))
class CustomPage extends Component {
@@ -66,7 +70,8 @@
    loading: false,       // 列表数据加载中
    visible: false,       // 标签页控制
    shortcuts: null,      // 快捷键
    loadinginter: false
    loadinginter: false,
    noParam: false
  }
  stepInter = null
@@ -75,11 +80,16 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { MenuID, MenuName } = this.props
    const { MenuID, MenuName, param } = this.props
    const { noParam } = this.state
    let _param = {
      func: 'sPC_Get_LongParam',
      MenuID: MenuID
    }
    if (window.GLOB.mkHS) {
      _param.lang = 'zh-CN'
    }
    let result = await Api.getCacheConfig(_param)
@@ -181,8 +191,8 @@
        try { // 配置信息解析
          let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
          if (userConfig) {
            shortcuts = userConfig.action
            userConfig.printers.forEach(item => {
            shortcuts = userConfig.action || []
            userConfig.printers && userConfig.printers.forEach(item => {
              window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item)
            })
          }
@@ -202,10 +212,48 @@
      // 权限过滤
      let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
      let balMap = new Map()
      let tbMap = new Map()
      let skip = config.permission === 'false' || window.GLOB.mkHS
      let param = this.props.param || {} // url参数
      let urlparam = {} // url参数
      if (param) {
        if (!noParam) {
          Object.keys(param).forEach(key => {
            if (/^\$/.test(key)) {
              urlparam[key] = param[key]
            } else {
              urlparam[key.toLowerCase()] = param[key]
            }
          })
        } else {
          urlparam.$BID = param.$BID
        }
      }
      window.GLOB.CacheData.set(MenuID, param)
      if (config.urlFields && config.urlFields.length) {
        config.urlFields.forEach(field => {
          let key = field.toLowerCase()
          if (urlparam[key] !== undefined) return
          urlparam[key] = ''
        })
      }
      window.GLOB.CacheData.set(MenuID, urlparam)
      if (window.backend && config.allSqls) {
        let keys = Object.keys(urlparam)
        config.allSqls.forEach(item => {
          item.id = md5(window.GLOB.appkey + item.v_id)
          if (['datasource', 'interface', 'excelOut'].includes(item.type)) {
            item.urlkeys = keys
            item.urlparam = urlparam
            if (config.flow_code) {
              item.works_flow_code = config.flow_code
            }
          }
          window.GLOB.CacheData.set('sql_' + item.uuid, item)
        })
      }
      let userName = sessionStorage.getItem('User_Name') || ''
      let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -223,7 +271,7 @@
      }
      if (config.urlFields) {
        config.urlFields.forEach(field => {
          let val = `'${param[field] || ''}'`
          let val = `'${urlparam[field.toLowerCase()]}'`
          regs.push({
            reg: new RegExp('@' + field + '@', 'ig'),
            value: val
@@ -250,10 +298,10 @@
      let initInters = []
      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters, config.MenuName)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true')
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, tbMap, skip, urlparam, MenuID, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true', regs)
      let params = []
      let BID = param.$BID || ''
      let BID = urlparam.$BID || ''
      let inherit = {}
      if (config.cacheUseful === 'true') { // 缓存继承
@@ -266,18 +314,6 @@
      config.components.forEach(component => {
        if (component.type !== 'search') return
        if (param.$searchkey) {
          component.search = component.search.map(item => {
            if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field.toLowerCase()) {
              item.initval = param.$searchval
            }
            return item
          })
          component.$searches = Utils.initMainSearch(component.search)
        }
        window.GLOB.SearchBox.set(MenuID, component.$searches)
        if (component.$s_req) {
@@ -285,11 +321,7 @@
        }
      })
      config.components = this.formatSetting(config.components, params, inherit, regs, balMap)
      if (balMap.size > 0) {
        config.components = this.filterBalcony(config.components, balMap)
      }
      config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap, BID)
      if (initInters.length > 0) {
        this.stepInter = {
@@ -381,7 +413,7 @@
    }
  }
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process) => {
  filterComponent = (components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, searchId, syncId, process, regs) => {
    return components.filter(item => {
      item.$pageId = pageId
      item.$searchId = searchId
@@ -461,12 +493,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
@@ -479,12 +506,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 = ''
@@ -508,7 +530,7 @@
            _searchId = tab.uuid
          }
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid, process)
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, _searchId, tab.uuid, process, regs)
          
          if (_searchId === tab.uuid) {
            tab.components.forEach(cell => {
@@ -532,7 +554,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process)
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, tbMap, skip, urlparam, pageId, cache, time, MenuName, searchId, syncId, process, regs)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) {
@@ -549,24 +571,20 @@
        ) {
          return false
        }
        if (item.wrap.datatype === 'public') {
          let inter = interfaces.filter(int => item.wrap.publicId === int.uuid)[0]
          if (!inter) {
            item.wrap.datatype = 'static'
          } else {
            item.setting = {...inter.setting}
            item.$searchId = inter.$searchId
          }
        }
      }
      if (item.subtype === 'tablecard') { // 兼容
        item.type = 'card'
      }
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件
        item.setting.supModule = item.supNodes[0].componentId
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡、table多上级组件
        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') {
@@ -574,13 +592,34 @@
        } else {
          item.setting.supModule = ''
        }
      } else if (item.type === 'search') {
        if (item.wrap.supModule) {
          item.wrap.supModule = item.wrap.supModule.pop()
        }
      }
      // 搜索条件初始化
      if (item.search) {
        Utils.initSearchVal(item)
        if (urlparam.$searchkey) {
          let reg = new RegExp('(^|,)' + urlparam.$searchkey + '($|,)', 'ig')
          item.search.forEach(cell => {
            if (reg.test(cell.field) && ['text', 'select', 'link', 'checkcard'].includes(cell.type)) {
              cell.initval = urlparam.$searchval
            }
          })
        }
        item.$searches = Utils.initMainSearch(item.search)
        if (item.type === 'search' && item.wrap.supModule) {
          if (!item.checkBid) {
            item.wrap.supModule = ''
          } else {
            window.GLOB.SearchBox.set(item.$searchId + 'checkBid', true)
          }
        }
      }
      let pass = skip
@@ -602,7 +641,7 @@
            cell = this.getPrinter(cell, item.uuid)
          }
          return pass || permAction[cell.uuid]
          return pass || permAction[cell.uuid] || cell.permission === 'false'
        })
      }
@@ -617,7 +656,10 @@
              col.type = 'custom'
            }
            
            if (col.type === 'number') {
            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') {
@@ -644,7 +686,7 @@
                    cell = this.getPrinter(cell, item.uuid)
                  }
                  return pass || permAction[cell.uuid]
                  return pass || permAction[cell.uuid] || cell.permission === 'false'
                } else {
                  cell = this.resetElement(cell)
                }
@@ -673,6 +715,20 @@
        
        item.cols = getCols(item.cols)
        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 + '-提交'
          item.submit.$menuId = item.uuid
@@ -686,6 +742,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
@@ -707,7 +766,7 @@
              cell = this.resetElement(cell)
            }
            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
            return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
          })
          if (card.setting.click === 'menus') {
@@ -749,7 +808,7 @@
              cell = this.resetElement(cell)
            }
            return cell.eleType !== 'button' || pass || permAction[cell.uuid]
            return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
          })
        })
      } else if (item.type === 'balcony') {
@@ -759,6 +818,9 @@
        } else if (item.wrap.linkType === 'sup') {
          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') {
@@ -773,9 +835,12 @@
            cell = this.resetElement(cell)
          }
          return cell.eleType !== 'button' || pass || permAction[cell.uuid]
          return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false'
        })
      } 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.OpenType = 'formSubmit'
@@ -785,6 +850,13 @@
          }
          group.subButton = this.resetButton(item, group.subButton)
          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
          }
          if (item.$cache && item.$time) { // 表单缓存
            group.$cache = item.$cache
@@ -818,43 +890,98 @@
          item.wrap.supModule = ''
        }
      }
      // 整理数据源
      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'   // 是否分页,转为boolean 统一格式
        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是否执行,转为boolean 统一格式
          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     // 后置自定义脚本
        if (!conf || conf === true) {
          return false
        }
        item.syncConfig = {
          uuid: conf.uuid,
          wrap: conf.wrap,
          setting: conf.setting,
          columns: conf.columns
        }
          item.setting.custompage = false
        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 (/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 (/\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
@@ -890,71 +1017,91 @@
    if (cell.OpenType === 'excelOut') { // 导出
      cell.$menuName = item.$menuname
      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'
        }
    } else if (cell.OpenType === 'pop' && cell.modal) {
      if (item.$cache && item.$time) {
        cell.modal.$cache = item.$cache
        cell.modal.$time = item.$time
      }
    } else if (cell.OpenType === 'pop' && item.$cache && item.$time && cell.modal) {
      cell.modal.$cache = item.$cache
      cell.modal.$time = item.$time
      cell.modal.uuid = cell.uuid + 'pop'
      cell.modal.uuid = cell.uuid + '_pop'
    }
    if (cell.verify && cell.verify.invalid === 'true') {
      if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) {
        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 && 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 (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 (/#position-inner/.test(script)) {
        cell.$innerScript = script
      if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) {
        cell.verify.uniques = []
      }
      if (/#position-outer/.test(script)) {
        cell.$outerScript = script
      if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) {
        cell.returnValue = 'true'
      }
      if (/#position-callback/.test(script)) {
        cell.$callbackScript = script
      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)
          }
        }
      }
    }
    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)
@@ -1049,20 +1196,64 @@
  }
  // 格式化默认设置
  formatSetting = (components, params, inherit, regs, balMap) => {
  formatSetting = (components, params, inherit, interfaces, 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, inherit, regs, balMap)
          tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap, BID)
          tab = {...tab, ...inherit}
          return tab
        })
        return component
      } else if (component.type === 'group') {
        component.components = this.formatSetting(component.components, params, null, regs, balMap)
        component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap, BID)
        return component
      } else if (component.wrap && component.wrap.datatype === 'public') {
      }
      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 {
          let inter = interfaces.filter(int => component.wrap.publicId === int.uuid)[0]
          if (!inter) {
            component.wrap.datatype = 'static'
          } else {
            component.setting = {...inter.setting}
            component.$searchId = inter.$searchId
          }
        }
        return component
      } else if (component.wrap && component.wrap.datatype === 'static') {
        component.format = ''
@@ -1075,91 +1266,23 @@
        return component
      }
      component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : ''
      component.setting.useMSearch = component.setting.useMSearch === 'true'
      component.setting.laypage = component.setting.laypage === 'true'   // 是否分页,转为boolean 统一格式
      if (component.setting.useMSearch) {
        if (!window.GLOB.SearchBox.has(component.$searchId)) {
          component.setting.useMSearch = false
        } else if (window.GLOB.SearchBox.has(component.$searchId + 'required')) {
          component.$s_req = true
        }
      }
      if (component.wrap && component.wrap.goback === 'true') {
        component.setting.sync = 'false'
      }
      if (component.format === 'object') {
        component.setting.laypage = false
        component.setting.$top = true
      }
      if (component.setting.interType !== 'system') { // 不使用系统函数时
        component.setting.sync = 'false'
        component.setting.dataresource = ''
        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是否执行,转为boolean 统一格式
      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.execute || component.setting.custompage) {
        component.forbidLine = true
      }
      if (component.setting.sync === 'true') {
        // pageable 是否分页,组件属性,不分页的组件才可以统一查询
        if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') {
        } else {
          component.setting.sync = 'false'
          if (window.GLOB.SearchBox.has(component.$searchId + 'required')) {
            component.$s_req = true
          }
          if (window.GLOB.SearchBox.has(component.$searchId + 'checkBid')) {
            component.checkBid = true
            component.setting.checkBid = true
          }
        }
      }
      if (component.setting.interType !== 'system') return component
      component.setting.uuid = component.uuid
      // dataName 系统生成的数据源名称
      if (component.setting.sync === 'true') {
@@ -1182,18 +1305,23 @@
            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
    })
@@ -1218,7 +1346,7 @@
    let delay = 15
    return interfaces.map(inter => {
      inter.MenuID = MenuID
      inter.setting.delay = delay
      inter.setting.delay = delay + (inter.setting.delay || 0)
      inter.$searchId = MenuID
      delay += 15
@@ -1242,6 +1370,8 @@
      if (inter.setting.interType !== 'system') return inter
      inter.setting.uuid = inter.uuid
      let _customScript = ''
      let _tailScript = ''
      inter.scripts.forEach(script => {
@@ -1264,9 +1394,6 @@
      if (!inter.setting.execute) {
        inter.setting.dataresource = ''
      }
      if (/\s/.test(inter.setting.dataresource)) {
        inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb'
      }
  
      if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
        inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
@@ -1286,8 +1413,17 @@
      inter.setting.customScript = _customScript // 整理后自定义脚本
      inter.setting.tailScript = _tailScript     // 后置自定义脚本
      inter.setting.custompage = false
      inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript)
      if (/order\s+by\s+sort_id\s*$/i.test(inter.setting.dataresource)) {
        inter.setting.custompage = true
      } else if (/@pageSize@|@orderBy@|@mk_total/i.test(inter.setting.dataresource + inter.setting.customScript)) {
        inter.setting.custompage = true
      }
      if (/\s/.test(inter.setting.dataresource)) {
        inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb'
      }
      return inter
    })
@@ -1303,7 +1439,11 @@
    this.setState({loading: true, loadingview: false})
    if (config.$cache && config.$time) {
      Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => {
      let uuid = params[0].uuid || ''
      if (params[0].id) {
        uuid = window.GLOB.CacheData.get('first_' + params[0].id) || ''
      }
      Api.getLCacheConfig(uuid, config.$time, BID).then(res => {
        if (!res.valid) {
          this.getMainData(param, params, config.MenuID)
        } else {
@@ -1339,11 +1479,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', MenuID)
@@ -1370,12 +1510,12 @@
    })
  }
  reloadMenuView = (menuId) => {
  reloadMenuView = (menuId, clear) => {
    const { MenuID } = this.props
    if (MenuID !== menuId) return
    this.reloadview()
    this.reloadview(clear)
  }
  resetActiveMenu = (menuId) => {
@@ -1470,7 +1610,7 @@
    })
  }
  reloadview = () => {
  reloadview = (clear) => {
    window.GLOB.CacheData.delete(this.props.MenuID)
    
    if (this.state.config) {
@@ -1488,7 +1628,8 @@
      viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
      config: null,         // 页面配置信息,包括组件等
      loading: false,       // 列表数据加载中
      shortcuts: null
      shortcuts: null,
      noParam: clear === true
    }, () => {
      this.loadconfig()
    })
@@ -1624,9 +1765,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 (
@@ -1682,6 +1821,12 @@
            <Account config={item}/>
          </Col>
        )
      } else if (item.type === 'module' && item.subtype === 'invoice') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <Invoice config={item}/>
          </Col>
        )
      } else if (item.type === 'iframe') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
@@ -1719,6 +1864,7 @@
          {config.process === 'true' ? <FlowFloat config={config}/> : null}
          <SettingComponent config={config} shortcuts={shortcuts || []}/>
          <TableNodes config={config} />
          <DeepSeek/>
        </div>
      </div>
    )