|
|
@@ -5,12 +5,13 @@
|
|
|
<el-upload
|
|
|
class="upload-show"
|
|
|
:file-list="fileArr"
|
|
|
- :limit="1"
|
|
|
+ :limit="50"
|
|
|
:on-change="upBefore"
|
|
|
:show-file-list="false"
|
|
|
drag
|
|
|
:http-request="onSuccess"
|
|
|
multiple
|
|
|
+ :on-exceed="handleExceed"
|
|
|
element-loading-text="上传中..."
|
|
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
|
|
v-loading="loadingUpload"
|
|
|
@@ -59,7 +60,7 @@
|
|
|
<span
|
|
|
class="fileName hand"
|
|
|
@click="toFile(item.content.docInfo)"
|
|
|
- >{{ item.content.docInfo.fileName }}</span
|
|
|
+ >{{ item.content.docInfo==null ? '' : item.content.docInfo.fileName }}</span
|
|
|
>
|
|
|
<div class="flieTime">
|
|
|
<span>创建时间:</span>
|
|
|
@@ -105,7 +106,7 @@
|
|
|
alt=""
|
|
|
style=""
|
|
|
/>
|
|
|
- <span v-html="scope.row.fileName"></span>
|
|
|
+ <span v-html="scope.row==null? '' :scope.row.fileName"></span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -122,16 +123,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else class="btmBox">
|
|
|
- <div class="upFile" @paste="copyFile">
|
|
|
+ <div class="upFile" @paste.native="copyFile">
|
|
|
<el-upload
|
|
|
class="upload-demo"
|
|
|
:file-list="fileArr"
|
|
|
- :limit="1"
|
|
|
+ :limit="50"
|
|
|
:on-change="upBefore"
|
|
|
:show-file-list="false"
|
|
|
drag
|
|
|
:http-request="onSuccess"
|
|
|
multiple
|
|
|
+ :on-exceed="handleExceed"
|
|
|
element-loading-text="上传中..."
|
|
|
element-loading-background="rgba(255, 255, 255, 0.8)"
|
|
|
v-loading="loadingUpload"
|
|
|
@@ -431,12 +433,24 @@ const getDirId = () => {
|
|
|
});
|
|
|
};
|
|
|
function onSuccess(files, val) {
|
|
|
- // console.log('suFiles',files);
|
|
|
- const maxSize = (maxFileSize.value - 0) * 1024 * 1024;
|
|
|
- if (files.file.size < maxSize) {
|
|
|
- fileArr.value.push(files.file);
|
|
|
+ if(!loadingUpload.value){
|
|
|
+ const maxSize = (maxFileSize.value - 0) * 1024 * 1024;
|
|
|
+ if (files.file.size < maxSize) {
|
|
|
+ fileArr.value.push(files.file);
|
|
|
+ }
|
|
|
+ sureUpload(); //没有文件在上传,立即上传
|
|
|
+ }else{
|
|
|
+ //当前有文件正在上传,排队等待上传
|
|
|
+ setTimeout(() => {
|
|
|
+ onSuccess(files,val)
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
- sureUpload();
|
|
|
+}
|
|
|
+const handleExceed = (files, fileList)=> {
|
|
|
+ ElMessage({
|
|
|
+ message: "同时上传文件数超过文件最大数量50",
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
}
|
|
|
// 确认上传
|
|
|
function sureUpload() {
|
|
|
@@ -446,17 +460,20 @@ function sureUpload() {
|
|
|
allSpace.value * 1024 * 1024
|
|
|
) {
|
|
|
ElMessage({
|
|
|
- message: "超过最大容量,请联系管理员扩容",
|
|
|
+ message: "当前文件空间占用已超过最大容量,请联系管理员扩容",
|
|
|
type: "error",
|
|
|
});
|
|
|
loadingUpload.value = false;
|
|
|
+ fileArr.value = []
|
|
|
return;
|
|
|
} else {
|
|
|
if (fileArr.value.length > 0) {
|
|
|
// console.log('fileArr',fileArr.value);
|
|
|
let form = new FormData();
|
|
|
+ let filename = ""
|
|
|
for (var i = 0; i < fileArr.value.length; i++) {
|
|
|
form.append("files", fileArr.value[i]);
|
|
|
+ filename = fileArr.value[i].name
|
|
|
}
|
|
|
form.append("spaceId", topSpaceId.value);
|
|
|
form.append("dirId", topDirId.value);
|
|
|
@@ -466,20 +483,20 @@ function sureUpload() {
|
|
|
.then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
ElMessage({
|
|
|
- message: "上传文件成功",
|
|
|
+ message: filename+"上传成功",
|
|
|
type: "success",
|
|
|
});
|
|
|
loadingUpload.value = false;
|
|
|
fileArr.value = [];
|
|
|
fileBig.value = 0;
|
|
|
const storage = sessionStorage.getItem("tagList");
|
|
|
- if (storage) {
|
|
|
+ if (storage != null) {
|
|
|
const oldStorage = JSON.parse(storage);
|
|
|
// 判断是否存在myfile
|
|
|
const myfileTag = oldStorage.find((item) =>
|
|
|
item.path.includes("myfile")
|
|
|
);
|
|
|
- if (myfileTag.id) {
|
|
|
+ if (myfileTag !=null && myfileTag.id) {
|
|
|
const tagIfarme = document.querySelector(
|
|
|
`#${myfileTag.id} iframe`
|
|
|
);
|
|
|
@@ -489,15 +506,26 @@ function sureUpload() {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ loadingUpload.value = false;
|
|
|
+ fileArr.value = [];
|
|
|
+ ElMessage({
|
|
|
+ message: filename+"上传失败:"+res.msg,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
loadingUpload.value = false;
|
|
|
fileArr.value = [];
|
|
|
+ ElMessage({
|
|
|
+ message: filename+"上传失败:"+err.message,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
loadingUpload.value = false;
|
|
|
- return ElMessage({ message: "请选择文件", type: "error" });
|
|
|
+ //return ElMessage({ message: "请选择文件", type: "error" });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -544,7 +572,7 @@ const closeOpenScanMove = () => {
|
|
|
//粘贴文件上传
|
|
|
const copyFile = (event) => {
|
|
|
const items = (event.clipboardData || window.clipboardData).items;
|
|
|
- // console.log("event", event);
|
|
|
+ console.log("files:", event.clipboardData);
|
|
|
let file = null;
|
|
|
if (!items || items.length === 0) {
|
|
|
ElMessage({
|
|
|
@@ -653,7 +681,6 @@ watch(
|
|
|
}
|
|
|
);
|
|
|
onMounted(() => {
|
|
|
- console.log('mounted');
|
|
|
getSpaceList();
|
|
|
getDirId();
|
|
|
getConfigKey("file.size.limit").then((response) => {
|