修改心电工作站

This commit is contained in:
Flow 2025-08-11 14:55:01 +08:00
parent 752ef312e8
commit 4c7a568621

View File

@ -137,23 +137,17 @@
>
<template #default="{ row }"> {{ row.age }} </template>
</el-table-column>
<el-table-column
prop="wearstarttime"
label="佩戴开始时间"
min-width="180"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">
<div v-if="row.isEditingWearTime" class="wear-time-editor">
<el-table-column prop="wearstarttime" label="佩戴时间" align="center" min-width="180">
<template #default="{ row, $index }">
<!-- 编辑状态 -->
<div v-if="row.editingMeasureTime" class="wear-time-editor">
<el-date-picker
v-model="row.tempWearTime"
v-model="row.wearstarttime"
type="datetime"
placeholder="选择佩戴时间"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择时间"
size="small"
style="width: 140px"
value-format="YYYY-MM-DD HH:mm:ss"
:popper-class="'no-tooltip'"
/>
<div class="edit-actions">
@ -161,7 +155,7 @@
type="success"
size="small"
circle
@click="confirmWearTimeChange(row)"
@click="saveMeasureTime(row, $index)"
class="confirm-btn"
>
<Icon icon="ep:check" />
@ -170,23 +164,24 @@
type="danger"
size="small"
circle
@click="cancelWearTimeChange(row)"
@click="cancelEditMeasureTime(row, $index)"
class="cancel-btn"
>
<Icon icon="ep:close" />
</el-button>
</div>
</div>
<!-- 显示状态 -->
<div v-else class="wear-time-display">
<div v-if="row.wearstarttime" class="time-content">
<span class="time-text">{{ formatWearTime(row.wearstarttime) }}</span>
<div class="time-content">
<span class="time-text">{{ formatMeasureTime(row.wearstarttime) }}</span>
</div>
<div class="edit-button-wrapper">
<el-button
type="primary"
size="small"
circle
@click="startEditWearTime(row)"
@click="editMeasureTime(row, $index)"
class="edit-btn"
>
<Icon icon="ep:edit" />
@ -218,7 +213,7 @@
@click="handleAnalysis(row)"
>
<Icon icon="ep:monitor" />
Holter
分析
</el-button>
</template>
</el-table-column>
@ -298,7 +293,7 @@
<Icon icon="ep:document-add" />
申请
</el-button>
<el-tag v-else type="success" class="status-tag"> 已申请 </el-tag>
<span v-else type="success" size="small" class="status-tag"> 已申请 </span>
</template>
</el-table-column>
<el-table-column
@ -592,7 +587,6 @@ import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
import { uploadFileInChunks } from '@/utils/upload'
import { OrgApi } from '@/api/org'
import { EcgworkstationApi, EcgworkstationVO } from '@/api/ecgworkstation'
import { ecgdataApi } from '@/api/ecgdata'
defineOptions({ name: 'AnalysisECGWorkstation' })
const Profilevo = ref<ProfileVO>({} as ProfileVO) //
@ -955,16 +949,30 @@ const formatDate = (date: Date | string) => {
})
}
/** 格式化佩戴时间显示 */
const formatWearTime = (date: Date | string) => {
if (!date) return '未设置'
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hour = String(d.getHours()).padStart(2, '0')
const minute = String(d.getMinutes()).padStart(2, '0')
const second = String(d.getSeconds()).padStart(2, '0')
//
const formatMeasureTime = (time: any) => {
if (!time) return ''
let date: Date
// Date
if (typeof time === 'number') {
//
const timestamp = time.toString().length === 13 ? time : time * 1000
date = new Date(timestamp)
} else {
// Date
date = new Date(time)
}
// YYYY-MM-DD HH:mm:ss
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hour = String(date.getHours()).padStart(2, '0')
const minute = String(date.getMinutes()).padStart(2, '0')
const second = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}
@ -1019,7 +1027,7 @@ const handleAnalysis = async (row) => {
try {
//
if (!row.wearstarttime) {
ElMessage.warning('请先设置佩戴开始时间后再进行分析')
ElMessage.warning('请先设置佩戴时间后再进行分析')
return
}
@ -1029,7 +1037,7 @@ const handleAnalysis = async (row) => {
patientName: encodeURIComponent(row.name), // URL
gender: row.gender === '1' ? '男' : row.gender === '2' ? '女' : '未知',
age: row.age?.toString() || '',
examTime: row.wearstarttime ? formatWearTime(row.wearstarttime) : '',
examTime: row.wearstarttime ? formatMeasureTime(row.wearstarttime) : '',
hospitalName: row.orgname || '',
department: '内科' //
}
@ -1560,53 +1568,42 @@ const handlePatientCancel = () => {
console.log('取消选择患者')
}
/** 开始编辑佩戴时间 */
const startEditWearTime = (
row: EcgworkstationVO & { isEditingWearTime?: boolean; tempWearTime?: any }
) => {
row.isEditingWearTime = true
row.tempWearTime = row.wearstarttime
//
const editMeasureTime = (row: any, index: number) => {
//
row.originalMeasureTime = row.wearstarttime
row.editingMeasureTime = true
}
/** 确认佩戴时间修改 */
const confirmWearTimeChange = async (
row: EcgworkstationVO & { isEditingWearTime?: boolean; tempWearTime?: any }
) => {
const saveMeasureTime = async (row: any, index: number) => {
try {
if (!row.tempWearTime) {
ElMessage.warning('请选择佩戴时间')
return
}
// 使
let formattedTime = row.tempWearTime
if (row.tempWearTime) {
//
formattedTime = new Date(row.tempWearTime).getTime()
}
//
const measureTimeTimestamp = row.wearstarttime ? new Date(row.wearstarttime).getTime() : null
// API
await ecgdataApi.updatewearstarttime({
id: row.id,
wearstarttime: formattedTime
})
const updateData = { ...row, wearstarttime: measureTimeTimestamp }
await EcgworkstationApi.updateEcgworkstation(updateData)
row.wearstarttime = row.tempWearTime
row.isEditingWearTime = false
ElMessage.success('佩戴时间更新成功')
getList()
row.editingMeasureTime = false
delete row.originalMeasureTime
ElMessage.success(`已更新佩戴时间`)
} catch (error) {
console.error('更新佩戴时间失败:', error)
ElMessage.error('更新佩戴时间失败')
ElMessage.error('更新佩戴时间失败,请重试')
//
if (row.originalMeasureTime !== undefined) {
row.wearstarttime = row.originalMeasureTime
}
}
}
/** 取消佩戴时间修改 */
const cancelWearTimeChange = (
row: EcgworkstationVO & { isEditingWearTime?: boolean; tempWearTime?: any }
) => {
row.isEditingWearTime = false
row.tempWearTime = null
const cancelEditMeasureTime = (row: any, index: number) => {
//
if (row.originalMeasureTime !== undefined) {
row.wearstarttime = row.originalMeasureTime
}
row.editingMeasureTime = false
delete row.originalMeasureTime
}
/** 初始化 */
@ -1944,30 +1941,6 @@ onMounted(async () => {
color: #606266;
}
}
.edit-button-wrapper {
display: flex;
align-items: center;
.edit-btn {
width: 20px;
height: 20px;
padding: 0;
background: transparent;
border: none;
color: #909399;
transition: all 0.3s ease;
&:hover {
color: #409eff;
transform: scale(1.1);
}
.ep-edit {
font-size: 12px;
}
}
}
}
.wear-time-editor {
@ -2584,4 +2557,103 @@ onMounted(async () => {
text-align: center;
}
}
//
.wear-time-display {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px;
border-radius: 6px;
transition: all 0.3s ease;
.time-content {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
.time-text {
font-size: 12px;
color: #606266;
}
}
.edit-button-wrapper {
display: flex;
align-items: center;
.edit-btn {
width: 20px;
height: 20px;
padding: 0;
background: transparent;
border: none;
color: #909399;
transition: all 0.3s ease;
&:hover {
color: #409eff;
transform: scale(1.1);
}
.ep-edit {
font-size: 12px;
}
}
}
}
.wear-time-editor {
display: flex;
align-items: center;
gap: 8px;
.edit-actions {
display: flex;
gap: 4px;
.confirm-btn {
width: 24px;
height: 24px;
padding: 0;
background: linear-gradient(135deg, #67c23a, #85ce61);
border: none;
&:hover {
background: linear-gradient(135deg, #5daf34, #73c25a);
transform: scale(1.05);
}
.ep-check {
font-size: 10px;
}
}
.cancel-btn {
width: 24px;
height: 24px;
padding: 0;
background: linear-gradient(135deg, #f56c6c, #f78989);
border: none;
&:hover {
background: linear-gradient(135deg, #e45656, #f56c6c);
transform: scale(1.05);
}
.ep-close {
font-size: 10px;
}
}
}
}
// tooltip
:deep(.no-tooltip) {
.el-tooltip__popper {
display: none !important;
}
}
</style>