king
2024-06-21 2bccb9ec7bdefe23292a22bc153463cfa1479a49
src/views/mkiframe/index.jsx
@@ -1,6 +1,5 @@
import React, {Component} from 'react'
import { Spin, notification, ConfigProvider } from 'antd'
import zhCN from 'antd/es/locale/zh_CN'
import { Spin, notification } from 'antd'
import Api from '@/api'
import asyncComponent from '@/utils/asyncLoadComponent'
@@ -18,6 +17,8 @@
    MenuId: '',
    type: 'CustomPage'
  }
  reloading = false
  UNSAFE_componentWillMount() {
    const { params, path } = this.props.match
@@ -112,6 +113,10 @@
    MKEmitter.addListener('modifyTabs', this.modifyTabs)
    MKEmitter.addListener('closeTabView', this.closeTabView)
    if (window.GLOB.forcedUpdate) {
      MKEmitter.addListener('reloadTabs', this.reloadTabs)
    }
    if (window.GLOB.sysType !== 'cloud') {
      Object.defineProperty(window, 'debugger', {
        configurable: true,
@@ -152,7 +157,24 @@
      return
    }
    MKEmitter.removeListener('modifyTabs', this.modifyTabs)
    MKEmitter.removeListener('reloadTabs', this.reloadTabs)
    MKEmitter.removeListener('closeTabView', this.closeTabView)
  }
  reloadTabs = () => {
    if (this.reloading) return
    this.reloading = true
    Api.getAppVersion(true).then(() => {
      window.location.reload()
    }, (message) => {
      notification.error({
        top: 92,
        message: message || '系统配置更新失败!',
        duration: 10
      })
    })
  }
  modifyTabs = (tab) => {
@@ -244,11 +266,9 @@
    return (
      <div className="main-iframe">
        <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>
        {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}
        <ImgScale />
      </div>
    )