<template>
|
<view class="container">
|
<scroll-view class="report-list" scroll-y>
|
<view v-for="(item, index) in reportList" :key="index" class="report-item">
|
<view class="report-content">
|
<view class="report-left">
|
<view class="user-info">
|
<uni-icons type="wallet" size="20" color="#3498db" />
|
<view class="report-date">{{ item.date }}</view>
|
</view>
|
|
<view class="report-right">
|
<uni-icons :type="item.selected ? 'checkbox-filled' : 'circle'"
|
size="20" :color="item.selected ? '#47a0fc' : '#999999'"
|
@click="toggleSelect(index)"></uni-icons>
|
<!-- <u-checkbox-group>
|
<u-checkbox v-model="checked" shape="circle"></u-checkbox>
|
</u-checkbox-group> -->
|
</view>
|
</view>
|
<view class="report-middle">
|
<view class="report-info">
|
<text class="report-name">{{ item.name }}</text>
|
<text class="report-age">{{ item.age }}岁</text>
|
<text class="report-gender">{{ item.gender }}</text>
|
</view>
|
<view class="report-hospital">{{ item.hospital }}</view>
|
</view>
|
</view>
|
</view>
|
</scroll-view>
|
|
<!-- 提示信息 -->
|
<view class="tip-text">
|
提示:最多可对比5份体检报告
|
</view>
|
|
<!-- 底部按钮 -->
|
<view class="bottom-button">
|
<button class="compare-button" @click="handleCompare">
|
报告对比
|
</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getReportByTjNumber,
|
getShenGaoTiZhong,
|
getdownloadReport,
|
getHyReportByTjNumber,
|
getJcReportByTjNumber
|
} from "@/api/system/report";
|
|
export default {
|
components: {},
|
data() {
|
return {
|
checked: "",
|
reportList: [{
|
date: '2025-02-15',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: true
|
},
|
{
|
date: '2024-08-21',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: false
|
},
|
{
|
date: '2023-05-15',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: false
|
},
|
{
|
date: '2022-08-21',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: false
|
},
|
|
{
|
date: '2023-05-15',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: false
|
},
|
{
|
date: '2022-08-21',
|
name: '李*蕊',
|
age: 35,
|
gender: '女',
|
hospital: '泾川县人民医院健康体检中心',
|
selected: false
|
}
|
]
|
}
|
},
|
//生命周期方法 —— 页面加载时
|
onLoad(options) {
|
// this.tjNumber = options.tjNumber
|
// this.getOrderDetailList();
|
// this.getjichu();
|
},
|
methods: {
|
// download() {
|
// this.$modal.showToast('下载中...')
|
// let tjNumber = this.tjNumber;
|
// downloadReport(tjNumber).then((response) => {});
|
// this.$modal.showToast('下载成功')
|
// },
|
toggleSelect(index) {
|
// const selectedCount = index
|
const selectedCount = this.reportList.filter(item => item.selected).length;
|
// console.log(selectedCount)
|
if (!this.reportList[index].selected && selectedCount >= 5) {
|
uni.showToast({
|
title: '最多只能选择5份报告',
|
icon: 'none'
|
});
|
return;
|
}
|
if (this.reportList[index].selected == true) {
|
this.reportList[index].selected = false
|
} else {
|
return this.reportList[index].selected = true
|
}
|
// this.reportList.value[index].selected = !this.reportList.value[index].selected;
|
},
|
handleCompare() {
|
const selectedReports = this.reportList.filter(item => item.selected);
|
if (selectedReports.length < 2) {
|
uni.showToast({
|
title: '请至少选择2份报告进行对比',
|
icon: 'none'
|
});
|
return;
|
}
|
},
|
getOrderDetailList() {
|
uni.showLoading({
|
title: '请稍等!'
|
})
|
let tjNumber = this.tjNumber;
|
getReportByTjNumber(tjNumber).then((response) => {
|
uni.hideLoading()
|
this.alist = response.data.list;
|
this.zjadvice = response.data.inspectionAdvice;
|
if (response.data.inspectionAdvice == null) {
|
this.zjadvice = "无"
|
}
|
this.yclist = response.data.tjAbnormal;
|
this.customer = response.data.customter;
|
});
|
getHyReportByTjNumber(tjNumber).then(res => {
|
this.alist1 = res.data;
|
})
|
getJcReportByTjNumber(tjNumber).then(res => {
|
this.alistss = res.data;
|
})
|
},
|
getjichu() {
|
|
let tjNumber = this.tjNumber;
|
getShenGaoTiZhong(tjNumber).then(res => {
|
this.jicuList = res.data;
|
})
|
},
|
add() {
|
if (this.content.length > 35) {
|
this.content = ''
|
} else {
|
this.content = ''
|
}
|
// TODO 小程序中不支持自动更新 ,需要手动resize 更新组件高度
|
// #ifdef MP
|
this.$nextTick(() => {
|
this.$refs.collapse.resize()
|
})
|
// #endif
|
},
|
onClick(e) {
|
uni.showToast({
|
title: '列表被点击'
|
})
|
},
|
getDownload() {
|
const tjNumber = this.tjNumber;
|
getdownloadReport(tjNumber).then(res => {
|
if (res.data.flag == "1") {
|
let url = res.data.url
|
uni.navigateTo({
|
url: `/pagesA/report/report?url=${url}`
|
})
|
} else if (res.data.flag == "0") {
|
wx.downloadFile({
|
url: res.data.url, //pdf地址 例如:http://**.*****.***/ceshi/demo.pdf
|
filePath: wx.env.USER_DATA_PATH + "/" + "报告" +
|
".pdf", //wx.env.USER_DATA_PATH 文件系统中的用户目录路径 filepath可有可无
|
success(res) {
|
if (res.statusCode === 200) {
|
const tempFilePath = res.filePath //返回的文件临时地址,用于后面打开本地预览所用
|
wx.openDocument({
|
filePath: tempFilePath,
|
showMenu: true,
|
fileType: "pdf",
|
success: function(res) {}
|
})
|
} else {
|
showAutoError("协议打开失败,请重新打开");
|
}
|
},
|
fail(res) {
|
showAutoError("协议下载失败")
|
}
|
})
|
}
|
})
|
},
|
change(e) {
|
console.log(e);
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
page {
|
height: 100%;
|
|
background-color: #f5f5f5;
|
}
|
|
.container {
|
display: flex;
|
flex-direction: column;
|
height: 100%;
|
background-color: #f5f5f5;
|
}
|
|
.nav-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding: 0 30rpx;
|
height: 88rpx;
|
background-color: #ffffff;
|
border-bottom: 1px solid #eeeeee;
|
}
|
|
.nav-left {
|
display: flex;
|
align-items: center;
|
}
|
|
.back-icon {
|
margin-right: 20rpx;
|
}
|
|
.nav-title {
|
font-size: 16px;
|
color: #333333;
|
font-weight: 500;
|
}
|
|
.nav-right {
|
display: flex;
|
align-items: center;
|
}
|
|
.divider {
|
width: 1px;
|
height: 20rpx;
|
background-color: #e5e5e5;
|
margin: 0 20rpx;
|
}
|
|
.report-list {
|
flex: 1;
|
overflow: auto;
|
padding: 30rpx;
|
}
|
|
.report-item {
|
background-color: #ffffff;
|
border-radius: 12rpx;
|
margin-bottom: 20rpx;
|
}
|
|
.report-content {
|
// display: flex;
|
align-items: center;
|
padding: 30rpx;
|
}
|
|
.report-left {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
// margin-right: 20rpx;
|
}
|
|
.user-info {
|
width: 90%;
|
display: flex;
|
align-items: center;
|
}
|
|
// .report-right {
|
// flex: 1;
|
// float: right;
|
// }
|
|
.report-middle {
|
flex: 1;
|
background-color: #F9FBFC;
|
}
|
|
.report-date {
|
font-size: 16px;
|
color: #333333;
|
margin-bottom: 16rpx;
|
font-weight: 500;
|
padding-left: 20rpx;
|
}
|
|
.report-info {
|
margin-bottom: 12rpx;
|
}
|
|
.report-name {
|
font-size: 14px;
|
color: #666666;
|
margin-right: 20rpx;
|
}
|
|
.report-age {
|
font-size: 14px;
|
color: #666666;
|
margin-right: 20rpx;
|
}
|
|
.report-gender {
|
font-size: 14px;
|
color: #666666;
|
}
|
|
.report-hospital {
|
font-size: 14px;
|
color: #999999;
|
}
|
|
.tip-text {
|
padding: 20rpx 30rpx;
|
font-size: 14px;
|
color: #ff9900;
|
}
|
|
.bottom-button {
|
padding: 30rpx;
|
background-color: #ffffff;
|
}
|
|
.compare-button {
|
width: 100%;
|
height: 88rpx;
|
line-height: 88rpx;
|
background-color: #419FFD;
|
color: #ffffff;
|
font-size: 16px;
|
// border-radius: 44rpx;
|
}
|
</style>
|