@@ -5,7 +5,7 @@ const {$gettext, interpolate} = gettext
55
66import StdDataEntry from ' @/components/StdDataEntry'
77import StdPagination from ' ./StdPagination.vue'
8- import {nextTick , reactive , ref } from ' vue'
8+ import {nextTick , reactive , ref , watch } from ' vue'
99import {useRoute , useRouter } from ' vue-router'
1010import {message } from ' ant-design-vue'
1111
@@ -61,9 +61,9 @@ const props = defineProps({
6161})
6262
6363
64- const data_source = reactive ([])
64+ const data_source = ref ([])
6565const loading = ref (true )
66- const pagination = ({
66+ const pagination = reactive ({
6767 total: 1 ,
6868 per_page: 10 ,
6969 current_page: 1 ,
@@ -80,7 +80,6 @@ const rowSelection = reactive({})
8080const searchColumns = getSearchColumns ()
8181const pithyColumns = getPithyColumns ()
8282
83-
8483get_list ()
8584
8685defineExpose ({
@@ -102,7 +101,7 @@ function get_list(page_num = null) {
102101 params [' page' ] = page_num
103102 }
104103 props .api ! .get_list (params ).then ((r : any ) => {
105- Object . assign ( data_source , r .data )
104+ data_source . value = r .data
106105
107106 if (r .pagination !== undefined ) {
108107 Object .assign (pagination , r .pagination )
@@ -161,10 +160,17 @@ function onSelect(record: any) {
161160const router = useRouter ()
162161
163162const reset_search = async () => {
164- params = reactive ({})
163+ Object .keys (params ).forEach (v => {
164+ delete params [v ]
165+ })
165166 router .push ({query: {}}).catch (() => {
166167 })
167168}
169+
170+ watch (params , () => {
171+ router .push ({query: params })
172+ get_list ()
173+ })
168174 </script >
169175
170176<template >
@@ -212,7 +218,6 @@ const reset_search = async () => {
212218 </template >
213219 </template >
214220 </template >
215-
216221 </a-table >
217222 <std-pagination :pagination =" pagination" @changePage =" get_list" />
218223 </div >
0 commit comments