|
|
@@ -178,7 +178,11 @@
|
|
|
async handleAddOrEdit(row, formPath) {
|
|
|
await updateNotifyMessageReadByIdAPI([row.id]);
|
|
|
if (formPath) {
|
|
|
+ // 跨子系统跳转:pushState + 触发 popstate 让 qiankun 主应用感知路由变化
|
|
|
window.history.pushState(null, '', formPath);
|
|
|
+ const evt = new PopStateEvent('popstate', { state: null });
|
|
|
+ window.dispatchEvent(evt);
|
|
|
+ return;
|
|
|
}
|
|
|
this.$refs.table.reload();
|
|
|
},
|
|
|
@@ -194,7 +198,26 @@
|
|
|
|
|
|
goDetail(row) {
|
|
|
console.log('row', row.formPath);
|
|
|
- this.$router.push(`${row.formPath}`);
|
|
|
+ const formPath = row.formPath;
|
|
|
+ if (!formPath) return;
|
|
|
+ // 获取当前子系统的路由 base 前缀
|
|
|
+ const routerBase = this.$router.options.base || '/';
|
|
|
+ // 判断目标路径是否属于当前子系统
|
|
|
+ const isCurrentApp =
|
|
|
+ formPath.startsWith(routerBase) ||
|
|
|
+ !formPath.startsWith('/page-');
|
|
|
+ if (isCurrentApp) {
|
|
|
+ // 本系统内跳转:去掉 base 前缀后使用 router.push
|
|
|
+ const innerPath = formPath.startsWith(routerBase)
|
|
|
+ ? formPath.slice(routerBase.length - 1)
|
|
|
+ : formPath;
|
|
|
+ this.$router.push(innerPath);
|
|
|
+ } else {
|
|
|
+ // 跨子系统跳转:通过修改 URL 并触发 popstate 让 qiankun 主应用切换子系统
|
|
|
+ window.history.pushState(null, '', formPath);
|
|
|
+ const evt = new PopStateEvent('popstate', { state: null });
|
|
|
+ window.dispatchEvent(evt);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
datasource({ page, where, limit, ...row }) {
|