From c7aece35a62b6e91fd98a625bf0e53f64bfbd18d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 17 八月 2023 16:22:15 +0800 Subject: [PATCH] 2023-08-17 --- src/components/breadview/index.jsx | 76 +++++++++++++------------------------- 1 files changed, 26 insertions(+), 50 deletions(-) diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 9f1a97d..3a44900 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -1,5 +1,4 @@ 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 moment from 'moment' @@ -7,28 +6,19 @@ 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 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')) -let service = '' - -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service + 'zh-CN/' -} else { - service = window.GLOB.location + '/' + window.GLOB.service + 'zh-CN/' -} +moment.locale('zh-cn') class BreadView extends Component { state = { @@ -40,7 +30,7 @@ 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', @@ -64,7 +54,7 @@ }) } - this.props.initActionPermission(_permAction) + window.GLOB.mkActions = _permAction } resolve() @@ -88,36 +78,34 @@ } } + changeTemp = (MenuID, Template) => { + this.setState({ + tabview: {...this.state.tabview, type: Template} + }) + } + 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' || view.type === 'ManageTable') { - return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) + 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 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}/>) + 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 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}/>) + 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 key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) + return (<Iframe MenuID={view.MenuID} title={view.MenuName} url={view.src}/>) } else { - return (<NotFount key={view.MenuID} />) + return (<NotFount />) } } UNSAFE_componentWillMount () { - if (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') { - moment.locale('zh-cn') - } else { - moment.locale('en') - } - let home = { MenuID: 'home_page_id', MenuName: '棣栭〉', @@ -135,11 +123,9 @@ 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 @@ -166,7 +152,7 @@ const { tabview, hasNavBar } = 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} /> @@ -194,14 +180,4 @@ } } -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