king
2023-08-08 dc258e4600bea2fba1e25054d163a2f4b1326a85
src/tabviews/custom/index.jsx
@@ -4,8 +4,6 @@
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 asyncComponent from '@/utils/asyncComponent'
@@ -59,7 +57,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    ContainerId: Utils.getuuid(), // 菜单外层html Id
    BID: '',              // 页面跳转时携带ID
    loadingview: true,    // 页面加载中
@@ -117,7 +114,7 @@
        this.setState({
          viewlost: true,
          loadingview: false,
          lostmsg: this.state.dict['main.view.unenabled']
          lostmsg: '抱歉,您访问的页面未启用,请联系管理员。'
        })
        return
      }
@@ -170,11 +167,6 @@
      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}'` },
@@ -446,16 +438,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)
          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
        })
@@ -501,9 +499,7 @@
      }
      // 搜索条件初始化
      if (item.type === 'search' && item.search.length === 0) {
        return false
      } else if (item.search) {
      if (item.search) {
        Utils.initSearchVal(item)
        item.$searches = Utils.initMainSearch(item.search)
@@ -996,6 +992,10 @@
      component.setting.customScript = _customScript // 整理后自定义脚本
      if (component.setting.laypage) {
        component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript)
      }
      if (component.setting.sync === 'true') {
        // pageable 是否分页,组件属性,不分页的组件才可以统一查询
        if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') {
@@ -1131,7 +1131,7 @@
    if (config.$cache && config.$time) {
      Api.getLCacheConfig(params[0].uuid, config.$time).then(res => {
        if (!res) {
        if (!res.valid) {
          this.getMainData(param, params, config.MenuID)
        } else {
          this.setState({
@@ -1521,13 +1521,13 @@
    const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state
    return (
      <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}>
      <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''} ${config && config.mask === 'false' ? 'mk-no-mask' : ''}`} 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}
        {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      </div>
    )