fix报表
Showing
8 changed files
with
172 additions
and
19 deletions
| ... | @@ -37,6 +37,7 @@ | ... | @@ -37,6 +37,7 @@ |
| 37 | "html2canvas": "^1.4.1", | 37 | "html2canvas": "^1.4.1", |
| 38 | "insert-css": "^2.0.0", | 38 | "insert-css": "^2.0.0", |
| 39 | "jquery": "^3.7.1", | 39 | "jquery": "^3.7.1", |
| 40 | "jsencrypt": "^3.3.2", | ||
| 40 | "lodash-es": "^4.17.21", | 41 | "lodash-es": "^4.17.21", |
| 41 | "md5": "^2.3.0", | 42 | "md5": "^2.3.0", |
| 42 | "mitt": "^3.0.0", | 43 | "mitt": "^3.0.0", | ... | ... |
| ... | @@ -71,6 +71,9 @@ dependencies: | ... | @@ -71,6 +71,9 @@ dependencies: |
| 71 | jquery: | 71 | jquery: |
| 72 | specifier: ^3.7.1 | 72 | specifier: ^3.7.1 |
| 73 | version: 3.7.1 | 73 | version: 3.7.1 |
| 74 | jsencrypt: | ||
| 75 | specifier: ^3.3.2 | ||
| 76 | version: 3.3.2 | ||
| 74 | lodash-es: | 77 | lodash-es: |
| 75 | specifier: ^4.17.21 | 78 | specifier: ^4.17.21 |
| 76 | version: 4.17.21 | 79 | version: 4.17.21 |
| ... | @@ -6426,6 +6429,10 @@ packages: | ... | @@ -6426,6 +6429,10 @@ packages: |
| 6426 | resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} | 6429 | resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} |
| 6427 | dev: true | 6430 | dev: true |
| 6428 | 6431 | ||
| 6432 | /jsencrypt@3.3.2: | ||
| 6433 | resolution: {integrity: sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==} | ||
| 6434 | dev: false | ||
| 6435 | |||
| 6429 | /jsesc@0.5.0: | 6436 | /jsesc@0.5.0: |
| 6430 | resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} | 6437 | resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} |
| 6431 | hasBin: true | 6438 | hasBin: true | ... | ... |
| ... | @@ -19,8 +19,18 @@ function onSidebarScroll(e: Event) { | ... | @@ -19,8 +19,18 @@ function onSidebarScroll(e: Event) { |
| 19 | const defaultMenuActive = computed(() => { | 19 | const defaultMenuActive = computed(() => { |
| 20 | let path = route.meta.activeMenu || route.path; | 20 | let path = route.meta.activeMenu || route.path; |
| 21 | let sideMenus = menuStore.sidebarMenus; | 21 | let sideMenus = menuStore.sidebarMenus; |
| 22 | let isSide = sideMenus.some(s => s.path === path || s.children?.some(c => path === `${s.path}/${c.path}`)); | 22 | 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'))); |
| 23 | if (isSide) { | 23 | if (isSide) { |
| 24 | if (path.includes('/data-meta/report')) { | ||
| 25 | let index = route.fullPath.indexOf("?"); | ||
| 26 | if (index > -1) { | ||
| 27 | let params = route.fullPath.substring(index + 1); | ||
| 28 | let searchParams: any = new URLSearchParams(params); | ||
| 29 | return `${path}?title=${searchParams.get('title')}&url=${encodeURIComponent(searchParams.get('url'))}` | ||
| 30 | } else { | ||
| 31 | return route.fullPath; | ||
| 32 | } | ||
| 33 | } | ||
| 24 | return path; | 34 | return path; |
| 25 | } | 35 | } |
| 26 | let matched = route.matched; | 36 | let matched = route.matched; |
| ... | @@ -38,22 +48,26 @@ const defaultMenuActive = computed(() => { | ... | @@ -38,22 +48,26 @@ const defaultMenuActive = computed(() => { |
| 38 | </script> | 48 | </script> |
| 39 | 49 | ||
| 40 | <template> | 50 | <template> |
| 41 | <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"> | 51 | <div |
| 42 | <Logo | 52 | v-if="['side', 'head', 'single'].includes(settingsStore.settings.menu.menuMode) || settingsStore.mode === 'mobile'" |
| 43 | :show-logo="settingsStore.settings.menu.menuMode === 'single'" class="sidebar-logo" :class="{ | 53 | class="sub-sidebar-container" |
| 44 | 'sidebar-logo-bg': settingsStore.settings.menu.menuMode === 'single', | 54 | :class="{ 'is-collapse': settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive == '/data-asset-index') }" |
| 45 | 'shadow': sidebarScrollTop, | 55 | @scroll="onSidebarScroll"> |
| 46 | }" | 56 | <Logo :show-logo="settingsStore.settings.menu.menuMode === 'single'" class="sidebar-logo" :class="{ |
| 47 | /> | 57 | 'sidebar-logo-bg': settingsStore.settings.menu.menuMode === 'single', |
| 58 | 'shadow': sidebarScrollTop, | ||
| 59 | }" /> | ||
| 48 | <!-- 侧边栏模式(无主导航) --> | 60 | <!-- 侧边栏模式(无主导航) --> |
| 49 | <el-menu | 61 | <el-menu :unique-opened="settingsStore.settings.menu.subMenuUniqueOpened" |
| 50 | :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="{ | 62 | :default-openeds="menuStore.defaultOpenedPaths" :default-active="defaultMenuActive" |
| 63 | :collapse="settingsStore.mode === 'pc' && (settingsStore.settings.menu.subMenuCollapse || defaultMenuActive == '/data-asset-index')" | ||
| 64 | :collapse-transition="false" :class="{ | ||
| 51 | 'is-collapse-without-logo': settingsStore.settings.menu.menuMode !== 'single' && settingsStore.settings.menu.subMenuCollapse, | 65 | 'is-collapse-without-logo': settingsStore.settings.menu.menuMode !== 'single' && settingsStore.settings.menu.subMenuCollapse, |
| 52 | }" | 66 | }"> |
| 53 | > | ||
| 54 | <transition-group name="sub-sidebar"> | 67 | <transition-group name="sub-sidebar"> |
| 55 | <template v-for="(route, index) in menuStore.sidebarMenus"> | 68 | <template v-for="(route, index) in menuStore.sidebarMenus"> |
| 56 | <SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path || index" :item="route" :base-path="route.path" /> | 69 | <SidebarItem v-if="route.meta?.sidebar !== false" :key="route.path || index" :item="route" |
| 70 | :base-path="route.path" /> | ||
| 57 | </template> | 71 | </template> |
| 58 | </transition-group> | 72 | </transition-group> |
| 59 | </el-menu> | 73 | </el-menu> |
| ... | @@ -140,6 +154,7 @@ const defaultMenuActive = computed(() => { | ... | @@ -140,6 +154,7 @@ const defaultMenuActive = computed(() => { |
| 140 | 154 | ||
| 141 | :deep(.el-menu-item), | 155 | :deep(.el-menu-item), |
| 142 | :deep(.el-sub-menu__title) { | 156 | :deep(.el-sub-menu__title) { |
| 157 | |||
| 143 | span, | 158 | span, |
| 144 | .el-sub-menu__icon-arrow { | 159 | .el-sub-menu__icon-arrow { |
| 145 | display: none; | 160 | display: none; | ... | ... |
| ... | @@ -58,10 +58,18 @@ watch( | ... | @@ -58,10 +58,18 @@ watch( |
| 58 | const changeTab = (pane: any, ev: any) => { | 58 | const changeTab = (pane: any, ev: any) => { |
| 59 | const tabIndex = Number(pane.index); | 59 | const tabIndex = Number(pane.index); |
| 60 | const paneData: any = tabbarList.value[tabIndex]; | 60 | const paneData: any = tabbarList.value[tabIndex]; |
| 61 | router.push({ | 61 | if (paneData.name == 'budgetDataIndex') { |
| 62 | name: paneData.name, | 62 | router.push(paneData.fullPath); |
| 63 | query: paneData.query | 63 | } else { |
| 64 | }); | 64 | router.push({ |
| 65 | name: paneData.name, | ||
| 66 | query: paneData.query | ||
| 67 | }); | ||
| 68 | } | ||
| 69 | // router.push({ | ||
| 70 | // name: paneData.name, | ||
| 71 | // query: paneData.query | ||
| 72 | // }); | ||
| 65 | const combPath = paneData.fullPath.split('/')[1] || 'app-scenes' | 73 | const combPath = paneData.fullPath.split('/')[1] || 'app-scenes' |
| 66 | userStore.setActiveTabbar(combPath, paneData.fullPath); | 74 | userStore.setActiveTabbar(combPath, paneData.fullPath); |
| 67 | }; | 75 | }; | ... | ... |
| ... | @@ -133,6 +133,29 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -133,6 +133,29 @@ const routes: RouteRecordRaw[] = [ |
| 133 | }, | 133 | }, |
| 134 | ], | 134 | ], |
| 135 | }, | 135 | }, |
| 136 | { | ||
| 137 | path: '/data-meta/report', | ||
| 138 | component: Layout, | ||
| 139 | meta: { | ||
| 140 | title: '报表查看', | ||
| 141 | icon: 'sidebar-videos', | ||
| 142 | }, | ||
| 143 | children: [ | ||
| 144 | { | ||
| 145 | path: 'budgetDataIndex', | ||
| 146 | name: 'budgetDataIndex', | ||
| 147 | component: () => import('@/views/data_meta/budgetDataIndex.vue'), | ||
| 148 | meta: { | ||
| 149 | title: '', | ||
| 150 | sidebar: false, | ||
| 151 | breadcrumb: false, | ||
| 152 | cache: true, | ||
| 153 | reuse: true, | ||
| 154 | activeMenu: '/data-meta/report/budgetDataIndex', | ||
| 155 | }, | ||
| 156 | } | ||
| 157 | ] | ||
| 158 | } | ||
| 136 | ] | 159 | ] |
| 137 | 160 | ||
| 138 | export default routes | 161 | export default routes | ... | ... |
| ... | @@ -63,7 +63,11 @@ const useMenuStore = defineStore( | ... | @@ -63,7 +63,11 @@ const useMenuStore = defineStore( |
| 63 | retnPath = getDeepestPath(item, resolveRoutePath(rootPath, menu.path)) | 63 | retnPath = getDeepestPath(item, resolveRoutePath(rootPath, menu.path)) |
| 64 | } | 64 | } |
| 65 | else { | 65 | else { |
| 66 | retnPath = getDeepestPath(menu.children[0], resolveRoutePath(rootPath, menu.path)) | 66 | if (!menu.children[0]) { |
| 67 | retnPath = menu.path; | ||
| 68 | } else { | ||
| 69 | retnPath = getDeepestPath(menu.children[0], resolveRoutePath(rootPath, menu.path)) | ||
| 70 | } | ||
| 67 | } | 71 | } |
| 68 | } | 72 | } |
| 69 | else { | 73 | else { |
| ... | @@ -170,6 +174,9 @@ const useMenuStore = defineStore( | ... | @@ -170,6 +174,9 @@ const useMenuStore = defineStore( |
| 170 | else { | 174 | else { |
| 171 | // 如果是 string 类型,则认为是路由,需要查找对应的主导航索引 | 175 | // 如果是 string 类型,则认为是路由,需要查找对应的主导航索引 |
| 172 | const findIndex = allMenus.value.findIndex(item => item.children.some(r => { | 176 | const findIndex = allMenus.value.findIndex(item => item.children.some(r => { |
| 177 | if (data== "/data-meta/report/budgetDataIndex" && r.path?.includes('/data-meta/report')) { | ||
| 178 | return true; | ||
| 179 | } | ||
| 173 | if (data.indexOf(`${r.path}/`) === 0 || data === r.path) { | 180 | if (data.indexOf(`${r.path}/`) === 0 || data === r.path) { |
| 174 | return true; | 181 | return true; |
| 175 | } | 182 | } | ... | ... |
| ... | @@ -156,7 +156,10 @@ const useRouteStore = defineStore( | ... | @@ -156,7 +156,10 @@ const useRouteStore = defineStore( |
| 156 | title: m.productName || m.menuName | 156 | title: m.productName || m.menuName |
| 157 | }; | 157 | }; |
| 158 | } | 158 | } |
| 159 | r = routes.find((route: any) => route.path === path || route.path === m.path || `/${route.path}` === m.path); | 159 | 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'))); |
| 160 | if (r && path.includes('budgetDataIndex')) { | ||
| 161 | r.path = path; | ||
| 162 | } | ||
| 160 | if(r && m.icon && m.icon !== "{}") { | 163 | if(r && m.icon && m.icon !== "{}") { |
| 161 | 164 | ||
| 162 | r.meta.icon = m.icon | 165 | r.meta.icon = m.icon |
| ... | @@ -206,6 +209,9 @@ const useRouteStore = defineStore( | ... | @@ -206,6 +209,9 @@ const useRouteStore = defineStore( |
| 206 | } | 209 | } |
| 207 | else { | 210 | else { |
| 208 | if (m.menuType === 'C' && tmpRoute.children?.length) { | 211 | if (m.menuType === 'C' && tmpRoute.children?.length) { |
| 212 | tmpRoute.children.forEach(c => { | ||
| 213 | !c.meta.title && (c.meta.title = tmpRoute.meta.title); | ||
| 214 | }); | ||
| 209 | tmpRoute.children = tmpRoute.children?.filter(t => t.path == '') || []; | 215 | tmpRoute.children = tmpRoute.children?.filter(t => t.path == '') || []; |
| 210 | } | 216 | } |
| 211 | res.push(tmpRoute) | 217 | res.push(tmpRoute) | ... | ... |
src/views/data_meta/budgetDataIndex.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | # 组件名称 | ||
| 3 | name: "" | ||
| 4 | </route> | ||
| 5 | |||
| 6 | <template> | ||
| 7 | <iframe :style="tableStyle" :src="link" frameborder="0"></iframe> | ||
| 8 | </template> | ||
| 9 | |||
| 10 | <script lang="ts" setup name="budgetDataIndex"> | ||
| 11 | |||
| 12 | import { ref, reactive, computed } from "vue"; | ||
| 13 | |||
| 14 | import { JSEncrypt } from 'jsencrypt'; | ||
| 15 | import { useElementSize } from "@vueuse/core"; | ||
| 16 | import useUserStore from '@/store/modules/user' | ||
| 17 | const route = useRoute() | ||
| 18 | |||
| 19 | const encryptor = new JSEncrypt() | ||
| 20 | const publicKey = '-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiv3Ko6rOBvWDK96tIExpdyuuQAGgZo0YmQxpT10hD3qu/MnNKlIJgo4+NwUHcwpleKE2DBOxgvCeMtUoP4FDWt8q18X+4+7t8p0D/57NhA0liNKQ/Ise6b5i293ht1XPen3XhR5xIcDNxauQ5vKqdwwzhoonsbJDtbowoinLQbAgMBAAE=-----END PUBLIC KEY-----'; | ||
| 21 | function encrypt(txt) { | ||
| 22 | encryptor.setPublicKey(publicKey) // 设置公钥 | ||
| 23 | return encryptor.encrypt(txt); // 对数据进行加密 | ||
| 24 | } | ||
| 25 | |||
| 26 | const { proxy } = getCurrentInstance() as any; | ||
| 27 | |||
| 28 | const searchContainer = ref(null) | ||
| 29 | const { height: contentHeight } = useElementSize(searchContainer) | ||
| 30 | const tableStyle = computed(() => { | ||
| 31 | return `height:calc(100% - ${contentHeight.value + 10}px);width:100%;` | ||
| 32 | }) | ||
| 33 | const userStore = useUserStore() | ||
| 34 | const userInfoData = JSON.parse(userStore.userData) | ||
| 35 | const url: any = ref(route.query.url); | ||
| 36 | const isFormIndex = ref(route.query.isFormIndex); | ||
| 37 | |||
| 38 | const link = ref('') | ||
| 39 | // const router = useRouter() | ||
| 40 | // // 监听当前路由 | ||
| 41 | // watch( | ||
| 42 | // () => router.currentRoute.value, | ||
| 43 | // (newValue: any) => { | ||
| 44 | // newValue.meta.title = title.value | ||
| 45 | // }, | ||
| 46 | // { immediate: true } | ||
| 47 | // ) | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | // 搜索区域的schema | ||
| 52 | |||
| 53 | onBeforeMount(() => { | ||
| 54 | let loginInfo = JSON.stringify({ | ||
| 55 | username: '18600000001', | ||
| 56 | pwd: 'e3916047c3f96efa4642db7bde06d327', | ||
| 57 | timestamp: new Date().getTime() | ||
| 58 | }) | ||
| 59 | |||
| 60 | console.log(route); | ||
| 61 | |||
| 62 | if (isFormIndex.value) { | ||
| 63 | let linkValue = decodeURIComponent(url.value) + '&loginInfo=' + encodeURI(encrypt(loginInfo)); | ||
| 64 | link.value = linkValue; | ||
| 65 | } else { | ||
| 66 | let staffGuid = userInfoData.staffGuid; | ||
| 67 | let tenantGuid = userInfoData.tenantGuid; | ||
| 68 | let linkValue = decodeURIComponent(url.value) + '&staffGuid=' + staffGuid + '&tenantGuid=' + tenantGuid + '&organisationGuidList=' + userInfoData.organisationGuidList?.join('|') + '&loginInfo=' + encodeURI(encrypt(loginInfo)) | ||
| 69 | link.value = linkValue; | ||
| 70 | } | ||
| 71 | |||
| 72 | }); | ||
| 73 | |||
| 74 | onActivated(() => { | ||
| 75 | let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.fullPath); | ||
| 76 | if (tab) { | ||
| 77 | tab.meta.title = route.query.title; | ||
| 78 | } | ||
| 79 | }) | ||
| 80 | |||
| 81 | </script> | ||
| 82 | |||
| 83 | <style lang="scss" scoped> | ||
| 84 | |||
| 85 | |||
| 86 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment