From c95918fb0fffb61b1117fbf4cd429e291b9594d0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 九月 2021 01:02:34 +0800 Subject: [PATCH] 2021-09-17 --- src/components/tabview/index.jsx | 195 +++++-------- src/tabviews/custom/components/form/tab-form/index.jsx | 24 - src/tabviews/custom/components/card/table-card/index.jsx | 24 - src/tabviews/zshare/actionList/tabbutton/index.jsx | 37 -- src/views/design/index.scss | 14 src/tabviews/formtab/index.jsx | 31 - src/views/design/header/index.jsx | 11 src/components/header/index.jsx | 46 -- src/tabviews/custom/components/carousel/cardItem/index.jsx | 32 -- src/store/reducer.js | 8 src/tabviews/zshare/normalTable/index.jsx | 40 -- src/store/action-type.js | 3 src/tabviews/custom/components/card/cardItem/index.jsx | 26 - src/tabviews/custom/components/chart/antv-pie/index.jsx | 29 - src/tabviews/custom/components/form/normal-form/index.jsx | 24 - src/tabviews/custom/components/carousel/data-card/index.jsx | 83 ----- src/tabviews/custom/components/carousel/prop-card/index.jsx | 82 ----- src/store/action.js | 8 src/tabviews/custom/components/share/normalTable/index.jsx | 28 - src/views/design/sidemenu/index.jsx | 21 - src/components/sidemenu/index.jsx | 25 - src/utils/option.js | 2 22 files changed, 167 insertions(+), 626 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 84855e4..22d4bf1 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -10,7 +10,6 @@ toggleCollapse, modifyMenuTree, modifyMainMenu, - modifyTabview, initActionPermission, initMenuPermission, logout @@ -221,21 +220,12 @@ Promise.all([roledefer, menudefer]).then(response => { if (response[1]) { - let tabs = fromJS(this.props.tabviews).toJS() let menu = fromJS(response[1]).toJS() if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } else { - tabs = tabs.map(tab => { - tab.selected = false - return tab - }) - - menu.selected = true - tabs.push(menu) - this.props.modifyTabview(tabs) + MKEmitter.emit('modifyTabs', menu, 'plus') } } }) @@ -384,10 +374,6 @@ sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) sessionStorage.setItem('isEditState', 'true') - this.props.modifyMenuTree([]) - this.props.modifyMainMenu(null) - this.props.modifyTabview([]) - this.props.history.replace('/design') } } @@ -412,10 +398,6 @@ sessionStorage.setItem('isEditState', 'true') this.setSystemFuncs() - - this.props.modifyMenuTree([]) - this.props.modifyMainMenu(null) - this.props.modifyTabview([]) this.props.history.replace('/design') } else { @@ -632,27 +614,11 @@ if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { // NewPage涓烘墦寮�澶栭儴椤甸潰鍦板潃锛宯ewpage涓烘墦寮�绯荤粺鑿滃崟 window.open(menu.src) } else if (menu.OpenType === 'blank') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } else if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } 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) - }) + MKEmitter.emit('modifyTabs', menu, 'plus') } if (window.GLOB.systemType === 'production') { @@ -890,7 +856,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, collapse: state.collapse, menuTree: state.menuTree, mainMenu: state.mainMenu, @@ -901,7 +866,6 @@ const mapDispatchToProps = (dispatch) => { return { toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 4bb0b8b..846c5bd 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -4,7 +4,6 @@ import { is, fromJS } from 'immutable' import { Menu, Icon } from 'antd' -import { modifyTabview } from '@/store/action' import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' @@ -55,24 +54,9 @@ if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { window.open(menu.src) } else if (menu.OpenType === 'blank') { - menu.selected = true - this.props.modifyTabview([menu]) + MKEmitter.emit('modifyTabs', menu, 'replace') } 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) - }) + MKEmitter.emit('modifyTabs', menu, 'plus') } if (window.GLOB.systemType === 'production') { @@ -144,7 +128,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, collapse: state.collapse, isiframe: state.isiframe, mainMenu: state.mainMenu, @@ -153,9 +136,7 @@ } const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), - } + return {} } export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu) \ No newline at end of file diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index d12aba8..9cb3e0d 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -1,12 +1,12 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import {connect} from 'react-redux' -import { is, fromJS } from 'immutable' +import { fromJS } from 'immutable' import {Tabs, Icon, BackTop, notification} from 'antd' import moment from 'moment' import 'moment/locale/zh-cn' -import { modifyTabview, toggleIsiframe, initActionPermission } from '@/store/action' +import { toggleIsiframe, initActionPermission } from '@/store/action' import asyncComponent from '@/utils/asyncLoadComponent' import NotFount from '@/components/404' import options from '@/store/options.js' @@ -38,49 +38,21 @@ class TabViews extends Component { static propTpyes = { - collapse: PropTypes.bool, - tabviews: PropTypes.array // 鏍囩椤垫暟缁� + collapse: PropTypes.bool } state = { activeId: '', - // tabviews: [{ - // MenuID: 'home_page_id', - // MenuName: '棣栭〉', - // selected: true, - // type: 'Home' - // }], // 鏍囩闆� tabviews: null, // 鏍囩闆� iFrameHeight: 0, dict: sessionStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, } // 鍏抽棴tab椤碉紝閲嶆柊閫夋嫨鏄剧ず椤� - handleTabview = (e, menu, index) => { - e.stopPropagation() - let tabs = fromJS(this.state.tabviews).toJS() - tabs = tabs.filter(tab => { - return tab.MenuID !== menu.MenuID - }) - - if (menu.selected && tabs[index - 1]) { - tabs[index - 1].selected = true - this.setState({ - activeId: tabs[index - 1].MenuID || '' - }) - - if (this.props.isiframe) { - this.props.toggleIsiframe(false) - } - } - - this.props.modifyTabview(tabs) - } - - // 鍏抽棴tab椤碉紝閲嶆柊閫夋嫨鏄剧ず椤� closeTabView = (id) => { let tabs = fromJS(this.state.tabviews).toJS() - let index = 0 + let index = -1 + tabs = tabs.filter((tab, i) => { if (tab.MenuID === id) { index = i @@ -90,18 +62,28 @@ } }) - if (tabs[index - 1]) { - tabs[index - 1].selected = true + if (index > -1) { + let activeId = '' + if (index > 0) { + activeId = tabs[index - 1].MenuID || '' + } else if (tabs[index]) { + activeId = tabs[index].MenuID || '' + } + this.setState({ - activeId: tabs[index - 1].MenuID || '' + activeId, + tabviews: tabs }) if (this.props.isiframe) { this.props.toggleIsiframe(false) } - } - this.props.modifyTabview(tabs) + let node = document.getElementById('root').parentNode.parentNode + if (node) { + node.scrollTop = 0 + } + } } refreshTabview = (e, menu) => { @@ -156,47 +138,58 @@ } } - // modifyTabs = (tab, type) => { + modifyTabs = (tab, type) => { + const { tabviews } = this.state - // } + if (type === 'plus') { + if (tabviews.findIndex(item => item.MenuID === tab.MenuID) > -1) { + let _tabs = tabviews.filter(item => item.MenuID !== tab.MenuID) + this.setState({ + tabviews: _tabs + }, () => { + this.setState({ + tabviews: [..._tabs, tab], + activeId: tab.MenuID + }) + }) + } else { + this.setState({ + tabviews: [...tabviews, tab], + activeId: tab.MenuID + }) + } + } else if (type === 'replace') { + this.setState({ + tabviews: tab ? [tab] : [], + activeId: tab ? tab.MenuID : '' + }) + } + + let node = document.getElementById('root').parentNode.parentNode + if (node) { + node.scrollTop = 0 + } + } changeTab = (e, menu) => { e.stopPropagation() // 绐楀彛鍒囨崲 - let tabs = fromJS(this.state.tabviews).toJS() - tabs = tabs.map(tab => { - tab.selected = false + let _isiframe = this.props.isiframe + if (menu.type === 'iframe') { + _isiframe = true + } else { + _isiframe = false + } - if (tab.MenuID === menu.MenuID) { - tab.selected = true - } - - return tab - }) - - if (menu) { - let _isiframe = this.props.isiframe - if (menu.type === 'iframe') { - _isiframe = true - } else { - _isiframe = false - } - - if (_isiframe !== this.props.isiframe) { - this.props.toggleIsiframe(_isiframe) - } + if (_isiframe !== this.props.isiframe) { + this.props.toggleIsiframe(_isiframe) } this.setState({ - tabviews: tabs, activeId: menu.MenuID || '' }, () => { - if (menu.MenuID) { - MKEmitter.emit('resetActiveMenu', menu.MenuID) - } + MKEmitter.emit('resetActiveMenu', menu.MenuID || '') }) - - this.props.modifyTabview(tabs) } selectcomponent = (view) => { @@ -236,57 +229,31 @@ } else { moment.locale('en') } - this.setState({ - tabviews: this.props.tabviews - }) + + if (sessionStorage.getItem('isEditState') !== 'true') { + this.setState({ + activeId: 'home_page_id', + tabviews: [{ + MenuID: 'home_page_id', + MenuName: '棣栭〉', + type: 'Home' + }] + }) + } else { + this.setState({ + activeId: '', + tabviews: [] + }) + } } componentDidMount () { - if (sessionStorage.getItem('isEditState') !== 'true') { - let home = { - MenuID: 'home_page_id', - MenuName: '棣栭〉', - selected: true, - type: 'Home' - } - this.props.modifyTabview([home]) - } - // MKEmitter.addListener('modifyTabs', this.modifyTabs) + MKEmitter.addListener('modifyTabs', this.modifyTabs) MKEmitter.addListener('closeTabView', this.closeTabView) } UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { - let view = nextProps.tabviews.filter(tab => tab.selected)[0] - - // 绐楀彛鍦╥frame涓庢櫘閫氶〉闈㈠垏鎹㈡椂锛屼慨鏀瑰乏渚ц彍鍗曟爮鏍峰紡 - let activeId = '' - if (view) { - let _isiframe = this.props.isiframe - if (view.type === 'iframe') { - _isiframe = true - } else { - _isiframe = false - } - - if (_isiframe !== this.props.isiframe) { - this.props.toggleIsiframe(_isiframe) - } - - activeId = view.MenuID - } - - // 淇濆瓨淇敼鏍囩闆� - this.setState({ - tabviews: nextProps.tabviews, - activeId - }) - - let node = document.getElementById('root').parentNode.parentNode - if (node) { - node.scrollTop = 0 - } - } + } /** @@ -296,7 +263,7 @@ this.setState = () => { return } - // MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('modifyTabs', this.modifyTabs) MKEmitter.removeListener('closeTabView', this.closeTabView) } @@ -318,7 +285,7 @@ {view.MenuName} </span> {view.type !== 'Home' ? - <Icon type="close" onClick={(e) => {this.handleTabview(e, view, index)}}/> : null + <Icon type="close" onClick={(e) => {e.stopPropagation();this.closeTabView(view.MenuID)}}/> : null } </span> } @@ -346,7 +313,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, collapse: state.collapse, isiframe: state.isiframe } @@ -354,7 +320,6 @@ const mapDispatchToProps = (dispatch) => { return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), toggleIsiframe: (isiframe) => dispatch(toggleIsiframe(isiframe)) } diff --git a/src/store/action-type.js b/src/store/action-type.js index a63129f..08b822e 100644 --- a/src/store/action-type.js +++ b/src/store/action-type.js @@ -7,9 +7,6 @@ // 灞曞紑鍚堝苟鑿滃崟鏍� export const Toggle_COLLAPSE = 'Toggle_COLLAPSE' -// 淇敼瀵艰埅鏍忚彍鍗� -export const MODIFY_TABVIEW = 'MODIFY_TABVIEW' - // 淇敼绐楀彛鏍峰紡锛屽尯鍒唅frame涓庢甯搁〉闈� export const TOGGLE_ISIFRAME = 'TOGGLE_ISIFRAME' diff --git a/src/store/action.js b/src/store/action.js index 37d29d0..dd38fc8 100644 --- a/src/store/action.js +++ b/src/store/action.js @@ -24,14 +24,6 @@ } } -// 淇敼瀵艰埅鏍忚彍鍗� -export const modifyTabview = (tabviews) => { - return { - type: user.MODIFY_TABVIEW, - tabviews - } -} - // 淇敼绐楀彛鏍峰紡锛屽尯鍒唅frame涓庢甯搁〉闈� export const toggleIsiframe = (isiframe) => { return { diff --git a/src/store/reducer.js b/src/store/reducer.js index 40d35ee..e623cf4 100644 --- a/src/store/reducer.js +++ b/src/store/reducer.js @@ -24,7 +24,6 @@ let defaultState = { menuTree: null, // 鑿滃崟缁撴瀯鏍� mainMenu: _mainMenu, // 宸查�変富鑿滃崟 - tabviews: [], // 瀵艰埅鏍� collapse: _collapse, // 鏄惁鏀惰捣渚ц竟鏍忓鑸� isiframe: false, // 鏄惁涓篿frame绐楀彛 editLevel: null, // 缂栬緫鑿滃崟绾у埆锛屽�间负level1銆乴evel2銆乴evel3銆丠S @@ -53,12 +52,6 @@ return { ...state, mainMenu: action.mainMenu - } - case Type.MODIFY_TABVIEW: - // tab椤垫敼鍙� - return { - ...state, - tabviews: action.tabviews } case Type.TOGGLE_ISIFRAME: // 鍒囨崲鏄惁涓篿frame鐘舵�� @@ -94,7 +87,6 @@ return { menuTree: null, mainMenu: null, - tabviews: [], collapse: localStorage.getItem('collapse') === 'true', isiframe: false, editLevel: null, diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index 881b053..e8e0d52 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -5,7 +5,6 @@ import { notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' -import { modifyTabview } from '@/store/action' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -80,21 +79,9 @@ } if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - this.props.modifyTabview([newtab]) + MKEmitter.emit('modifyTabs', newtab, 'replace') } else { - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) + MKEmitter.emit('modifyTabs', newtab, 'plus') } } else if (card.setting.click === 'link') { let src = card.setting.linkurl @@ -137,15 +124,12 @@ const mapStateToProps = (state) => { return { - permMenus: state.permMenus, - tabviews: state.tabviews, + permMenus: state.permMenus } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(CardBoxComponent) \ No newline at end of file diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index d852e7e..748e8d3 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -8,7 +8,6 @@ import Utils from '@/utils/utils.js' import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' -import { modifyTabview } from '@/store/action' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -333,21 +332,9 @@ } if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - this.props.modifyTabview([newtab]) + MKEmitter.emit('modifyTabs', newtab, 'replace') } else { - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) + MKEmitter.emit('modifyTabs', newtab, 'plus') } } else if (card.setting.click === 'link') { let src = card.setting.linkurl @@ -444,14 +431,11 @@ const mapStateToProps = (state) => { return { permMenus: state.permMenus, - tabviews: state.tabviews, } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(TableCard) \ No newline at end of file diff --git a/src/tabviews/custom/components/carousel/cardItem/index.jsx b/src/tabviews/custom/components/carousel/cardItem/index.jsx index 2a29eee..94144cb 100644 --- a/src/tabviews/custom/components/carousel/cardItem/index.jsx +++ b/src/tabviews/custom/components/carousel/cardItem/index.jsx @@ -1,10 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import asyncComponent from '@/utils/asyncComponent' -import { modifyTabview } from '@/store/action' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -64,21 +62,9 @@ } if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - this.props.modifyTabview([newtab]) + MKEmitter.emit('modifyTabs', newtab, 'replace') } else { - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) + MKEmitter.emit('modifyTabs', newtab, 'plus') } } else if (card.setting.click === 'link') { let src = card.setting.linkurl @@ -114,16 +100,4 @@ } } -const mapStateToProps = (state) => { - return { - tabviews: state.tabviews, - } -} - -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(CardBoxComponent) \ No newline at end of file +export default CardBoxComponent \ No newline at end of file diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 392bbb6..8594a40 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -1,14 +1,12 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { connect } from 'react-redux' import { Spin, Empty, notification, Carousel } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' -import { modifyTabview } from '@/store/action' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -241,70 +239,6 @@ } } - openView = (item) => { - const { card } = this.state - - if (card.setting.click === 'menu') { - let menu = null - - if (card.setting.menu && card.setting.menu.length > 0) { - let menu_id = card.setting.menu.slice(-1)[0] - menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' - } - - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } - - let newtab = { - ...menu, - selected: true, - param: {} - } - - if (card.setting.joint === 'true') { - newtab.param.$BID = item.$$uuid - } - - if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - this.props.modifyTabview([newtab]) - } else { - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) - } - } else if (card.setting.click === 'link') { - let src = card.setting.linkurl - - if (card.setting.joint === 'true') { - let con = '?' - - if (/\?/ig.test(src)) { - con = '&' - } - - src = src + `${con}id=${item.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` - } - - window.open(src) - } - } - render() { const { config, loading, data, card } = this.state @@ -324,7 +258,7 @@ autoplaySpeed={config.wrap.speed} > {data.map((item, index) => ( - <div key={index} onClick={() => {this.openView(item)}}> + <div key={index}> <CardItem card={card} cards={config} data={item}/> </div> ))} @@ -335,17 +269,4 @@ } } -const mapStateToProps = (state) => { - return { - permMenus: state.permMenus, - tabviews: state.tabviews, - } -} - -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(DataCard) \ No newline at end of file +export default DataCard \ No newline at end of file diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 4020b61..316a0e5 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -1,14 +1,12 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { connect } from 'react-redux' import { Spin, notification, Carousel } from 'antd' import asyncComponent from '@/utils/asyncComponent' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' -import { modifyTabview } from '@/store/action' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -237,69 +235,6 @@ } } - openView = (item) => { - if (item.setting.click === 'menu') { - let menu = null - - if (item.setting.menu && item.setting.menu.length > 0) { - let menu_id = item.setting.menu.slice(-1)[0] - menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' - } - - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } - - let newtab = { - ...menu, - selected: true, - param: {} - } - - if (item.setting.joint === 'true') { - newtab.param.$BID = item.setting.primaryId - } - - if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - this.props.modifyTabview([newtab]) - } else { - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) - } - } else if (item.setting.click === 'link') { - let src = item.setting.linkurl - - if (item.setting.joint === 'true') { - let con = '?' - - if (/\?/ig.test(src)) { - con = '&' - } - - src = src + `${con}id=${item.setting.primaryId}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` - } - - window.open(src) - } - } - - render() { const { config, loading, data } = this.state @@ -319,7 +254,7 @@ autoplaySpeed={config.wrap.speed} > {config.subcards.map((item, index) => ( - <div key={index} onClick={() => {this.openView(item)}}> + <div key={index}> <CardItem card={item} cards={config} data={data}/> </div> ))} @@ -329,17 +264,4 @@ } } -const mapStateToProps = (state) => { - return { - permMenus: state.permMenus, - tabviews: state.tabviews, - } -} - -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(PropCard) \ No newline at end of file +export default PropCard \ No newline at end of file diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 325dcd4..9d4f491 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -9,15 +9,11 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import { modifyTabview } from '@/store/action' import { chartColors } from '@/utils/option.js' -// import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' - -// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) class PieChart extends Component { static propTpyes = { @@ -970,20 +966,12 @@ $BID: primaryId } } - - let tabs = this.props.tabviews.filter(tab => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', newtab, 'replace') + } else { + MKEmitter.emit('modifyTabs', newtab, 'plus') } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) } catch (e) { console.warn('鑿滃崟鎵撳紑澶辫触锛�') } @@ -1026,15 +1014,12 @@ 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)(PieChart) \ No newline at end of file diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx index 54a0d90..0a3a142 100644 --- a/src/tabviews/custom/components/form/normal-form/index.jsx +++ b/src/tabviews/custom/components/form/normal-form/index.jsx @@ -12,7 +12,6 @@ import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' -import { modifyTabview } from '@/store/action' import './index.scss' const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) @@ -250,19 +249,11 @@ param: {$BID: id || ''} } - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', newtab, 'replace') + } else { + MKEmitter.emit('modifyTabs', newtab, 'plus') } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) } } @@ -404,14 +395,11 @@ const mapStateToProps = (state) => { return { permMenus: state.permMenus, - tabviews: state.tabviews, } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(NormalForm) \ No newline at end of file diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 4082856..98bb970 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -12,7 +12,6 @@ import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' -import { modifyTabview } from '@/store/action' import './index.scss' const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) @@ -221,19 +220,11 @@ param: {$BID: id || ''} } - let tabs = this.props.tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== newtab.MenuID - }) - - if (this.props.tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', newtab, 'replace') + } else { + MKEmitter.emit('modifyTabs', newtab, 'plus') } - - this.setState({}, () => { - tabs.push(newtab) - this.props.modifyTabview(tabs) - }) } } @@ -349,14 +340,11 @@ const mapStateToProps = (state) => { return { permMenus: state.permMenus, - tabviews: state.tabviews, } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(TabForm) \ No newline at end of file diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index a1bb8fc..e56e977 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -5,7 +5,6 @@ import { is, fromJS } from 'immutable' import { Table, Typography, Icon, Col, Switch, message } from 'antd' -import { modifyTabview } from '@/store/action' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' @@ -564,7 +563,6 @@ // 瀛楁閫忚 triggerLink = (e, item, record) => { - const { tabviews } = this.props e.stopPropagation() let __param = { @@ -583,21 +581,12 @@ let tabmenu = item.linkThdMenu tabmenu.param = __param - tabmenu.selected = true - - let tabs = tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== tabmenu.MenuID - }) - - if (tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', tabmenu, 'replace') + } else { + MKEmitter.emit('modifyTabs', tabmenu, 'plus') } - - this.setState({}, () => { - tabs.push(tabmenu) - this.props.modifyTabview(tabs) - }) } else if (item.linkurl) { let src = item.linkurl @@ -907,15 +896,12 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - tabviews: state.tabviews, memberLevel: state.memberLevel } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index ed54cf2..35e72b5 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -16,7 +16,6 @@ import FormGroup from './formgroup' import FormAction from './actionList' import NotFount from '@/components/404' -import { modifyTabview } from '@/store/action' import './index.scss' const { TabPane } = Tabs @@ -507,16 +506,7 @@ MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) } - let tabs = this.props.tabviews.filter(tab => { - tab.selected = false - if (tab.MenuID === this.props.param.parentId) { - tab.selected = true - } - - return tab.MenuID !== this.props.MenuID - }) - - this.props.modifyTabview(tabs) + MKEmitter.emit('closeTabView', this.props.MenuID) } else if (type === 'error' && btn.afterExecError === 'notclose') { if (btn.execError === 'refresh') { this.loadmaindata() @@ -525,17 +515,7 @@ if (btn.execError !== 'never') { MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) } - - let tabs = this.props.tabviews.filter(tab => { - tab.selected = false - if (tab.MenuID === this.props.param.parentId) { - tab.selected = true - } - - return tab.MenuID !== this.props.MenuID - }) - - this.props.modifyTabview(tabs) + MKEmitter.emit('closeTabView', this.props.MenuID) } } @@ -692,15 +672,12 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - tabviews: state.tabviews, permAction: state.permAction } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index b500308..4b352b6 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -4,7 +4,6 @@ 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' @@ -78,7 +77,7 @@ * @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 @@ -122,7 +121,6 @@ primaryId: primaryId } } - // } else if (btn.tabTemplate === 'ThdMenu') { } else { let menu = null @@ -156,32 +154,10 @@ } } - 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') @@ -236,15 +212,12 @@ 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) \ No newline at end of file diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 86261d5..fdbc84e 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -5,7 +5,6 @@ import { is, fromJS } from 'immutable' import { Table, Affix, Typography, Icon } from 'antd' -import { modifyTabview } from '@/store/action' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import '@/assets/css/table.scss' @@ -204,8 +203,6 @@ // 瀛楁閫忚 triggerLink = (e, item, record) => { - const { tabviews, MenuID } = this.props - e.stopPropagation() let __param = { @@ -222,33 +219,13 @@ if (item.linkThdMenu) { let tabmenu = item.linkThdMenu - tabmenu.param = __param - tabmenu.selected = true - - let index = 0 - let tabs = tabviews.filter((tab, i) => { - tab.selected = false - - if (tab.MenuID === MenuID) { - index = i - } - - return tab.MenuID !== tabmenu.MenuID - }) - - if (tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', tabmenu, 'replace') + } else { + MKEmitter.emit('modifyTabs', tabmenu, 'plus') } - - this.setState({}, () => { - if (MenuID) { - tabs.splice(index + 1, 0, tabmenu) - } else { - tabs.push(tabmenu) - } - this.props.modifyTabview(tabs) - }) } else if (item.linkurl) { let src = item.linkurl @@ -1238,15 +1215,12 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - tabviews: state.tabviews, memberLevel: state.memberLevel } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file diff --git a/src/utils/option.js b/src/utils/option.js index b91afd5..df5e76b 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -803,6 +803,8 @@ 'phone', 'picture', 'red-envelope', + 'setting', + 'tool', 'smile', 'star', 'thunderbolt', diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 7313843..db4bf38 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -8,7 +8,6 @@ import { modifyMenuTree, modifyMainMenu, - modifyTabview, resetEditLevel, logout } from '@/store/action' @@ -19,6 +18,7 @@ import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' +import MKEmitter from '@/utils/events.js' import './index.scss' const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu')) @@ -214,7 +214,8 @@ this.props.modifyMainMenu(menulist[0] || null) this.props.resetEditLevel(false) - this.props.modifyTabview([]) + + MKEmitter.emit('modifyTabs', null, 'replace') } exitEdit = () => { @@ -300,7 +301,7 @@ } render () { - const { mainMenu, editLevel, tabviews } = this.props + const { mainMenu, editLevel } = this.props const { menulist } = this.state return ( @@ -339,7 +340,7 @@ </Button> </div> : null } - {editLevel === 'HS' && tabviews.length === 0 && options.sysType === 'local' && window.GLOB.systemType === 'production' && this.props.memberLevel >= 20 ? + {editLevel === 'HS' && options.sysType === 'local' && window.GLOB.systemType === 'production' && this.props.memberLevel >= 20 ? <div className="app-prod-entrance entrance"> <div className="icon"><Icon type="appstore" /></div> <div className="title">搴旂敤绠$悊</div> @@ -400,7 +401,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, menuTree: state.menuTree, mainMenu: state.mainMenu, editLevel: state.editLevel, @@ -411,7 +411,6 @@ const mapDispatchToProps = (dispatch) => { return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), resetEditLevel: (level) => dispatch(resetEditLevel(level)), diff --git a/src/views/design/index.scss b/src/views/design/index.scss index 7e50489..deb9746 100644 --- a/src/views/design/index.scss +++ b/src/views/design/index.scss @@ -3,6 +3,14 @@ flex: auto; min-height: 100%; } -// .mk-design-view { -// background-color: rgb(238, 241, 246); -// } \ No newline at end of file +.mk-design-view { + #mk-tabview-wrap { + z-index: unset; + >.content-header { + >.ant-tabs { + z-index: 21; + background: #ffffff; + } + } + } +} \ No newline at end of file diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index 99c1da2..e92164f 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -4,12 +4,13 @@ import { Menu, Icon, notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' -import { modifyTabview, resetEditLevel, modifyMenuTree, modifyMainMenu } from '@/store/action' +import { resetEditLevel, modifyMenuTree, modifyMainMenu } from '@/store/action' import { SySMenuList } from './config' import options from '@/store/options.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Api from '@/api' +import MKEmitter from '@/utils/events.js' import './index.scss' const EditSecMenu = asyncComponent(() => import('@/templates/menuconfig/editsecmenu')) @@ -82,21 +83,7 @@ return } - 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) - }) + MKEmitter.emit('modifyTabs', menu, 'plus') } UNSAFE_componentWillReceiveProps (nextProps) { @@ -303,7 +290,6 @@ const mapStateToProps = (state) => { return { - tabviews: state.tabviews, mainMenu: state.mainMenu, menuTree: state.menuTree, memberLevel: state.memberLevel, @@ -315,7 +301,6 @@ return { modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), resetEditLevel: (level) => dispatch(resetEditLevel(level)) } } -- Gitblit v1.8.0