king
2023-08-15 a94b0a4d15b26ecf8fe99f0a1c3e60d60b97766d
src/views/mkiframe/index.jsx
@@ -1,9 +1,11 @@
import React, {Component} from 'react'
import { Spin, notification } from 'antd'
import { Spin, notification, ConfigProvider } from 'antd'
import zhCN from 'antd/es/locale/zh_CN'
import Api from '@/api'
import asyncComponent from '@/utils/asyncLoadComponent'
import MKEmitter from '@/utils/events.js'
import ImgScale from '@/components/imgScale'
import './index.scss'
const CustomPage = asyncComponent(() => import('@/tabviews/custom'))
@@ -23,6 +25,7 @@
    if (/^\/view\//.test(path)) {
      localStorage.setItem('getSysPermission', window.GLOB.appkey)
      const that = this
    
      window.addEventListener('storage', function(event) {
        if (event.key === 'sysPermissions' && event.newValue) {
@@ -31,6 +34,15 @@
          window.GLOB.mkThdMenus = values.mkThdMenus
          window.GLOB.mkActions = values.mkActions
        } else if (event.key === 'menuUpdate') {
          let vals = event.newValue.split(',')
          let MenuId = vals[1]
          let position = vals[2] || ''
          if (position === 'menu' && menuId === MenuId) {
            that.setState({loading: true}, () => {
              that.setState({loading: false})
            })
          }
        }
      })
@@ -38,7 +50,7 @@
        localStorage.removeItem('getSysPermission')
        localStorage.removeItem('sysPermissions')
        if (window.GLOB.mkActions) {
        if (window.GLOB.mkActions && window.GLOB.mkActions.loaded) {
          this.setState({loading: false})
        } else {
          this.getPermRole()
@@ -77,6 +89,37 @@
  componentDidMount () {
    MKEmitter.addListener('modifyTabs', this.modifyTabs)
    MKEmitter.addListener('closeTabView', this.closeTabView)
    if (window.GLOB.sysType !== 'cloud') {
      Object.defineProperty(window, 'debugger', {
        configurable: true,
        enumerable: true,
        set(value) {
          if (value + '' === 'false') {
            window.GLOB.debugger = false
          } else {
            window.GLOB.debugger = true
          }
        }
      })
      Object.defineProperty(window, 'debug', {
        configurable: true,
        enumerable: true,
        set(value) {
          if (value + '' === 'false') {
            window.GLOB.debugger = false
            window.GLOB.breakpoint = false
            sessionStorage.removeItem('breakpoint')
          } else {
            window.GLOB.debugger = true
            window.GLOB.breakpoint = value + ''
            sessionStorage.setItem('breakpoint', value)
          }
          MKEmitter.emit('debugChange')
        }
      })
    }
  }
  /**
@@ -176,9 +219,12 @@
    return (
      <div className="main-iframe">
        {loading ? <Spin size="large" /> : null}
        {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null}
        {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null}
        <ConfigProvider locale={zhCN}>
          {loading ? <Spin size="large" /> : null}
          {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null}
          {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null}
        </ConfigProvider>
        <ImgScale />
      </div>
    )
  }