import {Modal} from 'ant-design-vue'
import 'ant-design-vue/lib/modal/style/css'
const _checkSameTab = (to,next)=>{
//当前页签组
const pagesList = JSON.parse(sessionStorage.getItem('pagesList')) || [];
const tabPaths = pagesList && pagesList.map(i=>{return i.path});
const tabPathIndex = tabPaths.indexOf(to.path);
const existsTabObj = tabPathIndex !== -1 ? pagesList[tabPathIndex] : false;
//判断当前是否是新增操作 并且 是否存在于 当前标签组内 (需要弹窗并跳转到重复页签)
if(existsTabObj){
const preFullPath = existsTabObj.fullPath;
const modal = Modal.warning();
modal.update({
title:"检测到当前有正在操作的相同业务页面",
content: (h)=>{
return (
<div class="share-content">
{/<a-icon type="question-circle"/>/}
<div>
{/<h3 class="m-ver-5 red">检测到当前有正在操作的相同业务页面</h3>/}
<div class="mt-10" style=" display: flex;justify-content: flex-start;align-items: center;">
<a-button onClick={()=>_checkSameHandle('cancel',preFullPath,modal,next)}>取消</a-button>
<a-button style="margin:0 30px;" onClick={()=>_checkSameHandle('create',preFullPath,modal,next)}>新建</a-button>
<a-button type="primary" onClick={()=>_checkSameHandle('edit',preFullPath,modal,next)}>继续编辑</a-button>
</div>
</div>
</div>
)
}
});
//dom方式删除底部确认按钮
document.getElementsByClassName('ant-modal-confirm-btns')[0].remove();
return true
}
return false;
};
网友评论