Merge branch 'dev' of http://47.94.165.164:13000/geg-gas/geg-gas-web into dev
This commit is contained in:
@ -10,9 +10,10 @@ VITE_PUBLIC_PATH = /
|
||||
# 如果接口地址匹配到,则会转发到http://localhost:3000,防止本地出现跨域问题
|
||||
# 可以有多个,注意多个不能换行,否则代理将会失效
|
||||
#VITE_PROXY = [["/api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
|
||||
VITE_PROXY=[["/api","http://10.10.2.102:9500"]]
|
||||
#VITE_PROXY=[["/api","http://10.10.2.102:9500"]]
|
||||
#VITE_PROXY=[["/api/system/generator/","http://127.0.0.1:8091/system/generator/"],["/api/system/file/","http://127.0.0.1:8091/system/file/"],["/api/system/oss/","http://127.0.0.1:8091/system/oss/"],["/api/sales/","http://127.0.0.1:8096","/sales/"],["/api/mdm/","http://127.0.0.1:8096","/mdm/"],["/api","http://10.10.2.102:9500"]]
|
||||
#VITE_PROXY=[["/api/sales/","http://127.0.0.1:8096","/sales/"],["/api/mdm/","http://127.0.0.1:8096","/mdm/"],["/api","http://10.10.2.102:9500"]]
|
||||
VITE_PROXY=[["/api/system/file/","http://127.0.0.1:8091/system/file/"],["/api","http://10.10.2.102:9500"]]
|
||||
|
||||
# 是否删除Console.log
|
||||
VITE_DROP_CONSOLE = false
|
||||
@ -29,10 +30,10 @@ VITE_GLOB_API_URL=/api
|
||||
VITE_GLOB_REPORT_URL=http://localhost:8090/api
|
||||
|
||||
# 文件上传接口 可选
|
||||
VITE_GLOB_UPLOAD_URL = /system/oss/upload
|
||||
VITE_GLOB_UPLOAD_URL = /system/file/upload
|
||||
|
||||
# 文件预览接口 可选
|
||||
VITE_GLOB_UPLOAD_PREVIEW = http://10.10.2.101:8012/onlinePreview?url=
|
||||
VITE_GLOB_UPLOAD_PREVIEW = http://10.10.2.101:8012/preview/onlinePreview?url=
|
||||
|
||||
#外部url地址
|
||||
VITE_GLOB_OUT_LINK_URL = ['http://localhost:4100']
|
||||
|
||||
@ -25,7 +25,7 @@ VITE_GLOB_REQUEST_TIMEOUT=600000
|
||||
|
||||
|
||||
# 文件上传地址 可以由nginx做转发或者直接写实际地址
|
||||
VITE_GLOB_UPLOAD_URL = /system/oss/upload
|
||||
VITE_GLOB_UPLOAD_URL = /system/file/upload
|
||||
|
||||
# 文件预览接口 可选
|
||||
VITE_GLOB_UPLOAD_PREVIEW = /preview/onlinePreview?url=
|
||||
@ -42,7 +42,7 @@ VITE_GLOB_API_URL_PREFIX =
|
||||
# 打包是否开启pwa功能
|
||||
VITE_USE_PWA = false
|
||||
#租户开关
|
||||
# VITE_GLOB_TENANT_ENABLED = true
|
||||
VITE_GLOB_TENANT_ENABLED = true
|
||||
#登录时是否需要输入租户码
|
||||
# VITE_GLOB_TENANT_INPUT_REQUIRED = true
|
||||
|
||||
|
||||
@ -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,
|
||||
},
|
||||
{
|
||||
@ -64,7 +94,7 @@ export async function deleteSingleFile(id: string, mode: ErrorMessageMode = 'mod
|
||||
return defHttp.delete<string>(
|
||||
{
|
||||
url: Api.DeleteFile,
|
||||
data: id,
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1326,25 +1326,25 @@
|
||||
// console.log(t('上传超时'));
|
||||
// };
|
||||
// xhr.send(formData);
|
||||
let folderId = data.value.options.defaultValue;
|
||||
let tableId = data.value.options.defaultValue;
|
||||
uploadMultiApi(
|
||||
{
|
||||
name: 'file',
|
||||
file: [file]
|
||||
},
|
||||
folderId
|
||||
tableId
|
||||
).then((res) => {
|
||||
data.value.options.defaultValue = res[0].folderId;
|
||||
data.value.options.defaultValue = res[0].tableId;
|
||||
getImage();
|
||||
});
|
||||
};
|
||||
|
||||
async function getImage() {
|
||||
if (data.value.options.defaultValue) {
|
||||
let fileList = await getFileList({ folderId: data.value.options.defaultValue });
|
||||
let fileList = await getFileList({ tableId: data.value.options.defaultValue });
|
||||
if (fileList.length) {
|
||||
imageUrl.value = fileList[0].fileUrl;
|
||||
data.value.options.defaultValue = fileList[0].folderId;
|
||||
data.value.options.defaultValue = fileList[0].tableId;
|
||||
}
|
||||
} else {
|
||||
imageUrl.value = '';
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: String,
|
||||
columnName: String,
|
||||
maxNumber: Number,
|
||||
accpet: String,
|
||||
name: String,
|
||||
@ -67,32 +69,53 @@
|
||||
const fileList = ref<any[]>([]);
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const folderId = ref<string>('');
|
||||
const tableId = ref<string>('');
|
||||
const tableName = ref<string>('');
|
||||
const columnName = ref<string>('');
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = '';
|
||||
tableName.value = '';
|
||||
columnName.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click']);
|
||||
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
|
||||
const previewVisible = ref(false);
|
||||
const previewImage = ref('');
|
||||
const previewTitle = ref('');
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
|
||||
const refreshList = async (val:any) => {
|
||||
if (val) {
|
||||
fileList.value = await getFileList({ folderId: props.value });
|
||||
fileList.value = await getFileList({ tableName: props.tableName, columnName: props.columnName,tableId: props.value });
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName;
|
||||
x.name = x.fileOrg;
|
||||
x.thumbUrl = x.fileUrl;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
});
|
||||
folderId.value = fileList.value[0].folderId;
|
||||
bindValues(fileList.value[0]);
|
||||
}
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
bindValues(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
await refreshList(val);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@ -113,15 +136,21 @@
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
folderId.value
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
folderId.value = res[0].folderId;
|
||||
let tableIdValue = tableId.value;
|
||||
bindValues(res[0]);
|
||||
fileList.value.forEach((x) => {
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.thumbUrl = x.fileUrl;
|
||||
});
|
||||
emit('update:value', folderId.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
if(tableIdValue==tableId.value){
|
||||
await refreshList(tableId.value);
|
||||
}
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
@ -155,26 +184,21 @@
|
||||
}
|
||||
const handleRemove = async (info) => {
|
||||
const id = info.response ? info.response.data.id : info.id;
|
||||
|
||||
const newFolderId = await deleteSingleFile(id);
|
||||
|
||||
folderId.value = newFolderId;
|
||||
|
||||
const status = await deleteSingleFile(id);
|
||||
if (status) {
|
||||
deleteFlag.value = true;
|
||||
|
||||
const index = fileList.value.findIndex((x) => x.id === id);
|
||||
fileList.value.splice(index, 1);
|
||||
|
||||
fileList.value.forEach((x) => {
|
||||
x.folderId = newFolderId;
|
||||
});
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('change');
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: '删除成功!'
|
||||
});
|
||||
}else{
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: '删除失败!'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = (info) => {
|
||||
@ -185,7 +209,7 @@
|
||||
const handlePreview = async (file) => {
|
||||
previewImage.value = file.response?.data?.fileUrl || file.fileUrl;
|
||||
previewVisible.value = true;
|
||||
previewTitle.value = file.name || file.fileName;
|
||||
previewTitle.value = file.name || file.fileOrg;
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
|
||||
@ -29,13 +29,21 @@
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getFileList } from '/@/api/system/file';
|
||||
import { getFileList,parseDownloadUrl } from '/@/api/system/file';
|
||||
|
||||
import { uploadMultiApi } from '/@/api/sys/upload';
|
||||
import { Icon } from '/@/components/Icon';
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
columnName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
name: String,
|
||||
disabled: Boolean,
|
||||
isUpload: Boolean
|
||||
@ -44,33 +52,51 @@
|
||||
const fileList = ref('');
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const folderId = ref<string>('');
|
||||
const tableId = ref<string>('');
|
||||
const tableName = ref<string>('');
|
||||
const columnName = ref<string>('');
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = '';
|
||||
tableName.value = '';
|
||||
columnName.value = '';
|
||||
}
|
||||
}
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click']);
|
||||
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
const visible = ref<boolean>(false);
|
||||
const setVisible = (value): void => {
|
||||
visible.value = value;
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
const refreshList = async (val:any) => {
|
||||
if (val) {
|
||||
let result = await getFileList({ folderId: props.value });
|
||||
let result = await getFileList({tableName: props.tableName, columnName: props.columnName,tableId: props.value});
|
||||
if (result.length) {
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let x = result[i];
|
||||
if (i > 0) break;
|
||||
fileList.value = x.fileUrl;
|
||||
fileList.value = parseDownloadUrl(x.fileUrl,false,true);
|
||||
}
|
||||
folderId.value = result[0].folderId;
|
||||
bindValues(result[0]);
|
||||
console.log(fileList.value, val, 'fileList.value');
|
||||
}
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
await refreshList(val);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@ -91,22 +117,27 @@
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
folderId.value
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
folderId.value = res[0].folderId;
|
||||
const tableIdValue = tableId.value;
|
||||
bindValues(res[0]);
|
||||
if (res.length) {
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
let x = res[i];
|
||||
|
||||
if (i > 0) break;
|
||||
fileList.value = x.fileUrl;
|
||||
fileList.value = parseDownloadUrl(x.fileUrl,false,true);
|
||||
}
|
||||
folderId.value = res[0].folderId;
|
||||
bindValues(res[0]);
|
||||
console.log(fileList.value, 'fileList.value1111111');
|
||||
}
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
if(tableIdValue==tableId.value){
|
||||
await refreshList(tableId.value);
|
||||
}
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { QuestionCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { deleteSingleFile, getFileList } from '/@/api/system/file';
|
||||
import { deleteSingleFile, getFileList, parseDownloadUrl } from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { uploadMultiApi } from '/@/api/sys/upload';
|
||||
import { Icon } from '/@/components/Icon';
|
||||
@ -51,6 +51,14 @@
|
||||
const { VITE_GLOB_UPLOAD_ALERT_TIP } = getAppEnvConfig();
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
columnName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
showTip: { type: Boolean, default: true },
|
||||
placeholder: String,
|
||||
tipType: String,
|
||||
@ -61,35 +69,53 @@
|
||||
const fileList = ref<any[]>([]);
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const folderId = ref<string>('');
|
||||
const tableId = ref<string>('');
|
||||
const tableName = ref<string>('');
|
||||
const columnName = ref<string>('');
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = '';
|
||||
tableName.value = '';
|
||||
columnName.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click']);
|
||||
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
const name = ref();
|
||||
const previewVisible = ref(false);
|
||||
const previewFile = ref('');
|
||||
const previewTitle = ref('');
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
const refreshList = async (val:any) => {
|
||||
if (val) {
|
||||
fileList.value = await getFileList({ folderId: props.value });
|
||||
fileList.value = await getFileList({ tableName: props.tableName, columnName: props.columnName,tableId: props.value});
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName;
|
||||
x.name = x.fileOrg;
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
});
|
||||
folderId.value = fileList.value[0].folderId;
|
||||
name.value = fileList.value[0].name + fileList.value[0].fileType;
|
||||
bindValues(fileList.value[0]);
|
||||
name.value = fileList.value[0].fileOrg;
|
||||
}
|
||||
}
|
||||
if (!val) {
|
||||
} else {
|
||||
fileList.value = [];
|
||||
name.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
await refreshList(val);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@ -110,17 +136,21 @@
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
folderId.value
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
folderId.value = res[0].folderId;
|
||||
const tableIdValue = tableId.value;
|
||||
bindValues(res[0]);
|
||||
fileList.value.forEach((x) => {
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
});
|
||||
name.value = res[0].fileName + res[0].fileType;
|
||||
emit('update:value', folderId.value);
|
||||
name.value = res[0].fileOrg;
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
if(tableIdValue==tableId.value) await refreshList(tableId.value);
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -152,40 +182,46 @@
|
||||
const handleRemove = async (info) => {
|
||||
const id = info.response ? info.response.data.id : info.id;
|
||||
|
||||
const newFolderId = await deleteSingleFile(id);
|
||||
|
||||
folderId.value = newFolderId;
|
||||
const status = await deleteSingleFile(id);
|
||||
|
||||
if (status) {
|
||||
deleteFlag.value = true;
|
||||
|
||||
const index = fileList.value.findIndex((x) => x.id === id);
|
||||
fileList.value.splice(index, 1);
|
||||
|
||||
fileList.value.forEach((x) => {
|
||||
x.folderId = newFolderId;
|
||||
});
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: '删除成功!'
|
||||
});
|
||||
}else{
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: '删除失败!'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = (info) => {
|
||||
const url = info.response ? info.response.data.fileUrl : info.fileUrl;
|
||||
const fileName = info.response ? info.response.data.fileName : info.fileName;
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
|
||||
downloadByUrl({ url, fileName });
|
||||
};
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
const fileUrl = file.response?.data?.fileUrl || file.fileUrl;
|
||||
previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : getAppEnvConfig().VITE_GLOB_API_URL + fileUrl));
|
||||
const fileName = file.response?.data?.fileOrg || file.fileOrg;
|
||||
let fileFullUrl = fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : location.origin + getAppEnvConfig().VITE_GLOB_API_URL + fileUrl;
|
||||
fileFullUrl+="&fullfilename="+fileName;
|
||||
previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileFullUrl));
|
||||
|
||||
previewVisible.value = true;
|
||||
previewTitle.value = file.name || file.fileName;
|
||||
previewTitle.value = file.name || file.fileOrg;
|
||||
|
||||
console.log(fileFullUrl);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@ -195,8 +231,8 @@
|
||||
|
||||
function handleClear() {
|
||||
name.value = '';
|
||||
folderId.value = '';
|
||||
emit('update:value', folderId.value);
|
||||
tableId.value = '';
|
||||
emit('update:value', tableId.value);
|
||||
emit('change');
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { UploadOutlined, PlusOutlined, DownloadOutlined, DeleteOutlined, EditOutlined, PaperClipOutlined } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { deleteSingleFile, getAppToken, getFileList, getOnlineEditUrl, getZipFiles } from '/@/api/system/file';
|
||||
import { deleteFile, getAppToken, getFileList, getZipFiles,parseDownloadUrl,parsePreviewUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { uploadMultiApi } from '/@/api/sys/upload';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
@ -119,13 +119,24 @@
|
||||
import WebOfficeSDK from '/@/assets/libs/open-jssdk-v0.1.3.es.js';
|
||||
import { getToken } from '/@/utils/auth';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { methodOf } from 'lodash-es';
|
||||
const route = useRoute();
|
||||
const { VITE_GLOB_UPLOAD_ALERT_TIP } = getAppEnvConfig();
|
||||
|
||||
const { createSuccessModal } = useMessage();
|
||||
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
columnName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
maxNumber: Number,
|
||||
accept: String,
|
||||
name: String,
|
||||
@ -156,9 +167,25 @@
|
||||
const fileList = ref<any[]>([]);
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const folderId = ref<string>('');
|
||||
const tableId = ref<string>('');
|
||||
const tableName = ref<string>('');
|
||||
const columnName = ref<string>('');
|
||||
const removeIds = ref<string[]>([]);
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = '';
|
||||
tableName.value = '';
|
||||
columnName.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click']);
|
||||
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
|
||||
const previewVisible = ref(false);
|
||||
@ -166,26 +193,31 @@
|
||||
const previewFile = ref('');
|
||||
const previewTitle = ref('');
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
const refreshList = async (val:any) => {
|
||||
if (val) {
|
||||
fileList.value = await getFileList({ folderId: props.value });
|
||||
let _list = await getFileList({ tableName: props.tableName, columnName: props.columnName,tableId: props.value });
|
||||
fileList.value = _list.filter((o) => !removeIds.value.includes(o.id));
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName;
|
||||
x.name = x.fileOrg;
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
});
|
||||
folderId.value = fileList.value[0].folderId;
|
||||
bindValues(fileList.value[0]);
|
||||
}
|
||||
} else {
|
||||
folderId.value = '';
|
||||
bindValues(undefined);
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
await refreshList(val);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@ -206,18 +238,24 @@
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
folderId.value
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
folderId.value = res[0].folderId;
|
||||
|
||||
fileList.value.forEach((x) => {
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.fileSize = x.fileSize
|
||||
});
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
let tableIdValue = tableId.value;
|
||||
bindValues(res[0]);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
if(tableIdValue==tableId.value){
|
||||
await refreshList(tableId.value);
|
||||
}
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -255,34 +293,34 @@
|
||||
}
|
||||
const handleRemove = async (info) => {
|
||||
const id = info.response ? info.response.data.id : info.id;
|
||||
|
||||
const newFolderId = await deleteSingleFile(id);
|
||||
|
||||
folderId.value = newFolderId;
|
||||
|
||||
const status = await deleteFile([id]);
|
||||
if (status) {
|
||||
removeIds.value.push(id);
|
||||
deleteFlag.value = true;
|
||||
|
||||
const index = fileList.value.findIndex((x) => x.id === id);
|
||||
fileList.value.splice(index, 1);
|
||||
|
||||
fileList.value.forEach((x) => {
|
||||
x.folderId = newFolderId;
|
||||
});
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
await refreshList(tableId.value);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: '删除成功!'
|
||||
});
|
||||
}else{
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: '删除失败!'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = (info) => {
|
||||
const url = info.response ? info.response.data.fileUrl : info.fileUrl;
|
||||
const fileName = info.response ? info.response.data.fileName : info.fileName;
|
||||
const fileType = info.response ? info.response.data.fileType : info.fileType;
|
||||
|
||||
downloadByUrl({ url, fileName: fileName + fileType });
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
|
||||
const handleCancelWps = () => {
|
||||
@ -322,12 +360,13 @@
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
const fileUrl = file.response?.data?.fileUrl || file.fileUrl;
|
||||
previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : getAppEnvConfig().VITE_GLOB_API_URL + fileUrl));
|
||||
const fileName = file.name || file.fileOrg;
|
||||
const previewUrl = parsePreviewUrl(fileName, fileUrl);
|
||||
previewFile.value = parsePreviewUrl(fileName, fileUrl);
|
||||
|
||||
previewVisible.value = true;
|
||||
previewTitle.value = file.name || file.fileName;
|
||||
|
||||
console.log(fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : getAppEnvConfig().VITE_GLOB_API_URL + fileUrl);
|
||||
previewTitle.value = fileName;
|
||||
console.log(previewUrl);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@ -377,7 +416,7 @@
|
||||
createSuccessModal({ title: 'Tip', content: res.msg });
|
||||
return;
|
||||
} else if (res.type === 'synced') {
|
||||
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
|
||||
downloadByUrl({ url: parseDownloadUrl(res.url), fileName: res.name || 'files.zip' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { UploadOutlined, PlusOutlined, DownloadOutlined, DeleteOutlined, EditOutlined, PaperClipOutlined } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { deleteSingleFile, getAppToken, getFileList, getOnlineEditUrl, getZipFiles } from '/@/api/system/file';
|
||||
import { deleteSingleFile, getAppToken, getFileList, parseDownloadUrl, getZipFiles } from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { uploadMultiApi } from '/@/api/sys/upload';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
@ -126,6 +126,8 @@
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: String,
|
||||
columnName: String,
|
||||
maxNumber: Number,
|
||||
accept: String,
|
||||
name: String,
|
||||
@ -162,9 +164,23 @@
|
||||
const fileList = ref<any[]>([]);
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const folderId = ref<string>('');
|
||||
const tableId = ref<string>('');
|
||||
const tableName = ref<string>('');
|
||||
const columnName = ref<string>('');
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = '';
|
||||
tableName.value = '';
|
||||
columnName.value = '';
|
||||
}
|
||||
}
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click']);
|
||||
const emit = defineEmits(['update:value', 'change', 'click','update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
|
||||
const previewVisible = ref(false);
|
||||
@ -185,10 +201,10 @@
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.fileType =x.fileType || ('.' + x.filePath.split('?')[0]?.split('.')?.pop())
|
||||
});
|
||||
// folderId.value = fileList.value[0].folderId;
|
||||
}
|
||||
bindValues(fileList.value[0]);
|
||||
} else {
|
||||
folderId.value = '';
|
||||
bindValues(undefined);
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
@ -202,7 +218,7 @@
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
if (val) {
|
||||
fileList.value = await getFileList({ folderId: props.value });
|
||||
fileList.value = await getFileList({tableName: props.tableName, columnName: props.columnName,tableId: props.value});
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName;
|
||||
@ -210,10 +226,10 @@
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
});
|
||||
folderId.value = fileList.value[0].folderId;
|
||||
}
|
||||
bindValues(fileList.value[0]);
|
||||
} else {
|
||||
folderId.value = '';
|
||||
bindValues(undefined);
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
@ -238,9 +254,8 @@
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
folderId.value
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
// folderId.value = res[0].folderId;
|
||||
let fileArr = res||[]
|
||||
fileArr.forEach((x) => {
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
@ -248,9 +263,12 @@
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.fileSize = x.fileSize
|
||||
});
|
||||
bindValues(res[0]);
|
||||
fileList.value = [...fileList.value, ...fileArr]
|
||||
emit('update:value', folderId.value);
|
||||
emit('change', fileList.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change');
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -288,21 +306,9 @@
|
||||
}
|
||||
const handleRemove = async (info) => {
|
||||
const id = info.response ? info.response.data.id : info.id;
|
||||
|
||||
// const newFolderId = await deleteSingleFile(id);
|
||||
|
||||
// folderId.value = newFolderId;
|
||||
|
||||
// deleteFlag.value = true;
|
||||
|
||||
const index = fileList.value.findIndex((x) => x.id === id);
|
||||
fileList.value.splice(index, 1);
|
||||
|
||||
// fileList.value.forEach((x) => {
|
||||
// x.folderId = newFolderId;
|
||||
// });
|
||||
|
||||
emit('update:value', folderId.value);
|
||||
emit('update:value', tableId.value);
|
||||
emit('change', fileList.value);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
@ -312,12 +318,9 @@
|
||||
|
||||
const handleDownload = (info) => {
|
||||
console.log(info, 434)
|
||||
|
||||
const url = info.response ? info.response.data.fileUrl : (info.presignedUrl || info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileName : (info.fileOrg || info.fileName);
|
||||
const fileType = info.response ? info.response.data.fileType : info.fileType;
|
||||
|
||||
downloadByUrl({ url, fileName: fileName + fileType });
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : (info.presignedUrl || info.fileUrl));
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName });
|
||||
};
|
||||
|
||||
const handleCancelWps = () => {
|
||||
@ -356,16 +359,15 @@
|
||||
};
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
// const fileUrl = file.presignedUrl|| file.response?.data?.fileUrl || file.fileUrl;
|
||||
// console.log(fileUrl, 'fileUrl', file)
|
||||
// window.open(fileUrl)
|
||||
|
||||
const fileUrl = file.presignedUrl|| file.response?.data?.fileUrl || file.fileUrl;
|
||||
console.log(fileUrl, 'fileUrl', file)
|
||||
window.open(fileUrl)
|
||||
|
||||
// previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : getAppEnvConfig().VITE_GLOB_API_URL + fileUrl));
|
||||
|
||||
// previewVisible.value = true;
|
||||
// previewTitle.value = file.name || file.fileName;
|
||||
// console.log(previewFile.value, 99)
|
||||
// console.log(fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : getAppEnvConfig().VITE_GLOB_API_URL + fileUrl);
|
||||
const fileName = file.response?.data?.fileOrg || file.fileOrg;
|
||||
let fileFullUrl = fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : location.origin + getAppEnvConfig().VITE_GLOB_API_URL + fileUrl;
|
||||
fileFullUrl+="&fullfilename="+fileName;
|
||||
previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileFullUrl));
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
</a-button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
<UploadModal v-bind="bindValue" :previewFileList="fileList" :folderId="folderId" @register="registerUploadModal" @change="handleChange" @delete="handleDelete" />
|
||||
<UploadModal v-bind="bindValue" :previewFileList="fileList" :folderId="tableId" @register="registerUploadModal" @change="handleChange" @delete="handleDelete" />
|
||||
|
||||
<UploadPreviewModal :value="fileList" :file-names="fileNameList" @register="registerPreviewModal" @list-change="handlePreviewChange" @delete="handlePreviewDelete" />
|
||||
</div>
|
||||
@ -56,7 +56,7 @@
|
||||
const fileList = ref<string[]>([]);
|
||||
const fileNameList = ref<string[]>([]);
|
||||
|
||||
const folderId = computed(() => props.value);
|
||||
const tableId = computed(() => props.value);
|
||||
const showPreview = computed(() => {
|
||||
const { emptyHidePreview } = props;
|
||||
if (!emptyHidePreview) return true;
|
||||
@ -73,9 +73,9 @@
|
||||
async (value) => {
|
||||
//如果没有传入参数 默认不再请求文件列表
|
||||
if (value && value.length > 0) {
|
||||
const list = await getFileList({ folderId: value });
|
||||
const list = await getFileList({ tableId: value });
|
||||
fileList.value = list.map((item) => item.fileUrl);
|
||||
fileNameList.value = list.map((item) => item.fileName);
|
||||
fileNameList.value = list.map((item) => item.fileOName);
|
||||
} else {
|
||||
fileList.value = [];
|
||||
}
|
||||
@ -122,7 +122,7 @@
|
||||
bindValue,
|
||||
handleDelete,
|
||||
handlePreviewDelete,
|
||||
folderId,
|
||||
tableId,
|
||||
t
|
||||
};
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@
|
||||
{
|
||||
data: {
|
||||
...(props.uploadParams || {}),
|
||||
folderId
|
||||
tableId: props.folderId,
|
||||
},
|
||||
file: item.file,
|
||||
name: props.name,
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
|
||||
import { getOaMessage, getOaNews, setOaRead, setSingleRead, setWorkReadAll, getScheduleMsg, setScheduleRead, setScheduleReadAll } from '/@/api/system/login';
|
||||
import { queryLoginUserNotices, setSystemNoticeRead } from '/@/api/system/systemNotice/index';
|
||||
import { getInfoByDownloadUrl } from '/@/api/system/file';
|
||||
import { getInfoByDownloadUrl,parseDownloadUrl } from '/@/api/system/file';
|
||||
import { Empty } from 'ant-design-vue';
|
||||
|
||||
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
|
||||
@ -356,8 +356,8 @@
|
||||
record.paramsJson = record.paramsJson ? JSON.parse(record.paramsJson) : {};
|
||||
let fileId = record.paramsJson.id || [];
|
||||
getInfoByDownloadUrl({ id: fileId }).then((res) => {
|
||||
let fileUrl = res.fileUrlFixed || res.fileUrl;
|
||||
downloadByUrl({ url: fileUrl, fileName: res.fileName + res.fileType || 'files.zip' });
|
||||
let fileUrl = parseDownloadUrl(res.fileUrl);
|
||||
downloadByUrl({ url: res.fileUrl, fileName: res.fileOrg || 'files.zip' });
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { openWindow } from '..';
|
||||
import { dataURLtoBlob, urlToBase64 } from './base64Conver';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
/**
|
||||
* Download online pictures
|
||||
@ -71,7 +72,6 @@ export function downloadByUrl({
|
||||
let fileUrl = window.URL.createObjectURL(x.response);
|
||||
const isChrome = window.navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
|
||||
const isSafari = window.navigator.userAgent.toLowerCase().indexOf('safari') > -1;
|
||||
|
||||
if (/(iP)/g.test(window.navigator.userAgent)) {
|
||||
console.error('Your browser does not support download!');
|
||||
return false;
|
||||
|
||||
@ -26,7 +26,6 @@ import useGlobalFlag from '/@/hooks/core/useGlobalFlag';
|
||||
|
||||
import { useLockStore } from '/@/store/modules/lock';
|
||||
|
||||
|
||||
const globSetting = useGlobSetting();
|
||||
const urlPrefix = globSetting.urlPrefix;
|
||||
const { createMessage, createErrorModal } = useMessage();
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
height: '300px'
|
||||
}
|
||||
});
|
||||
imgList.value = await getFileList({ folderId: data.filePath });
|
||||
imgList.value = await getFileList({ tableId: data.filePath });
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
@ -302,7 +302,7 @@
|
||||
};
|
||||
});
|
||||
if (baseInfo.value.filePath) {
|
||||
imgList.value = await getFileList({ folderId: baseInfo.value.filePath });
|
||||
imgList.value = await getFileList({ tableId: baseInfo.value.filePath });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
alarmtInfo.value = await getDeviceAlarmCheck(data.id);
|
||||
imgSrc.value = alarmtInfo.value?.state === 0 ? 'check_tip_no1' : 'check_tip_pass1';
|
||||
if (alarmtInfo.value.filePath) {
|
||||
imgList.value = await getFileList({ folderId: alarmtInfo.value.filePath });
|
||||
imgList.value = await getFileList({ tableId: alarmtInfo.value.filePath });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
inspectInfo.value = await getDeviceInspectInfo(data.id);
|
||||
imgSrc.value = inspectInfo.value?.state === 0 ? 'check_tip_no' : 'check_tip_pass';
|
||||
if (inspectInfo.value.filePath) {
|
||||
imgList.value = await getFileList({ folderId: inspectInfo.value.filePath });
|
||||
imgList.value = await getFileList({ tableId: inspectInfo.value.filePath });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -257,7 +257,7 @@
|
||||
}
|
||||
];
|
||||
if (baseInfo.value.fileId) {
|
||||
imgList.value = await getFileList({ folderId: baseInfo.value.fileId });
|
||||
imgList.value = await getFileList({ tableId: baseInfo.value.fileId });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -528,7 +528,7 @@
|
||||
isReady.value = true;
|
||||
|
||||
if (baseInfo.value.filePath) {
|
||||
imgList.value = await getFileList({ folderId: baseInfo.value.filePath });
|
||||
imgList.value = await getFileList({ tableId: baseInfo.value.filePath });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@
|
||||
};
|
||||
});
|
||||
if (baseInfo.value.filePath) {
|
||||
imgList.value = await getFileList({ folderId: baseInfo.value.filePath });
|
||||
imgList.value = await getFileList({ tableId: baseInfo.value.filePath });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -103,10 +103,10 @@
|
||||
}
|
||||
});
|
||||
if (ele1.fieldCode.indexOf('file') > 0 || ele1.fieldCode.indexOf('File') > 0) {
|
||||
const newlist = await getFileList({ folderId: ele1.newValue });
|
||||
const newlist = await getFileList({ tableId: ele1.newValue });
|
||||
fileList.value.push({ id: ele1.newValue, name: newlist.map((item) => item.fileName).join('、') });
|
||||
|
||||
const oldlist = await getFileList({ folderId: ele1.oldValue });
|
||||
const oldlist = await getFileList({ tableId: ele1.oldValue });
|
||||
fileList.value.push({ id: ele1.oldValue, name: oldlist.map((item) => item.fileName).join('、') });
|
||||
}
|
||||
});
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
);
|
||||
async function getImage() {
|
||||
if (props.config.folderId) {
|
||||
let fileList = await getFileList({ folderId: props.config.folderId });
|
||||
let fileList = await getFileList({ tableId: props.config.folderId });
|
||||
if (fileList.length) {
|
||||
imageUrl.value = fileList[0].fileUrl;
|
||||
}
|
||||
|
||||
@ -70,24 +70,24 @@
|
||||
data.show = true;
|
||||
});
|
||||
const submitUpload = (file) => {
|
||||
let folderId = data.info.config.folderId;
|
||||
let tableId = data.info.config.folderId;
|
||||
uploadMultiApi(
|
||||
{
|
||||
name: 'file',
|
||||
file: [file]
|
||||
},
|
||||
folderId
|
||||
tableId
|
||||
).then((res) => {
|
||||
data.info.config.folderId = res[0].folderId;
|
||||
data.info.config.folderId = res[0].tableId;
|
||||
getImage();
|
||||
});
|
||||
};
|
||||
async function getImage() {
|
||||
if (data.info.config.folderId) {
|
||||
let fileList = await getFileList({ folderId: data.info.config.folderId });
|
||||
let fileList = await getFileList({ tableId: data.info.config.folderId });
|
||||
if (fileList.length) {
|
||||
imageUrl.value = fileList[0].fileUrl;
|
||||
data.info.config.folderId = fileList[0].folderId;
|
||||
data.info.config.folderId = fileList[0].tableId;
|
||||
}
|
||||
} else {
|
||||
imageUrl.value = '';
|
||||
|
||||
@ -1178,15 +1178,15 @@
|
||||
};
|
||||
|
||||
const submitUpload = (file) => {
|
||||
let folderId = data.value.options.defaultValue;
|
||||
let tableId = data.value.options.defaultValue;
|
||||
uploadMultiApi(
|
||||
{
|
||||
name: 'file',
|
||||
file: [file]
|
||||
},
|
||||
folderId
|
||||
tableId
|
||||
).then((res) => {
|
||||
data.value.options.defaultValue = res[0].folderId;
|
||||
data.value.options.defaultValue = res[0].tableId;
|
||||
getImage();
|
||||
});
|
||||
};
|
||||
@ -1350,10 +1350,10 @@
|
||||
}
|
||||
async function getImage() {
|
||||
if (data.value.options.defaultValue) {
|
||||
let fileList = await getFileList({ folderId: data.value.options.defaultValue });
|
||||
let fileList = await getFileList({ tableId: data.value.options.defaultValue });
|
||||
if (fileList.length) {
|
||||
imageUrl.value = fileList[0].fileUrl;
|
||||
data.value.options.defaultValue = fileList[0].folderId;
|
||||
data.value.options.defaultValue = fileList[0].tableId;
|
||||
}
|
||||
} else {
|
||||
imageUrl.value = '';
|
||||
|
||||
@ -129,7 +129,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||
fileOrg: v.name,
|
||||
filePath: v.url,
|
||||
fileSize: v.fileSize,
|
||||
xjrFileId: v.folderId
|
||||
xjrFileId: v.tableId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user