ec3ff51c by lihua

修改下载文件,注释掉血缘

1 parent c7b77154
......@@ -4,7 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统
# VITE_API_BASEURL = https://www.zgsjzc.com/api
# VITE_API_BASEURL = https://swzl-test.csbr.cn/api
# VITE_API_BASEURL = http://localhost:9000
VITE_API_BASEURL = http://10.4.82.1:28052/
VITE_API_BASEURL = http://192.168.6.20:28052/
# 平台用户 接口请地址
VITE_APP_USER_API_BASEURL = gateway-server
......
......@@ -3,7 +3,7 @@ server {
listen [::]:80;
server_name localhost;
# server_name http://192.168.6.20:8052;
client_max_body_size 100M;
# 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问
add_header 'Access-Control-Allow-Origin' * always;
......
import request from "@/utils/request";
export const parseAndDecodeUrl = (url:string) => {
// 创建一个 URL 对象来解析传入的 URL 字符串
const parsedUrl = new URL(url);
// 获取 pathname (路径) 和 search (查询字符串, 如果有的话)
// hash (锚点, 如果有的话) 也可以根据需要添加
let { pathname, search = '', hash = '' } = parsedUrl;
// 去掉路径最前面的斜杠
pathname = pathname.startsWith('/') ? pathname.slice(1) : pathname;
// 将路径、查询字符串和锚点部分进行解码
pathname = decodeURIComponent(pathname);
search = decodeURIComponent(search);
hash = decodeURIComponent(hash);
// 提取最后一个斜杠后面的内容(文件名或资源标识符)
const lastSlashIndex = pathname.lastIndexOf('/');
const lastPart = lastSlashIndex !== -1 ? pathname.substring(lastSlashIndex + 1) : pathname;
// 返回去掉主机信息和开头斜杠后的解码部分以及最后一个斜杠后面的内容
return {
decodedPath: pathname + search + hash,
lastPart: lastPart
};
}
//获取下载签名
export const getDownFileSignByUrl = (fileName) => {
return request({
url: `${
import.meta.env.VITE_APP_COMMON_URL
}/obs/generate-download-file-signature?fileName=${fileName}`,
method: "get",
});
};
export const getImageContent = (params) => request({
url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/download-file-stream?filePath=${params.signedUrl}`,
method: 'get',
responseType: 'blob',
headers: { 'Content-Type': params.actualSignedRequestHeaders['Content-Type'] }
});
......@@ -93,46 +93,46 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/data-meta/metadata-lineage',
component: Layout,
meta: {
title: '元数据血缘',
icon: 'ep:grid',
},
children: [
{
path: 'analysis-view',
name: 'analysisView',
component: () => import('@/views/data_meta/analysisView.vue'),
meta: {
title: '查看血缘',
breadcrumb: false,
cache: true
},
},
{
path: 'change-detection',
name: 'changeDetection',
component: () => import('@/views/data_meta/changeDetection.vue'),
meta: {
title: '血缘变更检测',
breadcrumb: false,
cache: true
},
},
{
path: 'analysis-reports',
name: 'analysisReports',
component: () => import('@/views/data_meta/analysisReports.vue'),
meta: {
title: '血缘关系解析',
breadcrumb: false,
cache: true
},
},
],
},
// {
// path: '/data-meta/metadata-lineage',
// component: Layout,
// meta: {
// title: '元数据血缘',
// icon: 'ep:grid',
// },
// children: [
// {
// path: 'analysis-view',
// name: 'analysisView',
// component: () => import('@/views/data_meta/analysisView.vue'),
// meta: {
// title: '查看血缘',
// breadcrumb: false,
// cache: true
// },
// },
// {
// path: 'change-detection',
// name: 'changeDetection',
// component: () => import('@/views/data_meta/changeDetection.vue'),
// meta: {
// title: '血缘变更检测',
// breadcrumb: false,
// cache: true
// },
// },
// {
// path: 'analysis-reports',
// name: 'analysisReports',
// component: () => import('@/views/data_meta/analysisReports.vue'),
// meta: {
// title: '血缘关系解析',
// breadcrumb: false,
// cache: true
// },
// },
// ],
// },
]
export default routes
......
......@@ -60,7 +60,7 @@ const tabsInfo = ref({
activeName: '',
tabs: [
{ label: '基础信息', name: 'first' },
{ label: '数据血缘', name: 'second' },
// / { label: '数据血缘', name: 'second' },
{ label: '变更记录', name: 'third' }
]
})
......
......@@ -18,8 +18,13 @@ import {
getImportData,
exportDictionary,
exportCollectTask,
getImageContent
// getImageContent
} from '@/api/modules/queryService';
import {
parseAndDecodeUrl,
getDownFileSignByUrl,
getImageContent
} from '@/api/modules/obsService';
import { commonPageConfig } from '@/utils/enum';
const { proxy } = getCurrentInstance() as any;
......@@ -216,7 +221,12 @@ const tableBtnClick = async (scope, btn) => {
const row = scope.row;
currTableData.value = row;
if (type == "export_file") {
getImageContent(row.filePath).then((res: any) => {
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(row.filePath).decodedPath);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
getImageContent(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let name = row.filePath;
var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!