fix: correct sorting order for upload and update date options

This commit is contained in:
jmal 2025-07-18 17:42:36 +08:00
parent 74b03dac4f
commit 2e10b87b0d
3 changed files with 11 additions and 16 deletions

View File

@ -2806,7 +2806,6 @@ export default {
child.map(item => {
if (orderProp === item.orderProp && this.sortable.order === item.order) {
item.iconClass = 'menu-' + this.sortable.order
console.log('当前排序:', item.order)
} else {
item.iconClass = 'menu-null'
}

View File

@ -22,7 +22,7 @@
:divided="item.order === 'ascending' && item.key !== 'name-asc'"
>
<span :class="{ 'al-file-sort-item': true, active: sortable.prop === item.prop && sortable.order === item.order }">
<i :class="{ 'al-file-sort-item-icon': true, 'el-icon-top': sortable.order === 'ascending', 'el-icon-bottom': sortable.order === 'descending' }" ></i>
<i :class="['al-file-sort-item-icon', (sortable.prop === item.prop && sortable.order === item.order) ? (sortable.order === 'ascending' ? 'el-icon-top' : 'el-icon-bottom') : '']" ></i>
<span>{{ item.label }}</span>
</span>
</el-dropdown-item>
@ -56,33 +56,29 @@ export default {
computed: {
// 生成完整的排序选项(包含顺序和倒序)
allSortOptions() {
const options = []
this.sortOptions.forEach(option => {
// 顺序选项
options.push({
return this.sortOptions.flatMap(option => [
{
key: `${option.prop}-asc`,
command: `${option.command}-ascending`,
prop: option.prop,
order: 'ascending',
title: option.title,
label: `${option.title} - 顺序`
})
// 倒序选项
options.push({
},
{
key: `${option.prop}-desc`,
command: `${option.command}-descending`,
prop: option.prop,
order: 'descending',
title: option.title,
label: `${option.title} - 倒序`
})
})
return options
}
])
},
// 当前排序字段的显示名称
currentSortName() {
const currentOption = this.sortOptions.find(option => option.prop === this.sortable.prop)
return currentOption.title
return currentOption ? currentOption.title : ''
},
// 当前排序方向
currentSortOrder() {
@ -129,7 +125,7 @@ export default {
}
/* 确保图标和文字垂直对齐 */
.al-file-sort-item-icon /deep/ svg {
.al-file-sort-item-icon >>> svg {
width: 14px;
height: 14px;
vertical-align: middle;

View File

@ -27,10 +27,10 @@ export const fileArrangements = [
{ label: '大小 - 倒序', operation: 'orderSize-descending', orderProp: 'size', order: 'descending'},
{ divider: true, operation: 'divider' },
{ label: '上传时间 - 顺序', operation: 'orderUploadDate-ascending', orderProp: 'uploadDate', order: 'ascending'},
{ label: '上传时间 - 倒序', operation: 'orderUploadDate-descending', orderProp: 'uploadDate', order: 'ascending'},
{ label: '上传时间 - 倒序', operation: 'orderUploadDate-descending', orderProp: 'uploadDate', order: 'descending'},
{ divider: true, operation: 'divider' },
{ label: '修改时间 - 顺序', operation: 'orderUpdateDate-ascending', orderProp: 'updateDate', order: 'ascending'},
{ label: '修改时间 - 倒序', operation: 'orderUpdateDate-descending', orderProp: 'updateDate', order: 'ascending'},
{ label: '修改时间 - 倒序', operation: 'orderUpdateDate-descending', orderProp: 'updateDate', order: 'descending'},
]
export const createFiles = [