删除分页,搜索接口待协调

This commit is contained in:
lai
2024-01-10 14:27:49 +08:00
parent 25a93c5a72
commit 7c67c1e973
2 changed files with 7 additions and 91 deletions

View File

@@ -20,22 +20,14 @@ let queryParams = reactive({
subscriptionId: undefined, subscriptionId: undefined,
/**网元ID */ /**网元ID */
neId: undefined, neId: undefined,
/**当前页数 */
pageNum: 1,
/**每页条数 */
pageSize: 20,
}); });
/**查询参数重置 */ /**查询参数重置 */
function fnQueryReset() { function fnQueryReset() {
queryParams = Object.assign(queryParams, { queryParams = Object.assign(queryParams, {
imsi: '', subscriptionId: '',
msisdn: '', neId: '',
pageNum: 1,
pageSize: 20,
}); });
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList(); fnGetList();
} }
@@ -70,7 +62,6 @@ let tableColumns: ColumnsType = [
{ {
title: 'Subscription ID', title: 'Subscription ID',
dataIndex: 'subscriptionId', dataIndex: 'subscriptionId',
sorter: (a: any, b: any) => Number(a.imsi) - Number(b.imsi),
align: 'center', align: 'center',
width: 150, width: 150,
}, },
@@ -88,34 +79,6 @@ let tableColumns: ColumnsType = [
}, },
]; ];
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
current: 1,
/**每页条数 */
pageSize: 20,
/**默认的每页条数 */
defaultPageSize: 20,
/**指定每页可以显示多少条 */
pageSizeOptions: ['10', '20', '50', '100'],
/**只有一页时是否隐藏分页器 */
hideOnSinglePage: false,
/**是否可以快速跳转至某页 */
showQuickJumper: true,
/**是否可以改变 pageSize */
showSizeChanger: true,
/**数据总数 */
total: 0,
showTotal: (total: number) => t('common.tablePaginationTotal', { total }),
onChange: (page: number, pageSize: number) => {
tablePagination.current = page;
tablePagination.pageSize = pageSize;
queryParams.pageNum = page;
queryParams.pageSize = pageSize;
fnGetList();
},
});
/**表格紧凑型变更操作 */ /**表格紧凑型变更操作 */
function fnTableSize({ key }: MenuInfo) { function fnTableSize({ key }: MenuInfo) {
tableState.size = key as SizeType; tableState.size = key as SizeType;
@@ -130,19 +93,14 @@ function fnTableStriped(_record: unknown, index: number): any {
function fnGetList(pageNum?: number) { function fnGetList(pageNum?: number) {
if (tableState.loading) return; if (tableState.loading) return;
tableState.loading = true; tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
}
listNSSF(toRaw(queryParams)).then(res => { listNSSF(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选 // 取消勾选
if (tableState.selectedRowKeys.length > 0) { if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = []; tableState.selectedRowKeys = [];
} }
tablePagination.total = res.total;
tableState.data = res.rows; tableState.data = res.rows;
} else { } else {
tablePagination.total = 0;
tableState.data = []; tableState.data = [];
} }
tableState.loading = false; tableState.loading = false;
@@ -293,7 +251,7 @@ onMounted(() => {
:data-source="tableState.data" :data-source="tableState.data"
:size="tableState.size" :size="tableState.size"
:row-class-name="fnTableStriped" :row-class-name="fnTableStriped"
:pagination="tablePagination" :pagination="false"
:scroll="{ x: 1200, y: 400 }" :scroll="{ x: 1200, y: 400 }"
> >
</a-table> </a-table>

View File

@@ -20,22 +20,14 @@ let queryParams = reactive({
subscriptionId: undefined, subscriptionId: undefined,
/**网元ID */ /**网元ID */
neId: undefined, neId: undefined,
/**当前页数 */
pageNum: 1,
/**每页条数 */
pageSize: 20,
}); });
/**查询参数重置 */ /**查询参数重置 */
function fnQueryReset() { function fnQueryReset() {
queryParams = Object.assign(queryParams, { queryParams = Object.assign(queryParams, {
imsi: '', subscriptionId: '',
msisdn: '', neId: '',
pageNum: 1,
pageSize: 20,
}); });
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList(); fnGetList();
} }
@@ -70,7 +62,6 @@ let tableColumns: ColumnsType = [
{ {
title: 'NF ID', title: 'NF ID',
dataIndex: 'nfId', dataIndex: 'nfId',
sorter: (a: any, b: any) => Number(a.imsi) - Number(b.imsi),
align: 'center', align: 'center',
width: 150, width: 150,
}, },
@@ -82,34 +73,6 @@ let tableColumns: ColumnsType = [
}, },
]; ];
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
current: 1,
/**每页条数 */
pageSize: 20,
/**默认的每页条数 */
defaultPageSize: 20,
/**指定每页可以显示多少条 */
pageSizeOptions: ['10', '20', '50', '100'],
/**只有一页时是否隐藏分页器 */
hideOnSinglePage: false,
/**是否可以快速跳转至某页 */
showQuickJumper: true,
/**是否可以改变 pageSize */
showSizeChanger: true,
/**数据总数 */
total: 0,
showTotal: (total: number) => t('common.tablePaginationTotal', { total }),
onChange: (page: number, pageSize: number) => {
tablePagination.current = page;
tablePagination.pageSize = pageSize;
queryParams.pageNum = page;
queryParams.pageSize = pageSize;
fnGetList();
},
});
/**表格紧凑型变更操作 */ /**表格紧凑型变更操作 */
function fnTableSize({ key }: MenuInfo) { function fnTableSize({ key }: MenuInfo) {
tableState.size = key as SizeType; tableState.size = key as SizeType;
@@ -124,20 +87,15 @@ function fnTableStriped(_record: unknown, index: number): any {
function fnGetList(pageNum?: number) { function fnGetList(pageNum?: number) {
if (tableState.loading) return; if (tableState.loading) return;
tableState.loading = true; tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
}
listNSSFAMF(toRaw(queryParams)).then(res => { listNSSFAMF(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
console.log(res.rows) console.log(res.rows);
// 取消勾选 // 取消勾选
if (tableState.selectedRowKeys.length > 0) { if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = []; tableState.selectedRowKeys = [];
} }
tablePagination.total = res.total;
tableState.data = res.rows; tableState.data = res.rows;
} else { } else {
tablePagination.total = 0;
tableState.data = []; tableState.data = [];
} }
tableState.loading = false; tableState.loading = false;
@@ -288,7 +246,7 @@ onMounted(() => {
:data-source="tableState.data" :data-source="tableState.data"
:size="tableState.size" :size="tableState.size"
:row-class-name="fnTableStriped" :row-class-name="fnTableStriped"
:pagination="tablePagination" :pagination="false"
:scroll="{ x: 1200, y: 400 }" :scroll="{ x: 1200, y: 400 }"
> >
</a-table> </a-table>