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 | 57 +++++++++++++++++++++++++-------------------------------- 1 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 62ae100..3a44900 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -6,7 +6,6 @@ import asyncComponent from '@/utils/asyncLoadComponent' import NotFount from '@/components/404' -import options from '@/store/options.js' import MKEmitter from '@/utils/events.js' import Api from '@/api' import './index.scss' @@ -14,12 +13,12 @@ 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')) + +moment.locale('zh-cn') class BreadView extends Component { state = { @@ -31,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', @@ -79,38 +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') { - 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}/>) + 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={window.GLOB.baseurl + 'zh-CN/' + 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: '棣栭〉', @@ -128,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 @@ -159,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} /> -- Gitblit v1.8.0