Commit c72021a714cd8a2f10aa5d394d315cc601ebfd59

Authored by ww
1 parent 43386bdd

fix: DEFECT-1195 修复任务中心未配置分页

@@ -28,13 +28,21 @@ @@ -28,13 +28,21 @@
28 }, 28 },
29 }); 29 });
30 30
  31 + const paginationChange = (page: number, pageSize: number) => {
  32 + pagination.current = page - 1 * pageSize > pagination.total ? 1 : page;
  33 + pagination.pageSize = pageSize;
  34 + getDataSource();
  35 + };
  36 +
31 const pagination = reactive({ 37 const pagination = reactive({
32 - total: 10,  
33 current: 1, 38 current: 1,
34 pageSize: 10, 39 pageSize: 10,
  40 + total: 0,
35 showQuickJumper: true, 41 showQuickJumper: true,
36 size: 'small', 42 size: 'small',
37 showTotal: (total: number) => `共 ${total} 条数据`, 43 showTotal: (total: number) => `共 ${total} 条数据`,
  44 + onChange: paginationChange,
  45 + onShowSizeChange: paginationChange,
38 }); 46 });
39 47
40 const dataSource = ref<TaskRecordType[]>([]); 48 const dataSource = ref<TaskRecordType[]>([]);
@@ -44,12 +52,13 @@ @@ -44,12 +52,13 @@
44 try { 52 try {
45 loading.value = true; 53 loading.value = true;
46 const params = getFieldsValue() || {}; 54 const params = getFieldsValue() || {};
47 - const { items } = await getTaskCenterList({ 55 + const { items, total } = await getTaskCenterList({
48 page: pagination.current, 56 page: pagination.current,
49 pageSize: pagination.pageSize, 57 pageSize: pagination.pageSize,
50 tbDeviceId: props.tbDeviceId, 58 tbDeviceId: props.tbDeviceId,
51 ...params, 59 ...params,
52 }); 60 });
  61 + pagination.total = total;
53 dataSource.value = items; 62 dataSource.value = items;
54 } catch (error) { 63 } catch (error) {
55 throw error; 64 throw error;
@@ -35,12 +35,21 @@ @@ -35,12 +35,21 @@
35 }, 35 },
36 }); 36 });
37 37
  38 + const paginationChange = (page: number, pageSize: number) => {
  39 + pagination.current = page - 1 * pageSize > pagination.total ? 1 : page;
  40 + pagination.pageSize = pageSize;
  41 + getDataSource();
  42 + };
  43 +
38 const pagination = reactive({ 44 const pagination = reactive({
39 - total: 10,  
40 current: 1, 45 current: 1,
  46 + pageSize: 10,
  47 + total: 0,
41 showQuickJumper: true, 48 showQuickJumper: true,
42 size: 'small', 49 size: 'small',
43 showTotal: (total: number) => `共 ${total} 条数据`, 50 showTotal: (total: number) => `共 ${total} 条数据`,
  51 + onChange: paginationChange,
  52 + onShowSizeChange: paginationChange,
44 }); 53 });
45 54
46 const dataSource = ref<TaskRecordType[]>([]); 55 const dataSource = ref<TaskRecordType[]>([]);
@@ -49,8 +58,13 @@ @@ -49,8 +58,13 @@
49 try { 58 try {
50 loading.value = true; 59 loading.value = true;
51 const params = getFieldsValue(); 60 const params = getFieldsValue();
52 - const { items } = await getTaskCenterList({ page: 1, pageSize: 10, ...params }); 61 + const { items, total } = await getTaskCenterList({
  62 + page: pagination.current,
  63 + pageSize: pagination.pageSize,
  64 + ...params,
  65 + });
53 dataSource.value = items; 66 dataSource.value = items;
  67 + pagination.total = total;
54 } catch (error) { 68 } catch (error) {
55 throw error; 69 throw error;
56 } finally { 70 } finally {