<template> <div class="h-full flex flex-col visit"> <div class="shrink-0 flex pb-2 px-2 pt-3 items-center"> <van-tabs shrink type="card" class="grow doc-tab-round" line v-model:active="activeTab" @change="tabChange"> <van-tab v-for="item in tabList" :key="item.value" :title="item.name"></van-tab> </van-tabs> <div class="shrink-0 pl-3" style="border-left: 1px solid #A5AEBE;" @click='openSearch'> <doc-icon type="doc-menu" style="font-size:.2rem;color:#03053D"/> </div> </div> <div class='grow pt-1 relative min-h-0'> <div class='h-full overflow-y-auto px-2 pb-3' 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" @click="toDetail(item)"> <span class="name mr-2">{{ item.residentName }}</span> <span class="tag mr-2">{{ item.age }}岁</span> <span class="tag mr-2">{{ item.genderName || '-' }}</span> </div> <div class="flex flex-col gap-y-2.5" @click="toDetail(item)"> <div> <span class="label">身份证号</span> <span>{{ $idCardHide(item.idCard) }}</span> </div> <div> <span class="label">是否逾期</span> <span>{{ item.isOverdue == 1 ? '是' : '否' }}</span> </div> <div> <span class="label">逾期天数</span> <span> <span :class="{'text-red': item.overdueDay > 0}">{{ item.overdueDay }}</span> <span>天</span> </span> </div> <div class="flex"> <span class="label">慢病标签</span> <span> <ChronicTag :list='item.chronicTagsArray' /> </span> </div> <div> <span class="label">数据来源</span> <span>{{ item.sourceName || '-' }}</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> <van-button round size="small" class="doc-btn-primary" @click='toAddGeneral(item)'>通用随访</van-button> <van-button round size="small" class="doc-btn-primary" @click="onIgnore(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> </div> <van-popup v-model:show="searchVisible" position="top" :style="{ height: '80%' }" style="position: absolute;transition: none" :overlay-style="{ position: 'absolute' }" transition="viewer-fade" :teleport="$refs.list"> <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.residentName" placeholder="输入居民姓名" maxlength="100" class="doc-input"/> <div class="my-3">下次随访日期</div> <div class="flex items-center"> <van-field v-model="form.nextVisitDateStart" placeholder="开始日期" readonly class="doc-input" @click="() => { dateShow = true, dateMark = 1 }"/> <span class="px-2">~</span> <van-field v-model="form.nextVisitDateEnd" placeholder="结束日期" readonly class="doc-input" @click="() => { dateShow = true, dateMark = 2 }"/> </div> <van-popup v-model:show="dateShow" position="bottom" :teleport="$refs.list"> <van-date-picker @confirm="onDateConfirm" @cancel="dateShow = false"/> </van-popup> <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="isOverdueArray" v-model:value="form.isOverdue" 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 { useStore } from '@/doctor/store' import { getVisitByPage, delVisit } from '@/api/doctor/workbench.js' import ChronicTag from '@/doctor/components/chronicTag/ChronicTag.vue' import CheckBtn from '@/doctor/components/checkBtn/CheckBtn.vue' import IdCardScan from '@/doctor/components/idCardScan/IdCardScan.vue' const DefaultForm = { // 数据来源,[CP00124] source: undefined, // 是否逾期 isOverdue: '', // 下次随访日期-开始日期 nextVisitDateStart: undefined, // 下次随访日期-截止日期 nextVisitDateEnd: undefined, // 姓名 residentName: undefined, // 身份证号 idCard: undefined } export default { name: 'TableVisit', components: { ChronicTag, CheckBtn, IdCardScan }, props: { searchType: { default: 1 } }, data() { return { store: useStore(), list: [], pagination: { total: 0, pageIndex: 1, pageSize: 8 }, loading: false, finished: false, loadingRefresh: false, isRefreshDisable: false, // 慢病tab列表 tabList: [ { name: '高血压', value: 1 }, { name: '糖尿病', value: 2 }, { name: '冠心病', value: 3 }, { name: '脑卒中', value: 4 }, { name: '慢阻肺', value: 5 }, { name: '慢性肾脏病', value: 6 }, { name: '血脂异常', value: 7 } ], activeTab: 0, // 搜索弹出框 searchVisible: false, // 时间选择 dateShow: false, // 判断对哪一个日期赋值 dateMark: 0, form: { ...DefaultForm } } }, computed: { activeTabItem() { return this.tabList[this.activeTab] || {} }, isOverdueArray() { return [ { name: '是', value: 1 }, { name: '否', value: 2 } ] } }, 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) { const query = { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, searchType: this.searchType, diseaseType: this.activeTabItem.value, ...this.form } getVisitByPage(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.search() }, onMore() { this.pagination.pageIndex++ this.load(false) }, onRefresh() { this.pagination.pageIndex = 1 this.load(false) }, tabChange() { this.pagination.pageIndex = 1 this.load() }, openSearch() { this.searchVisible = !this.searchVisible }, onDateConfirm({ selectedValues }) { const result = selectedValues.join('-') if (this.dateMark === 1) { this.form.nextVisitDateStart = result } else if (this.dateMark === 2) { this.form.nextVisitDateEnd = result } this.dateShow = false this.dateMark = 0 }, toDetail(record) { if (!record) return if (record.residentInfoId == null) { this.$message.info('暂时无法查看 详情信息') return } this.$router.push({ path: '/doctor/patient-detail', query: { residentInfoId: record.residentInfoId } }) }, onIgnore(record) { delVisit({ id: record.id }).then(() => { this.list = this.list.filter(e => e.id !== record.id) setTimeout(() => { this.$message.info('操作成功') }, 800); }) }, //新增通用随访 toAddGeneral(val) { const {id, ...others} = val this.$router.push({ path: `/doctor/followUp/generalFU/add`, query: {...others} }) } }, watch: { searchType() { this.onRefresh() }, 'store.refreshMark'() { this.onRefresh() } } } </script> <style lang="less" scoped> </style>