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 moment from 'moment'
|
import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input } from 'antd'
|
|
import asyncComponent from '@/utils/asyncComponent'
|
import {
|
toggleCollapse,
|
modifyMainMenu,
|
modifyTabview,
|
resetState,
|
resetDebug,
|
resetEditState,
|
resetEditLevel,
|
initPermission,
|
modifyDataManager,
|
initActionPermission,
|
initMenuPermission,
|
logout
|
} from '@/store/action'
|
import Api from '@/api'
|
import options from '@/store/options.js'
|
import zhCN from '@/locales/zh-CN/header.js'
|
import enUS from '@/locales/en-US/header.js'
|
import Utils from '@/utils/utils.js'
|
import avatar from '@/assets/img/avatar.jpg'
|
import Resetpwd from './resetpwd'
|
import LoginForm from './loginform'
|
import './index.scss'
|
|
const EditMenu = asyncComponent(() => import('@/templates/headerconfig'))
|
const { confirm } = Modal
|
const { Search } = Input
|
|
class Header extends Component {
|
static propTpyes = {
|
collapse: PropTypes.bool,
|
mainMenu: PropTypes.oneOfType([
|
PropTypes.string,
|
PropTypes.object
|
])
|
}
|
state = {
|
menulist: null, // 一级菜单
|
visible: false, // 修改密码模态框
|
dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
|
confirmLoading: false,
|
userName: sessionStorage.getItem('User_Name'),
|
logourl: window.GLOB.mainlogo,
|
loginVisible: false,
|
loginLoading: false,
|
avatar: avatar,
|
systems: [],
|
searchkey: '',
|
thdMenuList: []
|
}
|
|
handleCollapse = () => {
|
// 展开、收起左侧菜单栏
|
if (!this.props.editState) {
|
this.props.toggleCollapse(!this.props.collapse)
|
localStorage.setItem('collapse', !this.props.collapse)
|
}
|
}
|
|
changePassword = () => {
|
// 点击修改密码,显示弹窗
|
this.setState({
|
visible: true
|
})
|
}
|
|
resetPwdSubmit = () => {
|
this.formRef.handleConfirm().then(res => {
|
this.setState({
|
confirmLoading: true
|
})
|
this.resetPwdSubmitexec(res)
|
}, () => {})
|
}
|
|
async resetPwdSubmitexec (param) {
|
let _param = {
|
func: 's_PwdUpt',
|
LText: `select '${param.originpwd}','${param.password}'`
|
}
|
|
_param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密
|
_param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 时间戳
|
_param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥
|
|
let result = await Api.getSystemConfig(_param) // 取消修改本地密码,只修改单点服务器
|
|
if (result.status) {
|
this.setState({
|
visible: false,
|
confirmLoading: false
|
})
|
notification.success({
|
top: 92,
|
message: this.state.dict['header.password.resetsuccess'],
|
duration: 2
|
})
|
} else {
|
notification.warning({
|
top: 92,
|
message: result.message,
|
duration: 5
|
})
|
this.setState({
|
confirmLoading: false
|
})
|
}
|
}
|
|
handleCancel = () => {
|
// 取消时关闭修改密码模态框,清空表单数据
|
this.setState({
|
visible: false
|
})
|
}
|
|
logout = () => {
|
// 退出登录
|
let _this = this
|
confirm({
|
title: this.state.dict['header.logout.hint'],
|
content: '',
|
okText: this.state.dict['header.confirm'],
|
cancelText: this.state.dict['header.cancel'],
|
onOk() {
|
sessionStorage.clear()
|
_this.props.logout()
|
_this.props.history.replace('/login')
|
},
|
onCancel() {}
|
})
|
}
|
|
changeMenu (value) {
|
// 主菜单切换
|
if (this.props.editState && this.props.editLevel) {
|
// 编辑状态下,不可切换菜单
|
return
|
}
|
if (value.PageParam.OpenType === 'menu') {
|
this.props.modifyMainMenu(value)
|
} else {
|
window.open('#/' + value.PageParam.linkUrl + '/')
|
}
|
}
|
|
async loadmenu () {
|
// 获取主菜单
|
let _param = {func: 'sPC_Get_MainMenu', systemType: options.systemType}
|
if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,获取一级菜单,增加参数debug
|
_param.debug = 'Y'
|
}
|
if (options.systemType !== 'cloud' && window.GLOB.systemType !== 'official') {
|
_param.linkurl = window.GLOB.linkurl
|
}
|
|
let result = await Api.getSystemConfig(_param)
|
|
// 登录超时
|
if (!result) return
|
|
if (result.status) {
|
if (result.debug === 'true') { // 是否为debug模式,即可复制菜单参数
|
this.props.resetDebug()
|
}
|
|
let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面
|
if (MainMenuId) {
|
// 通过url中menuid筛选出选中的主菜单
|
let _menu = result.data.filter(item => item.MenuID === MainMenuId)[0]
|
sessionStorage.removeItem('MainMenu')
|
this.props.modifyMainMenu(_menu || result.data[0])
|
} else {
|
this.props.modifyMainMenu(result.data[0])
|
}
|
|
this.setState({
|
menulist: result.data.map((item, index) => {
|
item.id = index
|
item.text = item.MenuName
|
if (item.PageParam) {
|
try {
|
item.PageParam = JSON.parse(item.PageParam)
|
} catch (e) {
|
item.PageParam = {OpenType: 'menu', linkUrl: ''}
|
}
|
} else {
|
item.PageParam = {OpenType: 'menu', linkUrl: ''}
|
}
|
return item
|
}),
|
systems: result.Systems.filter(sys => sys.LinkUrl1 && sys.AppKey !== window.GLOB.appkey)
|
})
|
|
if (result.dataM) {
|
this.props.modifyDataManager(true)
|
}
|
} else {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
}
|
|
async getRolesMenu () {
|
// 获取角色权限
|
let promiseRole = new Promise(resolve => {
|
Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}).then(result => {
|
let _permAction = {}
|
let _permRoles = []
|
if (result && result.status) {
|
if (result.UserRoles) {
|
result.UserRoles.forEach(role => {
|
_permRoles.push(role.RoleID)
|
|
role.RoleMenu.forEach(menu => {
|
if (!menu.MenuID) return
|
_permAction[menu.MenuID] = true
|
})
|
})
|
}
|
} else if (result) {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
|
resolve({permAction: _permAction, permRoles: _permRoles})
|
})
|
})
|
|
// 获取主菜单参数
|
let promiseMenu = new Promise(resolve => {
|
let _param = {func: 'sPC_Get_MainMenu', systemType: options.systemType}
|
if (options.systemType !== 'cloud' && window.GLOB.systemType !== 'official') {
|
_param.linkurl = window.GLOB.linkurl
|
}
|
|
Api.getSystemConfig(_param).then(result => {
|
let mainMenu = null
|
if (result && result.status) {
|
if (result.debug === 'true') { // 是否为debug模式,即可复制菜单参数
|
this.props.resetDebug()
|
}
|
|
let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面
|
if (MainMenuId) {
|
// 通过url中menuid筛选出选中的主菜单
|
let _menu = result.data.filter(item => item.MenuID === MainMenuId)[0]
|
sessionStorage.removeItem('MainMenu')
|
mainMenu = _menu || result.data[0]
|
} else {
|
mainMenu = result.data[0]
|
}
|
|
this.setState({
|
menulist: result.data.map((item, index) => {
|
item.id = index
|
item.text = item.MenuName
|
if (item.PageParam) {
|
try {
|
item.PageParam = JSON.parse(item.PageParam)
|
} catch (e) {
|
item.PageParam = {OpenType: 'menu', linkUrl: ''}
|
}
|
} else {
|
item.PageParam = {OpenType: 'menu', linkUrl: ''}
|
}
|
return item
|
}),
|
systems: result.Systems.filter(sys => sys.LinkUrl1 && sys.AppKey !== window.GLOB.appkey)
|
})
|
|
if (result.dataM) {
|
this.props.modifyDataManager(true)
|
}
|
} else if (result) {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
|
resolve(mainMenu)
|
})
|
})
|
|
let _mainMenu = await promiseMenu
|
if (_mainMenu) {
|
this.props.modifyMainMenu(_mainMenu)
|
}
|
|
let _role = await promiseRole
|
|
this.props.initActionPermission(_role.permRoles, _role.permAction)
|
}
|
|
reload = () => {
|
this.setState({
|
menulist: null
|
})
|
this.loadmenu()
|
}
|
|
changeEditState = (state) => {
|
const { menulist } = this.state
|
|
if (!state) { // 退出编辑,页面刷新
|
window.location.reload()
|
return
|
}
|
|
// 修改编辑状态
|
let UserID = sessionStorage.getItem('CloudUserID')
|
let LoginUID = sessionStorage.getItem('CloudLoginUID')
|
|
if (state && (!UserID || !LoginUID)) {
|
this.setState({
|
loginVisible: true
|
})
|
} else {
|
sessionStorage.setItem('isEditState', state)
|
let _userName = sessionStorage.getItem('User_Name')
|
let _avatar = avatar
|
|
if (!state && sessionStorage.getItem('avatar')) {
|
_avatar = Utils.getrealurl(sessionStorage.getItem('avatar')) // 头像
|
} else if (state && sessionStorage.getItem('CloudAvatar')) {
|
_avatar = Utils.getrealurl(sessionStorage.getItem('CloudAvatar')) // 头像
|
}
|
|
if (state) {
|
_userName = sessionStorage.getItem('CloudUserName')
|
}
|
|
if (window.GLOB.systemType === 'official' && state) {
|
this.props.resetEditLevel('HS')
|
this.props.modifyMainMenu({
|
MenuID: 'systemManageView'
|
})
|
|
this.setState({
|
userName: _userName,
|
avatar: _avatar
|
})
|
this.props.resetEditState(state)
|
|
return
|
} else if (window.GLOB.systemType === 'official' && !state) {
|
this.props.resetEditLevel(false)
|
this.props.modifyMainMenu(menulist[0] || '')
|
|
this.setState({
|
userName: _userName,
|
avatar: _avatar
|
})
|
this.props.resetEditState(state)
|
|
return
|
}
|
|
this.setState({
|
menulist: null,
|
userName: _userName,
|
avatar: _avatar
|
})
|
this.loadmenu()
|
this.props.modifyMainMenu('')
|
this.props.resetEditState(state)
|
}
|
|
if (state && this.props.sysRoles.length === 0 && this.props.permFuncField.length === 0 && window.GLOB.systemType !== 'official') {
|
Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => {
|
if (res.status) {
|
let _permFuncField = []
|
let _sysRoles = []
|
|
if (res.Roles && res.Roles.length > 0) {
|
_sysRoles = res.Roles.map(role => {
|
return {
|
uuid: Utils.getuuid(),
|
value: role.RoleID,
|
text: role.RoleName
|
}
|
})
|
}
|
|
if (res.sModular && res.sModular.length > 0) {
|
res.sModular.forEach(field => {
|
if (field.ModularNo) {
|
_permFuncField.push(field.ModularNo)
|
}
|
})
|
_permFuncField = _permFuncField.sort()
|
}
|
|
this.props.initPermission(_sysRoles, _permFuncField)
|
}
|
})
|
}
|
}
|
|
loginSubmit = () => {
|
this.setState({
|
loginLoading: true
|
})
|
this.loginRef.handleConfirm().then(param => {
|
Api.getusermsg(param.username, param.password, true).then(res => {
|
if (res.status) {
|
sessionStorage.setItem('CloudUserID', res.UserID)
|
sessionStorage.setItem('CloudSessionUid', Utils.getuuid())
|
sessionStorage.setItem('CloudLoginUID', res.LoginUID)
|
sessionStorage.setItem('CloudUserName', res.UserName)
|
sessionStorage.setItem('CloudFullName', res.FullName)
|
sessionStorage.setItem('CloudAvatar', res.icon)
|
sessionStorage.setItem('isEditState', 'true')
|
|
let _avatar = avatar
|
if (res.icon) {
|
_avatar = Utils.getrealurl(res.icon) // 头像
|
}
|
|
if (window.GLOB.systemType === 'official') {
|
this.props.resetEditLevel('HS')
|
this.props.modifyMainMenu({
|
MenuID: 'systemManageView'
|
})
|
|
this.setState({
|
loginVisible: false,
|
loginLoading: false,
|
userName: res.UserName,
|
avatar: _avatar
|
})
|
this.props.resetEditState(true)
|
|
return
|
}
|
|
this.setState({
|
menulist: null,
|
loginVisible: false,
|
loginLoading: false,
|
userName: res.UserName,
|
avatar: _avatar
|
})
|
this.loadmenu()
|
this.props.modifyMainMenu('')
|
this.props.resetEditState(true)
|
} else {
|
this.setState({
|
loginLoading: false
|
})
|
notification.error({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
}
|
})
|
})
|
}
|
|
enterEdit = () => {
|
// 进入编辑状态
|
this.props.resetEditLevel('level1')
|
}
|
|
enterEditManage = () => {
|
const { editLevel } = this.props
|
|
if (editLevel === 'HS') return
|
|
this.props.resetEditLevel('HS')
|
this.props.modifyMainMenu({
|
MenuID: 'systemManageView'
|
})
|
}
|
|
/**
|
* @description 退出管理界面菜单
|
*/
|
exitManage = () => {
|
if (window.GLOB.systemType === 'official') { // 正式系统版本升级后,页面刷新
|
window.location.reload()
|
return
|
}
|
|
this.props.resetEditState(true)
|
this.props.resetEditLevel(false)
|
this.reload()
|
}
|
|
exitEdit = () => {
|
// 退出编辑状态
|
this.props.resetEditLevel(false)
|
}
|
|
changeSystem = (system) => {
|
let _param = window.btoa('ud=' + sessionStorage.getItem('UserID') + '&sd=' + sessionStorage.getItem('SessionUid') + '&ld=' + sessionStorage.getItem('LoginUID') + '&un=' + sessionStorage.getItem('User_Name'))
|
window.location.href = system.LinkUrl1 + '#/ssologin/' + _param
|
}
|
|
dropdownMenuChange = (visible) => {
|
this.setState({searchkey: ''}, () => {
|
if (visible) {
|
setTimeout(() => {
|
let input = document.getElementById('thdMenu-search')
|
|
if (input) {
|
input.focus()
|
}
|
}, 500)
|
}
|
})
|
}
|
|
selectMenu = (item) => {
|
const { tabviews } = this.props
|
|
let menu = JSON.parse(JSON.stringify(item))
|
menu.selected = true
|
|
let index = 0
|
let isexit = false
|
let tabs = tabviews.map((tab, i) => {
|
tab.selected = false
|
|
if (tab.MenuID === menu.MenuID) {
|
tab.selected = true
|
isexit = true
|
}
|
|
return tab
|
})
|
|
if (!isexit) {
|
tabs.splice(index + 1, 0, menu)
|
}
|
|
this.props.modifyTabview(tabs)
|
}
|
|
UNSAFE_componentWillMount () {
|
// 组件加载时,获取菜单数据
|
let _avatar = sessionStorage.getItem('avatar')
|
if (_avatar) {
|
_avatar = Utils.getrealurl(_avatar) // 头像
|
this.setState({avatar: _avatar})
|
}
|
this.getRolesMenu()
|
}
|
|
componentDidMount () {
|
// 获取角色菜单权限
|
Api.getSystemConfig({func: 's_Get_TrdMenu_Role'}).then(result => {
|
if (!result) return
|
if (result.status) {
|
let _permMenus = {}
|
let menulist = []
|
|
if (result.UserRoles) {
|
let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt']
|
|
result.UserRoles.forEach(role => {
|
role.RoleMenu.forEach(menu => {
|
if (!menu.MenuID) return
|
_permMenus[menu.MenuID] = true
|
|
let _type = ''
|
if (menu.LinkUrl) {
|
if (menu.LinkUrl === 'CommonTable') {
|
_type = 'CommonTable'
|
} else if (menu.LinkUrl === 'DataManage') {
|
_type = 'DataManage'
|
} else if (iframes.includes(menu.LinkUrl.split('?')[0])) {
|
_type = 'iframe'
|
}
|
}
|
|
if (_type !== 'iframe') {
|
let pageParam = {}
|
try {
|
pageParam = JSON.parse(menu.PageParam)
|
} catch (e) {
|
pageParam = {}
|
}
|
_type = pageParam.Template || _type
|
}
|
|
menulist.push({
|
MenuID: menu.MenuID,
|
MenuName: menu.MenuName,
|
MenuNo: menu.MenuNo || '',
|
EasyCode: menu.EasyCode || '',
|
LinkUrl: menu.LinkUrl,
|
type: _type
|
})
|
})
|
})
|
}
|
|
this.setState({
|
thdMenuList: menulist
|
})
|
|
this.props.initMenuPermission(_permMenus)
|
} else {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
}
|
})
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
render () {
|
const { thdMenuList, searchkey } = this.state
|
|
const menu = (
|
<Menu overlayclassname="header-dropdown">
|
{this.props.debug && <Menu.Item key="0">
|
{this.state.dict['header.edit']}
|
<Switch size="small" className="edit-switch" disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} />
|
</Menu.Item>}
|
{!this.props.editState ? <Menu.Item key="1" onClick={this.changePassword}>{this.state.dict['header.password']}</Menu.Item> : null}
|
{/* {this.state.systems.length > 0 ? <Menu.SubMenu title="切换系统">
|
{this.state.systems.map((system, index) => (
|
<Menu.Item className="header-subSystem" key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item>
|
))}
|
</Menu.SubMenu> : null} */}
|
<Menu.Item key="2" onClick={this.logout}>{this.state.dict['header.logout']}</Menu.Item>
|
</Menu>
|
)
|
|
return (
|
<header className="header-container ant-menu-dark" id="main-header-container">
|
<div className={this.props.collapse ? "collapse header-logo" : "header-logo"}><img src={this.state.logourl} alt=""/></div>
|
<div className={this.props.collapse ? "collapse header-collapse" : "header-collapse"} onClick={this.handleCollapse}>
|
<Icon type={this.props.collapse ? 'menu-unfold' : 'menu-fold'} />
|
</div>
|
{/* 正常菜单 */}
|
{this.props.editLevel !== 'level1' && this.state.menulist ?
|
<ul className={'header-menu ' + this.props.editLevel}>{
|
this.state.menulist.map(item => {
|
return (
|
<li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={this.props.selectmenu.MenuID === item.MenuID ? 'active' : ''}>
|
<span>{item.MenuName}</span>
|
</li>
|
)
|
})}
|
{this.props.editState && (!this.props.editLevel || this.props.editLevel === 'HS') ?
|
<li key="HS" onClick={this.enterEditManage} className={this.props.editLevel === 'HS' ? 'active' : ''}>
|
<span>HS</span>
|
</li> : null
|
}
|
</ul> : null
|
}
|
{this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>退出</Button> : null}
|
{/* 进入编辑按钮 */}
|
{this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null}
|
{this.props.editState && !this.props.editLevel ? <a href="#/mobile" target="_blank" className="mobile" type="edit"> 移动端 <Icon type="arrow-right" /></a> : null}
|
{/* 编辑菜单 */}
|
{this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null}
|
{/* 头像、用户名 */}
|
<Dropdown className="header-setting" overlay={menu}>
|
<div>
|
<img src={this.state.avatar} alt=""/>
|
<span>
|
<span className="username">{this.state.userName}</span> <Icon type="down" />
|
</span>
|
</div>
|
</Dropdown>
|
{/* 菜单搜索 */}
|
{!this.props.editState && thdMenuList.length > 0 ?
|
<Dropdown overlayClassName="menu-select-dropdown" getPopupContainer={() => document.getElementById('main-header-container')} overlay={
|
<div>
|
<Search
|
placeholder=""
|
id="thdMenu-search"
|
value={searchkey}
|
onChange={e => this.setState({searchkey: e.target.value})}
|
style={{ minWidth: '200px' }}
|
onSearch={(val, e) => {e.stopPropagation()}}
|
onClick={(e) => {e.stopPropagation()}}
|
/>
|
<div className="menu-select-box">
|
<Menu>
|
{thdMenuList.map(option => {
|
if (searchkey) {
|
if (
|
option.MenuName.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ||
|
option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ||
|
option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0
|
) {
|
return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
|
} else {
|
return null
|
}
|
}
|
return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
|
})}
|
</Menu>
|
</div>
|
</div>
|
} trigger={['click']} className="search-menu" placement="bottomRight" onVisibleChange={this.dropdownMenuChange}>
|
<Icon className="search-menu" type="search" />
|
</Dropdown> : null
|
}
|
{/* 修改密码 */}
|
<Modal
|
title={this.state.dict['header.password']}
|
okText={this.state.dict['header.confirm']}
|
cancelText={this.state.dict['header.cancel']}
|
visible={this.state.visible}
|
onOk={this.resetPwdSubmit}
|
confirmLoading={this.state.confirmLoading}
|
onCancel={this.handleCancel}
|
destroyOnClose
|
>
|
<Resetpwd dict={this.state.dict} wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/>
|
</Modal>
|
{/* 编辑状态登录 */}
|
<Modal
|
title={this.state.dict['header.login.develop']}
|
okText={this.state.dict['header.confirm']}
|
cancelText={this.state.dict['header.cancel']}
|
visible={this.state.loginVisible}
|
onOk={this.loginSubmit}
|
width={'430px'}
|
confirmLoading={this.state.loginLoading}
|
onCancel={() => {this.setState({ loginVisible: false, loginLoading: false })}}
|
destroyOnClose
|
>
|
<LoginForm handleSubmit={() => this.loginSubmit()} wrappedComponentRef={(inst) => this.loginRef = inst}/>
|
</Modal>
|
</header>
|
)
|
}
|
}
|
|
const mapStateToProps = (state) => {
|
return {
|
tabviews: state.tabviews,
|
collapse: state.collapse,
|
selectmenu: state.selectedMainMenu,
|
debug: state.debug,
|
editState: state.editState,
|
editLevel: state.editLevel,
|
permAction: state.permAction,
|
sysRoles: state.sysRoles,
|
permFuncField: state.permFuncField
|
}
|
}
|
|
const mapDispatchToProps = (dispatch) => {
|
return {
|
toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)),
|
modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)),
|
modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)),
|
resetEditState: (state) => dispatch(resetEditState(state)),
|
resetEditLevel: (level) => dispatch(resetEditLevel(level)),
|
initActionPermission: (permRoles, permAction) => dispatch(initActionPermission(permRoles, permAction)),
|
initPermission: (sysRoles, permFuncField) => dispatch(initPermission(sysRoles, permFuncField)),
|
initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)),
|
modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)),
|
resetState: () => dispatch(resetState()),
|
resetDebug: () => dispatch(resetDebug()),
|
logout: () => dispatch(logout())
|
}
|
}
|
|
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Form.create()(Header)))
|