| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import {Tabs, Icon, ConfigProvider} from 'antd' |
| | | import {Tabs, Icon, Button, ConfigProvider, message} from 'antd' |
| | | import {modifyTabview, toggleIsiframe} from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import NotFount from '@/components/404' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | import './index.scss' |
| | |
| | | state = { |
| | | selectedTabId: '', // 当前选中tab页面 |
| | | iFrameHeight: 0, |
| | | dict: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? mzhCN : menUS, |
| | | locale: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS |
| | | } |
| | | |
| | |
| | | |
| | | selectcomponent (view) { |
| | | // 根据tab页中菜单信息,选择所需的组件 |
| | | if (view.Remark === 'CommonTable') { |
| | | if (view.type === 'CommonTable') { |
| | | return (<Comps.CommonTable MenuNo={view.MenuNo} key={view.MenuID}/>) |
| | | } else if (view.LinkUrl.split('?')[0] === 'Main/Index') { |
| | | } else if (view.type === 'DataManage') { |
| | | return (<Comps.DataManage MenuNo={view.MenuNo} key={view.MenuID}/>) |
| | | } else if (view.type === 'RoleManage') { |
| | | return (<Comps.RoleManage MenuNo={view.MenuNo} key={view.MenuID}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Comps.Iframe key={view.MenuID} title={view.MenuName} url={'http://qingqiumarket.cn/MKWMS/zh-CN/' + view.LinkUrl}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | |
| | | // 窗口在iframe与普通页面切换时,修改左侧菜单栏样式 |
| | | if (!view) return |
| | | let _isiframe = this.props.isiframe |
| | | if (view && view.Remark === 'CommonTable') { |
| | | _isiframe = false |
| | | } else if (view && view.LinkUrl.split('?')[0] === 'Main/Index') { |
| | | if (view && view.type === 'iframe') { |
| | | _isiframe = true |
| | | } else { |
| | | _isiframe = false |
| | |
| | | if (_isiframe !== this.props.isiframe) { |
| | | this.props.toggleIsiframe(_isiframe) |
| | | } |
| | | } |
| | | |
| | | copyMenuNo = (e) => { |
| | | e.stopPropagation() |
| | | let oInput = document.createElement('input') |
| | | oInput.value = e.target.dataset.menuno || '' |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | oInput.className = 'oInput' |
| | | oInput.style.display='none' |
| | | message.success(this.state.dict['main.copy.success']) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | if (nextProps.tabviews.length > this.props.tabviews.length) { |
| | | // 查看新tab页需要组件是否加载 |
| | | let newtab = nextProps.tabviews[nextProps.tabviews.length - 1] |
| | | if (!Comps.CommonTable && newtab.Remark === 'CommonTable') { |
| | | if (!Comps.CommonTable && newtab.type === 'CommonTable') { |
| | | Comps.CommonTable = asyncComponent(() => import('@/tabviews/commontable')) |
| | | } else if (!Comps.Iframe && newtab.LinkUrl.split('?')[0] === 'Main/Index') { |
| | | } else if (!Comps.Iframe && newtab.type === 'iframe') { |
| | | Comps.Iframe = asyncComponent(() => import('@/tabviews/iframe')) |
| | | } else if (!Comps.DataManage && newtab.type === 'DataManage') { |
| | | Comps.DataManage = asyncComponent(() => import('@/tabviews/datamanage')) |
| | | } else if (!Comps.DataManage && newtab.type === 'RoleManage') { |
| | | Comps.RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) |
| | | } |
| | | } |
| | | |
| | |
| | | key={view.MenuID} |
| | | > |
| | | {this.selectcomponent(view)} |
| | | <Button className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} icon="copy" data-menuno={view.MenuNo} onClick={this.copyMenuNo} shape="circle" /> |
| | | </Tabs.TabPane> |
| | | ) |
| | | })} |