fix(查询组件): 自定义排序问题

This commit is contained in:
dataeaseShu 2024-11-25 11:10:57 +08:00
parent b193074bf0
commit 30d84e5dd6

View File

@ -291,9 +291,18 @@ const setOldMapValue = arr => {
const customSort = () => { const customSort = () => {
if (config.value.sortList?.length && config.value.sort === 'customSort') { if (config.value.sortList?.length && config.value.sort === 'customSort') {
options.value = [ options.value = [
...options.value.sort( ...options.value
(a, b) => config.value.sortList.indexOf(a.value) - config.value.sortList.indexOf(b.value) .sort(a => {
) if (config.value.sortList.indexOf(a.value) !== -1) {
return -1
}
})
.sort((a, b) => {
if (config.value.sortList.indexOf(a.value) === -1) {
return 0
}
return config.value.sortList.indexOf(a.value) - config.value.sortList.indexOf(b.value)
})
] ]
} }
} }
@ -517,7 +526,7 @@ const setOptions = (num: number) => {
handleFieldIdChange({ handleFieldIdChange({
queryId: field.id, queryId: field.id,
displayId: displayId || field.id, displayId: displayId || field.id,
sort: sort === 'customSort' ? '' : sort, sort: sort === 'customSort' ? 'asc' : sort,
sortId, sortId,
resultMode: config.value.resultMode || 0, resultMode: config.value.resultMode || 0,
searchText: searchText.value, searchText: searchText.value,