| | |
| | | import React, {Component} from 'react' |
| | | import { withRouter } from 'react-router-dom' |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Dropdown, Menu, Modal, notification, Switch, Input } from 'antd' |
| | | import { SearchOutlined, DownOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons' |
| | | |
| | | import { |
| | | toggleCollapse, |
| | | modifyMainMenu, |
| | | logout |
| | | } from '@/store/action' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Api from '@/api' |
| | |
| | | const LoginForm = asyncSpinComponent(() => import('./loginform')) |
| | | |
| | | class Header extends Component { |
| | | static propTpyes = { |
| | | collapse: PropTypes.bool |
| | | } |
| | | state = { |
| | | menulist: null, // 一级菜单 |
| | | userName: '', |
| | |
| | | systems: [], |
| | | searchkey: '', |
| | | thdMenuList: [], |
| | | debug: sessionStorage.getItem('debug') === 'true' |
| | | debug: sessionStorage.getItem('debug') === 'true', |
| | | collapse: sessionStorage.getItem('collapse') === 'true' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | window.GLOB.mainMenu = null |
| | | // 组件加载时,获取菜单数据 |
| | | this.getRolesMenu() |
| | | |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | |
| | | if (fullName.toLowerCase() === userName.toLowerCase()) { |
| | | userName = '' |
| | | } |
| | | |
| | | this.setState({fullName, userName}) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // 获取系统的版本信息,延时查询 |
| | | setTimeout(() => { |
| | | Api.getAppVersion() |
| | | }, 1000) |
| | | |
| | | // sessionStorage 跨页面共享 |
| | | window.addEventListener('storage', (e) => { |
| | | if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { |
| | | localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) |
| | | } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { |
| | | localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) |
| | | } else if (e.key === 'menuUpdate') { |
| | | let vals = e.newValue.split(',') |
| | | let menuId = vals[1] |
| | | let position = vals[2] || '' |
| | | if (position === 'menu') { |
| | | MKEmitter.emit('reloadMenuView', menuId) |
| | | } else if (menuId) { |
| | | Api.getAppVersion(menuId).then(() => { |
| | | MKEmitter.emit('reloadMenuView', menuId) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | handleCollapse = () => { |
| | | // 展开、收起左侧菜单栏 |
| | | this.props.toggleCollapse(!this.props.collapse) |
| | | localStorage.setItem('collapse', !this.props.collapse) |
| | | const { collapse } = this.state |
| | | |
| | | sessionStorage.setItem('collapse', !collapse) |
| | | |
| | | this.setState({collapse: !collapse}) |
| | | |
| | | MKEmitter.emit('toggleCollapse', !collapse) |
| | | } |
| | | |
| | | changePassword = () => { |
| | |
| | | MKEmitter.emit('resetpassword', () => { |
| | | setTimeout(() => { |
| | | sessionStorage.clear() |
| | | this.props.logout() |
| | | this.props.history.replace('/login') |
| | | }, 2000) |
| | | }) |
| | |
| | | cancelText: '取消', |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.logout() |
| | | _this.props.history.replace('/login') |
| | | }, |
| | | onCancel() {} |
| | |
| | | } else if (value.OpenType === 'newtab') { |
| | | MKEmitter.emit('modifyTabs', value) |
| | | } else if (value.OpenType === 'menu') { |
| | | this.props.modifyMainMenu(value) |
| | | window.GLOB.mainMenu = value |
| | | MKEmitter.emit('mainMenuChange') |
| | | } |
| | | } |
| | | |
| | |
| | | sessionStorage.removeItem('ThirdMenu') |
| | | } |
| | | |
| | | this.props.modifyMainMenu(mainMenu) |
| | | |
| | | window.GLOB.mainMenu = mainMenu |
| | | window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}] |
| | | |
| | | MKEmitter.emit('mainMenuChange') |
| | | |
| | | if (_menu) { |
| | | this.openTab(_menu, 0) |
| | |
| | | loginVisible: true |
| | | }) |
| | | } else { |
| | | this.props.modifyMainMenu(null) |
| | | |
| | | window.GLOB.mainMenu = null |
| | | this.props.history.replace('/design') |
| | | } |
| | | } |
| | |
| | | localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: ''})))) |
| | | } |
| | | |
| | | this.props.modifyMainMenu(null) |
| | | window.GLOB.mainMenu = null |
| | | |
| | | this.props.history.replace('/design') |
| | | } else { |
| | | if (res.message.indexOf('密码错误') > -1) { |
| | |
| | | }, 500) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.getRolesMenu() |
| | | |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | |
| | | if (fullName.toLowerCase() === userName.toLowerCase()) { |
| | | userName = '' |
| | | } |
| | | |
| | | this.setState({fullName, userName}) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // 获取系统的版本信息,延时查询 |
| | | setTimeout(() => { |
| | | Api.getAppVersion() |
| | | }, 1000) |
| | | |
| | | // sessionStorage 跨页面共享 |
| | | window.addEventListener('storage', (e) => { |
| | | if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { |
| | | localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) |
| | | } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { |
| | | localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) |
| | | } else if (e.key === 'menuUpdate') { |
| | | let vals = e.newValue.split(',') |
| | | let menuId = vals[1] |
| | | let position = vals[2] || '' |
| | | if (position === 'menu') { |
| | | MKEmitter.emit('reloadMenuView', menuId) |
| | | } else if (menuId) { |
| | | Api.getAppVersion(menuId).then(() => { |
| | | MKEmitter.emit('reloadMenuView', menuId) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | gotoDoc = () => { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { mainMenu, collapse } = this.props |
| | | const { thdMenuList, searchkey, debug, menulist } = this.state |
| | | const { thdMenuList, searchkey, debug, menulist, collapse } = this.state |
| | | const navBar = window.GLOB.navBar |
| | | |
| | | const menu = ( |
| | |
| | | <ul className="header-menu">{ |
| | | menulist.map(item => { |
| | | return ( |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={window.GLOB.mainMenu && window.GLOB.mainMenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | | ) |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | collapse: state.collapse, |
| | | mainMenu: state.mainMenu |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), |
| | | modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), |
| | | logout: () => dispatch(logout()) |
| | | } |
| | | } |
| | | |
| | | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)) |
| | | export default withRouter(Header) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu } from 'antd' |
| | | |
| | |
| | | const { SubMenu } = Menu |
| | | |
| | | class Sidemenu extends Component { |
| | | static propTypes = { |
| | | collapse: PropTypes.bool |
| | | } |
| | | |
| | | state = { |
| | | subMenulist: [], // 二级菜单 |
| | | rootSubmenuKeys: null, |
| | | collapse: sessionStorage.getItem('collapse') === 'true', |
| | | openKeys: null |
| | | } |
| | | |
| | | async loadsubmenu (menu) { |
| | | componentDidMount() { |
| | | MKEmitter.addListener('mainMenuChange', this.loadsubmenu) |
| | | MKEmitter.addListener('toggleCollapse', this.toggleCollapse) |
| | | |
| | | if (window.GLOB.mainMenu) { |
| | | this.loadsubmenu() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate(nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('mainMenuChange', this.loadsubmenu) |
| | | MKEmitter.removeListener('toggleCollapse', this.toggleCollapse) |
| | | } |
| | | |
| | | toggleCollapse = (collapse) => { |
| | | this.setState({ |
| | | collapse: collapse, |
| | | openKeys: [] |
| | | }) |
| | | } |
| | | |
| | | loadsubmenu = () => { |
| | | let menu = window.GLOB.mainMenu |
| | | |
| | | if (!menu || !menu.MenuID) { // 没有主菜单时,清空下级菜单 |
| | | this.setState({ |
| | | subMenulist: [], |
| | |
| | | this.setState({ |
| | | subMenulist: menu.children, |
| | | rootSubmenuKeys: menu.children.map(item => item.MenuID), |
| | | openKeys: this.props.collapse ? [] : [openKey], |
| | | openKeys: this.state.collapse ? [] : [openKey], |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | // 主菜单切换,请求2、3级菜单数据 |
| | | this.loadsubmenu(nextProps.mainMenu) |
| | | } else if (nextProps.collapse && this.props.collapse !== nextProps.collapse) { |
| | | // 展开合并时,关闭展开菜单 |
| | | this.setState({ |
| | | openKeys: [] |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate(nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | onOpenChange = openKeys => { |
| | | const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1) |
| | | if (this.state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { mainMenu } = this.props |
| | | const { collapse } = this.state |
| | | |
| | | if (mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) |
| | | if (window.GLOB.mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) |
| | | |
| | | return ( |
| | | <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={this.props.collapse}> |
| | | <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (collapse ? ' collapsed' : '')}> |
| | | <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={collapse}> |
| | | {this.state.subMenulist && this.state.subMenulist.map((item) => { |
| | | return ( |
| | | <SubMenu |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | collapse: state.collapse, |
| | | mainMenu: state.mainMenu, |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu) |
| | | export default Sidemenu |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { fromJS } from 'immutable' |
| | | import {Tabs, BackTop, notification} from 'antd' |
| | | import { RedoOutlined, CloseOutlined } from '@ant-design/icons' |
| | |
| | | moment.locale('zh-cn') |
| | | |
| | | class TabViews extends Component { |
| | | static propTpyes = { |
| | | collapse: PropTypes.bool |
| | | } |
| | | |
| | | state = { |
| | | activeId: '', |
| | | tabviews: [], |
| | |
| | | const { tabviews, activeId } = this.state |
| | | |
| | | return ( |
| | | <section id="mk-tabgroup-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <section id="mk-tabgroup-wrap" className="mk-tabview-wrap"> |
| | | <div className="content-header"> |
| | | {tabviews.length > 0 && |
| | | <Tabs activeKey={activeId}> |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | collapse: state.collapse, |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(TabViews) |
| | | export default TabViews |
| | |
| | | .header-container + .mk-tabview-wrap { |
| | | max-width: 100%; |
| | | } |
| | | .mk-tabview-wrap.collapsed { |
| | | |
| | | .mk-side-menu.collapsed + .mk-tabview-wrap { |
| | | max-width: calc(100% - 80px); |
| | | } |
| | | .mk-side-menu-hidden + .mk-tabview-wrap, .mk-side-menu-hidden + .mk-tabview-wrap.collapsed { |
| | | .mk-side-menu-hidden + .mk-tabview-wrap { |
| | | max-width: 100%; |
| | | >.content-header >.ant-tabs >.ant-tabs-bar { |
| | | display: none; |
| | |
| | | import React from 'react' |
| | | import ReactDOM from 'react-dom' |
| | | import Route from './router' |
| | | import { Provider } from 'react-redux' |
| | | import md5 from 'md5' |
| | | import store from '@/store' |
| | | import * as serviceWorker from './serviceWorker' |
| | | import options, { styles } from '@/store/options.js' |
| | | import '@/assets/css/main.scss' |
| | |
| | | |
| | | const render = Component => { |
| | | ReactDOM.render( |
| | | <Provider store={store}> |
| | | <Component/> |
| | | </Provider>, |
| | | <Component/>, |
| | | document.getElementById('root') |
| | | ) |
| | | } |
| | |
| | | GLOB.WXNotice = config.WXNotice + '' === 'true' |
| | | GLOB.accessToken = {} |
| | | GLOB.mkHS = false |
| | | GLOB.debugger = false |
| | | GLOB.dataFormat = false |
| | | GLOB.navBar = 'shutter' // 默认为百叶窗 |
| | | GLOB.style = 'bg_black_style_blue' |
| | | |
| | | GLOB.sysType = options.sysType |
| | | if (GLOB.sysType !== 'cloud') { |
| | |
| | | } |
| | | } else if (GLOB.sysType === 'local') { |
| | | GLOB.probation = true |
| | | GLOB.debugger = true |
| | | GLOB.systemType = '' |
| | | |
| | | // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' |
| | |
| | | GLOB.systemType = '' |
| | | GLOB.mainSystemApi = '' |
| | | } |
| | | |
| | | GLOB.debugger = GLOB.sysType === 'local' && GLOB.systemType !== 'production' |
| | | |
| | | if (/#\/hs$/.test(window.location.href)) { // hs下不打印脚本 |
| | | GLOB.debugger = false |
| | |
| | | GLOB.mainlogo = _systemMsg.mainlogo |
| | | GLOB.doclogo = _systemMsg.doclogo |
| | | GLOB.webSite = _systemMsg.webSite |
| | | GLOB.style = _systemMsg.style |
| | | GLOB.style = _systemMsg.style || 'bg_black_style_blue' |
| | | GLOB.showline = _systemMsg.showline || '' |
| | | GLOB.navBar = _systemMsg.navBar || 'shutter' |
| | | GLOB.appVersion = _systemMsg.app_version || '' |
| | |
| | | link.href = GLOB.favicon |
| | | document.getElementsByTagName('head')[0].appendChild(link) |
| | | } |
| | | if (GLOB.style && styles[GLOB.style]) { |
| | | if (styles[GLOB.style]) { |
| | | className = styles[GLOB.style] + ' ' + (GLOB.showline === 'false' ? 'hidden-split-line' : '') |
| | | } |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | } |
| | | } |
| | | |
| | | // 不使用百叶窗打开菜单时,去掉合并标记 |
| | | if (GLOB.navBar !== 'shutter') { |
| | | localStorage.removeItem('collapse') |
| | | } |
| | | |
| | | document.body.className = className |
| | |
| | | GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') |
| | | GLOB.baseurl = GLOB.location + '/' + GLOB.service |
| | | GLOB.linkurl = GLOB.baseurl + 'index.html' |
| | | GLOB.dataFormat = false |
| | | |
| | | let mark = sessionStorage.getItem('system_mark') |
| | | let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}` |
| | | if (mark && mark !== _mark) { |
| | | sessionStorage.clear() |
| | | } |
| | | sessionStorage.setItem('system_mark', _mark) |
| | | } |
| | | |
| | | let mark = sessionStorage.getItem('system_mark') |
| | | let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}` |
| | | if (mark && mark !== _mark) { |
| | | sessionStorage.clear() |
| | | } |
| | | sessionStorage.setItem('system_mark', _mark) |
| | | |
| | | if (localStorage.getItem(_href + 'lang')) { |
| | | sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) |
| | | } else { |
| | | sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') |
| | | } |
| | | let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') |
| | | sessionStorage.setItem('lang', lang) |
| | | |
| | | let _level = 10 |
| | | let _Mlevel = sessionStorage.getItem('Member_Level') |
| | |
| | | |
| | | if (config.$cache && config.$time && config.wrap.autoExec) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res.valid) { |
| | | this.autoExec() |
| | | } else { |
| | | Api.writeCacheConfig(config.uuid, []) |
| | | } |
| | | if (res.valid) return |
| | | |
| | | this.autoExec() |
| | | |
| | | Api.writeCacheConfig(config.uuid, []) |
| | | }) |
| | | } else { |
| | | this.autoExec() |
| | |
| | | MenuID: this.props.MenuID |
| | | } |
| | | Api.getCacheConfig(_param).then(result => { |
| | | if (result.status) { |
| | | if (result.LongParam) { |
| | | let config = '' |
| | | let view = 'default' |
| | | if (result.status && result.LongParam) { |
| | | let config = '' |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | | } |
| | | |
| | | if (!config || !config.enabled) { |
| | | this.setState({ |
| | | loading: false, |
| | | waiting: false, |
| | | view: 'default' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | | view: 'custom' |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | | waiting: false, |
| | | view: 'default' |
| | | }) |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | | } |
| | | } else { |
| | | |
| | | if (config && config.enabled) { |
| | | view = 'custom' |
| | | } |
| | | } |
| | | |
| | | if (view === 'default') { |
| | | this.setState({ |
| | | loading: false, |
| | | waiting: false, |
| | | view: 'default' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | | view: 'custom' |
| | | }) |
| | | } |
| | | |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | message: res.message || '执行失败!', |
| | | duration: 5 |
| | | }) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let refresh = !/@no_target_menu@/i.test(res.message) |
| | | |
| | | this.setState({loading: false}) |
| | | |
| | | if (pageId) { |
| | | if (pageId && refresh) { |
| | | localStorage.setItem('menuUpdate', new Date().getTime() + ',' + pageId + ',menu') |
| | | } |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import { withRouter } from 'react-router-dom' |
| | | import {connect} from 'react-redux' |
| | | import { Dropdown, Menu, Modal, notification, Switch, Button, Popover } from 'antd' |
| | | import { MenuFoldOutlined, SettingOutlined, AppstoreOutlined, DownOutlined, HomeOutlined, ApiOutlined, PlusOutlined, EditOutlined, MenuOutlined, DatabaseOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { |
| | | modifyMenuTree, |
| | | modifyMainMenu, |
| | | resetEditLevel, |
| | | logout |
| | | } from '@/store/action' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import avatar from '@/assets/img/avatar.jpg' |
| | | import MainLogo from '@/assets/img/main-logo.png' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | |
| | | content: '', |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.logout() |
| | | _this.props.history.replace('/login') |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuTree: state.menuTree, |
| | | mainMenu: state.mainMenu, |
| | | editLevel: state.editLevel |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), |
| | | modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)), |
| | | logout: () => dispatch(logout()) |
| | | } |
| | | } |
| | | |
| | | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)) |
| | | export default withRouter(Header) |
| | |
| | | import React, {Component} from 'react' |
| | | import { withRouter } from 'react-router-dom' |
| | | import { ConfigProvider } from 'antd' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | // import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | |
| | | import Header from './header' |
| | | import { setGLOBFuncs } from '@/utils/utils.js' |
| | | import Sidemenu from './sidemenu' |
| | | import { setGLOBFuncs } from '@/utils/utils.js' |
| | | |
| | | import '@/assets/css/design.scss' |
| | | import './index.scss' |
| | | |
| | | const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class Design extends Component { |
| | | state = { |
| | | editLevel: false, |
| | | mainMenu: null, |
| | | menuTree: [] |
| | | } |
| | | |
| | | componentDidMount() { |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | sessionStorage.removeItem('isEditState') |
| | |
| | | setGLOBFuncs() |
| | | } |
| | | } |
| | | |
| | | resetEditLevel = (level) => { |
| | | this.setState({editLevel: level}) |
| | | } |
| | | |
| | | modifyMenuTree = (menulist) => { |
| | | this.setState({menuTree: menulist}) |
| | | } |
| | | |
| | | modifyMainMenu = (menu) => { |
| | | this.setState({mainMenu: menu}) |
| | | } |
| | | |
| | | render () { |
| | | const { editLevel, menuTree, mainMenu } = this.state |
| | | |
| | | return ( |
| | | <div className={'mk-main-view ' + (window.GLOB.systemType || '')}> |
| | | <ConfigProvider locale={_locale}> |
| | | <Sidemenu key="sidemenu"/> |
| | | <Header key="header"/> |
| | | <ConfigProvider locale={zhCN}> |
| | | <Sidemenu key="sidemenu" editLevel={editLevel} menuTree={menuTree} mainMenu={mainMenu} resetEditLevel={this.resetEditLevel}/> |
| | | <Header key="header" editLevel={editLevel} mainMenu={mainMenu} resetEditLevel={this.resetEditLevel} modifyMenuTree={this.modifyMenuTree} modifyMainMenu={this.modifyMainMenu}/> |
| | | </ConfigProvider> |
| | | </div> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { connect } from 'react-redux' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { notification, Modal, Button } from 'antd' |
| | |
| | | |
| | | class EditMenu extends Component { |
| | | static propTpyes = { |
| | | menuTree: PropTypes.array, // 菜单树 |
| | | menulist: PropTypes.any, // 三级菜单列表 |
| | | exitEdit: PropTypes.func, // 退出编辑状态 |
| | | supMenu: PropTypes.object, // 对应的上级菜单 |
| | |
| | | } else if (_menu.PageParam.Template === 'BaseTable') { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) |
| | | |
| | | |
| | | window.open(`#/tabledesign/${_param}`) |
| | | } else if (_menu.PageParam.Template === 'CustomPage') { |
| | | let _param = { |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuTree: state.menuTree |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(EditMenu) |
| | | export default EditMenu |
| | |
| | | import React, {Component} from 'react' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu, Popover, Modal, notification } from 'antd' |
| | | import { EditOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { resetEditLevel } from '@/store/action' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | menulist={this.state.editMenu.children} |
| | | supMenuList={mainMenu.children} |
| | | supMenu={this.state.editMenu} |
| | | menuTree={this.props.menuTree} |
| | | exitEdit={this.exitEdit} |
| | | /> : null |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | mainMenu: state.mainMenu, |
| | | menuTree: state.menuTree, |
| | | editLevel: state.editLevel |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)) |
| | | } |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu) |
| | | export default Sidemenu |
| | |
| | | </div> |
| | | <div className="login-middle" style={lineColor ? {borderColor: lineColor} : {}}> |
| | | {loginWays ? <LoginForm |
| | | platName={this.state.platName} |
| | | dict={this.state.dict} |
| | | auth={this.state.auth} |
| | | authError={this.state.authError} |
| | |
| | | touristLogin: PropTypes.bool, |
| | | lang: PropTypes.string, |
| | | langList: PropTypes.array, |
| | | loginWays: PropTypes.array, |
| | | platName: PropTypes.string |
| | | loginWays: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {config.callback === 'true' ? <Col span={24}> |
| | | <Form.Item label="回调函数"> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="回调函数执行成功后默认会刷新源菜单页,返回信息(@retmsg)中含有(@no_target_menu@)可阻止此项刷新。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 回调函数 |
| | | </Tooltip> |
| | | }> |
| | | s_print_proc <EditOutlined style={{cursor: 'pointer'}} onClick={() => {window.open('#/proc/s_print_proc')}}/> |
| | | </Form.Item> |
| | | </Col> : null} |