62bbf8eb by lxs

Merge branch 'develop' of http://117.78.60.236:8000/csbr-daop/fe-data-asset-management into develop

2 parents c89e416a a655ce70
...@@ -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
......
...@@ -62,6 +62,8 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory ...@@ -62,6 +62,8 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
62 # 数据字典接口地址 62 # 数据字典接口地址
63 VITE_APP_CONFIG_URL = 'ms-daop-configure-service' 63 VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
64 64
65 # 文件上传下载接口地址
66 VITE_APP_COMMON_URL = 'ms-daop-common-service'
65 67
66 #门户接口 68 #门户接口
67 VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal 69 VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal
......
...@@ -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;
......
This diff could not be displayed because it is too large.
1 import request from "@/utils/request"; 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
2 //获取下载签名 31 //获取下载签名
3 export const getDownFileSignByUrl = (params) => { 32 export const getDownFileSignByUrl = (fileName) => {
4 return request({ 33 return request({
5 url: `${ 34 url: `${
6 import.meta.env.VITE_APP_COMMON_URL 35 import.meta.env.VITE_APP_COMMON_URL
7 }/obs/generate-download-file-signature?fileName=${params.fileName}`, 36 }/obs/generate-download-file-signature?fileName=${fileName}`,
8 method: "get", 37 method: "get",
9 }); 38 });
10 }; 39 };
40
11 //obs下载 41 //obs下载
12 export const obsDownloadRequest = (params) => { 42 export const obsDownloadRequest = (params) => {
13 return request({ 43 return request({
...@@ -27,6 +57,7 @@ export const obsDownloadRequest = (params) => { ...@@ -27,6 +57,7 @@ export const obsDownloadRequest = (params) => {
27 method: "get", 57 method: "get",
28 }); 58 });
29 }; 59 };
60
30 //获取上传签名 61 //获取上传签名
31 export const getUpFileSignByUrl = (params) => { 62 export const getUpFileSignByUrl = (params) => {
32 return request({ 63 return request({
...@@ -36,9 +67,11 @@ export const getUpFileSignByUrl = (params) => { ...@@ -36,9 +67,11 @@ export const getUpFileSignByUrl = (params) => {
36 method: "get", 67 method: "get",
37 }); 68 });
38 }; 69 };
70
39 //obs上传 71 //obs上传
40 export const obsUploadRequest = (params) => { 72 export const obsUploadRequest = (params) => {
41 return request({ 73 return request({
74 url: params.signedUrl,
42 withCredentials: false, 75 withCredentials: false,
43 headers: params.actualSignedRequestHeaders ? { 76 headers: params.actualSignedRequestHeaders ? {
44 "Content-Type": params.actualSignedRequestHeaders[ 77 "Content-Type": params.actualSignedRequestHeaders[
...@@ -48,14 +81,9 @@ export const obsUploadRequest = (params) => { ...@@ -48,14 +81,9 @@ export const obsUploadRequest = (params) => {
48 validateStatus: function (status) { 81 validateStatus: function (status) {
49 return status >= 200; 82 return status >= 200;
50 }, 83 },
51 84 maxRedirects: 0,
52 url: params.signedUrl, 85 // responseType: 'text',
53 method: "put",
54 data: params.file, 86 data: params.file,
87 method: 'obsUploadRequest'
55 }); 88 });
56 }; 89 };
57 export const getImageContent = (params) => request({
58 url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/view-pic?filePath=${params.split("?")[0]}`,
59 method: 'get',
60 responseType: 'blob'
61 });
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,10 +24,12 @@ import useUserStore from "@/store/modules/user"; ...@@ -24,10 +24,12 @@ import useUserStore from "@/store/modules/user";
24 // getImageContent 24 // getImageContent
25 // } from '@/api/modules/queryService'; 25 // } from '@/api/modules/queryService';
26 import { 26 import {
27 getImageContent, 27 parseAndDecodeUrl,
28 getUpFileSignByUrl, 28 getUpFileSignByUrl,
29 obsUploadRequest 29 obsUploadRequest,
30 } from "@/api/modules/obsSerivice"; 30 getDownFileSignByUrl,
31 obsDownloadRequest
32 } from "@/api/modules/obsService";
31 import { Editor, EditorExpose } from '@/components/Editor' 33 import { Editor, EditorExpose } from '@/components/Editor'
32 34
33 const userStore = useUserStore() 35 const userStore = useUserStore()
...@@ -332,10 +334,15 @@ const handlePictureCardPreview = (file, item) => { ...@@ -332,10 +334,15 @@ const handlePictureCardPreview = (file, item) => {
332 uploadPreviewVisible.value = true; 334 uploadPreviewVisible.value = true;
333 } 335 }
334 336
335 const onUploadFilePreview = (file, item) => { 337 const onUploadFilePreview = async (file, item) => {
336 let f = formInline.value[item.field].find(i => i.name == file.name); 338 let f = formInline.value[item.field].find(i => i.name == file.name);
337 let url = f.url; 339 let url = f.url;
338 getImageContent(url).then((res: any) => { 340 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
341 if (!refSignInfo?.data) {
342 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
343 return;
344 }
345 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
339 if (res && !res.msg) { 346 if (res && !res.msg) {
340 let name = f.name; 347 let name = f.name;
341 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1).toLowerCase() : ''; 348 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1).toLowerCase() : '';
...@@ -346,20 +353,19 @@ const onUploadFilePreview = (file, item) => { ...@@ -346,20 +353,19 @@ const onUploadFilePreview = (file, item) => {
346 } else { 353 } else {
347 download(res, name, fileSuffix); 354 download(res, name, fileSuffix);
348 } 355 }
349 // if (fileSuffix === 'png' || fileSuffix === 'jpeg' || fileSuffix === 'jpg' || fileSuffix === 'pdf' || fileSuffix === 'zip' || fileSuffix === 'rar') {
350 // let win = window.open(fileUrl, name);
351 // win && (win.document.title = name);
352 // return win;
353 // }
354 // window.open('https://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(fileUrl));
355 } else { 356 } else {
356 res?.msg && ElMessage.error(res?.msg); 357 res?.msg && ElMessage.error(res?.msg);
357 } 358 }
358 }) 359 });
359 } 360 }
360 361
361 const downloadTemplate = (url) => { 362 const downloadTemplate = async (url) => {
362 getImageContent(url).then((res: any) => { 363 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
364 if (!refSignInfo?.data) {
365 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
366 return;
367 }
368 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
363 if (res && !res.msg) { 369 if (res && !res.msg) {
364 let urlNames = url.split('/'); 370 let urlNames = url.split('/');
365 let name = urlNames.at(-1); 371 let name = urlNames.at(-1);
...@@ -368,12 +374,17 @@ const downloadTemplate = (url) => { ...@@ -368,12 +374,17 @@ const downloadTemplate = (url) => {
368 } else { 374 } else {
369 res?.msg && ElMessage.error(res?.msg); 375 res?.msg && ElMessage.error(res?.msg);
370 } 376 }
371 }) 377 });
372 } 378 }
373 379
374 const onUploadFileDownload = (file, item) => { 380 const onUploadFileDownload = async (file, item) => {
375 let url = file.url; 381 let url = file.url;
376 getImageContent(url).then((res: any) => { 382 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
383 if (!refSignInfo?.data) {
384 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
385 return;
386 }
387 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
377 if (res && !res.msg) { 388 if (res && !res.msg) {
378 let f = formInline.value[item.field].find(i => i.name == file.name); 389 let f = formInline.value[item.field].find(i => i.name == file.name);
379 let name = f.name; 390 let name = f.name;
...@@ -457,7 +468,7 @@ const uploadFile = (file, item) => { ...@@ -457,7 +468,7 @@ const uploadFile = (file, item) => {
457 obsUploadRequest({ 468 obsUploadRequest({
458 signedUrl: res.data.signedUrl, 469 signedUrl: res.data.signedUrl,
459 file: file.file, 470 file: file.file,
460 actualsignedRequestHeaders: res.data.actualsignedRequestHeaders 471 actualSignedRequestHeaders: res.data.actualSignedRequestHeaders
461 }).then(() => { 472 }).then(() => {
462 if (res.code == '00000') { 473 if (res.code == '00000') {
463 let fileItem = { 474 let fileItem = {
......
...@@ -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
......
...@@ -298,6 +298,16 @@ export const downFile = (fileUrl, fileName) => { ...@@ -298,6 +298,16 @@ export const downFile = (fileUrl, fileName) => {
298 }, 66) 298 }, 66)
299 } 299 }
300 300
301 //本地文件下载根据Bob流
302 export const downFileByBob = (data,fileName) => {
303 let blob = new Blob([data],{type:data.type || 'text'}); // #识别文件类型
304 let objectUrl = URL.createObjectURL(blob);
305 const link = document.createElement('a');
306 link.download = decodeURIComponent(fileName);
307 link.href = objectUrl;
308 link.click();
309 }
310
301 // 表单提交参数 311 // 表单提交参数
302 export const setFormFields = (list) => { 312 export const setFormFields = (list) => {
303 let obj = {}; 313 let obj = {};
......
...@@ -56,6 +56,10 @@ service.interceptors.request.use( ...@@ -56,6 +56,10 @@ service.interceptors.request.use(
56 config.headers.Authorization = localStorage.getItem('token'); 56 config.headers.Authorization = localStorage.getItem('token');
57 return config; 57 return config;
58 } 58 }
59 if (config.method === 'obsuploadrequest') {
60 config.method = 'put';
61 return config;
62 }
59 // /** 63 // /**
60 // * 缓存命中判断 64 // * 缓存命中判断
61 // * 成功则取消当次请求 65 // * 成功则取消当次请求
......
...@@ -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 })
......
...@@ -11,15 +11,20 @@ import Tabs from '@/components/Tabs/index.vue' ...@@ -11,15 +11,20 @@ import Tabs from '@/components/Tabs/index.vue'
11 import Table from '@/components/Table/index.vue' 11 import Table from '@/components/Table/index.vue'
12 import Dialog from '@/components/Dialog/index.vue' 12 import Dialog from '@/components/Dialog/index.vue'
13 import useCatchStore from "@/store/modules/catch"; 13 import useCatchStore from "@/store/modules/catch";
14 import { download, downFile, getDownloadUrl } from '@/utils/common' 14 import { download, downFileByBob, downFile } from '@/utils/common'
15 import { 15 import {
16 addImportData, 16 addImportData,
17 deleteImportData, 17 deleteImportData,
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 obsDownloadRequest
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,11 +221,14 @@ const tableBtnClick = async (scope, btn) => { ...@@ -216,11 +221,14 @@ 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 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
220 if (res && !res.msg) { 230 if (res && !res.msg) {
221 let name = row.filePath; 231 downFileByBob(res, row.fileName);
222 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
223 download(res, row.fileName, fileSuffix);
224 } else { 232 } else {
225 res?.msg && ElMessage.error(res?.msg); 233 res?.msg && ElMessage.error(res?.msg);
226 } 234 }
...@@ -228,12 +236,16 @@ const tableBtnClick = async (scope, btn) => { ...@@ -228,12 +236,16 @@ const tableBtnClick = async (scope, btn) => {
228 //downFile(row.filePath, row.fileName) 236 //downFile(row.filePath, row.fileName)
229 } else if (type == 'export_abnormal_data') { 237 } else if (type == 'export_abnormal_data') {
230 //downFile(row.errorFilePath, '') 238 //downFile(row.errorFilePath, '')
231 getImageContent(row.errorFilePath).then((res: any) => { 239 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(row.errorFilePath).decodedPath);
240 if (!refSignInfo?.data) {
241 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
242 return;
243 }
244 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
232 if (res && !res.msg) { 245 if (res && !res.msg) {
233 let name = row.errorFilePath; 246 let name = row.errorFilePath;
234 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
235 let fileName = name ? name.substring(name.lastIndexOf('/') + 1) : '' 247 let fileName = name ? name.substring(name.lastIndexOf('/') + 1) : ''
236 download(res, fileName, fileSuffix); 248 downFileByBob(res, fileName);
237 } else { 249 } else {
238 res?.msg && ElMessage.error(res?.msg); 250 res?.msg && ElMessage.error(res?.msg);
239 } 251 }
......
...@@ -40,6 +40,11 @@ export default ({ mode, command }) => { ...@@ -40,6 +40,11 @@ export default ({ mode, command }) => {
40 changeOrigin: env.VITE_OPEN_PROXY === 'true', 40 changeOrigin: env.VITE_OPEN_PROXY === 'true',
41 rewrite: path => path.replace(/\/portal/, ''), 41 rewrite: path => path.replace(/\/portal/, ''),
42 }, 42 },
43 '/obs': {
44 target: '//csbr-daop.obs.cn-north-1.myhuaweicloud.com:443',
45 changeOrigin: env.VITE_OPEN_PROXY === 'true',
46 rewrite: path => path.replace(/\/obs/, ''),
47 }
43 }, 48 },
44 }, 49 },
45 // 构建选项 https://cn.vitejs.dev/config/#server-fsserve-root 50 // 构建选项 https://cn.vitejs.dev/config/#server-fsserve-root
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!