国际化排序更改
continuous-integration/drone/push Build is running Details

main
caiyiling 2026-05-06 14:33:15 +08:00
parent 1f20834dd3
commit 3c0971e961
1 changed files with 15 additions and 9 deletions

View File

@ -63,7 +63,7 @@
" size="mini"></el-input> " size="mini"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="ValueCN" :label="$t('il8n:table:state')" sortable="custom"> <el-table-column prop="State" :label="$t('il8n:table:state')" sortable="custom">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.State" clearable filterable size="mini"> <el-select v-model="scope.row.State" clearable filterable size="mini">
<el-option v-for="item of $d.InternationalizationKeyState" <el-option v-for="item of $d.InternationalizationKeyState"
@ -150,15 +150,21 @@ export default {
methods: { methods: {
// //
handleSortByColumn(column) { handleSortByColumn(column) {
if (column.order === 'ascending') { const { prop, order } = column
this.tableData.sort((a, b) => if (!prop || !order) {
a[column.prop].localeCompare(b[column.prop]) this.tableData = [...this.tableData]
) return
} else {
this.tableData.sort((a, b) =>
b[column.prop].localeCompare(a[column.prop])
)
} }
const collator = new Intl.Collator('zh-Hans-CN', {
numeric: true,
sensitivity: 'base',
})
this.tableData.sort((a, b) => {
const result = collator.compare(a[prop], b[prop])
return order === 'ascending' ? result : -result
})
}, },
handleStateChange() { handleStateChange() {
this.tableData.forEach((item) => { this.tableData.forEach((item) => {