| | |
| | | logout |
| | | } from '@/store/action' |
| | | import Api from '@/api' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | selectMenu = (item) => { |
| | | let tabs = fromJS(this.props.tabviews).toJS() |
| | | let menu = fromJS(item).toJS() |
| | | menu.selected = true |
| | | |
| | | tabs = tabs.filter(tab => { |
| | | tab.selected = false |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | |
| | | if (this.props.tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.setState({}, () => { |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | |
| | | componentDidMount () { |
| | | // 获取系统的版本信息,延时查询 |
| | | setTimeout(() => { |
| | | new Promise((resolve, reject) => { |
| | | Api.getAppVersion(resolve, reject) |
| | | }).then(res => { |
| | | Api.getAppVersion().then(res => { |
| | | this.setState({ |
| | | oriVersion: res.oldVersion, |
| | | newVersion: res.newVersion |
| | | }) |
| | | }, () => { |
| | | console.warn('websql 初始化错误!') |
| | | }) |
| | | }, () => {}) |
| | | }, 1000) |
| | | } |
| | | |
| | |
| | | content: `最新版本${newVersion},当前版本${oriVersion}`, |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.updateAppVersion(newVersion).then(res => { |
| | | if (res.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '升级成功!', |
| | | duration: 2 |
| | | }) |
| | | _this.setState({oriVersion: newVersion}) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '升级失败,请刷新页面重试!', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | if (!window.GLOB.WebSql) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '升级失败,请刷新页面重试!', |
| | | duration: 2 |
| | | }) |
| | | resolve() |
| | | }) |
| | | } else { |
| | | Api.updateAppVersion(newVersion) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '升级成功!', |
| | | duration: 2 |
| | | }) |
| | | _this.setState({oriVersion: newVersion}) |
| | | resolve() |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | window.open(url) |
| | | } else if (options.sysType === 'SSO' || options.sysType === 'cloud') { |
| | | window.open(`${window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '')}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`) |
| | | } |
| | | } |
| | | |
| | | changeVerMenu(menu, type) { |
| | | if (type === 'first') { |
| | | if (menu.PageParam.OpenType === 'menu') { |
| | | |
| | | } else if (menu.PageParam.OpenType === 'outpage') { |
| | | window.open(menu.PageParam.linkUrl) |
| | | } |
| | | } else { |
| | | if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { |
| | | window.open(menu.src) |
| | | } else if (menu.OpenType === 'blank') { |
| | | menu.selected = true |
| | | this.props.modifyTabview([menu]) |
| | | } else { |
| | | let tabs = fromJS(this.props.tabviews).toJS() |
| | | tabs = tabs.filter(tab => { |
| | | tab.selected = false |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | |
| | | if (this.props.tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.setState({}, () => { |
| | | menu.selected = true |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'}) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | <ul className="header-menu">{ |
| | | menulist.map(item => { |
| | | return ( |
| | | // <Dropdown overlay={ |
| | | // <Menu mode="vertical"> |
| | | // {item.children.map(cell => { |
| | | // if (!cell.children || cell.children.length === 0) { |
| | | // return ( |
| | | // <Menu.Item key={cell.MenuID}> |
| | | // {cell.MenuName} |
| | | // </Menu.Item> |
| | | // ) |
| | | // } else { |
| | | // return ( |
| | | // <Menu.SubMenu key={cell.MenuID} title={cell.MenuName}> |
| | | // {cell.children.map(m => ( |
| | | // <Menu.Item key={m.MenuID}> |
| | | // {m.MenuName} |
| | | // </Menu.Item> |
| | | // ))} |
| | | // </Menu.SubMenu> |
| | | // ) |
| | | // } |
| | | // })} |
| | | // </Menu> |
| | | // }> |
| | | // <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | // <span>{item.MenuName}</span> |
| | | // </li> |
| | | // </Dropdown> |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | |
| | | })} |
| | | </ul> : null |
| | | } |
| | | {/* 正常菜单 */} |
| | | {/* {menulist ? |
| | | <ul className="header-menu vertical-menu">{ |
| | | menulist.map(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | return ( |
| | | <Dropdown key={item.MenuID} overlayClassName="vertical-dropdown-menu" overlay={ |
| | | <Menu mode="vertical"> |
| | | {item.children.map(cell => { |
| | | if (!cell.children || cell.children.length === 0) { |
| | | return ( |
| | | <Menu.Item key={cell.MenuID}> |
| | | {cell.MenuName} |
| | | </Menu.Item> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <Menu.SubMenu popupClassName="vertical-dropdown-submenu" key={cell.MenuID} title={cell.MenuName}> |
| | | {cell.children.map(m => ( |
| | | <Menu.Item key={m.MenuID} onClick={() => {this.changeVerMenu(m)}}> |
| | | {m.MenuName} |
| | | </Menu.Item> |
| | | ))} |
| | | </Menu.SubMenu> |
| | | ) |
| | | } |
| | | })} |
| | | </Menu> |
| | | }> |
| | | <li> |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | | </Dropdown> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <li key={item.MenuID} onClick={() => {this.changeVerMenu(item, 'first')}}> |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | | ) |
| | | } |
| | | })} |
| | | </ul> : null |
| | | } */} |
| | | {/* 头像、用户名 */} |
| | | <Dropdown className="header-setting" overlay={menu}> |
| | | <div> |
| | |
| | | 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> |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item> |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> |
| | | })} |
| | | </Menu> |
| | | </div> |