king
2023-08-23 547e5fe219ee7bee309ecd67db74bc8df66b5433
src/tabviews/custom/index.jsx
@@ -50,7 +50,6 @@
class CustomPage extends Component {
  static propTpyes = {
    param: PropTypes.any,        // 其他页面传递的参数
    Tab: PropTypes.string,       // 弹窗标签
    MenuID: PropTypes.string,    // 菜单Id
    MenuName: PropTypes.string,  // 菜单名称
    changeTemp: PropTypes.func
@@ -189,19 +188,13 @@
        })
      }
      let popview = 'CustomPage'
      if (config.version === 2.0) {
        popview = 'popview'
      }
      config.$cache = config.cacheLocal === 'true'
      config.$time = config.localCacheTime || 0
      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.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID)
      let params = []
      let BID = param.$BID || ''
@@ -278,9 +271,7 @@
          this.loadmaindata(params)
        }
        if (!this.props.Tab) {
          this.setShortcut()
        }
        this.setShortcut()
      })
    } else {
      this.setState({
@@ -334,7 +325,7 @@
    }
  }
  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) => {
    return components.filter(item => {
      item.$pageId = pageId
      item.$cache = cache
@@ -441,7 +432,7 @@
            _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)
          
          if (_searchId === tab.uuid) {
            tab.components.forEach(cell => {
@@ -465,7 +456,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)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) {
@@ -526,7 +517,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
@@ -574,7 +565,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)
@@ -631,7 +622,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)
@@ -673,7 +664,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)
@@ -697,7 +688,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)
@@ -801,14 +792,14 @@
    })
  }
  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 (cell.btnstyle) { // 兼容
      cell.style = cell.style || {}
@@ -820,6 +811,20 @@
        cell.controlVals = cell.controlVal.split(',')
      } else {
        cell.controlVals = [(cell.controlVal || '')]
      }
    }
    if (cell.OpenType === 'excelOut') { // 导出
      cell.$menuName = item.name
      if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
        cell.errorType = 'error1'
      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') {
        if (item.setting.interType !== 'system') {
          cell.errorType = 'error2'
        } else if (item.type === 'balcony' || item.subtype === 'propcard') {
          cell.errorType = 'error2'
        }
      }
    }
@@ -937,6 +942,7 @@
        return component
      }
      component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : ''
      component.setting.useMSearch = component.setting.useMSearch === 'true'
      if (component.setting.useMSearch) {
        if (!window.GLOB.SearchBox.has(component.$searchId)) {
@@ -957,9 +963,15 @@
      }
      let _customScript = ''
      let _tailScript = ''
      component.scripts && component.scripts.forEach(script => {
        if (script.status !== 'false') {
        if (script.status === 'false') return
        if (script.position !== 'back') {
          _customScript += `
          ${script.sql}
          `
        } else {
          _tailScript += `
          ${script.sql}
          `
        }
@@ -979,17 +991,21 @@
      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)
@@ -1077,12 +1093,20 @@
        inter.setting.onload = 'false'
      }
      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}
          `
        }
@@ -1103,17 +1127,21 @@
      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     // 后置自定义脚本
      return inter
    })
@@ -1201,9 +1229,9 @@
  }
  resetActiveMenu = (menuId) => {
    const { MenuID, Tab } = this.props
    const { MenuID } = this.props
    if (MenuID !== menuId || Tab) return
    if (MenuID !== menuId) return
    this.setShortcut()
  }