fix: UDM用户数据表格优化

This commit is contained in:
TsMask
2023-11-25 15:26:56 +08:00
parent 9f5f35c79d
commit 03a3899377
7 changed files with 170 additions and 187 deletions

View File

@@ -6,6 +6,7 @@ import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table';
import UploadModal from '@/components/UploadModal/index.vue';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import {
listAuth,
getAuth,
@@ -85,7 +86,7 @@ let tableColumns: ColumnsType = [
{
title: 'IMSI',
dataIndex: 'imsi',
align: 'center',
align: 'left',
fixed: 'left',
width: 5,
sorter: true,
@@ -129,6 +130,9 @@ let tableColumns: ColumnsType = [
},
];
/**表格字段列排序 */
let tableColumnsDnd = reactive<ColumnsType>([]);
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
@@ -162,6 +166,11 @@ function fnTableSize({ key }: MenuInfo) {
tableState.size = key as SizeType;
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
/**表格分页、排序、筛选变化时触发操作, 排序方式,取值为 ascend descend */
function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
const { field, order } = sorter;
@@ -569,6 +578,7 @@ function fnGetList(pageNum?: number) {
tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
tablePagination.current = pageNum;
}
listAuth(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
@@ -683,7 +693,7 @@ onMounted(() => {
<a-select
v-model:value="queryParams.neId"
:options="neOtions"
allow-clear
:placeholder="t('common.selectPlease')"
/>
</a-form-item>
</a-col>
@@ -809,6 +819,10 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<TableColumnsDnd
:columns="tableColumns"
v-model:columns-dnd="tableColumnsDnd"
></TableColumnsDnd>
<a-tooltip placement="topRight">
<template #title>{{ t('common.sizeText') }}</template>
<a-dropdown placement="bottomRight" trigger="click">
@@ -840,12 +854,13 @@ onMounted(() => {
<a-table
class="table"
row-key="imsi"
:columns="tableColumns"
:columns="tableColumnsDnd"
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:row-class-name="fnTableStriped"
:pagination="tablePagination"
:scroll="{ x: 1000, y: 400 }"
:scroll="{ x: tableColumnsDnd.length * 100, y: 450 }"
@change="fnTableChange"
>
<template #bodyCell="{ column, record }">
@@ -1271,4 +1286,8 @@ onMounted(() => {
.table :deep(.ant-pagination) {
padding: 0 24px;
}
.table :deep(.table-striped) td {
background-color: #fafafa;
}
</style>