From 07c005cf28acf74e3afde82122e4c53e1000d70c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 12 六月 2023 12:06:18 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/components/tabview/index.jsx | 61 +++++++++++++----------------- 1 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index ad4fec5..1b5e633 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -7,7 +7,6 @@ import moment from 'moment' import 'moment/locale/zh-cn' -import { initActionPermission } from '@/store/action' import asyncComponent from '@/utils/asyncLoadComponent' import NotFount from '@/components/404' import options from '@/store/options.js' @@ -18,21 +17,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 BaseTable = asyncComponent(() => import('@/tabviews/basetable')) const CalendarPage = asyncComponent(() => import('@/tabviews/calendar')) const TreePage = asyncComponent(() => import('@/tabviews/treepage')) -const TabManage = asyncComponent(() => import('@/tabviews/tabmanage')) 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/' -} class TabViews extends Component { static propTpyes = { @@ -109,7 +99,7 @@ }) } - this.props.initActionPermission(_permAction) + window.GLOB.mkActions = _permAction } resolve() @@ -118,7 +108,7 @@ // 鑾峰彇涓昏彍鍗曞弬鏁� let menudefer = new Promise(resolve => { - Api.getAppVersion().then(() => { + Api.getAppVersion(menu.MenuID).then(() => { resolve() }, () => { resolve() @@ -133,10 +123,10 @@ } } - modifyTabs = (tab, type, fixed) => { + modifyTabs = (tab, fixed) => { const { tabviews, activeId } = this.state - if (type === 'plus' && fixed) { + if (fixed) { let _tabs = tabviews.filter(item => item.MenuID !== tab.MenuID) let index = _tabs.findIndex(item => item.MenuID === activeId) @@ -153,7 +143,7 @@ activeId: tab.MenuID }) }) - } else if (type === 'plus') { + } else { if (tabviews.findIndex(item => item.MenuID === tab.MenuID) > -1) { let _tabs = tabviews.filter(item => item.MenuID !== tab.MenuID) this.setState({ @@ -170,11 +160,6 @@ activeId: tab.MenuID }) } - } else if (type === 'replace') { - this.setState({ - tabviews: tab ? [tab] : [], - activeId: tab ? tab.MenuID : '' - }) } let node = document.getElementById('root').parentNode.parentNode @@ -194,28 +179,39 @@ }) } + changeTemp = (MenuID, Template) => { + let tabs = fromJS(this.state.tabviews).toJS() + + this.setState({ + tabviews: tabs.map(item => { + if (item.MenuID === MenuID) { + item.type = Template + } + return item + }) + }) + } + 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}/>) + return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param} changeTemp={this.changeTemp}/>) + } else if (view.type === 'BaseTable') { + return (<BaseTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} 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}/>) + return (<CustomPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param} changeTemp={this.changeTemp}/>) } 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 === 'TabManage') { - return (<TabManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } 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={service + view.LinkUrl}/>) + 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} />) } @@ -265,11 +261,11 @@ const { tabviews, activeId } = this.state return ( - <section id="mk-tabview-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '') + (tabviews && tabviews.length > 0 ? ' hastab' : '')}> + <section className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> <div className="content-header"> {tabviews && tabviews.length > 0 && <Tabs activeKey={activeId}> - {tabviews.map((view, index) => { + {tabviews.map(view => { return ( <Tabs.TabPane tab={ @@ -293,7 +289,6 @@ </div> </div> </BackTop> - {/* {options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <div className="mk-water-mark">娴嬭瘯绯荤粺</div> : null} */} </Tabs.TabPane> ) })} @@ -312,9 +307,7 @@ } const mapDispatchToProps = (dispatch) => { - return { - initActionPermission: (permAction) => dispatch(initActionPermission(permAction)) - } + return {} } export default connect(mapStateToProps, mapDispatchToProps)(TabViews) \ No newline at end of file -- Gitblit v1.8.0