<template>
|
<div class="statistics-cards" style="margin-bottom: 20px">
|
<el-row :gutter="16">
|
<el-col
|
v-for="(item, index) in mergedCardList"
|
:key="index"
|
:xs="12"
|
:sm="8"
|
:md="colSpan"
|
:lg="colSpan"
|
>
|
<el-tooltip
|
:content="getTooltipContent(item.name)"
|
placement="top"
|
effect="light"
|
popper-class="statistics-tooltip"
|
>
|
<el-card
|
shadow="hover"
|
:body-style="item.router ? 'cursor: pointer' : 'cursor: default'"
|
:class="getCardClass(item.name)"
|
>
|
<div
|
class="card-content"
|
@click="handleCardClick(item)"
|
>
|
<div class="card-label">
|
<span class="label-text">{{ item.name }}</span>
|
</div>
|
<div class="card-value">
|
{{ item.value !== undefined && item.value !== null ? item.value : 0 }}
|
</div>
|
</div>
|
</el-card>
|
</el-tooltip>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "StatisticsCards",
|
props: {
|
cardlist: {
|
type: Array,
|
default: () => []
|
},
|
colSpan: {
|
type: Number,
|
default: 4
|
},
|
showExtra: {
|
type: Boolean,
|
default: true
|
},
|
ycvalue: {
|
type: Number,
|
default: 0
|
},
|
jgvalue: {
|
type: Number,
|
default: 0
|
},
|
showWarningCondition: {
|
type: Boolean,
|
default: false
|
}
|
},
|
computed: {
|
mergedCardList() {
|
let list = [...this.cardlist];
|
|
if (this.showExtra) {
|
list.push({
|
name: "异常",
|
value: this.ycvalue
|
});
|
}
|
|
if (this.showWarningCondition) {
|
list.push({
|
name: "警告",
|
value: this.jgvalue
|
});
|
}
|
|
return list;
|
}
|
},
|
methods: {
|
getCardClass(name) {
|
const classMap = {
|
"患者服务总量": "total-card",
|
"无需随访": "no-follow-card",
|
"需随访": "need-follow-card",
|
"待随访": "pending-card",
|
"已完成": "completed-card",
|
"异常": "error-card",
|
"警告": "warning-card"
|
};
|
return classMap[name] || "default-card";
|
},
|
|
getTooltipContent(name) {
|
const tooltips = {
|
"患者服务总量": "患者服务总量 = 无需随访 + 需随访",
|
"无需随访": "无需随访:不需要进行随访的患者数量",
|
"需随访": "需随访 = 待随访 + 已完成",
|
"待随访": "待随访:等待进行随访的患者数量",
|
"已完成": "已完成:已完成随访的患者数量",
|
"异常": "异常数据统计",
|
"警告": "警告数据统计"
|
};
|
return tooltips[name] || "";
|
},
|
|
handleCardClick(item) {
|
if (item.router) {
|
this.$router.push(item.router);
|
}
|
this.$emit("card-click", item);
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.statistics-cards {
|
padding: 4px;
|
}
|
|
.card-content {
|
padding: 12px 8px;
|
transition: all 0.3s ease;
|
cursor: default;
|
}
|
|
.card-label {
|
margin-bottom: 10px;
|
font-size: 20px;
|
font-weight: 600;
|
color: #666;
|
}
|
|
.card-value {
|
text-align: center;
|
font-size: 28px;
|
font-weight: 700;
|
letter-spacing: 1px;
|
transition: all 0.3s ease;
|
}
|
|
/* 悬浮效果 - 整体上移+阴影加深 */
|
.el-card {
|
border-radius: 10px;
|
transition: all 0.3s ease;
|
border: none;
|
}
|
|
.el-card:hover {
|
transform: translateY(-3px);
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
|
}
|
|
/* 响应式 */
|
@media (max-width: 768px) {
|
.card-value {
|
font-size: 22px;
|
}
|
.card-content {
|
padding: 12px 8px;
|
}
|
}
|
</style>
|
|
<style>
|
/* ===== 卡片背景色(全局样式) ===== */
|
|
/* 患者服务总量 - 浅紫色 */
|
.total-card .el-card__body {
|
background: #f0edff;
|
border-radius: 10px;
|
}
|
.total-card .card-value {
|
color: #7c5cfc;
|
}
|
|
/* 无需随访 - 浅粉色 */
|
.no-follow-card .el-card__body {
|
background: #fde8ef;
|
border-radius: 10px;
|
}
|
.no-follow-card .card-value {
|
color: #f06292;
|
}
|
|
/* 需随访 - 浅蓝色 */
|
.need-follow-card .el-card__body {
|
background: #e3f2fd;
|
border-radius: 10px;
|
}
|
.need-follow-card .card-value {
|
color: #42a5f5;
|
}
|
|
/* 待随访 - 浅橙色 */
|
.pending-card .el-card__body {
|
background: #fff3e0;
|
border-radius: 10px;
|
}
|
.pending-card .card-value {
|
color: #ff9800;
|
}
|
|
/* 已完成 - 浅绿色 */
|
.completed-card .el-card__body {
|
background: #e8f5e9;
|
border-radius: 10px;
|
}
|
.completed-card .card-value {
|
color: #66bb6a;
|
}
|
|
/* 异常 - 浅红色 */
|
.error-card .el-card__body {
|
background: #fce4ec;
|
border-radius: 10px;
|
}
|
.error-card .card-value {
|
color: #ef5350;
|
}
|
|
/* 警告 - 浅黄色 */
|
.warning-card .el-card__body {
|
background: #fff8e1;
|
border-radius: 10px;
|
}
|
.warning-card .card-value {
|
color: #ffa726;
|
}
|
|
/* 默认卡片 */
|
.default-card .el-card__body {
|
background: #f5f5f5;
|
border-radius: 10px;
|
}
|
.default-card .card-value {
|
color: #757575;
|
}
|
|
/* ===== 清新白底蓝字 Tooltip ===== */
|
.statistics-tooltip {
|
background: #ffffff !important;
|
color: #1976d2 !important;
|
border: 1px solid #bbdefb !important;
|
border-radius: 8px !important;
|
padding: 10px 14px !important;
|
font-size: 13px !important;
|
line-height: 1.6 !important;
|
box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15) !important;
|
}
|
|
.statistics-tooltip .popper__arrow {
|
border-bottom-color: #bbdefb !important;
|
}
|
|
.statistics-tooltip .popper__arrow::after {
|
border-bottom-color: #ffffff !important;
|
}
|
</style>
|