| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { position } = this.props |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record) => { |
| | | actionTrigger = (triggerId, record, type) => { |
| | | const { setting, btn, tabviews, MenuID, selectedData } = this.props |
| | | |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | | if (type === 'linkbtn' && selectedData && selectedData.length === 1) { |
| | | if (record[0].$Index !== selectedData[0].$Index) { |
| | | return |
| | | } |
| | | } |
| | | |
| | | let data = record || selectedData || [] |
| | | |
| | |
| | | primaryId: primaryId |
| | | } |
| | | } |
| | | } else if (btn.tabTemplate === 'ThdMenu') { |
| | | // } else if (btn.tabTemplate === 'ThdMenu') { |
| | | } else { |
| | | let menu = null |
| | | |
| | | if (btn.linkmenu && btn.linkmenu.length > 0) { |
| | | if (btn.MenuID) { |
| | | menu = { |
| | | MenuID: btn.MenuID, |
| | | MenuName: btn.MenuName, |
| | | MenuNo: btn.MenuNo, |
| | | type: btn.tabType |
| | | } |
| | | } else if (btn.linkmenu && btn.linkmenu.length > 0) { |
| | | let menu_id = btn.linkmenu.slice(-1)[0] |
| | | menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } |
| | |
| | | return tab.MenuID !== newtab.MenuID |
| | | }) |
| | | |
| | | if (['linkage_navigation', 'linkage'].includes(window.GLOB.navBar)) { |
| | | if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { |
| | | this.props.modifyTabview([newtab]) |
| | | } else { |
| | | if (tabviews.length !== tabs.length) { |
| | |
| | | label = btn.label |
| | | icon = btn.icon || '' |
| | | } else if (show === 'link') { |
| | | label = <span>{btn.label}{btn.icon ? <Icon type={btn.icon}/> : ''}</span> |
| | | label = <span>{btn.label}{btn.icon ? <Icon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> |
| | | icon = '' |
| | | } else if (show === 'icon') { |
| | | icon = btn.icon || '' |