|
@@ -80,15 +80,38 @@ export function openWindow(url: string, opt?: { target?: TargetContext | string;
|
|
|
window.open(url, target, feature.join(','));
|
|
window.open(url, target, feature.join(','));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 高级路由跳转:支持去往外部系统时携带 deptId 参数并自动设置当前部门
|
|
|
|
|
+ *
|
|
|
|
|
+ * 功能说明:
|
|
|
|
|
+ * 1. 支持两种调用方式:直接传路径字符串,或传包含 path/name/query 的对象
|
|
|
|
|
+ * 2. 从 URL 参数或 query 对象中提取 deptId
|
|
|
|
|
+ * 3. 如果存在 deptId,自动设置到 mineDepartmentStore 中(用于跨系统页面传递部门上下文)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * // 方式1:字符串路径
|
|
|
|
|
+ * advancedRoutePush('/warningAnalysis/connectAnalysis?deptId=123')
|
|
|
|
|
+ *
|
|
|
|
|
+ * // 方式2:对象参数
|
|
|
|
|
+ * advancedRoutePush({
|
|
|
|
|
+ * path: '/warningAnalysis/connectAnalysis',
|
|
|
|
|
+ * query: { deptId: '123', type: 'mine' }
|
|
|
|
|
+ * })
|
|
|
|
|
+ *
|
|
|
|
|
+ * // 方式3:按 name 跳转
|
|
|
|
|
+ * advancedRoutePush({ name: 'ConnectAnalysis', query: { deptId: '456' } })
|
|
|
|
|
+ */
|
|
|
export function advancedRoutePush(path: string): Promise<any>;
|
|
export function advancedRoutePush(path: string): Promise<any>;
|
|
|
export function advancedRoutePush(params: { path?: string; query?: any; name?: string }): Promise<any>;
|
|
export function advancedRoutePush(params: { path?: string; query?: any; name?: string }): Promise<any>;
|
|
|
export function advancedRoutePush(params: { path?: string; query?: any; name?: string } | string) {
|
|
export function advancedRoutePush(params: { path?: string; query?: any; name?: string } | string) {
|
|
|
let query;
|
|
let query;
|
|
|
if (typeof params === 'string') {
|
|
if (typeof params === 'string') {
|
|
|
|
|
+ // 字符串模式下从 URL 中解析查询参数
|
|
|
query = QueryString.parse(get(params.split('?'), '[1]', ''));
|
|
query = QueryString.parse(get(params.split('?'), '[1]', ''));
|
|
|
} else {
|
|
} else {
|
|
|
query = params.query;
|
|
query = params.query;
|
|
|
}
|
|
}
|
|
|
|
|
+ // 如果携带了 deptId 参数,自动设置当前部门(用于跨系统页面联动)
|
|
|
if (query && query.deptId) {
|
|
if (query && query.deptId) {
|
|
|
useMineDepartmentStore().setDepartById(query.deptId);
|
|
useMineDepartmentStore().setDepartById(query.deptId);
|
|
|
}
|
|
}
|