|
@@ -16,7 +16,7 @@
|
|
:accept="fileType.join(',')"
|
|
:accept="fileType.join(',')"
|
|
:headers="headers"
|
|
:headers="headers"
|
|
>
|
|
>
|
|
- <el-button icon="icon" type="primary">{{ text }}</el-button>
|
|
|
|
|
|
+ <el-button :icon="icon" type="primary">{{ text }}</el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
<!-- 上传提示 -->
|
|
<!-- 上传提示 -->
|
|
<div class="el-upload__tip" v-if="showTip">
|
|
<div class="el-upload__tip" v-if="showTip">
|
|
@@ -54,6 +54,7 @@ import { globalHeaders } from '@/api'
|
|
import { OssVO } from '@/api/interface/system/oss'
|
|
import { OssVO } from '@/api/interface/system/oss'
|
|
import { getListByIdsApi, delOssApi } from '@/api/modules/system/oss'
|
|
import { getListByIdsApi, delOssApi } from '@/api/modules/system/oss'
|
|
import { listToString } from '@/utils/common'
|
|
import { listToString } from '@/utils/common'
|
|
|
|
+
|
|
interface UploadFileProps {
|
|
interface UploadFileProps {
|
|
modelValue?: string | number
|
|
modelValue?: string | number
|
|
disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
|
|
disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
|
|
@@ -64,7 +65,9 @@ interface UploadFileProps {
|
|
text?: string // 按钮文字
|
|
text?: string // 按钮文字
|
|
icon?: string
|
|
icon?: string
|
|
fileType?: Array<string>
|
|
fileType?: Array<string>
|
|
|
|
+ uploadApiPath: string // 上传文件服务器地址
|
|
}
|
|
}
|
|
|
|
+
|
|
// 默认值
|
|
// 默认值
|
|
const props = withDefaults(defineProps<UploadFileProps>(), {
|
|
const props = withDefaults(defineProps<UploadFileProps>(), {
|
|
modelValue: () => '',
|
|
modelValue: () => '',
|
|
@@ -72,13 +75,15 @@ const props = withDefaults(defineProps<UploadFileProps>(), {
|
|
disabled: false,
|
|
disabled: false,
|
|
limit: 1,
|
|
limit: 1,
|
|
fileSize: 5,
|
|
fileSize: 5,
|
|
- fileType: () => ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'txt', 'pdf'],
|
|
|
|
|
|
+ fileType: () => ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'txt', 'pdf', 'mp4'],
|
|
text: '文件上传',
|
|
text: '文件上传',
|
|
- isShowTip: true
|
|
|
|
|
|
+ isShowTip: true,
|
|
|
|
+ uploadApiPath: '/common/upload',
|
|
|
|
+ icon: 'upload-filled'
|
|
})
|
|
})
|
|
|
|
|
|
const baseUrl = import.meta.env.VITE_API_URL
|
|
const baseUrl = import.meta.env.VITE_API_URL
|
|
-const uploadFileUrl = ref(baseUrl + '/common/upload') // 上传文件服务器地址
|
|
|
|
|
|
+const uploadFileUrl = ref(baseUrl + props.uploadApiPath)
|
|
const headers = ref(globalHeaders())
|
|
const headers = ref(globalHeaders())
|
|
const uploadRef = ref<UploadInstance>()
|
|
const uploadRef = ref<UploadInstance>()
|
|
const number = ref(0)
|
|
const number = ref(0)
|