修改下载文件,注释掉血缘
Showing
6 changed files
with
102 additions
and
45 deletions
| ... | @@ -4,7 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 | ... | @@ -4,7 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 |
| 4 | # VITE_API_BASEURL = https://www.zgsjzc.com/api | 4 | # VITE_API_BASEURL = https://www.zgsjzc.com/api |
| 5 | # VITE_API_BASEURL = https://swzl-test.csbr.cn/api | 5 | # VITE_API_BASEURL = https://swzl-test.csbr.cn/api |
| 6 | # VITE_API_BASEURL = http://localhost:9000 | 6 | # VITE_API_BASEURL = http://localhost:9000 |
| 7 | VITE_API_BASEURL = http://10.4.82.1:28052/ | 7 | VITE_API_BASEURL = http://192.168.6.20:28052/ |
| 8 | # 平台用户 接口请地址 | 8 | # 平台用户 接口请地址 |
| 9 | VITE_APP_USER_API_BASEURL = gateway-server | 9 | VITE_APP_USER_API_BASEURL = gateway-server |
| 10 | 10 | ... | ... |
| ... | @@ -3,7 +3,7 @@ server { | ... | @@ -3,7 +3,7 @@ server { |
| 3 | listen [::]:80; | 3 | listen [::]:80; |
| 4 | server_name localhost; | 4 | server_name localhost; |
| 5 | # server_name http://192.168.6.20:8052; | 5 | # server_name http://192.168.6.20:8052; |
| 6 | 6 | client_max_body_size 100M; | |
| 7 | 7 | ||
| 8 | # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 | 8 | # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 |
| 9 | add_header 'Access-Control-Allow-Origin' * always; | 9 | add_header 'Access-Control-Allow-Origin' * always; | ... | ... |
src/api/modules/obsService.ts
0 → 100644
| 1 | import request from "@/utils/request"; | ||
| 2 | |||
| 3 | |||
| 4 | export const parseAndDecodeUrl = (url:string) => { | ||
| 5 | // 创建一个 URL 对象来解析传入的 URL 字符串 | ||
| 6 | const parsedUrl = new URL(url); | ||
| 7 | |||
| 8 | // 获取 pathname (路径) 和 search (查询字符串, 如果有的话) | ||
| 9 | // hash (锚点, 如果有的话) 也可以根据需要添加 | ||
| 10 | let { pathname, search = '', hash = '' } = parsedUrl; | ||
| 11 | |||
| 12 | // 去掉路径最前面的斜杠 | ||
| 13 | pathname = pathname.startsWith('/') ? pathname.slice(1) : pathname; | ||
| 14 | |||
| 15 | // 将路径、查询字符串和锚点部分进行解码 | ||
| 16 | pathname = decodeURIComponent(pathname); | ||
| 17 | search = decodeURIComponent(search); | ||
| 18 | hash = decodeURIComponent(hash); | ||
| 19 | |||
| 20 | // 提取最后一个斜杠后面的内容(文件名或资源标识符) | ||
| 21 | const lastSlashIndex = pathname.lastIndexOf('/'); | ||
| 22 | const lastPart = lastSlashIndex !== -1 ? pathname.substring(lastSlashIndex + 1) : pathname; | ||
| 23 | |||
| 24 | // 返回去掉主机信息和开头斜杠后的解码部分以及最后一个斜杠后面的内容 | ||
| 25 | return { | ||
| 26 | decodedPath: pathname + search + hash, | ||
| 27 | lastPart: lastPart | ||
| 28 | }; | ||
| 29 | } | ||
| 30 | |||
| 31 | //获取下载签名 | ||
| 32 | export const getDownFileSignByUrl = (fileName) => { | ||
| 33 | return request({ | ||
| 34 | url: `${ | ||
| 35 | import.meta.env.VITE_APP_COMMON_URL | ||
| 36 | }/obs/generate-download-file-signature?fileName=${fileName}`, | ||
| 37 | method: "get", | ||
| 38 | }); | ||
| 39 | }; | ||
| 40 | |||
| 41 | export const getImageContent = (params) => request({ | ||
| 42 | url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/download-file-stream?filePath=${params.signedUrl}`, | ||
| 43 | method: 'get', | ||
| 44 | responseType: 'blob', | ||
| 45 | headers: { 'Content-Type': params.actualSignedRequestHeaders['Content-Type'] } | ||
| 46 | }); | ||
| 47 |
| ... | @@ -93,46 +93,46 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -93,46 +93,46 @@ const routes: RouteRecordRaw[] = [ |
| 93 | }, | 93 | }, |
| 94 | ], | 94 | ], |
| 95 | }, | 95 | }, |
| 96 | { | 96 | // { |
| 97 | path: '/data-meta/metadata-lineage', | 97 | // path: '/data-meta/metadata-lineage', |
| 98 | component: Layout, | 98 | // component: Layout, |
| 99 | meta: { | 99 | // meta: { |
| 100 | title: '元数据血缘', | 100 | // title: '元数据血缘', |
| 101 | icon: 'ep:grid', | 101 | // icon: 'ep:grid', |
| 102 | }, | 102 | // }, |
| 103 | children: [ | 103 | // children: [ |
| 104 | { | 104 | // { |
| 105 | path: 'analysis-view', | 105 | // path: 'analysis-view', |
| 106 | name: 'analysisView', | 106 | // name: 'analysisView', |
| 107 | component: () => import('@/views/data_meta/analysisView.vue'), | 107 | // component: () => import('@/views/data_meta/analysisView.vue'), |
| 108 | meta: { | 108 | // meta: { |
| 109 | title: '查看血缘', | 109 | // title: '查看血缘', |
| 110 | breadcrumb: false, | 110 | // breadcrumb: false, |
| 111 | cache: true | 111 | // cache: true |
| 112 | }, | 112 | // }, |
| 113 | }, | 113 | // }, |
| 114 | { | 114 | // { |
| 115 | path: 'change-detection', | 115 | // path: 'change-detection', |
| 116 | name: 'changeDetection', | 116 | // name: 'changeDetection', |
| 117 | component: () => import('@/views/data_meta/changeDetection.vue'), | 117 | // component: () => import('@/views/data_meta/changeDetection.vue'), |
| 118 | meta: { | 118 | // meta: { |
| 119 | title: '血缘变更检测', | 119 | // title: '血缘变更检测', |
| 120 | breadcrumb: false, | 120 | // breadcrumb: false, |
| 121 | cache: true | 121 | // cache: true |
| 122 | }, | 122 | // }, |
| 123 | }, | 123 | // }, |
| 124 | { | 124 | // { |
| 125 | path: 'analysis-reports', | 125 | // path: 'analysis-reports', |
| 126 | name: 'analysisReports', | 126 | // name: 'analysisReports', |
| 127 | component: () => import('@/views/data_meta/analysisReports.vue'), | 127 | // component: () => import('@/views/data_meta/analysisReports.vue'), |
| 128 | meta: { | 128 | // meta: { |
| 129 | title: '血缘关系解析', | 129 | // title: '血缘关系解析', |
| 130 | breadcrumb: false, | 130 | // breadcrumb: false, |
| 131 | cache: true | 131 | // cache: true |
| 132 | }, | 132 | // }, |
| 133 | }, | 133 | // }, |
| 134 | ], | 134 | // ], |
| 135 | }, | 135 | // }, |
| 136 | ] | 136 | ] |
| 137 | 137 | ||
| 138 | export default routes | 138 | export default routes | ... | ... |
| ... | @@ -60,7 +60,7 @@ const tabsInfo = ref({ | ... | @@ -60,7 +60,7 @@ const tabsInfo = ref({ |
| 60 | activeName: '', | 60 | activeName: '', |
| 61 | tabs: [ | 61 | tabs: [ |
| 62 | { label: '基础信息', name: 'first' }, | 62 | { label: '基础信息', name: 'first' }, |
| 63 | { label: '数据血缘', name: 'second' }, | 63 | // / { label: '数据血缘', name: 'second' }, |
| 64 | { label: '变更记录', name: 'third' } | 64 | { label: '变更记录', name: 'third' } |
| 65 | ] | 65 | ] |
| 66 | }) | 66 | }) | ... | ... |
| ... | @@ -18,8 +18,13 @@ import { | ... | @@ -18,8 +18,13 @@ import { |
| 18 | getImportData, | 18 | getImportData, |
| 19 | exportDictionary, | 19 | exportDictionary, |
| 20 | exportCollectTask, | 20 | exportCollectTask, |
| 21 | getImageContent | 21 | // getImageContent |
| 22 | } from '@/api/modules/queryService'; | 22 | } from '@/api/modules/queryService'; |
| 23 | import { | ||
| 24 | parseAndDecodeUrl, | ||
| 25 | getDownFileSignByUrl, | ||
| 26 | getImageContent | ||
| 27 | } from '@/api/modules/obsService'; | ||
| 23 | import { commonPageConfig } from '@/utils/enum'; | 28 | import { commonPageConfig } from '@/utils/enum'; |
| 24 | 29 | ||
| 25 | const { proxy } = getCurrentInstance() as any; | 30 | const { proxy } = getCurrentInstance() as any; |
| ... | @@ -216,7 +221,12 @@ const tableBtnClick = async (scope, btn) => { | ... | @@ -216,7 +221,12 @@ const tableBtnClick = async (scope, btn) => { |
| 216 | const row = scope.row; | 221 | const row = scope.row; |
| 217 | currTableData.value = row; | 222 | currTableData.value = row; |
| 218 | if (type == "export_file") { | 223 | if (type == "export_file") { |
| 219 | getImageContent(row.filePath).then((res: any) => { | 224 | const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(row.filePath).decodedPath); |
| 225 | if (!refSignInfo?.data) { | ||
| 226 | refSignInfo?.msg && ElMessage.error(refSignInfo?.msg); | ||
| 227 | return; | ||
| 228 | } | ||
| 229 | getImageContent(refSignInfo?.data).then((res: any) => { | ||
| 220 | if (res && !res.msg) { | 230 | if (res && !res.msg) { |
| 221 | let name = row.filePath; | 231 | let name = row.filePath; |
| 222 | var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : ''; | 232 | var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : ''; | ... | ... |
-
Please register or sign in to post a comment