From c42f9c1c3b38f155c878cb1db6224930d6622be4 Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Mon, 17 Jul 2023 19:26:42 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9E=B6=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/controller/reportSystemFile.ts | 2 +- src/layouts/iframe/useFrameKeepAlive.ts | 7 +++++-- src/router/guard/paramMenuGuard.ts | 6 +++--- src/views/report/design/index.vue | 18 +++++++++++++++--- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/api/platform/report/controller/reportSystemFile.ts b/src/api/platform/report/controller/reportSystemFile.ts index 80ebed8..fa39f82 100644 --- a/src/api/platform/report/controller/reportSystemFile.ts +++ b/src/api/platform/report/controller/reportSystemFile.ts @@ -4,7 +4,7 @@ import { defHttp } from '/@/utils/http/axios'; enum Api { list = '/report_proxy/report/rest/list', get = '/report_proxy/report/rest', - del = '/report_proxy/report/client/remove', + del = '/report_proxy/report/rest/remove', } /** 查询报表列表 */ diff --git a/src/layouts/iframe/useFrameKeepAlive.ts b/src/layouts/iframe/useFrameKeepAlive.ts index e84c49f..9dcd751 100644 --- a/src/layouts/iframe/useFrameKeepAlive.ts +++ b/src/layouts/iframe/useFrameKeepAlive.ts @@ -32,8 +32,11 @@ export function useFrameKeepAlive() { function getAllFramePages(routes: AppRouteRecordRaw[]): AppRouteRecordRaw[] { let res: AppRouteRecordRaw[] = []; for (const route of routes) { - const { meta: { frameSrc } = {}, children } = route; - if (frameSrc) { + const { name: currentName, meta: currentMeta } = unref(currentRoute); + const { name ,meta: { frameSrc } = {}, children } = route; + if (currentMeta?.frameSrc || frameSrc) { + // 替换已定义的路由配置信息 + (currentName === name) && Object.assign(route.meta, currentMeta); res.push(route); } if (children && children.length) { diff --git a/src/router/guard/paramMenuGuard.ts b/src/router/guard/paramMenuGuard.ts index 2e71a08..8f73e38 100644 --- a/src/router/guard/paramMenuGuard.ts +++ b/src/router/guard/paramMenuGuard.ts @@ -2,7 +2,7 @@ import type { Router } from 'vue-router'; import { configureDynamicParamsMenu } from '../helper/menuHelper'; import { Menu } from '../types'; import { usePermissionStoreWithOut } from '/@/store/modules/permission'; -import { merge } from 'lodash-es'; +import { merge, omit } from 'lodash-es'; export function createParamMenuGuard(router: Router) { const permissionStore = usePermissionStoreWithOut(); @@ -20,8 +20,8 @@ export function createParamMenuGuard(router: Router) { let menus: Menu[] = permissionStore.getMenuList; menus.forEach((item) => configureDynamicParamsMenu(item, to.params)); // 处理路由切换动态替换vue-router自定义元数据 - if (to.query?.enableMetaMerge === 'y') { - merge(to.meta, to.query); + if (to.query?.openMetaUpdate === 'y') { + merge(to.meta, omit(to.query, 'openMetaUpdate')); } next(); }); diff --git a/src/views/report/design/index.vue b/src/views/report/design/index.vue index 282cee2..3d180f1 100644 --- a/src/views/report/design/index.vue +++ b/src/views/report/design/index.vue @@ -107,15 +107,27 @@ } function handleAdd() { - push({ name: '报表设计器', query: { enableMetaMerge: 'y', title: '设计报表', frameSrc: 'https://www.baidu.com' } }); + push({ path: '/report/edit', query: { + openMetaUpdate: 'y', + title: '新增报表', + frameSrc: 'https://192.168.3.10/ureport/designer' + }}); } function handleDesign(record: Recordable) { - push({ name: '报表设计' }); + push({ path: '/report/edit', query: { + openMetaUpdate: 'y', + title: '编辑报表', + frameSrc: `https://192.168.3.10/ureport/designer?_u=file:${record.name}` + }}); } function handlePreview(record: Recordable) { - + push({ path: '/report/preview', query: { + openMetaUpdate: 'y', + title: '预览报表', + frameSrc: `https://192.168.3.10/ureport/preview?_u=file:${record.name}` + }}); } async function handleDel(record?: Recordable) {