5d368f34 by lihua

fix报表

1 parent 617a6b60
......@@ -37,6 +37,7 @@
"html2canvas": "^1.4.1",
"insert-css": "^2.0.0",
"jquery": "^3.7.1",
"jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21",
"md5": "^2.3.0",
"mitt": "^3.0.0",
......
......@@ -71,6 +71,9 @@ dependencies:
jquery:
specifier: ^3.7.1
version: 3.7.1
jsencrypt:
specifier: ^3.3.2
version: 3.3.2
lodash-es:
specifier: ^4.17.21
version: 4.17.21
......@@ -6426,6 +6429,10 @@ packages:
resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==}
dev: true
/jsencrypt@3.3.2:
resolution: {integrity: sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==}
dev: false
/jsesc@0.5.0:
resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==}
hasBin: true
......
......@@ -19,8 +19,18 @@ function onSidebarScroll(e: Event) {
const defaultMenuActive = computed(() => {
let path = route.meta.activeMenu || route.path;
let sideMenus = menuStore.sidebarMenus;
let isSide = sideMenus.some(s => s.path === path || s.children?.some(c => path === `${s.path}/${c.path}`));
let isSide = sideMenus.some(s => s.path === path || s.children?.some(c => path === `${s.path}/${c.path}`) || (path.includes('/data-meta/report') && s.path?.includes('/data-meta/report')));
if (isSide) {
if (path.includes('/data-meta/report')) {
let index = route.fullPath.indexOf("?");
if (index > -1) {
let params = route.fullPath.substring(index + 1);
let searchParams: any = new URLSearchParams(params);
return `${path}?title=${searchParams.get('title')}&url=${encodeURIComponent(searchParams.get('url'))}`
} else {
return route.fullPath;
}
}
return path;
}
let matched = route.matched;
......@@ -38,22 +48,26 @@ const defaultMenuActive = computed(() => {
</script>
<template>
<div v-if="['side', 'head', 'single'].includes(settingsStore.settings.menu.menuMode) || settingsStore.mode === 'mobile'" class="sub-sidebar-container" :class="{ 'is-collapse': settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive =='/data-asset-index') }" @scroll="onSidebarScroll">
<Logo
:show-logo="settingsStore.settings.menu.menuMode === 'single'" class="sidebar-logo" :class="{
'sidebar-logo-bg': settingsStore.settings.menu.menuMode === 'single',
'shadow': sidebarScrollTop,
}"
/>
<div
v-if="['side', 'head', 'single'].includes(settingsStore.settings.menu.menuMode) || settingsStore.mode === 'mobile'"
class="sub-sidebar-container"
:class="{ 'is-collapse': settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive == '/data-asset-index') }"
@scroll="onSidebarScroll">
<Logo :show-logo="settingsStore.settings.menu.menuMode === 'single'" class="sidebar-logo" :class="{
'sidebar-logo-bg': settingsStore.settings.menu.menuMode === 'single',
'shadow': sidebarScrollTop,
}" />
<!-- 侧边栏模式(无主导航) -->
<el-menu
:unique-opened="settingsStore.settings.menu.subMenuUniqueOpened" :default-openeds="menuStore.defaultOpenedPaths" :default-active="defaultMenuActive" :collapse="settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive =='/data-asset-index')" :collapse-transition="false" :class="{
<el-menu :unique-opened="settingsStore.settings.menu.subMenuUniqueOpened"
:default-openeds="menuStore.defaultOpenedPaths" :default-active="defaultMenuActive"
:collapse="settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive == '/data-asset-index')"
:collapse-transition="false" :class="{
'is-collapse-without-logo': settingsStore.settings.menu.menuMode !== 'single' && settingsStore.settings.menu.subMenuCollapse,
}"
>
}">
<transition-group name="sub-sidebar">
<template v-for="(route, index) in menuStore.sidebarMenus">
<SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path || index" :item="route" :base-path="route.path" />
<SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path || index" :item="route"
:base-path="route.path" />
</template>
</transition-group>
</el-menu>
......@@ -140,6 +154,7 @@ const defaultMenuActive = computed(() => {
:deep(.el-menu-item),
:deep(.el-sub-menu__title) {
span,
.el-sub-menu__icon-arrow {
display: none;
......
......@@ -58,10 +58,18 @@ watch(
const changeTab = (pane: any, ev: any) => {
const tabIndex = Number(pane.index);
const paneData: any = tabbarList.value[tabIndex];
router.push({
name: paneData.name,
query: paneData.query
});
if (paneData.name == 'budgetDataIndex') {
router.push(paneData.fullPath);
} else {
router.push({
name: paneData.name,
query: paneData.query
});
}
// router.push({
// name: paneData.name,
// query: paneData.query
// });
const combPath = paneData.fullPath.split('/')[1] || 'app-scenes'
userStore.setActiveTabbar(combPath, paneData.fullPath);
};
......
......@@ -133,6 +133,29 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/data-meta/report',
component: Layout,
meta: {
title: '报表查看',
icon: 'sidebar-videos',
},
children: [
{
path: 'budgetDataIndex',
name: 'budgetDataIndex',
component: () => import('@/views/data_meta/budgetDataIndex.vue'),
meta: {
title: '',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
activeMenu: '/data-meta/report/budgetDataIndex',
},
}
]
}
]
export default routes
......
......@@ -63,7 +63,11 @@ const useMenuStore = defineStore(
retnPath = getDeepestPath(item, resolveRoutePath(rootPath, menu.path))
}
else {
retnPath = getDeepestPath(menu.children[0], resolveRoutePath(rootPath, menu.path))
if (!menu.children[0]) {
retnPath = menu.path;
} else {
retnPath = getDeepestPath(menu.children[0], resolveRoutePath(rootPath, menu.path))
}
}
}
else {
......@@ -170,6 +174,9 @@ const useMenuStore = defineStore(
else {
// 如果是 string 类型,则认为是路由,需要查找对应的主导航索引
const findIndex = allMenus.value.findIndex(item => item.children.some(r => {
if (data== "/data-meta/report/budgetDataIndex" && r.path?.includes('/data-meta/report')) {
return true;
}
if (data.indexOf(`${r.path}/`) === 0 || data === r.path) {
return true;
}
......
......@@ -156,7 +156,10 @@ const useRouteStore = defineStore(
title: m.productName || m.menuName
};
}
r = routes.find((route: any) => route.path === path || route.path === m.path || `/${route.path}` === m.path);
r = routes.find((route: any) => route.path === path || route.path === m.path || `/${route.path}` === m.path || (path.includes('/data-meta/report') && route.path.includes('/data-meta/report')));
if (r && path.includes('budgetDataIndex')) {
r.path = path;
}
if(r && m.icon && m.icon !== "{}") {
r.meta.icon = m.icon
......@@ -206,6 +209,9 @@ const useRouteStore = defineStore(
}
else {
if (m.menuType === 'C' && tmpRoute.children?.length) {
tmpRoute.children.forEach(c => {
!c.meta.title && (c.meta.title = tmpRoute.meta.title);
});
tmpRoute.children = tmpRoute.children?.filter(t => t.path == '') || [];
}
res.push(tmpRoute)
......
<route lang="yaml">
# 组件名称
name: ""
</route>
<template>
<iframe :style="tableStyle" :src="link" frameborder="0"></iframe>
</template>
<script lang="ts" setup name="budgetDataIndex">
import { ref, reactive, computed } from "vue";
import { JSEncrypt } from 'jsencrypt';
import { useElementSize } from "@vueuse/core";
import useUserStore from '@/store/modules/user'
const route = useRoute()
const encryptor = new JSEncrypt()
const publicKey = '-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiv3Ko6rOBvWDK96tIExpdyuuQAGgZo0YmQxpT10hD3qu/MnNKlIJgo4+NwUHcwpleKE2DBOxgvCeMtUoP4FDWt8q18X+4+7t8p0D/57NhA0liNKQ/Ise6b5i293ht1XPen3XhR5xIcDNxauQ5vKqdwwzhoonsbJDtbowoinLQbAgMBAAE=-----END PUBLIC KEY-----';
function encrypt(txt) {
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt); // 对数据进行加密
}
const { proxy } = getCurrentInstance() as any;
const searchContainer = ref(null)
const { height: contentHeight } = useElementSize(searchContainer)
const tableStyle = computed(() => {
return `height:calc(100% - ${contentHeight.value + 10}px);width:100%;`
})
const userStore = useUserStore()
const userInfoData = JSON.parse(userStore.userData)
const url: any = ref(route.query.url);
const isFormIndex = ref(route.query.isFormIndex);
const link = ref('')
// const router = useRouter()
// // 监听当前路由
// watch(
// () => router.currentRoute.value,
// (newValue: any) => {
// newValue.meta.title = title.value
// },
// { immediate: true }
// )
// 搜索区域的schema
onBeforeMount(() => {
let loginInfo = JSON.stringify({
username: '18600000001',
pwd: 'e3916047c3f96efa4642db7bde06d327',
timestamp: new Date().getTime()
})
console.log(route);
if (isFormIndex.value) {
let linkValue = decodeURIComponent(url.value) + '&loginInfo=' + encodeURI(encrypt(loginInfo));
link.value = linkValue;
} else {
let staffGuid = userInfoData.staffGuid;
let tenantGuid = userInfoData.tenantGuid;
let linkValue = decodeURIComponent(url.value) + '&staffGuid=' + staffGuid + '&tenantGuid=' + tenantGuid + '&organisationGuidList=' + userInfoData.organisationGuidList?.join('|') + '&loginInfo=' + encodeURI(encrypt(loginInfo))
link.value = linkValue;
}
});
onActivated(() => {
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.fullPath);
if (tab) {
tab.meta.title = route.query.title;
}
})
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!