| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, notification, Icon } from 'antd' |
| | | |
| | | import { modifyTabview } from '@/store/action' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record, type) => { |
| | | const { setting, btn, tabviews, MenuID, selectedData } = this.props |
| | | const { setting, btn, selectedData } = this.props |
| | | |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | |
| | | primaryId: primaryId |
| | | } |
| | | } |
| | | // } else if (btn.tabTemplate === 'ThdMenu') { |
| | | } else { |
| | | let menu = null |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let index = 0 |
| | | let tabs = tabviews.filter((tab, i) => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === MenuID) { |
| | | index = i |
| | | } |
| | | |
| | | return tab.MenuID !== newtab.MenuID |
| | | }) |
| | | |
| | | if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { |
| | | this.props.modifyTabview([newtab]) |
| | | MKEmitter.emit('modifyTabs', newtab, 'replace') |
| | | } else { |
| | | if (tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.setState({}, () => { |
| | | if (MenuID) { |
| | | tabs.splice(index + 1, 0, newtab) |
| | | } else { |
| | | tabs.push(newtab) |
| | | } |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | MKEmitter.emit('modifyTabs', newtab, 'plus') |
| | | } |
| | | |
| | | MKEmitter.emit('openNewTab') |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | permMenus: state.permMenus, |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) |
| | | } |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(TabButton) |