|
@@ -1,7 +1,7 @@
|
|
import { Menu, message } from 'antd';
|
|
import { Menu, message } from 'antd';
|
|
import { useState, useEffect } from 'react';
|
|
import { useState, useEffect } from 'react';
|
|
import { useDispatch, useSelector } from 'react-redux'
|
|
import { useDispatch, useSelector } from 'react-redux'
|
|
-import { add, active } from '@reducers/tabPanes'
|
|
|
|
|
|
+import { add, active,close } from '@reducers/tabPanes'
|
|
import { HomeOutlined, BarChartOutlined, SafetyCertificateOutlined, TableOutlined, SettingOutlined, BellOutlined,FileProtectOutlined } from '@ant-design/icons';
|
|
import { HomeOutlined, BarChartOutlined, SafetyCertificateOutlined, TableOutlined, SettingOutlined, BellOutlined,FileProtectOutlined } from '@ant-design/icons';
|
|
import { NotebookAndPen,ChartPie } from '@icon-park/react';
|
|
import { NotebookAndPen,ChartPie } from '@icon-park/react';
|
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
@@ -76,8 +76,15 @@ function AMenu() {
|
|
function changeMenu(val) {
|
|
function changeMenu(val) {
|
|
const idName = val.key.split("&");
|
|
const idName = val.key.split("&");
|
|
const item = panes.find((it) => it.key === val.key);
|
|
const item = panes.find((it) => it.key === val.key);
|
|
|
|
+ const paneIndex = panes.findIndex((it)=>it.key===val.key);
|
|
if (item) { //已存在当前tab,则定位即可不增加
|
|
if (item) { //已存在当前tab,则定位即可不增加
|
|
- dispatch(active({ idName: val.key }));
|
|
|
|
|
|
+ dispatch(close({delIndex:paneIndex,active:val.key}))
|
|
|
|
+ setTimeout(function (){
|
|
|
|
+ dispatch(
|
|
|
|
+ add({ title: idName[1], content: pageMap[idName[0]] || <NullPage />, key: val.key })
|
|
|
|
+ )
|
|
|
|
+ }, 50);
|
|
|
|
+
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
dispatch(
|
|
dispatch(
|