Skip to content

Commit

Permalink
feat: add two sorting methods to the list page
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteMinds committed Mar 1, 2024
1 parent 4f4468e commit 996fdc1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/web/src/views/RecordersManage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ const sortModes: {
name: '频道',
resolver: (recorder) => recorder.channelId,
},
{
id: 'state',
name: '状态',
resolver: (recorder) => {
return ['recording', 'stopping-record', 'idle'].indexOf(recorder.state)
},
},
{
id: 'remarks',
name: '备注',
resolver: (recorder) => {
if (recorder.remarks === '') return null
return recorder.remarks ?? null
},
},
]
const sortMode = ref(sortModes[0])
const filterText = ref<string>('')
Expand All @@ -104,8 +119,8 @@ const displayingRecorders = computed(() => {
// 空值与非空值同时存在,则非空值排序靠前,如果都为空则顺序不变
if (valA == null || valB == null) {
if (valA != null) return 1
if (valB != null) return -1
if (valA != null) return -1
if (valB != null) return 1
return 0
}
Expand Down

0 comments on commit 996fdc1

Please sign in to comment.