|
|
@ -1,8 +1,10 @@ |
|
|
|
<template> |
|
|
|
<view class="u-p-40 "> |
|
|
|
<SearchList /> |
|
|
|
<view class="relative" :style="{ 'padding-top': `${searchHeight}px` }"> |
|
|
|
<SearchList ref="searchListRef" @on-search="onSearch" @on-load="onSearchLoad" /> |
|
|
|
|
|
|
|
<uni-section title="患者列表" type="line" class="uni-my-5" titleFontSize="16px"></uni-section> |
|
|
|
|
|
|
|
<uni-grid :column="4" :highlight="true" :square="false" :show-border="false" @change="onClickItem"> |
|
|
|
<uni-grid-item :index="0" class="u-p-20 "> |
|
|
|
<view class="list-item flex justify-center"> |
|
|
@ -12,16 +14,16 @@ |
|
|
|
</uni-grid-item> |
|
|
|
|
|
|
|
<uni-grid-item v-for="(item, index) in data" :index="index + 1" :key="index + 1" class="u-p-20"> |
|
|
|
<view class="list-item flex active"> |
|
|
|
<view class="list-item flex " :class="{ active: currentAidId === item.firstAidId }"> |
|
|
|
<view class="flex-1"> |
|
|
|
<view class="text-title"> |
|
|
|
<text>{{ item.name }}</text> |
|
|
|
<text>{{ item.age }}</text> |
|
|
|
<text>{{ item.sex }}</text> |
|
|
|
<text>{{ item.patientName }}</text> |
|
|
|
<text>{{ item.patientAge }}</text> |
|
|
|
<text>{{ GET_GENDER_TEXT_BY_CODE(item.patientGender) }}</text> |
|
|
|
</view> |
|
|
|
<view class="text-summary"> |
|
|
|
<u-tag :text="item.status" mode="light" size="mini" /> |
|
|
|
<text class="time">{{ item.time }}</text> |
|
|
|
<u-tag :text="AID_STATUS[item.firstAidStatus]" mode="light" size="mini" /> |
|
|
|
<text class="time">{{ item.firstAidTime }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
@ -34,32 +36,66 @@ |
|
|
|
|
|
|
|
<image class="create-user" src="@/static/images/bed.png" mode="scaleToFill" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
import type { IPatient } from '@/store/modules/service'; |
|
|
|
import { useServiceStore } from '@/store/modules/service'; |
|
|
|
import { usePagination } from '@/hooks/usePagination' |
|
|
|
import { GET_GENDER_TEXT_BY_CODE, AID_STATUS } from '@/config/service' |
|
|
|
import { computed, ref } from 'vue'; |
|
|
|
import { onReachBottom } from '@dcloudio/uni-app' |
|
|
|
|
|
|
|
const serviceStore = useServiceStore() |
|
|
|
const { pagination, updatePagination, resetPagination } = usePagination() |
|
|
|
|
|
|
|
const data: IPatient[] = [ |
|
|
|
{ name: '脏兵', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵1', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵2', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵3', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵4', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵1', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵2', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
{ name: '脏兵3', age: 17, sex: '男', status: '到院', time: '2022-11-23 12:11' }, |
|
|
|
] |
|
|
|
const data = ref<IPatient[]>([]) |
|
|
|
const keywords = ref('') |
|
|
|
const searchHeight = ref(100) |
|
|
|
|
|
|
|
const currentAidId = computed(() => serviceStore.currentPatient?.firstAidId) |
|
|
|
|
|
|
|
function onClickItem(event) { |
|
|
|
const item = data[event.detail.index] |
|
|
|
serviceStore.setCurrentPatient(item) |
|
|
|
uni.$u.openPage('detail2') |
|
|
|
} |
|
|
|
|
|
|
|
function onSearch(searchValue: string) { |
|
|
|
keywords.value = searchValue |
|
|
|
resetPagination() |
|
|
|
getAidList() |
|
|
|
} |
|
|
|
|
|
|
|
// get list |
|
|
|
async function getAidList() { |
|
|
|
try { |
|
|
|
const res = await uni.$u.api.getAidList(keywords.value, pagination.nextPage || 1, pagination.pageSize) |
|
|
|
data.value = res?.list || [] |
|
|
|
updatePagination(res) // 更新分页信息 |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function onSearchLoad(height: number) { |
|
|
|
searchHeight.value = height |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onSearch('') |
|
|
|
onReachBottom(() => { |
|
|
|
console.log('reach bottom', pagination); |
|
|
|
if (pagination.nextPage === 0) { |
|
|
|
uni.$u.toast('没有更多数据') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
getAidList() |
|
|
|
|
|
|
|
}) |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|