Merge branch 'master' of http://gitlab.tianti.tg.unicom.local/eshop/fe_service_ebtp_frontend into master_jnryy_customerservice

This commit is contained in:
jl-zhoujl2
2023-01-31 09:56:50 +08:00
268 changed files with 28966 additions and 3131 deletions

View File

@ -50,6 +50,15 @@ export function returnDictVal(data: any, value: any) {
}
return val;
}
/**
* procurementType标的类型转换多个 20220927
*/
export function multipleTypeTransform(value: string | null | undefined, valueEnum: any): string {
if (valueEnum && value) {
return value.split(",").map(item => valueEnum[item].text).join();
}
return "-";
}
/**
* 获取url路径信息

View File

@ -2,10 +2,12 @@
* @Author: zhoujianlong
* @Date: 2022-03-03 09:06:36
* @Last Modified by: zhoujianlong
* @Last Modified time: 2022-05-18 17:23:26
* @Last Modified time: 2022-12-23 23:21:01
*/
import { getDownloadSecretKey, getFilelist, getFilelistBySecond } from "@/services/download_";
import { message } from "antd";
import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react";
import { isEmpty, isNotEmpty } from "./CommonUtils";
/**
@ -43,11 +45,11 @@ export const downloadPath = '/api/doc/v1.0/files/download';
/**
* 查询文件列表根据2.0 bid
*/
export const findFilelistPathBySecond = 'http://111.198.162.67:8081/downloadfile/v1/file/getFileListById';
export const findFilelistPathBySecond = '/downloadfile/v1/file/getFileListById';
/**
* 文件下载根据2.0 bid fileId
*/
export const downloadPathBySecond = 'http://111.198.162.67:8081/downloadfile/v1/file/downloadFileStreamById';
export const downloadPathBySecond = '/downloadfile/v1/file/downloadFileStreamById';
export interface FilelistProps {
uid: string,
@ -117,6 +119,8 @@ export const downloadFileObjectId = (objectId: string) => {
getFilelist([objectId]).then(res => {
if (res?.success && res?.data?.length > 0) {
downloadFile({ uid: res?.data[res?.data?.length - 1].fileId });
} else {
message.info("文档中心错误或文件不存在");
}
})
} else {
@ -146,6 +150,37 @@ export const getDownloadFileUrl = async (objectId: string) => {
}
return url;
}
/**
* objectId获取文件下载链接
* @param objectId
* @returns
*/
export const useDownLoadUrl = (objectId: string): string[] => {
const [url, setUrl] = useState<string>("");
useEffect(() => {
const getFileUrl = async () => {
console.log("objectId", objectId);
await getFilelist([objectId]).then(async res => {
if (res?.success && res?.data?.length > 0) {
const keyRes = await getDownloadSecretKey({ fileId: res?.data[res?.data?.length - 1].fileId });//获取key
let url = downloadAttachmentPath + '?fileId=' + res?.data[res?.data?.length - 1].fileId + '&documentSecretKey=' + keyRes?.data;
setUrl(url);
}
})
}
if (isNotEmpty(objectId)) {
if (checkObjectId(objectId)) {//判断3.0 objectId
getFileUrl();
} else {
let url = downloadPathBySecond + '?id=' + objectId + '&p=' + getTimeStamp();
setUrl(url);
}
}
}, [objectId])
return [url];
}
/**
* 获取文件列表
* @param objectId
@ -159,12 +194,12 @@ export async function getFileListByBid(objectId: string) {
if (checkObjectId(objectId)) {//判断3.0 objectId
return getFilelist([objectId]).then(res => {
if (res?.success && res?.data?.length > 0) {
res?.data?.forEach(({ fileId, originalName }: any) => {
res?.data?.forEach(({ fileId, originalName, filePath }: any) => {
result.push({
uid: fileId,
name: originalName,
status: 'done',
url: 'javascript:void(0);',
url: originalName.endsWith(".png") || originalName.endsWith(".jpg") || originalName.endsWith(".jpeg") ? pictureDisplayPath + '?filePath=' + filePath : 'javascript:void(0);',
})
});
return result;

View File

@ -137,6 +137,7 @@ const ExtendUpload: React.FC<ExtendUploadProps> = (props) => {
<>
<Spin spinning={spin}>
<Upload
onPreview={downloadFile}
{...uploadProps}
key={"file" + returnValue}
action={uploadAttachmentPath}
@ -155,7 +156,6 @@ const ExtendUpload: React.FC<ExtendUploadProps> = (props) => {
showUploadList={{
removeIcon: <CloseSquareOutlined />,
}}
onPreview={downloadFile}
fileList={fileList}
>
{!uploadProps?.disabled ?

View File

@ -3,7 +3,7 @@ import { Modal, Button } from 'antd';
import PDF from 'react-pdf-js';
import ProCard from '@ant-design/pro-card';
import FileDown from '@/utils/Download';
import { getDownloadFileUrl, getFileListByBid } from '../DownloadUtils';
import { getFileListByBid, useDownLoadUrl } from '../DownloadUtils';
/**
* Pdf Modal弹窗公共组件
* 2021.8.25 zhoujianlong 根据定标结果通知书的弹出窗口改造初始版本,增加备注
@ -17,6 +17,7 @@ interface PdfModalProps {
const PdfModal: React.FC<PdfModalProps> = (props) => {
const { fileId, downLoadFileName, modalVisible, onCancel } = props;
const [url] = useDownLoadUrl(fileId);
const [page, setPage] = useState<number>(1); //页码
const [pages, setPages] = useState<number>(0); //总页数
const [fileExist, setFileExist] = useState<string>('0'); //0未验证1验证后有2验证后没有
@ -93,10 +94,10 @@ const PdfModal: React.FC<PdfModalProps> = (props) => {
<ProCard layout="center" direction="column" ghost>
{fileExist == '0' ? (
<div />
) : fileExist == '1' ? (
) : fileExist == '1' ? url != "" && (
<>
<PDF
file={getDownloadFileUrl(fileId)}
file={url}
scale={1.6}
onDocumentComplete={onDocumentComplete}
page={page}

View File

@ -75,15 +75,17 @@ request.interceptors.request.use(async (url, options) => {
url.startsWith('/api/auth/reloadToken') ||
url.startsWith('/api/auth/reloadPartnerToken') ||
url.startsWith('/api/api/mall-expe') ||
url == '/api/biz-service-ebtp-extend/v1/userpassword/validatePassword' ||
url.startsWith('/api/notification')
url == '/api/core-service-ebtp-userinfo/v1/userpassword/validatePassword' ||
url.startsWith('/api/notification') ||
url == '/api/core-service-ebtp-userinfo/outer/v1/ebtp/face/faceCompare' ||
url == '/api/core-service-ebtp-userinfo/outer/v1/ebtp/face/rgbArray2Base64'
) {
headers = {
...options.headers,
};
url.startsWith('/api/api/mall-prox') ||
url.startsWith('/api/api/mall-expe') ||
url == '/api/biz-service-ebtp-extend/v1/userpassword/validatePassword'
url.startsWith('/api/api/mall-expe') ||
url == '/api/core-service-ebtp-userinfo/v1/userpassword/validatePassword'
? (options.credentials = 'omit')
: null;
} else {