FlowVue/src/views/Home/Index.vue

489 lines
14 KiB
Vue
Raw Normal View History

<template>
2024-10-25 21:52:24 +08:00
<div id="indexPage">
<span class="my-span" style="margin-left: 14px">快捷入口</span>
<div class="my-quickdiv">
<ContentWrap class="my-quick" v-for="(item, index) in projects" :key="`ContentWrap-${index}`">
<router-link
:to="item.message"
class="flex items-center justify-center"
style="width: 100%; height: 100%; text-decoration: none"
>
<div class="my-linkimagediv" :style="getbackground(item.name)">
<img :src="getImageUrl(item.name)" />
</div>
<span class="my-span">{{ item.name }}</span>
<img :src="getarrowImageUrl(item.name)" />
</router-link>
</ContentWrap>
</div>
<div class="stats-container">
<!-- 左侧上下两个统计图区域 -->
<div class="left-stats">
<div class="my-statistics">
<ContentWrap class="my-quickstatistics">
<span class="my-span">累计已检查登记单概况</span>
<div class="div-inline">
<div v-if="isDataReady" style="background-color: rgb(243, 247, 254)">
<YY
:mytotalcount="totalcount"
:myy="y"
:myyx="yx"
:myzdyx="zdyx"
style="height: 300px"
/>
</div>
<div class="flex-gap"></div>
<!-- 间隙 -->
<div v-if="isDataReady" style="background-color: rgb(243, 247, 254)">
<mw :F="F" :M="M" :mytotalcount="totalcount" style="height: 300px" />
</div>
2024-08-21 18:01:18 +08:00
</div>
2024-10-25 21:52:24 +08:00
</ContentWrap>
</div>
<div class="my-statistics">
<ContentWrap class="my-quickstatistics">
<span class="my-span">已检查登记单概况分布</span>
<div v-if="iszxDataReady">
<zx
:yxArray="yxArray"
:yArray="yArray"
:zdyxArray="zdyxArray"
style="height: 300px"
/>
2024-08-21 18:01:18 +08:00
</div>
2024-10-25 21:52:24 +08:00
</ContentWrap>
</div>
2024-08-21 18:01:18 +08:00
</div>
2024-08-01 15:18:28 +08:00
2024-10-25 21:52:24 +08:00
<!-- 右侧竖直统计图区域 -->
<div class="right-stats">
<ContentWrap class="my-right-statistics" style="height: 753px">
<span class="my-span" style="margin-left: 10px">检查状态概况</span>
2024-08-21 18:01:18 +08:00
<div
style="
display: flex;
align-items: flex-start;
2024-10-25 21:52:24 +08:00
justify-content: center;
margin-top: 50px;
2024-08-21 18:01:18 +08:00
"
>
2024-10-25 21:52:24 +08:00
<img src="/static/djdtj.jpg" style="width: 55px; height: 60px" />
<div
style="
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
"
>
<span style="color: rgb(128, 128, 128)">登记单累计总数</span>
<span class="my-span" style="margin-top: 8px">{{ regtotalcount }}</span>
</div>
</div>
2024-10-25 21:52:24 +08:00
<el-divider />
2024-08-21 18:01:18 +08:00
<div
style="
display: flex;
align-items: flex-start;
2024-10-25 21:52:24 +08:00
justify-content: center;
margin-top: 50px;
2024-08-21 18:01:18 +08:00
"
>
2024-10-25 21:52:24 +08:00
<img src="/static/djwfj.jpg" style="width: 55px; height: 60px; margin-left: 40px" />
<div
style="
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
"
>
<span style="color: rgb(128, 128, 128)">登记单未分检数</span>
<span class="my-span" style="margin-top: 8px">{{ wfj }}</span>
</div>
<span style="color: rgb(128, 128, 128); margin-left: auto; margin-top: 20px"
>({{ usePercentageCalculation(regtotalcount, wfj) }}%)</span
>
</div>
2024-10-25 21:52:24 +08:00
<!-- -->
2024-08-21 18:01:18 +08:00
<div
style="
display: flex;
align-items: flex-start;
2024-10-25 21:52:24 +08:00
justify-content: center;
margin-top: 50px;
2024-08-21 18:01:18 +08:00
"
>
2024-10-25 21:52:24 +08:00
<img src="/static/djwjc.jpg" style="width: 55px; height: 60px; margin-left: 40px" />
<div
style="
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
"
>
<span style="color: rgb(128, 128, 128)">登记单未检查数</span>
<span class="my-span" style="margin-top: 8px">{{ wjc }}</span>
</div>
<span style="color: rgb(128, 128, 128); margin-left: auto; margin-top: 20px"
>({{ usePercentageCalculation(regtotalcount, wjc) }}%)</span
>
2024-08-21 18:01:18 +08:00
</div>
2024-10-25 21:52:24 +08:00
<!-- -->
2024-08-21 18:01:18 +08:00
<div
style="
display: flex;
align-items: flex-start;
2024-10-25 21:52:24 +08:00
justify-content: center;
margin-top: 50px;
2024-08-21 18:01:18 +08:00
"
>
2024-10-25 21:52:24 +08:00
<img src="/static/djyjc.jpg" style="width: 55px; height: 60px; margin-left: 40px" />
<div
style="
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
"
>
<span style="color: rgb(128, 128, 128)">登记单已检查数</span>
<span class="my-span" style="margin-top: 8px">{{ yjc }}</span>
</div>
<span style="color: rgb(128, 128, 128); margin-left: auto; margin-top: 20px"
>({{ usePercentageCalculation(regtotalcount, yjc) }}%)</span
>
2024-08-21 18:01:18 +08:00
</div>
2024-10-25 21:52:24 +08:00
<!-- -->
2024-08-21 18:01:18 +08:00
<div
style="
display: flex;
align-items: flex-start;
2024-10-25 21:52:24 +08:00
justify-content: center;
margin-top: 50px;
2024-08-21 18:01:18 +08:00
"
>
2024-10-25 21:52:24 +08:00
<img src="/static/djfq.jpg" style="width: 55px; height: 60px; margin-left: 40px" />
<div
style="
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
"
>
<span style="color: rgb(128, 128, 128)">登记单已放弃数</span>
<span class="my-span" style="margin-top: 8px">{{ yfq }}</span>
</div>
<span style="color: rgb(128, 128, 128); margin-left: auto; margin-top: 20px"
>({{ usePercentageCalculation(regtotalcount, yfq) }}%)</span
>
</div>
2024-10-25 21:52:24 +08:00
</ContentWrap>
</div>
2024-08-21 18:01:18 +08:00
</div>
</div>
</template>
2024-10-25 21:52:24 +08:00
2023-06-21 19:35:11 +08:00
<script lang="ts" setup>
2024-10-25 21:52:24 +08:00
import autofit from 'autofit.js'
import { set } from 'lodash-es'
import { EChartsOption } from 'echarts'
import { formatTime } from '@/utils'
import { useUserStore } from '@/store/modules/user'
import { useWatermark } from '@/hooks/web/useWatermark'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data'
2024-08-21 18:01:18 +08:00
import YY from './YY.vue'
import mw from './mw.vue'
import zx from './zx.vue'
import { PatientexamlistApi } from '@/api/tblist/patientexamlist'
import { ApplyformApi } from '@/api/applyregistration/applyform'
2023-06-21 19:14:34 +08:00
defineOptions({ name: 'Home' })
2024-10-25 21:52:24 +08:00
onMounted(async () => {
autofit.init(
{
dw: 1920 * 1.03,
dh: 1080 * 1.03,
el: '#indexPage',
resize: true
},
false
)
await getAllApi()
})
onBeforeUnmount(() => {
autofit.off()
})
const isDataReady = ref(false)
const iszxDataReady = ref(false)
const { t } = useI18n()
const userStore = useUserStore()
const { setWatermark } = useWatermark()
const loading = ref(true)
2023-12-07 12:19:46 +08:00
const avatar = userStore.getUser.avatar
const username = userStore.getUser.nickname
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
// 获取项目数
let projects = reactive<Project[]>([])
const getProject = async () => {
const data = [
{
2024-08-06 17:25:46 +08:00
name: '登记单列表',
2024-08-01 15:18:28 +08:00
message: '/reservation/applyform'
},
{
2024-08-21 18:01:18 +08:00
name: '预约登记',
message: '/reservation/reservationInfo'
},
{
2024-08-21 18:01:18 +08:00
name: '病例管理',
message: '/reservation/illnessCase'
},
{
2024-08-21 18:01:18 +08:00
name: '超声工作台',
message: '/diagnosis/patientexamlistultrasonic'
},
{
2024-08-21 18:01:18 +08:00
name: '影像工作台',
message: '/diagnosis/patientexamlist'
},
{
2024-08-21 18:01:18 +08:00
name: '报告打印统计',
message: '/stat/reportPrintStatistics'
}
]
2024-08-21 18:01:18 +08:00
projects = Object.assign(projects, data)
}
2024-10-25 21:52:24 +08:00
const y = ref()
const yx = ref()
const totalcount = ref()
const zdyx = ref()
const F = ref()
const M = ref()
const GetWholeDiagFlagCount = async () => {
const data = await PatientexamlistApi.WholeDiagFlagCount()
totalcount.value = data.totalcount //总数
y.value = data.y
yx.value = data.yx
zdyx.value = data.zdyx
F.value = data.f
M.value = data.m
console.log('统计' + data.f)
isDataReady.value = true
}
2024-08-21 18:01:18 +08:00
// 定义一个长度为7的响应式数组初始值都为0
2024-10-25 21:52:24 +08:00
const yxArray = ref(new Array(7).fill(0))
const yArray = ref(new Array(7).fill(0))
const zdyxArray = ref(new Array(7).fill(0))
2024-08-21 18:01:18 +08:00
2024-10-25 21:52:24 +08:00
const GetDateYYZDYXCount = async () => {
const data = await PatientexamlistApi.GetDateYYZDYXCount()
2024-08-21 18:01:18 +08:00
for (let i = 0; i < data.length; i++) {
2024-10-25 21:52:24 +08:00
yxArray.value[i] = data[i].yx
yArray.value[i] = data[i].y
zdyxArray.value[i] = data[i].zdyx
2024-08-21 18:01:18 +08:00
}
2024-10-25 21:52:24 +08:00
iszxDataReady.value = true
}
2024-10-25 21:52:24 +08:00
const regtotalcount = ref(0)
const wfj = ref(0)
const wjc = ref(0)
const yjc = ref(0)
const yfq = ref(0)
const GetReglistCount = async () => {
const data = await ApplyformApi.GetReglistCount()
regtotalcount.value = data.totalcount
wfj.value = data.wfj
wjc.value = data.wjc
yjc.value = data.yjc
yfq.value = data.yfq
}
2024-08-21 18:01:18 +08:00
// 封装计算百分比的方法
function usePercentageCalculation(total, value) {
return computed(() => {
2024-10-25 21:52:24 +08:00
const totalNum = parseInt(total) // 转换总数为数字
const valueNum = parseInt(value) // 转换当前项的值为数字
2024-08-21 18:01:18 +08:00
// 判断total是否大于0如果不是则返回0
if (totalNum <= 0) {
2024-10-25 21:52:24 +08:00
return 0
}
2024-08-21 18:01:18 +08:00
// 如果total大于0计算百分比
2024-10-25 21:52:24 +08:00
const percentage = (valueNum / totalNum) * 100
2024-08-21 18:01:18 +08:00
// 返回计算出的百分比,保留两位小数
2024-10-25 21:52:24 +08:00
return parseFloat(percentage.toFixed(2))
})
}
2024-08-21 18:01:18 +08:00
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
const getAllApi = async () => {
2024-10-25 21:52:24 +08:00
await Promise.all([
getProject(),
GetWholeDiagFlagCount(),
GetDateYYZDYXCount(),
GetReglistCount()
])
loading.value = false
}
2024-08-21 18:01:18 +08:00
// 在组件挂载完成后调用getAllApi
2024-10-25 21:52:24 +08:00
// onMounted(getAllApi)
2024-08-21 18:01:18 +08:00
// 动态切换图片
function getImageUrl(name) {
const imageMap = {
登记单列表: '/static/登记单列表.jpg',
预约登记: '/static/预约登记.jpg',
病例管理: '/static/病例管理.jpg',
超声工作台: '/static/超声.jpg',
影像工作台: '/static/影像.jpg',
报告打印统计: '/static/报告打印.jpg'
}
return imageMap[name] || '/static/登记单列表.jpg' // 默认图片
}
// 动态获取背景颜色
function getbackground(name) {
const backgroundMap = {
登记单列表: 'background: rgb(220, 228, 245);',
预约登记: 'background: rgb(250, 239, 232);',
病例管理: 'background: rgb(235, 245, 244);',
超声工作台: 'background: rgb(247, 240, 218);',
影像工作台: 'background: rgb(250, 231, 235);',
报告打印统计: 'background: rgb(227, 228, 252);'
}
return backgroundMap[name] || 'background: rgb(220, 228, 245);'
}
// 动态切换箭头图片
function getarrowImageUrl(name) {
const imageMap = {
登记单列表: '/static/djjt.jpg',
预约登记: '/static/yydj.jpg',
病例管理: '/static/blgl.jpg',
超声工作台: '/static/cs.jpg',
影像工作台: '/static/yx.jpg',
报告打印统计: '/static/bg.jpg'
}
return imageMap[name] || '/static/djjt.jpg' // 默认图片
}
</script>
2024-08-21 18:01:18 +08:00
<style scoped>
2024-08-01 15:18:28 +08:00
.menu-button {
/* 按钮样式 */
padding: 10px 2px;
2024-08-21 18:01:18 +08:00
background: linear-gradient(141.88deg, rgb(0, 102, 235) 0%, rgb(3, 129, 255) 100%),
rgb(36, 93, 209);
2024-08-01 15:18:28 +08:00
color: white;
text-decoration: none;
border-radius: 5px;
cursor: pointer;
text-align: center;
2024-08-21 18:01:18 +08:00
}
/* 快捷入口样式 */
.my-quick {
margin-top: 20px;
width: 250px;
height: 80px;
opacity: 1;
border-radius: 12px;
background: rgba(255, 255, 255, 1);
box-shadow: 1px 5px 13px rgba(223, 226, 232, 1);
}
/* 快捷入口span样式 */
.my-span {
width: 123px;
height: 30px;
opacity: 1;
/** 文本1 */
font-size: 20px;
font-weight: 600;
letter-spacing: 0px;
line-height: 28px;
color: rgba(51, 51, 51, 1);
text-align: left;
vertical-align: top;
margin-right: 10px;
}
/* 快捷入口DIV 样式 */
.my-quickdiv {
display: flex;
gap: 30px;
}
/* 连接旁边的图标样式 */
.my-linkimagediv {
width: 40px;
height: 40px;
opacity: 1;
border-radius: 20px;
display: flex; /* 使用 Flexbox */
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
margin-right: 10px;
}
.my-linkimagediv img {
width: auto; /* 根据需要调整图片宽度 */
height: auto; /* 根据需要调整图片高度 */
max-width: 100%; /* 图片最大宽度不超过容器宽度 */
max-height: 100%; /* 图片最大高度不超过容器高度 */
}
2024-08-01 15:18:28 +08:00
2024-08-21 18:01:18 +08:00
/* ------------统计部分的样式---------- */
.stats-container {
display: flex;
/* 默认是 row 方向,子元素水平排列 */
}
2024-08-01 15:18:28 +08:00
2024-08-21 18:01:18 +08:00
.left-stats {
/* flex: 1; */ /* 左侧容器占据一半的空间 */
/* display: flex; */
flex-direction: column; /* 子元素垂直排列 */
justify-content: space-between; /* 子元素之间留有间隔 */
margin-right: 1%; /* 给右侧留出间隔 */
}
.left-stats .my-statistics {
/* 可以根据需要设置高度 */
width: 1100px;
}
/* 左侧的 ContentWrap 样式*/
.my-quickstatistics {
opacity: 1;
border-radius: 12px;
background: rgb(255, 255, 255);
box-shadow: 1px 5px 13px rgb(223, 226, 232);
}
/* 右侧div */
.right-stats {
/* flex: 1; */ /* 右侧容器占据另一半的空间 */
/* 可以根据需要设置宽度或高度 */
width: 543px;
}
/* 右侧侧的 ContentWrap 样式*/
.my-right-statistics {
opacity: 1;
border-radius: 12px;
background: rgb(255, 255, 255);
box-shadow: 1px 5px 13px rgb(223, 226, 232);
}
.div-inline {
display: flex;
}
/* 间隙DIV */
.flex-gap {
flex-grow: 1; /* 根据需要调整 */
2024-08-01 15:18:28 +08:00
}
</style>