You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
5.1 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script setup>
import DraggableButton from "@/pages/components/goHome.vue";
/**
* name
* userxzbg
* date2024年9月27日 16:01:08
*/
import {
ref
} from "vue";
import {
$api,
$response
} from "@/api";
import {
onShow
} from "@dcloudio/uni-app";
import {
useStore
} from "@/store";
const $store = useStore();
let bgcx_list = ref([]); // 体检报告列表
const mountedAction = () => {
gettjbgInfo();
};
const gettjbgInfo = async () => {
// 获取 体检报告列表
console.log($store, "store");
let obj = {
tj_status: 1,
hospital_id: $store.save.hospital,
};
uni.showLoading();
const response = await $api("GetReportList", obj);
$response(response, () => {
console.log(response, "response");
bgcx_list.value = response.data.list;
uni.hideLoading();
});
};
let tjbgList = ref([]);
// const selectdbObj = async (item) => {
// tjbgList.value = $store.getTjbgInfo();
// if ($store.setTjbgInfo?.length < 2) {
// console.log(item.体检号);
// console.log(tjbgList.value.length);
// if (tjbgList.value.length == 1 && item.体检号 == tjbgList.value[0].体检号) {
// uni.$lu.toast("请选择两份不同的报告");
// return false;
// }
// tjbgList.value.push(item);
// }
// $store.setTjbgInfo(tjbgList.value);
// // console.log(item.name)
// // 关闭当前页面携带医生名称返回上一个并且携带item.name
// // uni.navigateBack({
// // delta: 1,
// // });
// };
const selectdbObj = async (item) => {
// 获取 tjbgList 数据
tjbgList.value = $store.getTjbgInfo();
// 检查 tjbgList 中是否已经存在与 item.体检号 匹配的元素
const index = tjbgList.value.findIndex(tjbg => tjbg.体检号 === item.体检号);
if (index !== -1) {
// 如果存在,则从 tjbgList 中移除该元素(取消选择)
tjbgList.value.splice(index, 1);
} else {
// 如果不存在,则将 item 添加到 tjbgList 中
if (tjbgList.value.length >= 2) {
uni.$lu.toast("最多只能选择两份报告");
return false;
}
tjbgList.value.push(item);
}
// 更新 store 中的数据
$store.setTjbgInfo(tjbgList.value);
};
const selectdbDone =()=>{
uni.redirectTo({
url:"/pages/main/bgcx/bgdb/bgdb"
});
}
const config_ref = ref(null);
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e;
mountedAction();
}
};
onShow(() => {
tjbgList.value = $store.getTjbgInfo();
console.log('666666666', tjbgList.value)
if (!!config_ref.value) {
mountedAction();
}
});
</script>
<template>
<DraggableButton />
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view class="">
<view style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.05)"
class="text-24rpx text-#333 m-20rpx p-24rpx bg-#fff rounded-10rpx" v-for="(item, index) in bgcx_list"
:key="index">
<view class="pb-30rpx text-#0E0E0E text-34rpx flex flex-justify-between">
<text class="line-clamp-1">{{ item["套餐名称"] }}</text>
<text
class="w-90rpx h-42rpx bg-#32A8D9 text-#fff text-24rpx rounded-rb-20rpx rounded-lt-20rpx text-center line-height-[1.6]">
{{ item["团检"] ? "团检" : "个检" }}
</text>
</view>
<view style="display: flex;align-items: center;justify-content: space-between;">
<view>
<view class="pb-15rpx">
<text class="text-#8B8B8B">体检人</text>
<text class="ml-25rpx">{{ item["姓名"] }}</text>
</view>
<view class="pb-15rpx">
<text class="text-#8B8B8B">体检时间</text>
<text>{{ item["检前签到时间"]?.split("T").join(" ") }}</text>
</view>
<view class="pb-15rpx">
<text class="text-#8B8B8B">报告编号</text>
<text>{{ item["体检号"] }}</text>
</view>
<view class="pb-20rpx">
<text class="text-#8B8B8B">报告日期</text>
<text>{{ item["报告日期"]?.split("T").join(" ") }}</text>
</view>
</view>
<view style="margin-right: 40rpx;" @click="selectdbObj(item)">
<view class="checkbox" v-if="tjbgList.some(tjbg => tjbg.体检号 === item.体检号)">
<uni-icons type="checkmarkempty" size="16" color="#239ea3"></uni-icons>
</view>
<view class="checkbox" v-else>
</view>
</view>
</view>
<!-- <view style="border-top: 1px solid #e6e9e9" class="pt-20rpx flex flex-justify-end">
<view @click="selectdbObj(item)"
class="bg-#33ACB5 w-200rpx rounded-5rpx text-#fff text-center line-height-[2.5]">
报告对比
</view>
</view> -->
</view>
<view style="display: flex;justify-content: center; width: 100%;" v-if="bgcx_list.length>0">
<view @click="selectdbDone()"
class="bg-#33ACB5 w-200rpx rounded-5rpx text-#fff text-center line-height-[2.5]">
</view>
</view>
</view>
</view>
</template>
<style scoped>
.checkbox {
height: 30rpx;
width: 30rpx;
border: 1px solid #009FA8;
display: flex;
justify-items: center;
align-items: center;
text-align: center;
}
</style>