添加排序

This commit is contained in:
GGJ
2025-04-28 09:14:56 +08:00
parent 1e3b60eaaa
commit adc9b5a955
5 changed files with 24 additions and 8 deletions

View File

@@ -8,9 +8,9 @@
<el-form-item label="登录名称:" class="top">
<el-input v-model.trim="form.loginName" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="归属部门名称:" class="top">
<!-- <el-form-item label="归属部门名称:" class="top">
<el-input v-model.trim="form.deptName" :disabled="true"></el-input>
</el-form-item>
</el-form-item> -->
<el-form-item label="拥有的角色:" class="top">
<el-input v-model.trim="form.role" :disabled="true"></el-input>
</el-form-item>

View File

@@ -27,7 +27,7 @@ const tableStore = new TableStore({
{ title: '名称', field: 'name' },
{ title: '登录名', field: 'loginName' },
{ title: '角色', field: 'roleName' },
{ title: '部门', field: 'deptId' },
// { title: '部门', field: 'deptId' },
{ title: '电话', field: 'phoneShow' },
{ title: '注册时间', field: 'registerTime' },
{ title: '类型', field: 'casualUserName' },

View File

@@ -51,7 +51,7 @@ const tableStore = new TableStore({
{ title: '用户名称', field: 'name', minWidth: '130' },
{ title: '登录名', field: 'loginName', minWidth: '130' },
{ title: '角色', field: 'roleName', minWidth: '130' },
{ title: '部门', field: 'deptName', minWidth: '200' },
// { title: '部门', field: 'deptName', minWidth: '200' },
{ title: '电话', field: 'phoneShow', minWidth: '100' },
{ title: '注册时间', field: 'registerTime', minWidth: '130' },
{ title: '登录时间', field: 'loginTime', minWidth: '130' },

View File

@@ -23,9 +23,9 @@
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属部门" prop="deptId">
<!-- <el-form-item label="所属部门" prop="deptId">
<Area v-model.trim="form.deptId" />
</el-form-item>
</el-form-item> -->
<el-form-item label="角色" prop="role">
<el-select v-model.trim="form.role" placeholder="请选择角色" multiple collapse-tags>
<el-option v-for="(item, index) in roleOptions" :label="item.label" :value="item.value"

View File

@@ -78,7 +78,7 @@
</el-button>
</template>
</TableHeader>
<Table ref="tableRef" :checkbox-config="checkboxConfig" :key="tableKey"></Table>
<Table ref="tableRef" :checkbox-config="checkboxConfig" :key="tableKey" @sort-change="handleSortChange"></Table>
<el-dialog
:title="dialogTitle"
@@ -305,7 +305,7 @@ const tableStore = new TableStore({
return row.cellValue === 'MQTT' ? 'MQTT' : row.cellValue === 'CLD' ? 'CLD' : row.cellValue
}
},
{ title: '录入时间', field: 'createTime' },
{ title: '录入时间', field: 'createTime',sortable: true },
{
title: '使用状态',
@@ -638,6 +638,8 @@ tableStore.table.params.devType = ''
tableStore.table.params.devModel = ''
tableStore.table.params.devAccessMethod = ''
tableStore.table.params.status = ''
tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = ''
// 设备类型
const devTypeChange = (e: any) => {
@@ -732,7 +734,21 @@ const downLoadQrCode = async () => {
qrcodeFlag.value = false
}, 500)
}
// 排序
const handleSortChange = ({ column, order }: { column: TableColumn; order: 'asc' | 'desc' | null }) => {
// console.log('排序列:', column?.property);
// console.log('排序顺序:', order);
// tableStore.onTableAction('sortable', { column, order })
tableStore.table.params.sortBy = column?.property
tableStore.table.params.orderBy = order
tableStore.table.params.pageNum = 1
tableStore.index()
// // 在这里可以根据 column 和 order 进行相应的数据排序操作
// if (order === 'asc') {
// } else if (order === 'desc') {
// }
}
// 示例用法
// 新增