安全管理/知识库
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<el-upload
|
||||
ref="fileUploadRef"
|
||||
multiple
|
||||
:action="uploadFileUrl"
|
||||
:action="realUploadUrl"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:file-list="fileList"
|
||||
:limit="limit"
|
||||
@ -103,7 +103,15 @@ const props = defineProps({
|
||||
//可拖拽上传
|
||||
isDarg: propTypes.bool.def(false),
|
||||
// 其他参数
|
||||
data: propTypes.object.def({})
|
||||
data: propTypes.object.def({}),
|
||||
onUploadSuccess: {
|
||||
type: Function as PropType<(files: any[]) => void>,
|
||||
default: undefined
|
||||
},
|
||||
params: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
@ -115,6 +123,10 @@ const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||
const uploadFileUrl = ref(baseUrl + props.uploadUrl); // 上传文件服务器地址
|
||||
const headers = ref(globalHeaders());
|
||||
|
||||
const realUploadUrl = computed(() => {
|
||||
const search = new URLSearchParams(props.params).toString();
|
||||
return search ? `${baseUrl}${props.uploadUrl}?${search}` : `${baseUrl}${props.uploadUrl}`;
|
||||
});
|
||||
const fileList = ref<any[]>([]);
|
||||
const showTip = computed(() => props.isShowTip && (props.fileType || props.fileSize));
|
||||
|
||||
@ -256,6 +268,7 @@ const uploadedSuccessfully = () => {
|
||||
|
||||
emit('update:modelValue', listToString(fileList.value));
|
||||
proxy?.$modal.closeLoading();
|
||||
props.onUploadSuccess?.(fileList.value);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user