fix: correct sorting order for upload and update date options
This commit is contained in:
parent
74b03dac4f
commit
2e10b87b0d
@ -2806,7 +2806,6 @@ export default {
|
|||||||
child.map(item => {
|
child.map(item => {
|
||||||
if (orderProp === item.orderProp && this.sortable.order === item.order) {
|
if (orderProp === item.orderProp && this.sortable.order === item.order) {
|
||||||
item.iconClass = 'menu-' + this.sortable.order
|
item.iconClass = 'menu-' + this.sortable.order
|
||||||
console.log('当前排序:', item.order)
|
|
||||||
} else {
|
} else {
|
||||||
item.iconClass = 'menu-null'
|
item.iconClass = 'menu-null'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
:divided="item.order === 'ascending' && item.key !== 'name-asc'"
|
:divided="item.order === 'ascending' && item.key !== 'name-asc'"
|
||||||
>
|
>
|
||||||
<span :class="{ 'al-file-sort-item': true, active: sortable.prop === item.prop && sortable.order === item.order }">
|
<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>{{ item.label }}</span>
|
||||||
</span>
|
</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
@ -56,33 +56,29 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 生成完整的排序选项(包含顺序和倒序)
|
// 生成完整的排序选项(包含顺序和倒序)
|
||||||
allSortOptions() {
|
allSortOptions() {
|
||||||
const options = []
|
return this.sortOptions.flatMap(option => [
|
||||||
this.sortOptions.forEach(option => {
|
{
|
||||||
// 顺序选项
|
|
||||||
options.push({
|
|
||||||
key: `${option.prop}-asc`,
|
key: `${option.prop}-asc`,
|
||||||
command: `${option.command}-ascending`,
|
command: `${option.command}-ascending`,
|
||||||
prop: option.prop,
|
prop: option.prop,
|
||||||
order: 'ascending',
|
order: 'ascending',
|
||||||
title: option.title,
|
title: option.title,
|
||||||
label: `${option.title} - 顺序`
|
label: `${option.title} - 顺序`
|
||||||
})
|
},
|
||||||
// 倒序选项
|
{
|
||||||
options.push({
|
|
||||||
key: `${option.prop}-desc`,
|
key: `${option.prop}-desc`,
|
||||||
command: `${option.command}-descending`,
|
command: `${option.command}-descending`,
|
||||||
prop: option.prop,
|
prop: option.prop,
|
||||||
order: 'descending',
|
order: 'descending',
|
||||||
title: option.title,
|
title: option.title,
|
||||||
label: `${option.title} - 倒序`
|
label: `${option.title} - 倒序`
|
||||||
})
|
}
|
||||||
})
|
])
|
||||||
return options
|
|
||||||
},
|
},
|
||||||
// 当前排序字段的显示名称
|
// 当前排序字段的显示名称
|
||||||
currentSortName() {
|
currentSortName() {
|
||||||
const currentOption = this.sortOptions.find(option => option.prop === this.sortable.prop)
|
const currentOption = this.sortOptions.find(option => option.prop === this.sortable.prop)
|
||||||
return currentOption.title
|
return currentOption ? currentOption.title : ''
|
||||||
},
|
},
|
||||||
// 当前排序方向
|
// 当前排序方向
|
||||||
currentSortOrder() {
|
currentSortOrder() {
|
||||||
@ -129,7 +125,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 确保图标和文字垂直对齐 */
|
/* 确保图标和文字垂直对齐 */
|
||||||
.al-file-sort-item-icon /deep/ svg {
|
.al-file-sort-item-icon >>> svg {
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|||||||
@ -27,10 +27,10 @@ export const fileArrangements = [
|
|||||||
{ label: '大小 - 倒序', operation: 'orderSize-descending', orderProp: 'size', order: 'descending'},
|
{ label: '大小 - 倒序', operation: 'orderSize-descending', orderProp: 'size', order: 'descending'},
|
||||||
{ divider: true, operation: 'divider' },
|
{ divider: true, operation: 'divider' },
|
||||||
{ label: '上传时间 - 顺序', operation: 'orderUploadDate-ascending', orderProp: 'uploadDate', order: 'ascending'},
|
{ 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' },
|
{ divider: true, operation: 'divider' },
|
||||||
{ label: '修改时间 - 顺序', operation: 'orderUpdateDate-ascending', orderProp: 'updateDate', order: 'ascending'},
|
{ 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 = [
|
export const createFiles = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user