king
2024-05-16 b69b5f6329ca5f87932436b7a6c1ddfc3377e10f
src/tabviews/custom/index.jsx
@@ -2,10 +2,9 @@
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 zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
import { getStructuredParams, getStructDefaultParam } from '@/utils/utils-datamanage.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -43,30 +42,29 @@
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 MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces'))
class CustomPage extends Component {
  static propTpyes = {
    param: PropTypes.any,        // 其他页面传递的参数
    Tab: PropTypes.string,       // 弹窗标签
    MenuID: PropTypes.string,    // 菜单Id
    MenuName: PropTypes.string,  // 菜单名称
    changeTemp: PropTypes.func
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    ContainerId: Utils.getuuid(), // 菜单外层html Id
    BID: '',              // 页面跳转时携带ID
    loadingview: true,    // 页面加载中
    viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
    lostmsg: '',          // 页面丢失时的提示信息
    config: null,         // 页面配置信息,包括组件等
    userConfig: null,     // 用户自定义设置
    loading: false,       // 列表数据加载中
    visible: false,       // 标签页控制
    shortcuts: null,      // 快捷键
@@ -79,7 +77,7 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { MenuID, MenuName } = this.props
    const { MenuID, MenuName, param } = this.props
    let _param = {
      func: 'sPC_Get_LongParam',
@@ -117,7 +115,7 @@
        this.setState({
          viewlost: true,
          loadingview: false,
          lostmsg: this.state.dict['main.view.unenabled']
          lostmsg: '抱歉,您访问的页面未启用,请联系管理员。'
        })
        return
      }
@@ -137,13 +135,56 @@
        return
      }
      if (config.process === 'true') {
        let unset = true
        if (result.works_flow_code && result.works_long_param) {
          try { // 流程信息解析
            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) {
          config.interfaces = []
          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 { // 配置信息解析
          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)
            })
          }
@@ -164,17 +205,21 @@
      let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
      let balMap = new Map()
      let skip = config.permission === 'false' || window.GLOB.mkHS
      let param = this.props.param || {} // url参数
      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(MenuID, param)
      window.GLOB.CacheData.set(MenuID, urlparam)
      let userName = sessionStorage.getItem('User_Name') || ''
      let fullName = sessionStorage.getItem('Full_Name') || ''
      if (sessionStorage.getItem('isEditState') === 'true') {
        userName = sessionStorage.getItem('CloudUserName') || ''
        fullName = sessionStorage.getItem('CloudFullName') || ''
      }
      let regs = [
        { reg: /@userName@/ig, value: `'${userName}'` },
@@ -189,7 +234,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
@@ -197,22 +242,29 @@
        })
      }
      let popview = 'CustomPage'
      if (config.version === 2.0) {
        popview = 'popview'
      if (config.flow_code) {
        regs.push({ reg: /@works_flow_code@/ig, value: `'${config.flow_code}'` })
      }
      config.$cache = config.cacheLocal === 'true'
      config.$time = config.localCacheTime || 0
      if (window.GLOB.systemType !== 'production' && result.modifydate) {
        let s = (new Date().getTime() - new Date(result.modifydate).getTime()) / (1000 * 60 * 60)
        if (!isNaN(s) && s < 2) {
          config.$cache = false
          config.$time = 0
          config.cacheUseful = 'false'
        }
      }
      let initInters = []
      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.$time, config.MenuName, MenuID, MenuID)
      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters, config.MenuName)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, urlparam, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true')
      let params = []
      let BID = param.$BID || ''
      let BID = urlparam.$BID || ''
      let inherit = {}
      if (config.cacheUseful === 'true') { // 缓存继承
@@ -225,18 +277,6 @@
      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(MenuID, component.$searches)
        if (component.$s_req) {
@@ -246,7 +286,7 @@
      config.components = this.formatSetting(config.components, params, inherit, regs, balMap)
      if ([...balMap.keys()].length > 0) {
      if (balMap.size > 0) {
        config.components = this.filterBalcony(config.components, balMap)
      }
@@ -286,9 +326,7 @@
          this.loadmaindata(params)
        }
        if (!this.props.Tab) {
          this.setShortcut()
        }
        this.setShortcut()
      })
    } else {
      this.setState({
@@ -324,7 +362,6 @@
      let _shortcut = `${preKey}+${keyCode}`
      if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') {
        window.debugger = false
        window.GLOB.breakpoint = false
        sessionStorage.removeItem('breakpoint')
        
@@ -343,14 +380,32 @@
    }
  }
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) => {
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process) => {
    return components.filter(item => {
      item.$pageId = pageId
      item.$cache = cache
      item.$time = time
      item.$searchId = searchId
      item.$syncId = syncId
      
      if (process) {
        item.$process = process
        item.$flowId = 'flow' + this.props.MenuID
      }
      if (cache) {
        item.$cache = cache
        item.$time = time
        if (item.wrap && item.wrap.cacheLocal === 'false') {
          item.$cache = false
        } else if (item.plot && item.plot.cacheLocal === 'false') {
          item.$cache = false
        }
        if (!item.$cache && item.setting && item.setting.sync === 'true') {
          item.setting.sync = 'false'
        }
      }
      if (item.style && item.style.boxShadow) {
        delete item.style.hShadow
        delete item.style.vShadow
@@ -395,6 +450,8 @@
            }
          }
          tab.$menuname = (MenuName || '') + '-' + (tab.label || '')
          return true
        })
@@ -403,12 +460,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
@@ -421,12 +473,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 = ''
@@ -446,16 +493,22 @@
          let _searchId = searchId
          tab.components.forEach(cell => {
            if (cell.type !== 'search') return
            _searchId = cell.uuid
            window.GLOB.SearchBox.set(cell.uuid, cell.$searches)
            if (cell.$s_req) {
              window.GLOB.SearchBox.set(cell.uuid + 'required', true)
            }
          })
          if (tab.components.findIndex(cell => cell.type === 'search') > -1) {
            _searchId = tab.uuid
          }
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid)
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid, process)
          if (_searchId === tab.uuid) {
            tab.components.forEach(cell => {
              if (cell.type !== 'search') return
              window.GLOB.SearchBox.set(_searchId, cell.$searches)
              if (cell.$s_req) {
                window.GLOB.SearchBox.set(_searchId + 'required', true)
              }
            })
          }
          return tab
        })
@@ -468,7 +521,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId)
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) {
@@ -491,7 +544,8 @@
          if (!inter) {
            item.wrap.datatype = 'static'
          } else {
            item.setting = inter.setting
            item.setting = {...inter.setting}
            item.$searchId = inter.$searchId
          }
        }
      }
@@ -500,23 +554,47 @@
        item.type = 'card'
      }
      // 搜索条件初始化
      if (item.type === 'search' && item.search.length === 0) {
        return false
      } else 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') { // 数据卡、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') {
          item.setting.supModule = pid
        } 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) {
          item.search.forEach(cell => {
            if (urlparam.$searchkey === cell.field.toLowerCase() && ['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)
          }
        }
      }
@@ -531,7 +609,7 @@
        item.action = item.action.filter(cell => {
          if (cell.hidden === 'true') return false
          cell = this.resetButton(item, cell, popview)
          cell = this.resetButton(item, cell)
          cell.$toolbtn = true
@@ -539,12 +617,11 @@
            cell = this.getPrinter(cell, item.uuid)
          }
          return pass || permAction[cell.uuid]
          return pass || permAction[cell.uuid] || cell.permission === 'false'
        })
      }
      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) {
@@ -555,10 +632,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') {
@@ -579,13 +656,13 @@
                if (cell.eleType === 'button') {
                  if (cell.hidden === 'true') return false
                  cell = this.resetButton(item, cell, popview)
                  cell = this.resetButton(item, cell)
                  if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置
                    cell = this.getPrinter(cell, item.uuid)
                  }
                  return pass || permAction[cell.uuid]
                  return pass || permAction[cell.uuid] || cell.permission === 'false'
                } else {
                  cell = this.resetElement(cell)
                }
@@ -599,9 +676,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
@@ -609,7 +690,13 @@
        }
        
        item.cols = getCols(item.cols)
        item.statFields = statFields
        if (item.hasExtend) {
          item.setting.hasExtend = true
          item.setting.tableMode = 'compatible'
          item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss')
          item.colsCtrls = null
        }
        if (item.subtype === 'editable') {
          item.submit.logLabel = item.$menuname + '-提交'
@@ -636,7 +723,7 @@
            if (cell.eleType === 'button') {
              if (cell.hidden === 'true') return false
              cell = this.resetButton(item, cell, popview)
              cell = this.resetButton(item, cell)
              if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置
                cell = this.getPrinter(cell, item.uuid)
@@ -645,7 +732,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') {
@@ -678,7 +765,7 @@
            if (cell.eleType === 'button') {
              if (cell.hidden === 'true') return false
              cell = this.resetButton(item, cell, popview)
              cell = this.resetButton(item, cell)
              if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置
                cell = this.getPrinter(cell, item.uuid)
@@ -687,7 +774,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') {
@@ -702,7 +789,7 @@
          if (cell.eleType === 'button') {
            if (cell.hidden === 'true') return false
            cell = this.resetButton(item, cell, popview)
            cell = this.resetButton(item, cell)
            if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置
              cell = this.getPrinter(cell, item.uuid)
@@ -711,29 +798,22 @@
            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') {
        item.subcards = item.subcards.map(group => {
          group.subButton.uuid = group.uuid
          group.subButton.$menuId = group.uuid
          group.subButton.$MenuID = this.props.MenuID
          // group.subButton.$forbid = true // 不声明数据源变量
          group.subButton.OpenType = 'formSubmit'
          group.subButton.execError = 'never'
          group.subButton.logLabel = item.$menuname + '-' + group.subButton.label
          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)
          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
            group.subButton.syncComponentId = ''
            if (group.subButton.execSuccess === 'grid') {
              group.subButton.execSuccess = 'mainline'
            }
          if (item.$cache && item.$time) { // 表单缓存
            group.$cache = item.$cache
            group.$time = item.$time
          }
          group.fields = group.fields.map(cell => {
@@ -806,14 +886,19 @@
    })
  }
  resetButton = (item, cell, popview) => {
  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
    cell.$view = 'popview'
    if (item.$process) {
      cell.$process = true
      cell.$flowId = 'flow' + this.props.MenuID
    }
    if (cell.btnstyle) { // 兼容
      cell.style = cell.style || {}
@@ -828,10 +913,64 @@
      }
    }
    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' && item.$cache && item.$time && cell.modal) {
      cell.modal.$cache = item.$cache
      cell.modal.$time = item.$time
      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 (/#position-inner/.test(script)) {
        cell.$innerScript = script
      }
      if (/#position-outer/.test(script)) {
        cell.$outerScript = script
      }
      if (/#position-callback/.test(script)) {
        cell.$callbackScript = script
      }
    }
    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') {
@@ -839,8 +978,17 @@
          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)
@@ -859,6 +1007,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'
@@ -897,6 +1065,8 @@
  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 || ''
@@ -927,9 +1097,6 @@
        component.components = this.formatSetting(component.components, params, null, regs, balMap)
        return component
      } else if (component.wrap && component.wrap.datatype === 'public') {
        component.setting.useMSearch = false
        component.setting.sync = 'false'
        return component
      } else if (component.wrap && component.wrap.datatype === 'static') {
        component.format = ''
@@ -942,12 +1109,21 @@
        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
        } else {
          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
          }
        }
      }
@@ -955,16 +1131,27 @@
        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.laypage = component.setting.laypage === 'true'
        component.setting.dataresource = ''
        return component
      }
      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}
          `
        }
@@ -972,8 +1159,7 @@
      delete component.scripts
      component.setting.$name = component.$menuname || ''
      component.setting.execute = component.setting.execute !== 'false'  // 默认sql是否执行,转为boolean 统一格式
      component.setting.laypage = component.setting.laypage === 'true'   // 是否分页,转为boolean 统一格式
      if (!component.setting.execute) {
        component.setting.dataresource = ''
      }
@@ -984,20 +1170,26 @@
      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
      }
      if (component.setting.sync === 'true') {
@@ -1048,7 +1240,7 @@
  }
  // 格式化默认设置
  formatInterSetting = (inters, regs, MenuID, initInters) => {
  formatInterSetting = (inters, regs, MenuID, initInters, MenuName) => {
    if (!inters) return []
    let initlimit = false
@@ -1067,6 +1259,7 @@
    return interfaces.map(inter => {
      inter.MenuID = MenuID
      inter.setting.delay = delay
      inter.$searchId = MenuID
      delay += 15
      if (inter.setting.supModule) {
@@ -1077,26 +1270,36 @@
          inter.setting.supModule = ''
        }
      }
      if (initlimit && inter.setting.loadlevel !== 'init') {
        inter.setting.onload = 'false'
      }
      inter.setting.laypage = false
      inter.setting.$top = true
      inter.setting.useMSearch = inter.setting.useMSearch === 'true'
      inter.setting.arr_field = inter.columns.map(col => col.field).join(',')
      if (inter.setting.interType !== 'system') return inter
      let _customScript = ''
      let _tailScript = ''
      inter.scripts.forEach(script => {
        if (script.status !== 'false') {
        if (script.status === 'false') return
        if (script.position !== 'back') {
          _customScript += `
          ${script.sql}
          `
        } else {
          _tailScript += `
          ${script.sql}
          `
        }
      })
      delete inter.scripts
      inter.setting.$name = '公共数据源-' + inter.setting.name
      inter.setting.$name = (MenuName || '') + '-公共数据源-' + inter.setting.name
      inter.setting.execute = inter.setting.execute !== 'false'
      inter.setting.laypage = true
      if (!inter.setting.execute) {
        inter.setting.dataresource = ''
@@ -1108,17 +1311,23 @@
      if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
        inter.setting.dataresource = inter.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 {
        inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
        _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
        _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
      }
      regs.forEach(cell => {
        inter.setting.dataresource = inter.setting.dataresource.replace(cell.reg, cell.value)
        _customScript = _customScript.replace(cell.reg, cell.value)
        _tailScript = _tailScript.replace(cell.reg, cell.value)
      })
      inter.setting.customScript = _customScript // 整理后自定义脚本
      inter.setting.tailScript = _tailScript     // 后置自定义脚本
      inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript)
      return inter
    })
@@ -1128,14 +1337,14 @@
   * @description 主表数据加载
   */ 
  loadmaindata = (params) => {
    const { config } = this.state
    let param = getStructuredParams(params, config, this.state.BID || '')
    const { config, BID } = this.state
    let param = getStructuredParams(params, config, BID || '')
    this.setState({loading: true, loadingview: false})
    if (config.$cache && config.$time) {
      Api.getLCacheConfig(params[0].uuid, config.$time).then(res => {
        if (!res) {
      Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => {
        if (!res.valid) {
          this.getMainData(param, params, config.MenuID)
        } else {
          this.setState({
@@ -1182,6 +1391,10 @@
        MKEmitter.emit('transferSyncData', MenuID)
        if (!result.message) return
        if (/将截断字符串或二进制数据/ig.test(result.message)) {
          result.message = result.message + '请检查字段集'
        }
        if (result.ErrCode === 'N') {
          Modal.error({
            title: result.message,
@@ -1206,9 +1419,9 @@
  }
  resetActiveMenu = (menuId) => {
    const { MenuID, Tab } = this.props
    const { MenuID } = this.props
    if (MenuID !== menuId || Tab) return
    if (MenuID !== menuId) return
    this.setShortcut()
  }
@@ -1451,9 +1664,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 (
@@ -1509,6 +1720,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}>
@@ -1524,15 +1741,29 @@
  render() {
    const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state
    if (!config || viewlost) {
      return (
        <div className="custom-page-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-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}>
        {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null}
        <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row>
        {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null}
        {config && window.GLOB.breakpoint ? <DebugTable /> : null}
        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null}
        {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      <div className={`custom-page-wrap ${config.minWidth ? 'mk-scroll' : ''} ${loading ? 'loading' : ''} ${config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config.style}>
        {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null}
        <Row id={'menu' + config.uuid} style={{minWidth: config.minWidth || 'unset'}} className="component-wrap">{this.getComponents()}</Row>
        {config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null}
        {window.GLOB.breakpoint ? <DebugTable /> : null}
        <div className="user-tools">
          {config.process === 'true' ? <FlowFloat config={config}/> : null}
          <SettingComponent config={config} shortcuts={shortcuts || []}/>
          <TableNodes config={config} />
        </div>
      </div>
    )
  }