@@ -389,10 +398,24 @@ export default {
if (res.code === 200) {
this.fileDirectoryLoading = false
this.fileDirectory = res.data.path
+ res.data.list.forEach(item => {
+ if (item.name[0] === '.') {
+ item.isHide = true
+ }
+ })
this.fileList = res.data.list
this.oldFileList = res.data.list
this.editPath = ''
this.breadcrumb = res.data.path.split('/').filter(item => item)
+ if (this.nameOrderType) {
+ this.orderBy('nameOrderType',this.nameOrderType , 'name')
+ }
+ if (this.sizeOrderType) {
+ this.orderBy('sizeOrderType',this.sizeOrderType , 'size')
+ }
+ if (this.dateOrderType) {
+ this.orderBy('dateOrderType',this.dateOrderType , 'cts')
+ }
} else {
this.$message.error(res.msg)
this.editPath = ''
@@ -531,16 +554,41 @@ export default {
}
return '-'
},
- orderBy (key, orderType, order) {
+ orderBy (key, type, order) {
+ let orderType = type
+ if (!orderType) {
+ orderType = this[key] === 'asc' ? 'desc' : 'asc'
+ }
+ this.sizeOrderType = 0
+ this.dateOrderType = 0
+ this.nameOrderType = 0
if (this[key] == orderType) {
this[key] = 0
this.fileList = this.oldFileList
} else if (orderType == 'nameOrderType') {
this[key] = orderType
- this.fileList = this.$loadsh.orderBy(this.oldFileList, [user => user.name.toLowerCase()], [orderType])
+ let isDirArr = this.oldFileList.filter(item => item.isDir)
+ let isRegArr = this.oldFileList.filter(item => !item.isDir)
+ isDirArr = this.$loadsh.orderBy(isDirArr, [user => user.name.toLowerCase()], [orderType])
+ isRegArr = this.$loadsh.orderBy(isRegArr, [user => user.name.toLowerCase()], [orderType])
+ this.fileList = []
+ if (orderType === 'asc') {
+ this.fileList = this.fileList.concat(isDirArr, isRegArr)
+ } else {
+ this.fileList = this.fileList.concat(isRegArr, isDirArr)
+ }
} else {
this[key] = orderType
- this.fileList = this.$loadsh.orderBy(this.oldFileList, order, orderType)
+ let isDirArr = this.oldFileList.filter(item => item.isDir)
+ let isRegArr = this.oldFileList.filter(item => !item.isDir)
+ isDirArr = this.$loadsh.orderBy(isDirArr, order, orderType)
+ isRegArr = this.$loadsh.orderBy(isRegArr, order, orderType)
+ this.fileList = []
+ if (orderType === 'asc') {
+ this.fileList = this.fileList.concat(isDirArr, isRegArr)
+ } else {
+ this.fileList = this.fileList.concat(isRegArr, isDirArr)
+ }
}
},
tableOperation ([command, row, param]) {