Browse Source

chore: 架构调整

master
wangxiang 2 years ago
parent
commit
c42f9c1c3b
  1. 2
      src/api/platform/report/controller/reportSystemFile.ts
  2. 7
      src/layouts/iframe/useFrameKeepAlive.ts
  3. 6
      src/router/guard/paramMenuGuard.ts
  4. 18
      src/views/report/design/index.vue

2
src/api/platform/report/controller/reportSystemFile.ts

@ -4,7 +4,7 @@ import { defHttp } from '/@/utils/http/axios'; @@ -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',
}
/** 查询报表列表 */

7
src/layouts/iframe/useFrameKeepAlive.ts

@ -32,8 +32,11 @@ export function useFrameKeepAlive() { @@ -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) {

6
src/router/guard/paramMenuGuard.ts

@ -2,7 +2,7 @@ import type { Router } from 'vue-router'; @@ -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) { @@ -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();
});

18
src/views/report/design/index.vue

@ -107,15 +107,27 @@ @@ -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) {

Loading…
Cancel
Save