lcw
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
</template>
|
||||
<template #file="{ file }" v-if="!props.showBtn">
|
||||
<div v-if="props.isImg">
|
||||
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
|
||||
<img class="el-upload-list__item-thumbnail" :src="file.url || ''" alt="" />
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
|
||||
<el-icon> <zoom-in /></el-icon>
|
||||
@ -99,9 +99,18 @@ watch(() => props.modelValue,(val) => {
|
||||
if(arr.length == 0 ) return fileList.value = [];
|
||||
fileList.value = arr.map((el) => {
|
||||
if (Object.prototype.toString.call(el) === "[object Object]") {
|
||||
return props.isAll ? { url: `/mosty-api/mosty-base/minio/image/download/` + el.id, name: el.name ,id : el } : { url:el,name:el.name , id : el};
|
||||
// 确保file.url始终是字符串URL
|
||||
const fileUrl = props.isAll ? `/mosty-api/mosty-base/minio/image/download/` + el.id : el.url;
|
||||
return {
|
||||
url: String(fileUrl || ''),
|
||||
name: el.name || '',
|
||||
id: el
|
||||
};
|
||||
} else {
|
||||
return { url: `/mosty-api/mosty-base/minio/image/download/` + el,id : el };
|
||||
return {
|
||||
url: String(`/mosty-api/mosty-base/minio/image/download/` + el || ''),
|
||||
id: el
|
||||
};
|
||||
}
|
||||
});
|
||||
},{ immediate: true,deep:true });
|
||||
@ -110,7 +119,7 @@ const actionUrl = computed(() => {
|
||||
if (props.isAll) {
|
||||
return "/mosty-api/mosty-base/minio/image/upload/id";
|
||||
} else {
|
||||
return props.isImg ? "/mosty-api/mosty-base/minio/image/upload/id": "/mosty-api/mosty-base/minio/file/upload";
|
||||
return props.isImg ? "/mosty-api/mosty-base/minio/image/upload/id": "/mosty-api/mosty-base/minio/file/uploadObj";
|
||||
}
|
||||
});
|
||||
|
||||
@ -157,7 +166,8 @@ const getSuffix = (fileName) => {
|
||||
};
|
||||
|
||||
const handlerSuccess = (res, file) => {
|
||||
// file.url = `/mosty-api/mosty-base/minio/image/download/` + res.data;
|
||||
// 设置file.url,确保其存在且为字符串类型
|
||||
file.url = `/mosty-api/mosty-base/minio/image/download/` + res.data;
|
||||
file.id = res.data;
|
||||
fileList.value.push(file);
|
||||
let arr = []
|
||||
@ -187,7 +197,7 @@ const beforeImgUpload = (file) => {
|
||||
};
|
||||
//查询图片
|
||||
const handlePictureCardPreview = (file) => {
|
||||
dialogImageUrl.value = file.url;
|
||||
dialogImageUrl.value = file.url || '';
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
const handleDownload = (file) => {
|
||||
|
||||
@ -87,7 +87,13 @@ const submit = (resfun) => {
|
||||
};
|
||||
|
||||
const getdep = (e, val) => {
|
||||
if (val) listQuery.value[val] = e ? e.orgName : '';
|
||||
if (val) {
|
||||
if (Array.isArray(e)) {
|
||||
listQuery.value[val] = e ? e.map(item => item.orgName) : '';
|
||||
} else {
|
||||
listQuery.value[val] = e ? e.orgName : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
const reset = () => {
|
||||
elform.value.resetFields()
|
||||
|
||||
Reference in New Issue
Block a user