Merge branch 'dev' of http://47.94.165.164:13000/geg-gas/geg-gas-web into dev
This commit is contained in:
@ -19,16 +19,16 @@ export function uploadApi(params: UploadFileParams) {
|
||||
/**
|
||||
* @description: Upload interface
|
||||
*/
|
||||
export function uploadMultiApi(params: UploadFileParams, folderid) {
|
||||
export function uploadMultiApi(params: UploadFileParams,tableId:any,tableName?:any,columnName?:any) {
|
||||
return defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: '/system/oss/multi-upload?folderId=' + folderid,
|
||||
url: '/system/file/multi-upload?tableName=' + tableName + '&columnName=' + columnName + '&tableId=' + tableId,
|
||||
},
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export const uploadSrc = '/system/oss/upload';
|
||||
export const uploadSrc = '/system/file/upload';
|
||||
|
||||
// 上传二进制文件生成图片
|
||||
export async function uploadBlobApi(blob, filename) {
|
||||
|
||||
@ -2,20 +2,49 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
import { FilePageListParams, FilePageListSearchModel, FilePageListResultModel, ZipFilesModel, FileModel } from './model';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
const globSetting = useGlobSetting();
|
||||
|
||||
const urlPrefix = globSetting.apiUrl;
|
||||
|
||||
enum Api {
|
||||
File = '/system/file',
|
||||
Info = '/system/file/info',
|
||||
InfoByDownloadUrl = '/system/file/info-byDownloadUrl',
|
||||
List = '/system/file',
|
||||
List = '/system/file/list',
|
||||
Page = '/system/file/page',
|
||||
DeleteFile = '/system/file/delete-single',
|
||||
DeleteFile = '/system/file/delete',
|
||||
ZipFiles = '/system/file/package-files',
|
||||
}
|
||||
|
||||
export function parseDownloadUrl(url:string,th?:boolean,full?:boolean) {
|
||||
// 空值防护:如果url为空,直接返回空字符串(避免拼接出错)
|
||||
if (!url) return '';
|
||||
|
||||
// 判断url是否以/api开头(忽略首尾空格,兼容可能的空格场景)
|
||||
const trimmedUrl = url.trim();
|
||||
if(urlPrefix!=undefined && trimmedUrl.startsWith(urlPrefix)){
|
||||
return trimmedUrl + (th ? '&th=true' : '');
|
||||
}
|
||||
let resultUrl = urlPrefix + trimmedUrl + (th ? '&th=true' : '');
|
||||
if(full){
|
||||
return location.origin + resultUrl;
|
||||
}
|
||||
return resultUrl;
|
||||
}
|
||||
|
||||
export function parsePreviewUrl(fileName: string, fileUrl: string) {
|
||||
let fileFullUrl = fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : location.origin + getAppEnvConfig().VITE_GLOB_API_URL + fileUrl;
|
||||
fileFullUrl+="&fullfilename="+fileName;
|
||||
return getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileFullUrl));
|
||||
}
|
||||
|
||||
export async function getInfoByDownloadUrl(params: {id: string}, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<FileModel>(
|
||||
{
|
||||
url: Api.InfoByDownloadUrl,
|
||||
url: Api.Info,
|
||||
params,
|
||||
},
|
||||
{
|
||||
@ -24,6 +53,7 @@ export async function getInfoByDownloadUrl(params: {id: string}, mode: ErrorMess
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 查询文件分页
|
||||
*/
|
||||
@ -48,7 +78,7 @@ export async function getFilePage(
|
||||
export async function deleteFile(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.delete<number>(
|
||||
{
|
||||
url: Api.File,
|
||||
url: Api.DeleteFile,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
@ -61,15 +91,15 @@ export async function deleteFile(ids: string[], mode: ErrorMessageMode = 'modal'
|
||||
* @description: 删除单个文件
|
||||
*/
|
||||
export async function deleteSingleFile(id: string, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.delete<string>(
|
||||
{
|
||||
url: Api.DeleteFile,
|
||||
data: id,
|
||||
},
|
||||
{
|
||||
return defHttp.delete<string>(
|
||||
{
|
||||
url: Api.DeleteFile,
|
||||
data: [id],
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,3 +140,6 @@ export async function getAppToken(params, mode: ErrorMessageMode = 'modal') {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,9 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||
|
||||
export interface FilePageListParams {
|
||||
fileName?: string; //文件名
|
||||
folderId?: string; //文件夹Id
|
||||
tableName?: string; //表名称
|
||||
columnName?: string; //属性名
|
||||
tableId?: string; //表主键
|
||||
processId?: string; //流程Id
|
||||
}
|
||||
|
||||
@ -11,14 +13,17 @@ export interface FilePageListParams {
|
||||
*/
|
||||
export interface FilePageListModel {
|
||||
id: number;
|
||||
folderId: number;
|
||||
fileName: string;
|
||||
tableName: string;
|
||||
columnName: string;
|
||||
tableId: number;
|
||||
|
||||
fileOrg: string;
|
||||
fileUrl: string;
|
||||
fileSize: number;
|
||||
fileSuffiex: any;
|
||||
fileType: string;
|
||||
downloadCount: number;
|
||||
remark: string;
|
||||
filePath: string;
|
||||
downloadCnt: number;
|
||||
docDesc: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,15 +31,18 @@ export interface FilePageListModel {
|
||||
*/
|
||||
export interface FileModel {
|
||||
id: number;
|
||||
folderId: number;
|
||||
fileName: string;
|
||||
tableName: string;
|
||||
columnName: string;
|
||||
tableId: number;
|
||||
|
||||
fileOrg: string;
|
||||
fileUrl: string;
|
||||
fileSize: number;
|
||||
fileSuffiex: any;
|
||||
fileType: string;
|
||||
downloadCount: number;
|
||||
remark: string;
|
||||
fileUrlFixed: string; //加签后的url
|
||||
filePath: string;
|
||||
downloadCnt: number;
|
||||
docDesc: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user