1.5-24:正常血压

总时间限制: 

1000ms

内存限制: 

65536kB

描述

监护室每小时测量一次病人的血压,若收缩压在90 - 140之间并且舒张压在60 - 90之间(包含端点值)则称之为正常,现给出某病人若干次测量的血压值,计算病人保持正常血压的最长小时数。

输入

第一行为一个正整数n,n < 100
其后有n行,每行2个正整数,分别为一次测量的收缩压和舒张压,中间以一个空格分隔。

输出

输出仅一行,血压连续正常的最长小时数。

样例输入

4
100 80
90 50
120 60
140 90

样例输出

2

来源

习题(5-6) 医学部 2010 期末试题 周恺

代码

#include<stdio.h>
int main()
{
	int i,n,ss,sz,h=0,max=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&ss,&sz);
		if(ss>=90&&ss<=140&&sz>=60&&sz<=90)
		{
			h++;
			if(h>max)max=h;
		}
		else h=0;
    }
    printf("%d",max);
    return 0;
}
<style> :root { --sidebar-hover: #adcfe3; --sidebar-active: #5071d9; --content-bg: #f8f9fa; --header-bg: #3498db; --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); --primary-color: #3498db; --secondary-color: #8e44ad; --success-color: #2ecc71; --warning-color: #f39c12; --danger-color: #e74c3c; } body { font-family: "Arial","Microsoft YaHei","SimHei",sans-serif; background: #eff0f4; color: #333; display: flex; max-height: 100vh; overflow-x: hidden; } .sidebar { width: 250px; background: #ffffff; color: white; position: fixed; height: 910px; z-index: 1000; overflow-y: auto; transition: all 0.3s; border-radius: 20px; margin-top:20px; margin-bottom:20px; margin-left:20px } .sidebar-header { padding: 20px; background: rgba(0, 0, 0, 0.2); text-align: center; } .sidebar-header h3 { font-size: 1.5rem; margin-bottom: 0; } .sidebar-menu { padding: 25px 0; } .sidebar-menu ul { list-style: none; padding: 0; margin: 0; } .sidebar-menu li { margin-bottom: 5px; padding: 5px 5px; border-radius:50px; } ul li a { text-decoration: none; } .sidebar-menu a { display: flex; align-items: center; padding: 12px 20px; color: #333; text-decoration: none; transition: all 0.3s; } .sidebar-menu a:hover { background: var(--sidebar-hover); border-radius:50px; color: black; } .sidebar-menu a.active { background: var(--sidebar-active); border-radius:50px; color: white; } .sidebar-menu i { margin-right: 15px; font-size: 1.2rem; width: 25px; text-align: center; } .main-content { flex: 1; margin-left: 300px; margin-right: 50px; max-height: 100vh; display: flex; flex-direction: column; } .header { border-radius: 20px; color: white; padding: 15px 0; margin: 20px 20px 0 20px; box-shadow: var(--card-shadow); display:flex; justify-content:center; align-items:center; } .content-area { padding: 30px; flex: 1; } .card { background: #ffffff; border-radius: 12px; box-shadow: var(--card-shadow); margin-bottom: 25px; border: none; transition: transform 0.3s; overflow: hidden; } .card-header { background:#ffffff; border-radius: 12px 12px 0 0 !important; padding: 15px 20px; font-weight: bold; display: flex; align-items: center; } .history-card { display: flex; flex-direction: column; height: 410px; } .table-container { height: 100vh; overflow-y: auto; } .card-body { flex: 1; display: flex; flex-direction: column; padding: 0; height:375px; } .chart-container { position: relative; padding: 20px; } .data-table { table-layout: fixed; width: 100%; border-collapse: collapse; } .data-table th:nth-child(6), .data-table td:nth-child(6) { width: 28%; } .data-table th { padding: 12px 15px; text-align: center; background:#e2e6ed; } .data-table td { padding: 10px 15px; border-bottom: 1px solid #eee; text-align: center; } .data-table tr:hover { background-color: #f9f9f9; } .select-container { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; } .select-box { flex: 1; min-width: 200px; } #risk-table { width:10%; table-layout:fixed; } #th, td { width:calc(100% / 6); } .level-row { display: flex; justify-content:space-between; align-items: center; padding: 15px 0; } .level-row > div { flex:1; text-align:center; margin:0 10px; } .level-row:last-child { border-bottom: none; } .level-icon { flex: 0 0 60px; display: flex; justify-content: center; } .level-count { flex: 0 0 100px; text-align: center; font-size: 20px; font-weight: bold; color: #2c3e50; } .level-desc { flex: 1; text-align: left; padding-left: 15px; } .circle-btn { display: inline-flex; align-items: center; justify-content: center; width: 45px; height: 45px; border-radius: 50%; color: white; text-decoration: none; font-weight: bold; border: none; transition: all 0.3s; } .circle-btn:hover { transform: scale(1.1); box-shadow: 0 4px 8px rgba(0,0,0,0.2); } .circle-btn.risk { background-color: #e74c3c; } .circle-btn.subhealth { background-color: #f39c12; } .circle-btn.health { background-color: #27ae60; } .circle-btn.active { transform: scale(1.1); box-shadow: 0 0 0 3px rgba(0,0,0,0.2), 0 0 0 6px rgba(255,255,255,0.5); } .circle-btn a { color: white; text-decoration: none; } .table-title { padding: 15px 20px; font-weight: bold; background-color: #f8f9fa; border-bottom: 1px solid #dee2e6; } </style> </head> <body> <div class="sidebar"> <div class="sidebar-menu"> <ul> <li> <a href="/"> <i class="fas fa-heartbeat me-2"></i> <span>首页</span> </a> </li> <li id="register-link"> <a href="/register"> <i class="fas fa-sign-in me-2"></i> <span>登陆注册管理</span> </a> </li> <li> <a href="/general"> <i class="fas fa-folder"></i> <span>总体数据概况</span> </a> </li> <li> <a href="/clf" class="active"> <i class="fas fa-chart-pie"></i> <span>人员分级管理</span> </a> </li> <li> <a href="/hpa"> <i class="fas fa-bell"></i> <span>健康促进活动</span> </a> </li> <li id="blood-link"> <a href="/blood"> <i class="fas fa-chart-bar"></i> <span>血压数据统计</span> </a> </li> <li id="bmi-link"> <a href="/bmi"> <i class="fas fa-chart-bar"></i> <span>BMI数据统计</span> </a> </li> <li id="physical-link"> <a href="/physical"> <i class="fas fa-check-circle"></i> <span>体检信息统计</span> </a> </li> <li> <a href="/perfile"> <i class="fas fa-file-alt"></i> <span>个人健康档案</span> </a> </li> </ul> </div> </div> <div class="main-content"> <div class="row"> <div class="col-9"> <div class="header" style="background-color:#5071d9;"> <h1 class="mb-0">人员分级管理</h1> </div> </div> <div class="col-3"> <div id="user-info" class="header" style="background-color:#ffffff;"> </div> </div> </div> <div class="content-area"> <div class="row"> <div class="col-6"> <div class="select-container"> <div class="select-box"> <select id="year-month-select" class="form-select"> <option value="">加载中...</option> </select> </div> </div> <div class="level-row"> <div class="level-icon"> <button id="risk-btn" class="circle-btn risk active"> <i class="fas fa-exclamation-triangle"></i> </button> </div> <div class="level-count" id="num-risk">0</div> <div class="level-desc"> <h6 style="font-weight:bold;">风险</h6> <p class="small text-muted mb-0">二级/三级高血压</p> </div> </div> <div class="level-row"> <div class="level-icon"> <button id="unhealth-btn" class="circle-btn subhealth"> <i class="fas fa-tag"></i> </button> </div> <div class="level-count" id="num-unh">0</div> <div class="level-desc"> <h6 style="font-weight:bold;">亚健康</h6> <p class="small text-muted mb-0">血压BMI未在正常区间/体检指标存在异常</p> </div> </div> <div class="level-row"> <div class="level-icon"> <button id="health-btn" class="circle-btn health"> <i class="fas fa-heart"></i> </button> </div> <div class="level-count" id="num-health">0</div> <div class="level-desc"> <h6 style="font-weight:bold;">健康</h6> <p class="small text-muted mb-0">血压BMI正常、体检无异常</p> </div> </div> </div> <div class="col-6"> <div class="card"> <div class="chart-container"> <canvas id="deptChart" height="320"></canvas> </div> </div> </div> </div> <div id="table-wrapper"> <div class="card history-card"> <div class="card-header"> <span id="table-title">风险人员明细</span> <div class="ms-auto" style="width: 200px;"> <select id="dept-filter-select" class="form-select form-select-sm"> <option value="all">全部部门</option> </select> </div> <button id="export-risk-btn" class="btn"> <i class="fas fa-download me-2"></i>导出名单 </button> </div> <div class="card-body"> <div class="table-container" style="height:340px;"> <table class="data-table"> <tbody id="risk-table"> <tr><td colspan="7" class="text-center">加载中...</td></tr> </tbody> </table> </div> </div> </div> </div> </div> </div>改变窗口大小时内部组件会变化大小,是通过什么设定的
最新发布
10-15
在该vue项目下怎样将底部导航栏<footer>组件固定在底部,在不同设备打开时也不会位移,请提供修改后的完善代码:<template> <!-- 唯一根元素开始 --> <div class="container"> <!-- 顶部导航栏 --> <NavBar /> <!-- 中心大图展示区域 --> <section class="hero-section"> <img src="@/assets/recreation/fitness.png" alt="健身房内部场景" class="hero-image" > </section> <!-- 文字说明区域 --> <main class="content-section"> <section class="description"> <h2>活力健身房:城市上空的运动乌托邦</h2> <p>全景落地窗俯瞰草原与城市天际线,配备智能体测系统与专业训练器械,从有氧区到自由重量区私教课程结合蒙式体能训练法,让汗水挥洒成诗。恒温泳池与瑜伽室演绎健身快乐间奏曲,晨起泳姿划破朝阳,暮色中禅定瑜伽随音乐舒展,打造24小时不间断的健康生活场。</p> </section> <section class="rules"> <h3>蒙发国际温泉度假酒店多功能健身房设施使用守则</h3> <ul> <li>1、使用资格与时间</li> <p>-住店客人全天24小时刷卡进入,健身设施仅向住店客人开放。</p> <li>2、使用前准备</li> <p>-使用者需先熟悉各项设施使用说明,熟悉健身器材操作,有疑问可寻求工作人员帮助。</p> <li>3、场地使用规则</li> <p>-遵循先到先得原则,不设预订。</p> <p>-多功能活动室任何时间内最多允许十二名使用者同时在场。</p> <p>-室内不准饮食,需保持整洁。</p> <p>-须穿着合适运动服装及运动鞋,违反者校方有权拒绝其入场。</p> <li>4、健康与安全提示</li> <p>-患高血压、哮喘、心脏病或身体不适者,建议暂停使用。</p> <p>-运动前做10-15分钟热身,运动后做10分钟放松活动。</p> <p>-感到不适或痛楚,立刻停止运动并通知工作人员。</p> <p>-远离摆动中的健身设施或器材。</p> <li>5、器材使用规范</li> <p>-不能改动健身设施或器材原有位置。</p> <p>-有他人等待时,使用器材限时30分钟。</p> <p>-运动后将健身器材放回原处,用消毒剂喷雾擦拭。</p> <p>-操作前检查器材是否正常安全,发现故障/损坏,停止使用并通知酒店,勿自维修。</p> <p>-损坏或遗失器材需赔偿。</p> <li>6、其他注意事项</li> <p>-未经同意,严禁在场内拍照、录影或录音。</p> <p>-酒店有权预留场地用于维修、清洁、训练班及活动安排。</p> <p>-酒店保留修改规则和规定的权利,恕不另通知。</p> </ul> </section> </main> <!-- 底部导航栏 --> <Footer /> </div> <!-- 唯一根元素结束 --> </template> <script > import NavBar from '@/components/NavBar.vue'; export default { name: "ftness", data() { return { }; }, }; </script> <style > /* 健身区样式 */ .hero-section { position: relative; height: 60rem ; margin-top: 0rem; /* 补偿固定导航栏高度 */ overflow: hidden; } .hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center; } .hero-title { position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); color: white; font-size: 3rem; text-shadow: 2px 2px 10px rgba(0,0,0,0.5); margin: 0; } /* 内容区样式 */ .content-section { max-width: 150rem; margin: 2rem auto; padding: 0 5%; line-height:2.4rem; } .description { margin-bottom: 3rem; padding: 2rem; background: #f8f9fa; border-radius: 1rem; font-size: 2.4rem; line-height: 4rem; margin: 6rem auto; font-family: "宋体"; } .rules { margin-top: 3rem; height: 100rem; padding: 2rem; background: white; border-radius: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,0.05); font-size: 2rem; line-height: 3.8rem; font-family: "宋体"; text-align: left; } .rules h3 { color: #007bff; border-bottom: 2px solid #007bff; padding-bottom: 0.5rem; margin-bottom: 1rem; font-size: 2.4rem; text-align: center; } @media (max-width: 768px) { .navbar { flex-direction: column; padding: 1rem 5% 0.5rem; } .nav-left, .nav-right { width: 100%; flex-wrap: wrap; justify-content: center; margin-bottom: 0.5rem; } .nav-item { margin: 0.5rem; } .hero-title { font-size: 2rem; } } </style>
06-18
<template> <el-card class="timeline-card"> <div class="card-header"> <h3>患者诊疗事件时间轴</h3> <div class="header-actions"> <el-select v-model="timeScale" size="small" placeholder="时间尺度" style="width: 120px" @change="handleTimeScaleChange" > <el-option label="天" value="day" /> <el-option label="周" value="week" /> <el-option label="月" value="month" /> <el-option label="年" value="year" /> </el-select> <el-date-picker v-model="dateRange" type="daterange" size="small" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 240px; margin-left: 8px" @change="handleDateRangeChange" /> <el-select v-model="eventType" size="small" placeholder="事件类型" style="width: 140px; margin-left: 8px" @change="handleFilterChange" > <el-option label="全部事件" value="all" /> <el-option label="入院/出院" value="admission" /> <el-option label="用药" value="medication" /> <el-option label="检查/检验" value="examination" /> <el-option label="手术/麻醉" value="surgery" /> <el-option label="查房记录" value="rounds" /> </el-select> <div class="zoom-controls"> <el-button size="small" :icon="ZoomOut" @click="zoomOut" :disabled="zoomLevel <= 0.5" /> <el-slider v-model="zoomLevel" :min="0.5" :max="2" :step="0.1" style="width: 100px; margin: 0 8px" @change="handleZoomChange" /> <el-button size="small" :icon="ZoomIn" @click="zoomIn" :disabled="zoomLevel >= 2" /> </div> </div> </div> <div class="timeline-container"> <!-- 时间轴主体 --> <div class="timeline-main"> <!-- 时间标尺 --> <div class="timeline-ruler" ref="rulerEl"> <div v-for="mark in timeMarks" :key="mark.position" class="time-mark" :style="{ left: `${mark.position}%` }" > <div class="mark-line"></div> <div class="mark-label">{{ mark.label }}</div> </div> <div class="time-window" :style="{ left: `${windowStart}%`, width: `${windowWidth}%` }" @mousedown="startDrag" ></div> </div> <!-- 时间轴内容 --> <div class="timeline-content" ref="timelineEl" :style="{ transform: `scaleX(${zoomLevel})`, transformOrigin: 'left center' }" > <div v-for="(event, index) in filteredEvents" :key="event.id" class="timeline-event" :style="{ left: `${calculateEventPosition(event.date)}%`, zIndex: expandedEvent === index ? 100 : 1 }" :class="[ `event-${event.type}`, { expanded: expandedEvent === index } ]" @click="toggleEventExpand(index)" > <div class="event-marker"> <el-icon :size="16"> <component :is="eventIcons[event.type]" /> </el-icon> </div> <div class="event-card"> <div class="event-header"> <!-- <span class="event-type">{{ eventTypeLabels[event.type] }}</span> --> <span class="event-time">{{ formatTime(event.date) }}</span> </div> <div class="event-title">{{ event.title }}</div> <div v-if="expandedEvent === index" class="event-details"> <div v-for="(value, key) in event.details" :key="key" class="detail-item" > <span class="detail-label">{{ key }}:</span> <span class="detail-value">{{ value }}</span> </div> <el-button size="small" type="primary" @click.stop="viewRelatedData(event)" > 查看关联数据 </el-button> </div> </div> </div> </div> </div> <!-- 指标进展 --> <div class="indicators-progress" v-if="showIndicators"> <h4 class="section-title">重点指标进展</h4> <div class="indicator-tabs"> <el-tabs v-model="activeIndicator" type="card"> <el-tab-pane label="化疗用药" name="chemotherapy"> <div class="indicator-content"> <el-timeline> <el-timeline-item v-for="(item, index) in chemotherapyData" :key="index" :timestamp="item.date" placement="top" > <el-card> <h4>{{ item.drug }}</h4> <p>剂量: {{ item.dose }}</p> <p>周期: 第{{ item.cycle }}周期</p> <p>反应: {{ item.response }}</p> </el-card> </el-timeline-item> </el-timeline> </div> </el-tab-pane> <el-tab-pane label="靶向用药" name="targeted"> <div class="indicator-content"> <el-timeline> <el-timeline-item v-for="(item, index) in targetedTherapyData" :key="index" :timestamp="item.date" placement="top" > <el-card> <h4>{{ item.drug }}</h4> <p>剂量: {{ item.dose }}</p> <p>靶点: {{ item.target }}</p> <p>反应: {{ item.response }}</p> </el-card> </el-timeline-item> </el-timeline> </div> </el-tab-pane> </el-tabs> </div> </div> </div> <!-- 事件详情对话框 --> <el-dialog v-model="detailVisible" :title="currentEvent.title" width="60%"> <div class="event-detail-content"> <div class="detail-section"> <h4>基本信息</h4> <div class="detail-grid"> <div class="detail-item"> <span class="detail-label">事件类型:</span> <span class="detail-value">{{ eventTypeLabels[currentEvent.type] }}</span> </div> <div class="detail-item"> <span class="detail-label">发生时间:</span> <span class="detail-value">{{ formatTime(currentEvent.date) }}</span> </div> <div class="detail-item"> <span class="detail-label">执医生:</span> <span class="detail-value">{{ currentEvent.details["执医生"] || "无记录" }}</span> </div> </div> </div> <div class="detail-section"> <h4>详细内容</h4> <div class="detail-full"> <pre>{{ JSON.stringify(currentEvent.details, null, 2) }}</pre> </div> </div> <div class="detail-section" v-if="currentEvent.relatedData"> <h4>关联数据</h4> <el-table :data="currentEvent.relatedData" border style="width: 100%"> <el-table-column prop="type" label="数据类型" width="120" /> <el-table-column prop="content" label="内容" /> <el-table-column prop="time" label="时间" width="150" /> </el-table> </div> </div> </el-dialog> </el-card> </template> <script setup> import { ref, computed, onMounted } from "vue"; import { format } from "date-fns"; import { House, FirstAidKit, DocumentChecked, Operation, Notebook, ZoomIn, ZoomOut } from "@element-plus/icons-vue"; // 时间轴配置 const timeScale = ref("month"); const dateRange = ref([new Date(2023, 0, 1), new Date(2023, 5, 30)]); const eventType = ref("all"); const expandedEvent = ref(null); const detailVisible = ref(false); const currentEvent = ref({}); const activeIndicator = ref("chemotherapy"); const showIndicators = ref(true); const zoomLevel = ref(1); // 事件类型图标 const eventIcons = { admission: House, medication: FirstAidKit, examination: DocumentChecked, surgery: Operation, rounds: Notebook }; // DOM 引用 const rulerEl = ref(null); const timelineEl = ref(null); // 模拟数据 - 实际项目中从API获取 const events = ref([ { id: 1, type: "admission", title: "入院治疗", date: "2023-01-05", details: { 科室: "心血管内科", 主治医生: "张医生", 入院诊断: "高血压危象", 病情描述: "患者主诉头痛、头晕3天,血压180/110mmHg" } }, { id: 2, type: "examination", title: "血常规检查", date: "2023-01-06", details: { 检查项目: "血常规", 白细胞计数: "11.2 ×10⁹/L (偏高)", 血红蛋白: "125 g/L", 血小板: "210 ×10⁹/L" } }, { id: 3, type: "medication", title: "降压治疗", date: "2023-01-06", details: { 药品名称: "硝苯地平", 剂量: "10mg", 频次: "每日2次", 途径: "口服" } }, { id: 4, type: "rounds", title: "主治医生查房", date: "2023-01-07", details: { 查房医生: "张医生", 血压: "150/95mmHg", 心率: "82次/分", 医嘱: "继续当前治疗,监测血压" } }, { id: 5, type: "surgery", title: "心脏导管手术", date: "2023-01-10", details: { 手术名称: "冠状动脉造影", 主刀医生: "李医生", 麻醉方式: "局部麻醉", 手术结果: "发现左前降支狭窄70%" } }, { id: 6, type: "medication", title: "靶向药物治疗", date: "2023-01-12", details: { 药品名称: "阿托伐他汀", 剂量: "20mg", 频次: "每晚1次", 途径: "口服" } }, { id: 7, type: "admission", title: "出院", date: "2023-01-15", details: { 出院诊断: "1.血压危象 2.冠心病", 出院医嘱: "继续服药,定期复查", 复诊时间: "2023-02-15" } } ]); const chemotherapyData = ref([ { date: "2023-01-08", drug: "环磷酰胺", dose: "600mg/m&sup2;", cycle: 1, response: "良好" }, { date: "2023-01-22", drug: "环磷酰胺", dose: "600mg/m&sup2;", cycle: 2, response: "轻度恶心" }, { date: "2023-02-05", drug: "环磷酰胺", dose: "600mg/m&sup2;", cycle: 3, response: "白细胞降低" } ]); const targetedTherapyData = ref([ { date: "2023-01-12", drug: "阿托伐他汀", dose: "20mg", target: "LDL-C", response: "良好" }, { date: "2023-02-12", drug: "阿托伐他汀", dose: "20mg", target: "LDL-C", response: "LDL降至2.1mmol/L" } ]); // 计算属性 const filteredEvents = computed(() => { if (eventType.value === "all") return events.value; return events.value.filter(event => event.type === eventType.value); }); const timeMarks = computed(() => { const start = new Date(dateRange.value[0]); const end = new Date(dateRange.value[1]); const diff = end - start; const marks = []; // 根据时间尺度生成标记 if (timeScale.value === "day") { for (let i = 0; i <= 10; i++) { const date = new Date(start.getTime() + (diff * i) / 10); marks.push({ position: i * 10, label: format(date, "MM-dd") }); } } else if (timeScale.value === "week") { for (let i = 0; i <= 4; i++) { const date = new Date(start.getTime() + (diff * i) / 4); marks.push({ position: i * 25, label: `第${i + 1}周` }); } } else if (timeScale.value === "month") { const monthDiff = end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; for (let i = 0; i <= monthDiff; i++) { const date = new Date(start); date.setMonth(start.getMonth() + i); marks.push({ position: (i / monthDiff) * 100, label: format(date, "yyyy-MM") }); } } else { // year const yearDiff = end.getFullYear() - start.getFullYear(); for (let i = 0; i <= yearDiff; i++) { const date = new Date(start); date.setFullYear(start.getFullYear() + i); marks.push({ position: (i / yearDiff) * 100, label: format(date, "yyyy年") }); } } return marks; }); // 时间窗口控制 const windowStart = ref(0); const windowWidth = ref(100); let isDragging = false; let startX = 0; let startLeft = 0; // 方法 function formatTime(dateStr) { return format(new Date(dateStr), "yyyy-MM-dd HH:mm"); } function calculateEventPosition(dateStr) { const date = new Date(dateStr); const start = new Date(dateRange.value[0]); const end = new Date(dateRange.value[1]); if (date < start) return 0; if (date > end) return 100; const total = end - start; const position = ((date - start) / total) * 100; return Math.min(100, Math.max(0, position)); } function toggleEventExpand(index) { expandedEvent.value = expandedEvent.value === index ? null : index; } function showEventDetail(event) { currentEvent.value = event; detailVisible.value = true; } function viewRelatedData(event) { console.log("View related data for:", event); // 实际项目中这里获取关联数据 } function handleTimeScaleChange() { // 实际项目中这里可能需要重新获取数据 } function handleDateRangeChange() { // 实际项目中这里可能需要重新获取数据 } function handleFilterChange() { // 实际项目中这里可能需要重新获取数据 } function startDrag(e) { isDragging = true; startX = e.clientX; startLeft = windowStart.value; document.addEventListener("mousemove", handleDrag); document.addEventListener("mouseup", stopDrag); } function handleDrag(e) { if (!isDragging) return; const rulerWidth = rulerEl.value.offsetWidth; const dx = ((e.clientX - startX) / rulerWidth) * 100; windowStart.value = Math.max( 0, Math.min(100 - windowWidth.value, startLeft + dx) ); } function stopDrag() { isDragging = false; document.removeEventListener("mousemove", handleDrag); document.removeEventListener("mouseup", stopDrag); } // 缩放功能 function zoomIn() { zoomLevel.value = Math.min(2, zoomLevel.value + 0.1); updateTimeScaleByZoom(); } function zoomOut() { zoomLevel.value = Math.max(0.5, zoomLevel.value - 0.1); updateTimeScaleByZoom(); } function handleZoomChange(value) { zoomLevel.value = value; updateTimeScaleByZoom(); } function updateTimeScaleByZoom() { // 根据缩放级别自动调整时间尺度 if (zoomLevel.value > 1.5) { timeScale.value = "day"; } else if (zoomLevel.value > 1) { timeScale.value = "week"; } else { timeScale.value = "month"; } } // 生命周期 onMounted(() => { // 初始化时间窗口 const now = new Date(); const start = new Date(dateRange.value[0]); const end = new Date(dateRange.value[1]); const total = end - start; const current = now - start; if (now > start && now < end) { windowStart.value = (current / total) * 100 - 10; windowWidth.value = 20; } }); </script> <style scoped> .timeline-card { border-radius: 8px; margin-bottom: 10px; } .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .card-header h3 { margin: 0; font-size: 16px; color: #333; } .header-actions { display: flex; align-items: center; } .zoom-controls { display: flex; align-items: center; margin-left: 16px; } .timeline-container { display: flex; flex-direction: column; gap: 20px; } .timeline-main { position: relative; min-height: 240px; overflow-x: auto; } .timeline-ruler { position: relative; height: 40px; border-bottom: 1px solid #ebeef5; margin-bottom: 20px; min-width: 100%; } .time-mark { position: absolute; bottom: 0; transform: translateX(-50%); text-align: center; } .mark-line { height: 10px; width: 1px; background-color: #999; margin: 0 auto; } .mark-label { font-size: 12px; color: #666; margin-top: 4px; } .time-window { position: absolute; height: 100%; background-color: rgba(64, 158, 255, 0.1); border-left: 1px solid #409eff; border-right: 1px solid #409eff; cursor: move; } .timeline-content { position: relative; min-height: 180px; padding-bottom: 20px; transition: transform 0.3s ease; transform-origin: left center; min-width: 100%; } .timeline-event { position: absolute; bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: all 0.2s; } .timeline-event.expanded { z-index: 100; } .event-marker { width: 24px; height: 24px; border-radius: 50%; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); } .event-admission .event-marker { color: #67c23a; background-color: #f0f9eb; } .event-medication .event-marker { color: #409eff; background-color: #ecf5ff; } .event-examination .event-marker { color: #e6a23c; background-color: #fdf6ec; } .event-surgery .event-marker { color: #f56c6c; background-color: #fef0f0; } .event-rounds .event-marker { color: #909399; background-color: #f4f4f5; } .event-card { width: 200px; padding: 12px; background: white; border-radius: 6px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1); transition: all 0.2s; position: relative; } .timeline-event.expanded .event-card { width: 260px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); } .event-header { display: flex; justify-content: space-between; margin-bottom: 6px; } .event-type { font-size: 12px; font-weight: bold; } .event-admission .event-type { color: #67c23a; } .event-medication .event-type { color: #409eff; } .event-examination .event-type { color: #e6a23c; } .event-surgery .event-type { color: #f56c6c; } .event-rounds .event-type { color: #909399; } .event-time { font-size: 11px; color: #999; } .event-title { font-size: 13px; font-weight: bold; color: #333; margin-bottom: 8px; } .event-details { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #ebeef5; } .detail-item { font-size: 12px; margin-bottom: 6px; display: flex; } .detail-label { color: #666; margin-right: 4px; min-width: 70px; } .detail-value { color: #333; flex: 1; } .indicators-progress { margin-top: 20px; } .section-title { margin: 0 0 12px 0; font-size: 14px; color: #555; font-weight: bold; } .indicator-content { padding: 12px; } .event-detail-content { padding: 0 16px; } .detail-section { margin-bottom: 20px; } .detail-section h4 { margin: 0 0 12px 0; color: #555; font-size: 15px; padding-bottom: 6px; border-bottom: 1px solid #ebeef5; } .detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; } .detail-full { background: #f8f9fa; padding: 12px; border-radius: 4px; max-height: 300px; overflow: auto; } .detail-full pre { margin: 0; font-family: inherit; white-space: pre-wrap; font-size: 13px; line-height: 1.5; } @media (max-width: 768px) { .card-header { flex-direction: column; align-items: flex-start; gap: 8px; } .header-actions { width: 100%; flex-wrap: wrap; gap: 8px; } .header-actions .el-select, .header-actions .el-date-editor, .header-actions .zoom-controls { width: 100% !important; margin-left: 0 !important; } .zoom-controls { margin-top: 8px; } .timeline-main { min-height: 280px; } .timeline-content { min-height: 220px; } .event-card { width: 160px; } .timeline-event.expanded .event-card { width: 200px; } } </style> 这个组件存在以下问题: 1. 时间轴不能左右拖动 2.放大缩小时间轴时下方描述狂会随之挤压拉伸导致显示异常 3.时间轴最左侧和最右侧的刻度显示不完整
08-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值