salary
qsh 5 months ago
parent a4c5143ee5
commit 87a2fe09de
  1. 3
      src/components/UploadFile/src/UploadFile.vue
  2. 12
      src/views/Basic/Library/index.vue

@ -44,7 +44,8 @@ const props = defineProps({
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired, modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
title: propTypes.string.def('文件上传'), title: propTypes.string.def('文件上传'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // , ['png', 'jpg', 'jpeg'] // fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // , ['png', 'jpg', 'jpeg']
fileType: propTypes.array.def([]),
accept: propTypes.string.def('*'), accept: propTypes.string.def('*'),
fileSize: propTypes.number.def(5), // (MB) fileSize: propTypes.number.def(5), // (MB)
limit: propTypes.number.def(5), // limit: propTypes.number.def(5), //

@ -65,7 +65,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="files" label="附件"> <el-table-column prop="files" label="附件">
<template #default="{ row }"> <template #default="{ row }">
<el-link type="primary" underline :href="row.fileUrl" target="_blank"> <el-link type="primary" underline target="_blank" @click="handleDownload(row.files)">
{{ row.files }} {{ row.files }}
</el-link> </el-link>
</template> </template>
@ -195,6 +195,16 @@ function handleClickLib(index) {
getResourceList() getResourceList()
} }
function handleDownload(href) {
if (href) {
let a = document.createElement('a')
a.download = href //
a.href = href // URL
a.click() //
URL.revokeObjectURL(a.href) // URL
}
}
function openResource(type, id) { function openResource(type, id) {
resourceDialog.value.open(type, libraryList.value[libraryIndex.value], id) resourceDialog.value.open(type, libraryList.value[libraryIndex.value], id)
} }

Loading…
Cancel
Save