修改图片分页

develop
ihzero 2023-08-30 16:32:00 +08:00
parent 2e30983ae6
commit 0ce001a465
2 changed files with 25 additions and 2 deletions

View File

@ -1010,6 +1010,7 @@ export function getWormPhotos(device, params, mode: ErrorMessageMode = 'modal')
}, },
{ {
errorMessageMode: mode, errorMessageMode: mode,
isTransformResponse: false,
}, },
) )
} }

View File

@ -92,6 +92,19 @@
</List-item> </List-item>
</template> </template>
</List> </List>
<div class="text-right">
<pagination
size="small"
v-model:current="pageCurrent"
v-model:page-size="pageSize"
:total="pageTotal"
show-less-items
showSizeChanger
:pageSizeOptions="['8']"
:show-total="(total) => `共 ${total} 条数据`"
@change="getData"
/>
</div>
</Card> </Card>
</PageWrapper> </PageWrapper>
</template> </template>
@ -115,6 +128,7 @@
Radio, Radio,
List, List,
Image, Image,
Pagination,
} from 'ant-design-vue' } from 'ant-design-vue'
import { reactive, ref, onMounted } from 'vue' import { reactive, ref, onMounted } from 'vue'
const RadioButton = Radio.Button const RadioButton = Radio.Button
@ -133,6 +147,10 @@
time_interval: 'day', time_interval: 'day',
}) })
const pageCurrent = ref(1)
const pageTotal = ref(0)
const pageSize = ref(20)
const baseDate = ref<any>([]) const baseDate = ref<any>([])
const pointDate = ref<any>([]) const pointDate = ref<any>([])
const list = ref<any>([]) const list = ref<any>([])
@ -176,6 +194,8 @@
// //
const getData = async () => { const getData = async () => {
const params = { const params = {
per_page: pageSize.value,
page: pageCurrent.value,
device_id: formState.device_id, device_id: formState.device_id,
start_time: '', start_time: '',
end_time: '', end_time: '',
@ -199,8 +219,10 @@
params.end_time = dayjs().endOf('day').format('YYYY-MM-DD') params.end_time = dayjs().endOf('day').format('YYYY-MM-DD')
} }
if (params.device_id == null) return (list.value = []) if (params.device_id == null) return (list.value = [])
const res = await getWormPhotos(params.device_id, params) const { data, meta } = await getWormPhotos(params.device_id, params)
list.value = res pageTotal.value = meta.total
list.value = data
console.log(data)
} }
onMounted(() => { onMounted(() => {