From c06e58c80240afd703d289bb1c584e08b9783383 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 六月 2025 20:24:25 +0800
Subject: [PATCH] 2025-06-13

---
 src/components/breadview/index.jsx |  199 +++++++++++++++++++++++++++++++------------------
 1 files changed, 124 insertions(+), 75 deletions(-)

diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx
index 4e4e3e6..340b188 100644
--- a/src/components/breadview/index.jsx
+++ b/src/components/breadview/index.jsx
@@ -1,39 +1,66 @@
 import React, {Component} from 'react'
-import {connect} from 'react-redux'
-import { BackTop, Breadcrumb, notification} from 'antd'
-import { HomeOutlined, RightOutlined, RedoOutlined } from '@ant-design/icons'
+import { BackTop, Breadcrumb, notification, Modal } from 'antd'
+import { HomeOutlined, RightOutlined, RedoOutlined, LoadingOutlined } from '@ant-design/icons'
 import moment from 'moment'
 import 'moment/locale/zh-cn'
 
 import asyncComponent from '@/utils/asyncLoadComponent'
 import NotFount from '@/components/404'
-import options from '@/store/options.js'
 import MKEmitter from '@/utils/events.js'
-import { initActionPermission } from '@/store/action'
 import Api from '@/api'
 import './index.scss'
 
 const Home = asyncComponent(() => import('@/tabviews/home'))
 const CustomPage = asyncComponent(() => import('@/tabviews/custom'))
 const CommonTable = asyncComponent(() => import('@/tabviews/commontable'))
-// const BaseTable = asyncComponent(() => import('@/tabviews/basetable'))
-const CalendarPage = asyncComponent(() => import('@/tabviews/calendar'))
+const BaseTable = asyncComponent(() => import('@/tabviews/basetable'))
 const TreePage = asyncComponent(() => import('@/tabviews/treepage'))
 const Iframe = asyncComponent(() => import('@/tabviews/iframe'))
 const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage'))
-const FormTab = asyncComponent(() => import('@/tabviews/formtab'))
+
+if (sessionStorage.getItem('lang') === 'zh-CN') {
+  moment.locale('zh-cn')
+}
 
 class BreadView extends Component {
   state = {
-    tabview: null, // 鏍囩
-    hasNavBar: window.GLOB.navBar === 'linkage_navigation'
+    tabview: null,
+    hasNavBar: window.GLOB.navBar === 'linkage_navigation',
+    visible: false
+  }
+
+  reloading = false
+
+  UNSAFE_componentWillMount () {
+    let home = {
+      MenuID: 'home_page_id',
+      MenuName: window.GLOB.dict['home'] || '棣栭〉',
+      type: 'Home'
+    }
+    this.setState({tabview: home})
+  }
+
+  componentDidMount () {
+    MKEmitter.addListener('modifyTabs', this.modifyTabs)
+    MKEmitter.addListener('reloadTabs', this.reloadTabs)
+  }
+
+  /**
+   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
+   */
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('reloadTabs', this.reloadTabs)
+    MKEmitter.removeListener('modifyTabs', this.modifyTabs)
   }
 
   refreshTabview = () => {
     const { tabview } = this.state
     window.GLOB.CacheMap = new Map()
 
-    if (options.sysType === 'local' && window.GLOB.systemType !== 'production') {
+    if (window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') {
       let roledefer = new Promise(resolve => {
         Api.getSystemConfig({
           func: 's_Get_TrdMenu_Role',
@@ -57,7 +84,7 @@
               })
             }
   
-            this.props.initActionPermission(_permAction)
+            window.GLOB.mkActions = _permAction
           }
 
           resolve()
@@ -81,60 +108,45 @@
     }
   }
 
-  selectcomponent = (view) => {
-    // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠�
-    if (view.type === 'Home') {
-      return (<Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>)
-    } else if (view.type === 'CommonTable') {
-      return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    // } else if (view.type === 'BaseTable') {
-    //   return (<BaseTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    } else if (view.type === 'CustomPage') {
-      return (<CustomPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    } else if (view.type === 'TreePage') {
-      return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    } else if (view.type === 'CalendarPage') {
-      return (<CalendarPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    } else if (view.type === 'RolePermission') {
-      return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>)
-    } else if (view.type === 'FormTab') {
-      return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
-    } else if (view.type === 'iframe') {
-      return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>)
-    } else {
-      return (<NotFount key={view.MenuID} />)
-    }
+  changeTemp = (MenuID, Template) => {
+    this.setState({
+      tabview: {...this.state.tabview, type: Template}
+    })
   }
 
-  UNSAFE_componentWillMount () {
-    if (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') {
-      moment.locale('zh-cn')
+  selectcomponent = (view) => {
+    // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠�
+    if (view.type === 'BaseTable') {
+      return (<BaseTable MenuID={view.MenuID} MenuName={view.MenuName} param={view.param} changeTemp={this.changeTemp}/>)
+    } else if (view.type === 'CustomPage') {
+      return (<CustomPage MenuID={view.MenuID} MenuName={view.MenuName} param={view.param} changeTemp={this.changeTemp}/>)
+    } else if (view.type === 'Home') {
+      return (<Home MenuID={view.MenuID} MenuName={view.MenuName}/>)
+    } else if (view.type === 'RolePermission') {
+      return (<RoleManage MenuID={view.MenuID}/>)
+    } else if (view.type === 'CommonTable') {
+      return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param} changeTemp={this.changeTemp}/>)
+    } else if (view.type === 'TreePage') {
+      return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>)
+    } else if (view.type === 'iframe') {
+      return (<Iframe MenuID={view.MenuID} title={view.MenuName} url={view.src}/>)
     } else {
-      moment.locale('en')
+      return (<NotFount />)
     }
-
-    let home = {
-      MenuID: 'home_page_id',
-      MenuName: '棣栭〉',
-      type: 'Home'
-    }
-    this.setState({tabview: home})
   }
 
   gotoHome = () => {
     let home = {
       MenuID: 'home_page_id',
-      MenuName: '棣栭〉',
+      MenuName: window.GLOB.dict['home'] || '棣栭〉',
       type: 'Home'
     }
     this.setState({tabview: home})
   }
 
-  modifyTabs = (tab, type) => {
-    if (!tab || type !== 'replace') return
-
+  modifyTabs = (tab) => {
     this.setState({
-      tabview: tab,
+      tabview: tab
     })
 
     let node = document.getElementById('root').parentNode.parentNode
@@ -143,25 +155,57 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('modifyTabs', this.modifyTabs)
-  }
+  reloadTabs = () => {
+    if (this.reloading) return
 
-  /**
-   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
-   */
-  componentWillUnmount () {
-    this.setState = () => {
-      return
-    }
-    MKEmitter.removeListener('modifyTabs', this.modifyTabs)
+    let time = new Date().getTime()
+
+    let oldTime = sessionStorage.getItem('mk_reloadTabs')
+    
+    if (oldTime && time - oldTime < 180000) return
+
+    sessionStorage.setItem('mk_reloadTabs', time)
+
+    this.reloading = true
+    this.setState({visible: true})
+
+    Api.getAppVersion(true).then((list) => {
+      let _time = new Date().getTime()
+      let delay = _time - time
+      delay = delay < 3000 ? 3000 - delay : 0
+
+      setTimeout(() => {
+        this.setState({visible: false})
+        this.reloading = false
+  
+        Modal.success({
+          title: '鏇存柊鎴愬姛銆�',
+        })
+  
+        if (list && list.length && list.includes(this.state.tabview.MenuID)) {
+          MKEmitter.emit('reloadMenuView', this.state.tabview.MenuID)
+        }
+      }, delay)
+    }, (message) => {
+      let _time = new Date().getTime()
+      let delay = _time - time
+      delay = delay < 3000 ? 3000 - delay : 0
+
+      setTimeout(() => {
+        this.setState({visible: false})
+        this.reloading = false
+        Modal.error({
+          title: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�',
+        })
+      }, delay)
+    })
   }
 
   render () {
-    const { tabview, hasNavBar } = this.state
+    const { tabview, hasNavBar, visible } = this.state
 
     return (
-      <section id="mk-breadview-wrap" className="mk-breadview-wrap">
+      <section id="mk-tabgroup-wrap" className="mk-breadview-wrap">
         {hasNavBar && tabview ? <Breadcrumb separator="">
           <Breadcrumb.Item>
             <HomeOutlined onClick={this.gotoHome} />
@@ -184,19 +228,24 @@
             </div>
           </div>
         </BackTop>
+        <Modal
+          visible={visible}
+          width={400}
+          closable={false}
+          centered={true}
+          footer={null}
+          destroyOnClose
+        >
+          <div className="mk-menus-update">
+            <div className="tip">
+              绯荤粺鏇存柊涓紝璇风◢鍚�
+            </div>
+            <LoadingOutlined />
+          </div>
+        </Modal>
       </section>
     )
   }
 }
 
-const mapStateToProps = () => {
-  return {}
-}
-
-const mapDispatchToProps = (dispatch) => {
-  return {
-    initActionPermission: (permAction) => dispatch(initActionPermission(permAction)),
-  }
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(BreadView)
\ No newline at end of file
+export default BreadView
\ No newline at end of file

--
Gitblit v1.8.0