case-data/pages/searchList/searchList.vue
zoujiandong 518a5d1b47 6.12
2025-06-12 17:42:29 +08:00

698 lines
16 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="u-page">
<z-paging
ref="paging"
inside-more
loading-more-no-more-text="咱也是有底线的"
:auto-show-back-to-top="true"
v-model="dataList"
@query="queryList"
>
<template #top>
<navBarSearch :searchWord="keyWord" :navName="navName" :type="type" @changeWord="changeWord"></navBarSearch>
<!-- <view class="databox">
<view class="cell">
<view class="num">22</view>
<view class="name">文章</view>
</view>
<view class="cell">
<view class="num">11</view>
<view class="name">视频</view>
</view>
<view class="cell">
<view class="num">44</view>
<view class="name">阅读量</view>
</view>
</view> -->
<!-- <view class="detail" v-if="total>0">
<view class="desc" v-if="isArticle">检索到:<text class="red">{{total}}篇文章</text></view>
<view class="desc" v-else>检索到<text class="red">{{total}}个视频</text></view>
<view class="desc" v-if="keyWord">检索词:<text class="red">{{ keyWord }}</text></view>
</view> -->
<view class="filterbox">
<!-- <view class="type" @click="swicthType">{{!isArticle?'文章':'视频'}}<up--image :src="switchImg" width="31rpx" height="31rpx"></up--image></view> -->
<up-dropdown class="u-dropdown" ref="uDropdownRef">
<up-dropdown-item
v-model="order.push_date"
title="发布时间"
@change="change"
:options="options"
></up-dropdown-item>
<!-- <up-dropdown-item
v-model="order.read_num"
title="阅读量"
@change="change"
:options="options"
></up-dropdown-item> -->
</up-dropdown>
</view>
</template>
<view class="listbox">
<view class="item" v-for="(item, index) in dataList" :key="index" @click="type=='hospital'?goDetail(item.basic_hospital.hospital_id,item.basic_hospital.hospital_name):goDetail(item.case_clinical_doctor.doctor_id,item.case_clinical_doctor.doctor_name)">
<view class="title ellipsis" v-if="type=='hospital'">{{ item.basic_hospital.hospital_name}}</view>
<view class="title ellipsis" v-else>{{ item.case_clinical_doctor.doctor_name}}({{ item.case_clinical_doctor.hospital_name }})</view>
<view class="tagsbox">
<view class="tag" v-for="tag in item.author" :key="tag.author_id">{{ tag.doctor_name }}</view>
</view>
<view class="deal">
<view class="left">
<view class="count">
病例数{{ item.video_num+item.article_num}}<up--image :src="arrowrightImg" width="32rpx" height="32rpx"></up--image></view>
</view>
<view class="time">
<up-icon name="clock" color="#6B7280" size="28rpx"></up-icon>
<view class="num">{{formatdate(item.last_push_date) }}</view>
</view>
</view>
</view>
</view>
</z-paging>
</view>
<up-popup
:round="10"
zIndex="9"
:show="showCase"
mode="bottom"
@close="closeCase"
>
<view class="votepop casepop">
<view class="titlebox">
<view class="left" @click="showCase = false">取消</view>
<view class="left continue" @click="continueCase" v-show="level != 3"
>继续选择</view
>
<view class="right" @click="confirmCase">确定</view>
</view>
<view class="casecon">
<view v-show="level == 1" >
<up-radio-group
v-model="caseValue1"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list1"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 2" >
<up-radio-group
v-model="caseValue2"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
<view v-show="level == 3" >
<up-radio-group
v-model="caseValue3"
iconPlacement="right"
placement="column"
>
<view
class="column"
v-for="item in labelObj.list2"
:key="item.app_iden"
>
<up-radio
activeColor="#3CC7C0 "
:label="item.label_name"
:name="item.app_iden"
></up-radio>
</view>
</up-radio-group>
</view>
</view>
</view>
</up-popup>
</template>
<script setup>
import { ref, reactive} from "vue";
import navBarSearch from "@/components/navBarSearch/navBarSearch.vue";
import list from "@/uni_modules/z-paging/components/z-paging/z-paging";
import api from "@/api/api";
import { onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs";
import switchImg from "@/static/switch.png";
import arrowrightImg from "@/static/arrowright.png";
const paging = ref(null);
const uDropdownRef=ref(null);
const dataList = ref([]);
const total = ref(0);
const value = ref("");
const keyWord = ref("");
const isArticle=ref(true)
const type=ref('doctor')
const navName=ref('医生临床病例库');
const showCase = ref(false);
const caseValue1 = ref("");
const caseValue2 = ref("");
const caseValue3 = ref("");
const level = ref(1);
const labelObj = reactive({
list1: [],
list2: [],
list3: [],
});
const getCaseLabel = (lev,pid=0) => {
api.getCaseLabel({
pid:pid
}).then((res) => {
if (lev == 1) {
labelObj.list1 = res.data.data;
} else if (lev == 2) {
labelObj.list2 = res.data.data;
} else if (lev == 3) {
labelObj.list3 = res.data.data;
}
level.value = lev;
});
};
const confirmCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
showCase.value = false;
if(level.value == 1){
let label = labelObj.list1.find((item) => item.app_iden == caseValue1.value);
console.log(label);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
if(level.value == 2 ){
let label = labelObj.list2.find((item) => item.app_iden == caseValue2.value);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
if(level.value == 3 ){
let label = labelObj.list3.find((item) => item.app_iden == caseValue3.value);
labelList.value.push({
app_iden:label.app_iden,
label_name:label.label_name,
});
}
//去重
labelList.value=labelList.value.filter((item, index) => labelList.value.findIndex(i => i.app_iden === item.app_iden) === index);
caseValue1.value = "";
caseValue2.value = "";
caseValue3.value = "";
};
const continueCase = () => {
if (level.value == 1 && caseValue1.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 2 && caseValue2.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if (level.value == 3 && caseValue3.value == "") {
uni.showToast({ title: "请选择疾病", icon: "none" });
return false;
}
if(level.value == 1 ){
getCaseLabel(2,caseValue1.value);
}else if(level.value == 2 ){
getCaseLabel(3,caseValue2.value);
}
};
const closeCase = () => {
showCase.value = false;
};
const options= ref([
{
label: "正序",
value: 'asc',
},
{
label: "倒序",
value: 'desc',
},
]);
const order=reactive({
read_num:'',
push_date:''
})
onLoad((options) => {
if(options.type=='hospital'){
type.value ='hospital';
}
keyWord.value=options.name;
if(options.name){
navName.value=options.name+'临床病例库'
}
if((options.name='医生' || options.name=='医院') && !options.id){
keyWord.value='';
}
if(options.order=='new'){
order.push_date='asc'
};
if(options.order=='read'){
order.read_num='desc'
};
});
const change=(e)=>{
paging.value.reload();
}
const formatdate=(date)=>{
return dayjs(date).format('YYYY-MM-DD')
}
const swicthType=()=>{
isArticle.value=!isArticle.value;
dataList.value=[];
order.read_num='';
order.push_date='';
paging.value.reload();
}
const searchArticle =(params) => {
let searchForm={
keyword: keyWord.value,
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchArticle({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
}).catch(err=>{
paging.value.complete(false);
})
}
const searchVideo = async(params) => {
let searchForm={
keyword: keyWord.value,
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchVideo({
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
}).catch(err=>{
paging.value.complete(false);
})
}
const searchHospital = async(params) => {
let searchForm={
hospital_name: keyWord.value,
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchHospital({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
}).catch(err=>{
paging.value.complete(false);
})
}
const searchDoctor = async(params) => {
let searchForm={
doctor_name: keyWord.value,
}
if(!order.read_num){
delete order.read_num
}
if(!order.push_date){
delete order.push_date
}
if(order.read_num || order.push_date){
searchForm.order=order
}
api.searchDoctor({
...searchForm,
...params
}).then((res)=>{
paging.value.complete(res.data.data.data);
total.value=res.data.data.total;
}).catch(err=>{
paging.value.complete(false);
})
}
const queryList = (pageNo, pageSize) => {
const params = {
page: pageNo,
page_size: pageSize,
};
type.value=='hospital'?searchHospital(params):searchDoctor(params)
};
const goDetail=(id,name)=>{
let url=''
if(type.value=='doctor'){
url=`/pages/search/search?doctor_id=${id}&doctor_name=${name}`
}else{
url=`/pages/search/search?hospital_id=${id}&hospital_name=${name}`
}
uni.navigateTo({
url:url,
});
}
/**
* 修改关键词并更新界面
*
* @param value 输入的关键词
*/
const changeWord=(value)=>{
console.log(value);
if(value){
navName.value=value+'临床病例库';
keyWord.value=value;
dataList.value=[];
order.read_num='';
order.push_date='';
paging.value.reload();
}
}
</script>
<style lang="scss" scoped>
.votepop {
.confirm {
margin: 39rpx 30rpx 0;
height: 92rpx;
background: #3cc7c0;
border-radius: 15rpx;
display: flex;
align-items: center;
font-size: 31rpx;
color: #ffffff;
justify-content: center;
}
.del {
margin: 30rpx 30rpx 30rpx;
height: 92rpx;
background: #fff;
border-radius: 15rpx;
font-size: 31rpx;
color: #666666;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
margin-top: 30rpx;
font-size: 27rpx;
color: #9ca3af;
line-height: 38rpx;
padding: 0 30rpx;
}
.add {
margin: 0 30rpx;
display: flex;
align-items: center;
height: 92rpx;
justify-content: center;
background: #f5f5f5;
border-radius: 15rpx;
font-size: 31rpx;
color: #4b5563;
.desc {
margin-left: 10rpx;
}
}
.titlebox {
padding: 0 30rpx;
height: 86rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #f3f4f6;
.left {
font-size: 31rpx;
color: #4b5563;
}
.right {
font-size: 31rpx;
color: #3cc7c0;
}
}
.votecon {
max-height: calc(100vh - 530rpx);
overflow-y: scroll;
.row {
display: flex;
align-items: center;
.iconbox {
margin-left: 15rpx;
align-items: center;
}
}
.titlebox {
border: none;
margin: 30rpx 0 20rpx;
.title {
font-size: 31rpx;
color: #111827;
}
.desc {
font-size: 27rpx;
color: #9ca3af;
}
}
}
}
.casepop{
display: flex;
flex-direction: column;
max-height: calc(100vh - 400rpx);
.continue{
color: #2878ff !important;
}
}
.casecon {
flex:1;
overflow-y: scroll;
padding-top: 10rpx;
min-height: 350rpx;
.column {
padding: 0 30rpx;
border-bottom: 2rpx solid #e5e7eb;
}
}
.databox {
height: 162rpx;
background: #ffffff;
display: flex;
margin-bottom: 20rpx;
// padding: 0 30rpx;
justify-content: space-between;
.cell {
flex: 1;
padding: 35rpx 0;
text-align: center;
.num {
font-size: 38rpx;
color: #3cc7c0;
}
.name {
margin-top: 18rpx;
font-size: 28rpx;
color: #4b5563;
}
}
}
.listbox{
background: #F8F9FA;
overflow: hidden;
}
.filterbox{
display: flex;
height:128rpx;
background:#fff;
border-bottom: 2rpx solid rgba(0,0,0,0.08);
align-items: center;
position: relative;
.type{
position: absolute;
left:30rpx;
top:24rpx;
display: flex;
justify-content: center;
align-items: center;
background: #F3F4F6;
border-radius: 15rpx;
height: 74rpx;
padding:0 25rpx;
z-index:2;
}
}
.u-page {
:deep(.z-paging-content-fixed){
background: #F8F9FA!important;
}
:deep(.u-flex) {
display: flex;
flex-direction:row;
overflow: hidden;
}
:deep(.u-image){
background: none!important;
}
:deep(.u-dropdown__menu){
background: #fff;
z-index:1;
margin-left:-30rpx;
}
:deep(.u-dropdown__menu__item){
height:74rpx;
padding:0 20rpx;
background: #F3F4F6;
border-radius: 15rpx;
flex:none;
margin-left: 60rpx;
}
.deal {
margin-top: 20rpx;
display: flex;
color: #6b7280;
background:#fff;
font-size: 24rpx;
justify-content: space-between;
.left {
display: flex;
align-items: center;
font-size: 27rpx;
.count{
display: flex;
align-items: center;
}
}
.collect {
display: flex;
align-items: center;
}
.eyebox {
width: 160rpx;
display: flex;
align-items: center;
}
.time {
display: flex;
align-items: center;
}
.num {
margin-left: 8rpx;
}
}
.item {
margin:30rpx;
background: #fff;
padding:30rpx;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.08);
border-radius: 23rpx;
.title {
font-size: 30rpx;
color: #111827;
line-height: 46rpx;
}
}
.tagsbox {
margin-top: 20rpx;
display: flex;
.tag {
padding: 0 10rpx;
margin-right: 16rpx;
height: 46rpx;
line-height: 46rpx;
text-align: center;
background: rgba(60, 199, 192, 0.1);
border-radius: 8rpx;
font-weight: 400;
font-size: 24rpx;
color: #3cc7c0;
}
}
}
.detail {
background: #f9f9f9;
padding: 12rpx 30rpx;
.desc {
font-size: 26rpx;
color: #4b5563;
line-height: 40rpx;
}
.red{
color: #FF0000;
}
}
</style>