NEZ-2558 fix:当文件夹下文件及目录数量较大时,导致页面卡死

This commit is contained in:
zhangyu
2023-06-21 18:05:03 +08:00
parent bb388bcfdd
commit cb4d0f3905

View File

@@ -150,6 +150,9 @@
<!-- <i class="nz-icon nz-icon-delete" v-if="!item.isDir" @click="delFile(item)"></i>--> <!-- <i class="nz-icon nz-icon-delete" v-if="!item.isDir" @click="delFile(item)"></i>-->
</div> </div>
</div> </div>
<div class="file-item">
{{$t('fileDirectory.overNum', {num: overNum})}}
</div>
</div> </div>
</div> </div>
<el-dialog <el-dialog
@@ -280,6 +283,8 @@ export default {
breadcrumb: [], breadcrumb: [],
fileList: [], fileList: [],
oldFileList: [], oldFileList: [],
overNum: false,
showNum: 10000,
newFolderBoxShow: false, newFolderBoxShow: false,
folder: '', folder: '',
fileDirectoryLoading: false, fileDirectoryLoading: false,
@@ -409,6 +414,12 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.fileDirectoryLoading = false this.fileDirectoryLoading = false
this.fileDirectory = res.data.path this.fileDirectory = res.data.path
if (res.data.list.length > this.showNum) {
this.overNum = res.data.list.length - this.showNum
res.data.list.splice(this.showNum, res.data.list.length)
} else {
this.overNum = false
}
res.data.list.forEach(item => { res.data.list.forEach(item => {
if (item.name[0] === '.') { if (item.name[0] === '.') {
item.isHide = true item.isHide = true