<template> <div class="h-full flex flex-col px-2 py-3 work"> <div class="shrink-0 flex pb-2 items-center"> <van-tabs shrink type="card" class="grow doc-tab-round" line> <van-tab title="全部" title-style="padding: 0 .2rem"></van-tab> </van-tabs> <doc-icon type="doc-menu" style="font-size:.2rem;color:#03053D" @click='openSearch' /> </div> <div class='grow pt-1 overflow-y-auto' ref='list'> <van-pull-refresh v-model='loadingRefresh' @refresh='onRefresh' :disabled='isRefreshDisable' style="min-height: 100%"> <van-list v-model:loading='loading' :finished='finished' :finished-text="list.length ? '没有更多了' : ''" :immediate-check='false' @load='onMore' > <div class="flex flex-col gap-y-2.5"> <div class="py-3 px-4 doc-list-card" v-for='item in list' :key="item.id"> <div class="mb-4"> <span class="name mr-2">{{ item.residentName }}</span> <span class="tag mr-2">{{ item.currentAge }}岁</span> <span class="tag mr-2">{{ item.genderName }}</span> </div> <div class="flex flex-col gap-y-2.5"> <div> <span class="label">身份证号</span> <span>{{ item.idCard }}</span> </div> <div> <span class="label">服务类型</span> <span>{{ item.serviceTypeName }}</span> </div> <div> <span class="label">服务日期</span> <span>{{ item.serviceDate }}</span> </div> <div> <span class="label">服务医生</span> <span>{{ item.serviceDoctorName }}</span> </div> </div> <div class="divider my-3"></div> <div class="bt-group"> <van-button round size="small" class="doc-btn-primary" @click="toDetail(item)">详情</van-button> </div> </div> </div> </van-list> <div class='text-center shrink-0 empty' v-if='!list.length'> <img src='@/assets/image/doctor/empty.png' alt='' style='width: 1.2rem;'> <p>暂无数据</p> </div> </van-pull-refresh> <van-popup v-model:show="searchVisible" position="top" :style="{ height: '70%' }" style="position: absolute;transition: none" :overlay-style="{ position: 'absolute' }" transition="viewer-fade" :teleport="listDom"> <div class="h-full flex flex-col workbench-search-box"> <div class="px-4 py-3 grow overflow-y-auto" style=""> <div class="mb-3">身份证号</div> <van-field v-model="form.idCard" placeholder="请输入身份证号" maxlength="20" class="doc-input"> <template #right-icon> <IdCardScan /> </template> </van-field> <div class="my-3">居民姓名</div> <van-field v-model="form.patientName" placeholder="输入居民姓名" maxlength="100" class="doc-input"/> <div class="my-3">数据来源</div> <CheckBtn :options="store.getDict('CP00124')" v-model:value="form.source" column-3 class="check-btn-workbench"/> <div class="my-3">服务类型</div> <CheckBtn :options="store.getDict('CP00150')" v-model:value="form.serviceType" column-2 class="check-btn-workbench"/> </div> <div class="text-16 flex shrink-0 text-center bt-group"> <div class="grow py-3" @click="reset">重置</div> <div class="grow py-3 submit-btn" @click="search">确定</div> </div> </div> </van-popup> </div> </div> </template> <script> import { getWorkByPage } from '@/api/doctor/workbench.js' import { useStore } from '@/doctor/store' import CheckBtn from '@/doctor/components/checkBtn/CheckBtn.vue' import IdCardScan from '@/doctor/components/idCardScan/IdCardScan.vue' import { showToast } from 'vant' const DefaultForm = { // 数据来源,[DC00051] source: undefined, // 服务类型 serviceType: undefined, // 服务日期-截止日期 startDate: undefined, // 服务日期-开始日期 endDate: undefined, // 姓名 patientName: undefined, // 身份证号 idCard: undefined } export default { name: 'TableWork', components: { CheckBtn, IdCardScan }, data() { return { store: useStore(), list: [], pagination: { total: 0, pageIndex: 1, pageSize: 8 }, loading: false, finished: false, loadingRefresh: false, isRefreshDisable: false, // 搜索弹出框 searchVisible: false, form: { ...DefaultForm }, rangeDate: [], } }, computed: { listDom() { return this.$refs.list } }, created() { this.load() }, mounted() { const list = this.$refs.list list.addEventListener('scroll', () => { if (list.scrollTop > 0) { this.isRefreshDisable = true } else { this.isRefreshDisable = false } }) }, methods: { load(loading = true) { this.dateHandle() const query = { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, searchType: 1, ...this.form } getWorkByPage(query, loading).then(res => { if (this.pagination.pageIndex === 1) { this.list = [] } this.list = this.list.concat(res.data.dataList || []) this.pagination.total = res.data.total || 0 this.finished = this.list.length >= this.pagination.total }).finally(() => { this.loading = false this.loadingRefresh = false }) }, search() { this.pagination.pageIndex = 1 this.load() this.searchVisible = false }, reset() { this.form = { ...DefaultForm } this.rangeDate = [] this.search() }, onMore() { this.pagination.pageIndex++ this.load(false) }, onRefresh() { this.pagination.pageIndex = 1 this.load() }, openSearch() { this.searchVisible = true }, toDetail(record) { if (!record) return if (record.residentInfoId == null) { showToast('暂时无法查看 详情信息') return } this.$router.push({ path: '/doctor/patient-detail', query: { residentInfoId: record.residentInfoId } }) }, dateHandle() { if (this.rangeDate && this.rangeDate.length) { this.form.startDate = this.rangeDate[0] this.form.endDate = this.rangeDate[1] return } this.form.startDate = undefined this.form.endDate = undefined }, } } </script> <style lang="less" scoped> </style>