// 外部路由跳转专用■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
// 跳转路由路径
go2RouterPath({ path, query = {}, target = `_self`, cb } = {}, _this) {
if (path && (this.checkEverything("httpurl", path) || path.indexOf("//") === 0)) {
window.open(`${path}${this.formatAsUrlParamString(query)}`, target);
} else {
path || (path = _this.$route.path);
let pathQuery = this.getUrlParams(path);//获取path的跟参对象
query = {
BMID: $global.getBMID(),//资源系统需要部门参数
roleID: this.getRoleID(_this),//科研系统需要角色参数
..._this.$route.query,//如果path没有跟参,就用当前网页跟参
...pathQuery,//如果path有跟参,就覆盖当前网页跟参
...query,//如果query有参数,就覆盖当前path以及网页跟参
};
Object.keys(query || {}).forEach(k => query[k] == null && delete query[k]);//去掉值为null或undefined的对象属性
let o = { path, query, };
if (target === `_self`) {
_this.$router.push(o).catch(() => true);
} else {
let href = _this.$router.resolve(o).href;
window.open(href, target);
}
}
_this.$nextTick(() => cb && cb(...arguments));
},
//获取当前用户角色ID
getRoleID(_this) {
return _this.$route.query.roleID || _this.$store.getters._global.roleID;
},
// 内部跳转专用----------------------------------------
go2InsidePath({ path = ``, tab = ``, filters = null, params = null, cb }, _this) {
_this.$store.getters._global.tab = tab; //查看所有成果
_this.$store.getters._global.filters = filters; //查看所有成果
_this.$store.getters._global.params = params;//内部特殊参数
$global.leftMenuSelect(path);
_this.$nextTick(() => cb && cb(...arguments));
},
// ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
外部路由跳转专用go2RouterPath方法
于 2025-08-27 12:18:47 首次发布