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 = 数据资产管理系统
# 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
......
......@@ -62,6 +62,8 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
# 数据字典接口地址
VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
# 文件上传下载接口地址
VITE_APP_COMMON_URL = 'ms-daop-common-service'
#门户接口
VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal
......
......@@ -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;
......
This diff could not be displayed because it is too large.
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 = (params) => {
export const getDownFileSignByUrl = (fileName) => {
return request({
url: `${
import.meta.env.VITE_APP_COMMON_URL
}/obs/generate-download-file-signature?fileName=${params.fileName}`,
}/obs/generate-download-file-signature?fileName=${fileName}`,
method: "get",
});
};
//obs下载
export const obsDownloadRequest = (params) => {
return request({
......@@ -27,6 +57,7 @@ export const obsDownloadRequest = (params) => {
method: "get",
});
};
//获取上传签名
export const getUpFileSignByUrl = (params) => {
return request({
......@@ -36,9 +67,11 @@ export const getUpFileSignByUrl = (params) => {
method: "get",
});
};
//obs上传
export const obsUploadRequest = (params) => {
return request({
url: params.signedUrl,
withCredentials: false,
headers: params.actualSignedRequestHeaders ? {
"Content-Type": params.actualSignedRequestHeaders[
......@@ -48,14 +81,9 @@ export const obsUploadRequest = (params) => {
validateStatus: function (status) {
return status >= 200;
},
url: params.signedUrl,
method: "put",
maxRedirects: 0,
// responseType: 'text',
data: params.file,
method: 'obsUploadRequest'
});
};
\ No newline at end of file
export const getImageContent = (params) => request({
url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/view-pic?filePath=${params.split("?")[0]}`,
method: 'get',
responseType: 'blob'
});
......
......@@ -24,10 +24,12 @@ import useUserStore from "@/store/modules/user";
// getImageContent
// } from '@/api/modules/queryService';
import {
getImageContent,
parseAndDecodeUrl,
getUpFileSignByUrl,
obsUploadRequest
} from "@/api/modules/obsSerivice";
obsUploadRequest,
getDownFileSignByUrl,
obsDownloadRequest
} from "@/api/modules/obsService";
import { Editor, EditorExpose } from '@/components/Editor'
const userStore = useUserStore()
......@@ -332,10 +334,15 @@ const handlePictureCardPreview = (file, item) => {
uploadPreviewVisible.value = true;
}
const onUploadFilePreview = (file, item) => {
const onUploadFilePreview = async (file, item) => {
let f = formInline.value[item.field].find(i => i.name == file.name);
let url = f.url;
getImageContent(url).then((res: any) => {
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let name = f.name;
var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1).toLowerCase() : '';
......@@ -346,20 +353,19 @@ const onUploadFilePreview = (file, item) => {
} else {
download(res, name, fileSuffix);
}
// if (fileSuffix === 'png' || fileSuffix === 'jpeg' || fileSuffix === 'jpg' || fileSuffix === 'pdf' || fileSuffix === 'zip' || fileSuffix === 'rar') {
// let win = window.open(fileUrl, name);
// win && (win.document.title = name);
// return win;
// }
// window.open('https://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(fileUrl));
} else {
res?.msg && ElMessage.error(res?.msg);
}
})
});
}
const downloadTemplate = (url) => {
getImageContent(url).then((res: any) => {
const downloadTemplate = async (url) => {
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let urlNames = url.split('/');
let name = urlNames.at(-1);
......@@ -368,12 +374,17 @@ const downloadTemplate = (url) => {
} else {
res?.msg && ElMessage.error(res?.msg);
}
})
});
}
const onUploadFileDownload = (file, item) => {
const onUploadFileDownload = async (file, item) => {
let url = file.url;
getImageContent(url).then((res: any) => {
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(url).decodedPath);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let f = formInline.value[item.field].find(i => i.name == file.name);
let name = f.name;
......@@ -457,7 +468,7 @@ const uploadFile = (file, item) => {
obsUploadRequest({
signedUrl: res.data.signedUrl,
file: file.file,
actualsignedRequestHeaders: res.data.actualsignedRequestHeaders
actualSignedRequestHeaders: res.data.actualSignedRequestHeaders
}).then(() => {
if (res.code == '00000') {
let fileItem = {
......
......@@ -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
......
......@@ -298,6 +298,16 @@ export const downFile = (fileUrl, fileName) => {
}, 66)
}
//本地文件下载根据Bob流
export const downFileByBob = (data,fileName) => {
let blob = new Blob([data],{type:data.type || 'text'}); // #识别文件类型
let objectUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = decodeURIComponent(fileName);
link.href = objectUrl;
link.click();
}
// 表单提交参数
export const setFormFields = (list) => {
let obj = {};
......
......@@ -56,6 +56,10 @@ service.interceptors.request.use(
config.headers.Authorization = localStorage.getItem('token');
return config;
}
if (config.method === 'obsuploadrequest') {
config.method = 'put';
return config;
}
// /**
// * 缓存命中判断
// * 成功则取消当次请求
......
......@@ -60,7 +60,7 @@ const tabsInfo = ref({
activeName: '',
tabs: [
{ label: '基础信息', name: 'first' },
{ label: '数据血缘', name: 'second' },
// / { label: '数据血缘', name: 'second' },
{ label: '变更记录', name: 'third' }
]
})
......
......@@ -11,15 +11,20 @@ import Tabs from '@/components/Tabs/index.vue'
import Table from '@/components/Table/index.vue'
import Dialog from '@/components/Dialog/index.vue'
import useCatchStore from "@/store/modules/catch";
import { download, downFile, getDownloadUrl } from '@/utils/common'
import { download, downFileByBob, downFile } from '@/utils/common'
import {
addImportData,
deleteImportData,
getImportData,
exportDictionary,
exportCollectTask,
getImageContent
// getImageContent
} from '@/api/modules/queryService';
import {
parseAndDecodeUrl,
getDownFileSignByUrl,
obsDownloadRequest
} from '@/api/modules/obsService';
import { commonPageConfig } from '@/utils/enum';
const { proxy } = getCurrentInstance() as any;
......@@ -216,11 +221,14 @@ 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;
}
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let name = row.filePath;
var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
download(res, row.fileName, fileSuffix);
downFileByBob(res, row.fileName);
} else {
res?.msg && ElMessage.error(res?.msg);
}
......@@ -228,12 +236,16 @@ const tableBtnClick = async (scope, btn) => {
//downFile(row.filePath, row.fileName)
} else if (type == 'export_abnormal_data') {
//downFile(row.errorFilePath, '')
getImageContent(row.errorFilePath).then((res: any) => {
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(row.errorFilePath).decodedPath);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let name = row.errorFilePath;
var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
let fileName = name ? name.substring(name.lastIndexOf('/') + 1) : ''
download(res, fileName, fileSuffix);
downFileByBob(res, fileName);
} else {
res?.msg && ElMessage.error(res?.msg);
}
......
......@@ -40,6 +40,11 @@ export default ({ mode, command }) => {
changeOrigin: env.VITE_OPEN_PROXY === 'true',
rewrite: path => path.replace(/\/portal/, ''),
},
'/obs': {
target: '//csbr-daop.obs.cn-north-1.myhuaweicloud.com:443',
changeOrigin: env.VITE_OPEN_PROXY === 'true',
rewrite: path => path.replace(/\/obs/, ''),
}
},
},
// 构建选项 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!