|
@@ -372,7 +372,7 @@
|
|
|
<!-- 文件上传 -->
|
|
|
<div>
|
|
|
<el-dialog v-model="uploadModal" :close-on-click-modal="false" title="文件上传" width="30%" @close="closeUpload">
|
|
|
- <el-upload class="upload-demo" :before-upload="upBefore" :file-list="fileArr" drag :http-request="onSuccess" multiple
|
|
|
+ <el-upload class="upload-demo" :limit="10" :on-change="upBefore" :file-list="fileArr" drag :http-request="onSuccess" multiple
|
|
|
:on-remove="handleRemove"
|
|
|
element-loading-text="上传中..."
|
|
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
|
@@ -380,7 +380,7 @@
|
|
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
<div class="el-upload__text">拖入或<em>点击上传</em></div>
|
|
|
<template #tip>
|
|
|
- <div class="el-upload__tip">请选择或拖入文件</div>
|
|
|
+ <div class="el-upload__tip">请选择或拖入文件(一次最多上传10个文件)</div>
|
|
|
</template>
|
|
|
</el-upload>
|
|
|
<template #footer>
|
|
@@ -1199,7 +1199,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
function onSuccess(files, val) {
|
|
|
- fileArr.value.push(files.file)
|
|
|
+ const maxSize = (maxFileSize.value-0)*1024*1024
|
|
|
+ if(files.file.size<maxSize){
|
|
|
+ fileArr.value.push(files.file)
|
|
|
+ }
|
|
|
} //关闭文件上传
|
|
|
const closeUpload =() =>{
|
|
|
uploadModal.value = false;
|
|
@@ -1208,7 +1211,14 @@ export default {
|
|
|
}
|
|
|
// 移除上传的某些文件
|
|
|
const handleRemove = (file,rawFile) => {
|
|
|
- fileArr.value = [...rawFile]
|
|
|
+ // fileArr.value = [...rawFile]
|
|
|
+ fileArr.value = rawFile.map(item=>{
|
|
|
+ if(item.raw){
|
|
|
+ return item.raw
|
|
|
+ }else{
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
// 筛选后缀图片
|
|
|
function getImage(file) {
|
|
@@ -1887,8 +1897,8 @@ export default {
|
|
|
}
|
|
|
// 触底加载事件
|
|
|
const setScroll =async ()=>{
|
|
|
- console.log('setScroll','到底喽');
|
|
|
-
|
|
|
+ // console.log('setScroll','到底喽');
|
|
|
+ if(tableBeEnd.value)return
|
|
|
// console.log('tableBeEnd.value',tableBeEnd.value);
|
|
|
filePageNum.value = filePageNum.value+1
|
|
|
const query = `${thisFolder.value.dirId}?pageSize=${pageSize.value}&pageNum=${filePageNum.value}`
|
|
@@ -1897,7 +1907,7 @@ export default {
|
|
|
|
|
|
// --------------------
|
|
|
const res = await myfile.getById(query)
|
|
|
- // console.log('setScrollres',res);
|
|
|
+ console.log('setScrollres',res);
|
|
|
if (res.code === 200) {
|
|
|
// const newarr = res.rows.concat(toRaw(fileList.value))
|
|
|
const newarr = toRaw(fileList.value).concat(res.rows)
|
|
@@ -1943,17 +1953,15 @@ export default {
|
|
|
}
|
|
|
clickPath(null,addData)
|
|
|
}
|
|
|
- const upBefore = (file)=>{
|
|
|
+ const upBefore = (file,files)=>{
|
|
|
// console.log('file',file.size);
|
|
|
const maxSize = (maxFileSize.value-0)*1024*1024
|
|
|
// console.log('maxSize',maxSize);
|
|
|
if(file.size>maxSize){
|
|
|
- ElMessage({ message: '上传文件大小最大为'+maxFileSize.value+'M', type: 'error' })
|
|
|
- return false
|
|
|
- }
|
|
|
- if(fileArr.value.length>=10){
|
|
|
- ElMessage({ message: file.name+'上传失败,单次上传文件数量最多为10个', type: 'error' })
|
|
|
- return false
|
|
|
+ files.pop()
|
|
|
+ ElMessage({ message: file.name+'上传失败,上传文件大小最大为'+maxFileSize.value+'M', type: 'error' })
|
|
|
+ }else{
|
|
|
+ fileArr.value.push(file.raw)
|
|
|
}
|
|
|
}
|
|
|
//获取扫描仪列表
|
|
@@ -2058,6 +2066,7 @@ export default {
|
|
|
// 添加监听,点击其他地方关闭文件夹右键菜单
|
|
|
window.addEventListener("click", closeRMenu, true);
|
|
|
window.addEventListener("click", mouseClick, true);
|
|
|
+ window.addEventListener("mousewheel", mouseClick, true);
|
|
|
})
|
|
|
// 组件显示
|
|
|
onActivated(()=>{
|