king
2023-07-25 2a3cc4e6cecfc6dab8b60adf93f7fde898ddc939
src/tabviews/custom/popview/index.jsx
@@ -1,13 +1,14 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { notification, Spin, Row, Col } from 'antd'
import { notification, Spin, Row, Col, Modal } from 'antd'
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 MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
import NotFount from '@/components/404'
import './index.scss'
@@ -20,6 +21,7 @@
const AntvScatter = asyncComponent(() => import('../components/chart/antv-scatter'))
const DataCard = asyncComponent(() => import('../components/card/data-card'))
const PropCard = asyncComponent(() => import('../components/card/prop-card'))
const DoubleDataCard = asyncComponent(() => import('../components/card/double-data-card'))
const SimpleForm = asyncComponent(() => import('../components/form/simple-form'))
const StepForm = asyncComponent(() => import('../components/form/step-form'))
const TabForm = asyncComponent(() => import('../components/form/tab-form'))
@@ -39,7 +41,9 @@
const TimeLine = asyncComponent(() => import('../components/timeline/normal-timeline'))
const Voucher = asyncComponent(() => import('../components/module/voucher'))
const Iframe = asyncComponent(() => import('../components/iframe'))
const Calendar = asyncComponent(() => import('../components/calendar'))
const AntvG6 = asyncComponent(() => import('../components/chart/antv-G6'))
const AntvX6 = asyncComponent(() => import('../components/chart/antv-X6'))
class CustomPage extends Component {
  static propTpyes = {
@@ -53,8 +57,6 @@
    viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
    lostmsg: '',          // 页面丢失时的提示信息
    config: null,         // 页面配置信息,包括组件等
    mainSearch: null,     // 主搜索
    data: null,           // 列表数据集
    loading: false,       // 列表数据加载中
  }
@@ -96,7 +98,7 @@
    // 数据缓存设置
    if (config.cacheUseful === 'true') {
      if (!['day', 'hour'].includes(config.timeUnit)) {
      if (!['day', 'hour', 'minute'].includes(config.timeUnit)) {
        config.timeUnit = 'day'
      }
      config.cacheTime = config.cacheTime || 1
@@ -129,36 +131,35 @@
      })
    }
    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab)
    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid)
    
    // 获取主搜索条件
    let mainSearch = []
    config.components.forEach(component => {
      if (component.type !== 'search') return
      component.search = component.search.map(item => {
        item.oriInitval = item.initval
        if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) {
          item.initval = param.$searchval
        }
      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
      })
          return item
        })
      mainSearch = Utils.initMainSearch(component.search)
        component.$searches = Utils.initMainSearch(component.search)
      }
      window.GLOB.SearchBox.set(Tab.uuid, component.$searches)
      if (component.$s_req) {
        window.GLOB.SearchBox.set(Tab.uuid + 'required', true)
      }
    })
    let params = []
    let BID = param.$BID || ''
    let inherit = {}
    if (config.cacheUseful === 'true') { // 缓存继承
      inherit.cacheUseful = config.cacheUseful
      inherit.timeUnit = config.timeUnit
      inherit.cacheTime = config.cacheTime
    }
    config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs, balMap)
    config.components = this.formatSetting(config.components, params, regs, balMap)
    if ([...balMap.keys()].length > 0) {
      config.components = this.filterBalcony(config.components, balMap)
@@ -166,8 +167,7 @@
    this.setState({
      BID: BID,
      config,
      mainSearch
      config
    }, () => {
      if (params.length > 0) {
        this.loadmaindata(params)
@@ -175,9 +175,11 @@
    })
  }
  filterComponent = (components, roleId, balMap, urlparam, Tab) => {
  filterComponent = (components, roleId, balMap, urlparam, Tab, searchId, syncId) => {
    return components.filter(item => {
      item.$pageId = Tab.uuid
      item.$searchId = searchId
      item.$syncId = syncId
      
      if (item.style && item.style.boxShadow) {
        delete item.style.hShadow
@@ -196,6 +198,13 @@
          return false
        }
        if (item.setting.supModule) {
          let pid = item.setting.supModule.pop()
          item.setting.supModule = pid || ''
        } else {
          item.setting.supModule = ''
        }
        item.subtabs = item.subtabs.filter(tab => {
          if (
            tab.blacklist && tab.blacklist.length > 0 &&
@@ -205,35 +214,37 @@
          } else if (tab.hide === 'true') {
            return false
          }
          if (item.setting.supModule) {
            if (tab.controlVal === '@pass@') {
              tab.$pass = true
            } else if (/,/ig.test(tab.controlVal)) {
              tab.controlVals = tab.controlVal.split(',')
            } else {
              tab.controlVals = [(tab.controlVal || '')]
            }
          }
          return true
        })
        if (item.setting.supModule) {
          let pid = item.setting.supModule.pop()
          item.setting.supModule = pid || ''
          item.setting.controlField = item.setting.controlField.toLowerCase()
          if (item.setting.supModule) {
            item.setting.controlField = item.setting.controlField.toLowerCase()
            if (item.setting.supModule === 'preview') {
              item.setting.supModule = ''
              let val = ''
              Object.keys(urlparam).forEach(key => {
                if (key.toLowerCase() === item.setting.controlField) {
                  val = urlparam[key]
                }
              })
              item.subtabs = item.subtabs.filter(tab => {
                if (tab.controlVal === val) {
                  return false
                } else if (/,/ig.test(tab.controlVal)) {
                  return !tab.controlVal.split(',').includes(val)
                }
                return true
              })
            }
          if (item.setting.supModule === 'preview') {
            item.setting.supModule = ''
            let val = ''
            Object.keys(urlparam).forEach(key => {
              if (key.toLowerCase() === item.setting.controlField) {
                val = urlparam[key]
              }
            })
            item.subtabs = item.subtabs.filter(tab => {
              if (tab.$pass) return true
              return !tab.controlVals.includes(val)
            })
          }
        }
@@ -261,7 +272,18 @@
        item.subtabs = item.subtabs.map(tab => {
          tab.$pageId = Tab.uuid
          tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab)
          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)
            }
          })
          tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, _searchId, tab.uuid)
          return tab
        })
@@ -274,7 +296,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab)
        item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, searchId, syncId)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -294,8 +316,35 @@
      }
      // 搜索条件初始化
      if (item.search && item.search.length > 0) {
        item.search = Utils.initSearchVal(item.search)
      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
      } 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 = ''
        }
      }
      // 权限过滤
      if (item.action && item.action.length > 0) {
        item.action = item.action.filter(cell => {
          if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
          cell = this.resetButton(item, cell, Tab)
          cell.$toolbtn = true
          return true
        })
      }
      if (item.type === 'table') {
@@ -306,6 +355,8 @@
              return false
            } else if (col.Hide === 'true') {
              return false
            } else if (col.type === 'action') {
              col.type = 'custom'
            }
            
            if (col.type === 'number') {
@@ -318,26 +369,31 @@
                  col.decimal = col.decimal > 2 ? col.decimal - 2 : 0
                }
              }
            } else if (col.type === 'formula') {
              if (typeof(col.decimal) === 'number') {
                col.round = Math.pow(10, col.decimal)
              }
            } else if (col.type === 'colspan') {
              col.subcols = getCols(col.subcols || [])
              if (col.subcols.length === 0) {
                return false
              }
            } else if (col.type === 'custom') {
              col.elements = col.elements.map(cell => {
                if (['text', 'number', 'formula'].includes(cell.eleType)) {
                  if (!cell.height) {
                    cell.innerHeight = 'auto'
                  }
                  if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
                    cell.round = Math.pow(10, cell.decimal)
                    if (cell.format === 'percent') {
                      cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
                    }
                  }
              col.elements = col.elements.filter(cell => {
                if (cell.eleType === 'button') {
                  if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
                  cell = this.resetButton(item, cell, Tab)
                } else {
                  cell = this.resetElement(cell)
                }
                return cell
                return true
              })
              if (col.elements.length === 0) {
                return false
              }
            }
      
            if (col.linkmenu && col.linkmenu.length > 0) {
@@ -353,46 +409,20 @@
        
        item.cols = getCols(item.cols)
        item.statFields = statFields
      }
      let mutil = false
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件
        mutil = true
        item.setting.supModule = item.supNodes[0].componentId
      } else if (item.setting && item.setting.supModule) {
        let pid = item.setting.supModule.pop()
        if (pid && pid !== 'empty') {
          item.setting.supModule = pid
        } else {
          item.setting.supModule = ''
        if (item.subtype === 'editable') {
          item.submit.logLabel = item.$menuname + '-提交'
          item.submit.$menuId = item.uuid
          item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : ''
          if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) {
            item.submit.syncComponentId = ''
            if (item.submit.execSuccess === 'grid') {
              item.submit.execSuccess = 'mainline'
            }
          }
        }
      }
      // 权限过滤
      if (item.action && item.action.length > 0) {
        item.action = item.action.filter(cell => {
          if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false
          cell.logLabel = item.$menuname + '-' + cell.label
          cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
          cell.$menuId = item.uuid
          cell.$tabId = Tab.uuid
          cell.$toolbtn = true
          if (!mutil && cell.syncComponentId === item.setting.supModule) {
            cell.syncComponentId = ''
          }
          if (cell.btnstyle) { // 兼容
            cell.style = cell.style || {}
            cell.style = {...cell.style, ...cell.btnstyle}
          }
          return true
        })
      }
      if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
      } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
        item.subcards && item.subcards.forEach(card => {
          if (card.style.boxShadow) {
            delete card.style.hShadow
@@ -403,66 +433,49 @@
          card.elements = card.elements.filter(cell => {
            if (cell.eleType === 'button') {
              if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false
              if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
              cell.logLabel = item.$menuname + '-' + cell.label
              cell.Ot = cell.Ot || 'requiredSgl'
              cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
              cell.$menuId = item.uuid
              cell.$tabId = Tab.uuid
              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
              }
              if (card.btnstyle) { // 兼容
                card.style = card.style || {}
                card.style = {...card.style, ...card.btnstyle}
              }
            } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
              if (!cell.height) {
                cell.innerHeight = 'auto'
              }
              if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
                cell.round = Math.pow(10, cell.decimal)
                if (cell.format === 'percent') {
                  cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
                }
              }
              cell = this.resetButton(item, cell, Tab)
            } else {
              cell = this.resetElement(cell)
            }
            return true
          })
          if (card.setting.click === 'menus') {
            if (card.menus) {
              card.menus = card.menus.filter(m => !!m.MenuID)
              if (card.menus.length === 0) {
                card.menus = null
              }
            }
            if (!card.menus || item.subtype !== 'datacard' || card.$cardType === 'extendCard') {
              card.setting.click = ''
            }
          } else if (card.setting.click === 'menu') {
            if (!Array.isArray(card.setting.menu)) {
              card.setting.click = ''
            }
          }
          if (item.subtype === 'dualdatacard' && card.$cardType !== 'extendCard') {
            if (card.backSetting && card.backSetting.click === 'menu') {
              if (!Array.isArray(card.backSetting.menu)) {
                card.backSetting.click = ''
              }
            }
          }
          if (!card.backElements || card.backElements.length === 0) return
          card.backElements = card.backElements.filter(cell => {
            if (cell.eleType === 'button') {
              if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false
              if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
              cell.logLabel = item.$menuname + '-' + cell.label
              cell.Ot = cell.Ot || 'requiredSgl'
              cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
              cell.$menuId = item.uuid
              cell.$tabId = Tab.uuid
              if (!mutil && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
              }
              if (card.btnstyle) { // 兼容
                card.style = card.style || {}
                card.style = {...card.style, ...card.btnstyle}
              }
            } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
              if (!cell.height) {
                cell.innerHeight = 'auto'
              }
              if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
                cell.round = Math.pow(10, cell.decimal)
                if (cell.format === 'percent') {
                  cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
                }
              }
              cell = this.resetButton(item, cell, Tab)
            } else {
              cell = this.resetElement(cell)
            }
            return true
@@ -478,60 +491,15 @@
        }
        item.elements = item.elements.filter(cell => {
          if (cell.eleType === 'button') {
            if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false
            if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
            cell.logLabel = item.$menuname + '-' + cell.label
            cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
            cell.$menuId = item.uuid
            cell.$tabId = Tab.uuid
            if (cell.syncComponentId === item.wrap.supModule) {
              cell.syncComponentId = ''
            }
          } else if (['text', 'number', 'formula'].includes(cell.eleType)) {
            if (!cell.height) {
              cell.innerHeight = 'auto'
            }
            if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
              cell.round = Math.pow(10, cell.decimal)
              if (cell.format === 'percent') {
                cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
              }
            }
            cell = this.resetButton(item, cell, Tab)
          } else {
            cell = this.resetElement(cell)
          }
          return true
        })
      } else if (item.type === 'table') {
        item.cols = item.cols.filter(col => {
          if (col.type !== 'action') return true
          col.elements = col.elements.filter(cell => {
            if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false
            cell.logLabel = item.$menuname + '-' + cell.label
            cell.Ot = cell.Ot || 'requiredSgl'
            cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
            cell.$menuId = item.uuid
            cell.$tabId = Tab.uuid
            if (cell.syncComponentId === item.setting.supModule) {
              cell.syncComponentId = ''
            }
            if (cell.btnstyle) { // 兼容
              cell.style = cell.style || {}
              cell.style = {...cell.style, ...cell.btnstyle}
            }
            return true
          })
          return col.elements.length !== 0
        })
        if (item.subtype === 'editable') {
          item.submit.logLabel = item.$menuname + '-提交'
          item.submit.$menuId = item.uuid
        }
      } else if (item.type === 'form') {
        item.subcards = item.subcards.map(group => {
          group.subButton.uuid = group.uuid
@@ -540,35 +508,27 @@
          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.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
          if (group.subButton.syncComponentId === item.setting.supModule) {
          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
            group.subButton.syncComponentId = ''
            if (group.subButton.execSuccess === 'grid') {
              group.subButton.execSuccess = 'mainline'
            }
          }
          let _sql = `Declare @mk_organization nvarchar(512)  select @mk_organization='${sessionStorage.getItem('organization') || ''}'\n`
          let _sso = _sql
          let _local = _sql
          group.fields = group.fields.map(cell => {
            // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单
            if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
              let _option = Utils.getSelectQueryOptions(cell)
              if (cell.database === 'sso') {
                cell.data_sql = Utils.formatOptions(_sso + _option.sql)
                _sso = ''
              } else {
                cell.data_sql = Utils.formatOptions(_local + _option.sql)
                _local = ''
              }
              cell.base_sql = window.btoa(window.encodeURIComponent(_sql + _option.sql))
              cell.base_sql = _option.sql
              cell.arr_field = _option.field
            }
      
@@ -627,6 +587,93 @@
    })
  }
  resetButton = (item, cell, Tab) => {
    cell.logLabel = item.$menuname + '-' + cell.label
    cell.Ot = cell.Ot || 'requiredSgl'
    cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : ''
    cell.$menuId = item.uuid
    cell.$MenuID = Tab.$MenuID
    cell.$tabId = Tab.uuid
    if (cell.btnstyle) { // 兼容
      cell.style = cell.style || {}
      cell.style = {...cell.style, ...cell.btnstyle}
    }
    if (cell.controlField) {
      if (/,/ig.test(cell.controlVal)) {
        cell.controlVals = cell.controlVal.split(',')
      } else {
        cell.controlVals = [(cell.controlVal || '')]
      }
    }
    if (cell.syncComponentId) {
      if (cell.syncComponentId === item.setting.supModule) {
        cell.syncComponentId = ''
        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
          cell.execSuccess = 'mainline'
        }
      } else if (cell.syncComponentId === 'multiComponent') {
        let ids = cell.syncComponents.map(m => {
          return m.syncComId.pop() || ''
        })
        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
            cell.execSuccess = 'mainline'
          }
          ids = ids.filter(id => id !== item.setting.supModule)
        }
        if (ids.length === 0) {
          cell.syncComponentId = ''
        } else {
          cell.syncComponentIds = ids
        }
      }
    }
    return cell
  }
  resetElement = (cell) => {
    cell.style = cell.style || {}
    if (['text', 'number', 'formula'].includes(cell.eleType)) {
      if (!cell.height) {
        cell.innerHeight = 'auto'
      }
      cell.innerHeight = cell.innerHeight || 'auto'
      cell.alignItems = cell.height > 1 ? cell.alignItems : ''
      if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') {
        cell.round = Math.pow(10, cell.decimal)
        if (cell.format === 'percent') {
          cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0
        }
      } else if (cell.type === 'formula' && typeof(cell.decimal) === 'number') {
        cell.round = Math.pow(10, cell.decimal)
      }
    } else if (cell.eleType === 'icon') {
      if (!cell.innerHeight) { // 兼容
        let fontSize = 14
        let lineHeight = 1.5
        if (cell.style.fontSize) {
          fontSize = parseInt(cell.style.fontSize)
        }
        if (cell.style.lineHeight) {
          lineHeight = parseFloat(cell.style.lineHeight)
        }
        cell.innerHeight = fontSize * lineHeight
      }
    }
    return cell
  }
  getPrinter = (item, parentId) => {
    let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)
@@ -646,28 +693,28 @@
  }
  // 格式化默认设置
  formatSetting = (components, params, mainSearch, inherit, regs, balMap) => {
  formatSetting = (components, params, regs, balMap) => {
    let delay = 20
    return components.map(component => {
      if (component.type === 'tabs') {
        component.subtabs = component.subtabs.map(tab => {
          tab.components = this.formatSetting(tab.components, null, null, inherit, regs, balMap)
          tab = {...tab, ...inherit}
          tab.components = this.formatSetting(tab.components, null, regs, balMap)
          return tab
        })
        return component
      } else if (component.type === 'group') {
        component.components = this.formatSetting(component.components, null, null, inherit, regs, balMap)
        component = {...component, ...inherit}
        component.components = this.formatSetting(component.components, params, 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 = ''
        component.setting = component.setting || {}
        component.setting.useMSearch = false
        component.setting.sync = 'false'
        return component
      } else if (!component.setting || !component.format) {
@@ -675,6 +722,13 @@
      }
      component.setting.useMSearch = component.setting.useMSearch === 'true'
      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.setting.interType !== 'system') { // 不使用系统函数时
        component.setting.sync = 'false'
@@ -703,10 +757,8 @@
      }
  
      if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
        component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'')
        component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
        _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'')
        _customScript = _customScript.replace(/@\$/ig, '*/')
        component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
        _customScript = _customScript.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, '\'\'')
@@ -719,35 +771,39 @@
      component.setting.customScript = _customScript // 整理后自定义脚本
      // dataName 系统生成的数据源名称
      if (component.setting.sync === 'true') {
        component.dataName = Utils.getdataName()
        // pageable 是否分页,组件属性,不分页的组件才可以统一查询
        if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') {
        } else {
          component.setting.sync = 'false'
        }
      }
      // floor    组件的层级
      // pageable 是否分页,组件属性,不分页的组件才可以统一查询
      if (params && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') {
        let searchlist = []
        if (component.search && component.search.length > 0) {
          searchlist = Utils.initMainSearch(component.search)
        }
        if (component.setting.useMSearch) {
          let keys = searchlist.map(item => item.key)
          mainSearch.forEach(item => {
            if (!keys.includes(item.key)) {
              searchlist.push(item)
            }
          })
        }
      // dataName 系统生成的数据源名称
      if (component.setting.sync === 'true') {
        component.dataName = 'mk' + component.uuid.slice(-18)
        if (searchlist.filter(item => item.required && item.value === '').length > 0) {
          component.setting.sync = 'false'
          component.setting.onload = 'false'
        } else {
          params.push(getStructDefaultParam(component, searchlist, params.length === 0))
        if (params) {
          let searchlist = component.$searches || []
          if (component.setting.useMSearch) {
            let mainSearch = window.GLOB.SearchBox.get(component.$searchId)
            let keys = component.$s_keys || []
            mainSearch.forEach(item => {
              if (keys.includes(item.key.toLowerCase())) return
              searchlist.push(item)
            })
          }
          if (component.$s_req && searchlist.filter(item => item.required && item.value === '').length > 0) {
            component.setting.sync = 'false'
            component.setting.onload = 'false'
          } else {
            params.push(getStructDefaultParam(component, searchlist, params.length === 0))
          }
        }
      } else if (params) {
        component.setting.sync = 'false'
      }
      component.setting.delay = delay
@@ -766,31 +822,56 @@
   * @description 主表数据加载
   */ 
  loadmaindata = (params) => {
    let param = getStructuredParams(params, this.state.config, this.state.BID || '')
    const { Tab } = this.props
    const { config } = this.state
    let param = getStructuredParams(params, config, this.state.BID || '')
    this.setState({loading: true})
    Api.genericInterface(param).then(result => {
      if (result.status) {
        delete result.status
        delete result.message
        delete result.ErrMesg
        delete result.ErrCode
      this.setState({
        loading: false
      })
        this.setState({
          data: result,
          loading: false
      if (result.status) {
        if (result.message) {
          if (result.ErrCode === 'Y') {
            Modal.success({
              title: result.message
            })
          } else if (result.ErrCode === 'S') {
            notification.success({
              top: 92,
              message: result.message,
              duration: 2
            })
          }
        }
        params.forEach((item) => {
          let _data = result[item.name] || ''
          if (_data && !Array.isArray(_data)) {
            _data = [_data]
          }
          window.GLOB.SyncData.set(item.name, _data)
        })
        MKEmitter.emit('transferSyncData', Tab.uuid)
      } else {
        this.setState({
          data: '',
          loading: false
        })
        notification.error({
          top: 92,
          message: result.message,
          duration: 10
        })
        MKEmitter.emit('transferSyncData', Tab.uuid)
        if (!result.message) return
        if (result.ErrCode === 'N') {
          Modal.error({
            title: result.message,
          })
        } else if (result.ErrCode !== '-2') {
          notification.error({
            top: 92,
            message: result.message,
            duration: 10
          })
        }
      }
    })
  }
@@ -826,20 +907,20 @@
        })
      } else if (item.type === 'group') {
        this.deleteCache(item.components)
      } else if (item.type === 'search') {
        window.GLOB.SearchBox.delete(item.$searchId)
      } else {
        window.GLOB.CacheData.delete(item.uuid)
      }
      if (item.dataName) {
        window.GLOB.SyncData.delete(item.dataName)
      }
    })
  }
  resetSearch = (search) => {
    this.setState({mainSearch: null}, () => {
      this.setState({mainSearch: search})
    })
  }
  getComponents = () => {
    const { config, BID, data, mainSearch } = this.state
    const { config, BID } = this.state
    if (!config) return
@@ -848,18 +929,26 @@
      if (item.style && item.style.clear === 'left') {
        style = {clear: 'left'}
      } else if (item.style && item.style.clear === 'right') {
        style = {float: 'right'}
      }
      if (item.type === 'card' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <DataCard config={item} data={data} mainSearch={mainSearch}/>
            <DataCard config={item}/>
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <PropCard config={item} data={data} mainSearch={mainSearch}/>
            <PropCard config={item}/>
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'dualdatacard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <DoubleDataCard config={item}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'basetable') {
@@ -871,127 +960,133 @@
      } else if (item.type === 'bar' || item.type === 'line') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvBarAndLine config={item} data={data} mainSearch={mainSearch}/>
            <AntvBarAndLine config={item}/>
          </Col>
        )
      } else if (item.type === 'pie') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvPie config={item} data={data} mainSearch={mainSearch}/>
            <AntvPie config={item}/>
          </Col>
        )
      } else if (item.type === 'scatter') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvScatter config={item} data={data} mainSearch={mainSearch}/>
            <AntvScatter config={item}/>
          </Col>
        )
      } else if (item.type === 'dashboard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvDashboard config={item} data={data} mainSearch={mainSearch}/>
            <AntvDashboard config={item}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'simpleform') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <SimpleForm config={item} data={data} mainSearch={mainSearch}/>
            <SimpleForm config={item}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'stepform') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <StepForm config={item} data={data} mainSearch={mainSearch}/>
            <StepForm config={item}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'tabform') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <TabForm config={item} data={data} mainSearch={mainSearch}/>
            <TabForm config={item}/>
          </Col>
        )
      } else if (item.type === 'search') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <MainSearch config={item} BID={BID} refreshdata={this.resetSearch} />
            <MainSearch config={item} BID={BID} />
          </Col>
        )
      } else if (item.type === 'tabs') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvTabs config={item} mainSearch={mainSearch} />
            <AntvTabs config={item}/>
          </Col>
        )
      } else if (item.type === 'balcony') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <Balcony config={item} data={data}/>
            <Balcony config={item}/>
          </Col>
        )
      } else if (item.type === 'timeline') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <TimeLine config={item} data={data} mainSearch={mainSearch}/>
            <TimeLine config={item}/>
          </Col>
        )
      } else if (item.type === 'carousel' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/>
            <CarouselDataCard config={item}/>
          </Col>
        )
      } else if (item.type === 'carousel' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/>
            <CarouselPropCard config={item}/>
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'tablecard') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <TableCard config={item} data={data} mainSearch={mainSearch}/>
            <TableCard config={item}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'normaltable') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <NormalTable config={item} data={data} mainSearch={mainSearch}/>
            <NormalTable config={item}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'editable') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <EditTable config={item} mainSearch={mainSearch}/>
            <EditTable config={item}/>
          </Col>
        )
      } else if (item.type === 'group' && item.subtype === 'normalgroup') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <NormalGroup config={item} mainSearch={mainSearch}/>
            <NormalGroup config={item}/>
          </Col>
        )
      } else if (item.type === 'editor') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <BraftEditor config={item} data={data} mainSearch={mainSearch}/>
            <BraftEditor config={item}/>
          </Col>
        )
      } else if (item.type === 'tree') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <NormalTree config={item} data={data} mainSearch={mainSearch}/>
            <NormalTree config={item}/>
          </Col>
        )
      } else if (item.type === 'calendar') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <Calendar config={item}/>
          </Col>
        )
      } else if (item.type === 'code') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <SandBox config={item} data={data} mainSearch={mainSearch}/>
            <SandBox config={item}/>
          </Col>
        )
      } else if (item.type === 'chart') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <CustomChart config={item} data={data} mainSearch={mainSearch}/>
            <CustomChart config={item}/>
          </Col>
        )
      } else if (item.type === 'module' && item.subtype === 'voucher') {
@@ -1003,13 +1098,19 @@
      } else if (item.type === 'iframe') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <Iframe config={item} data={data} mainSearch={mainSearch}/>
            <Iframe config={item}/>
          </Col>
        )
      } else if (item.type === 'antvG6') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvG6 config={item} data={data} mainSearch={mainSearch}/>
            <AntvG6 config={item}/>
          </Col>
        )
      } else if (item.type === 'antvX6') {
        return (
          <Col span={item.width} style={style} key={item.uuid}>
            <AntvX6 config={item}/>
          </Col>
        )
      } else {