弃检功能实现

This commit is contained in:
Euni4U 2025-03-25 09:46:45 +08:00
parent 37fc126c40
commit e66d1cddac

View File

@ -267,7 +267,16 @@
@click="handleSaveCurrentTab"
:disabled="isReadOnly"
>
保存
保存小结
</el-button>
<el-button
type="text"
class="abandon-btn"
@click="handleAbandonExam"
:disabled="isReadOnly"
style="color: red"
>
弃检
</el-button>
</span>
</span>
@ -321,8 +330,17 @@
@click="handleSaveCurrentTab"
:disabled="isReadOnly"
>
保存
保存小结
</el-button>
<el-button
type="text"
class="abandon-btn"
@click="handleAbandonExam"
:disabled="isReadOnly"
style="color: red"
>
弃检
</el-button>
</span>
</span>
</div>
@ -368,9 +386,6 @@
</div>
<div class="right-section">
<div class="action-buttons">
<button class="action-btn" @click="checkEditPermission" :disabled="isDisabled"
>弃检</button
>
<button
class="action-btn primary"
@click="handleSaveAllResults"
@ -1485,7 +1500,16 @@ const isDisabled = computed(() => {
//
const isReadOnly = computed(() => {
return isDisabled.value
//
if (isDisabled.value) return true
//
const currentItems = examItems.value[currentTab.value] || []
if (currentItems.length > 0 && currentItems.every(item => item.itemStatus === '2')) {
return true //
}
return false
})
//
@ -2168,6 +2192,66 @@ const handleSaveCurrentTab = async () => {
ElMessage.error(`保存失败: ${error.message || '请检查数据是否完整'}`)
}
}
const handleAbandonExam = async () => {
if (!checkEditPermission()) return
try {
//
await ElMessageBox.confirm('确定要弃检当前项目吗?弃检后将无法编辑。', '弃检确认', {
confirmButtonText: '确定弃检',
cancelButtonText: '取消',
type: 'warning'
})
const loading = ElLoading.service({
lock: true,
text: '处理中...',
background: 'rgba(255, 255, 255, 0.7)'
})
try {
//
const currentItems = examItems.value[currentTab.value] || []
if (currentItems.length === 0) {
ElMessage.warning('当前标签页没有检查项目')
loading.close()
return
}
//
const updatedItems = currentItems.map(item => ({
id: item.id,
medicalSn: selectedPatient.value?.medicalSn,
itemStatus: '2', //
inspectdoctor: inspectDoctor.value || user.value?.nickname || '',
inspecttime: Date.now() // 使
}))
//
await PatientitemsApi.updatePatientitemsBatch(updatedItems)
//
currentItems.forEach(item => {
item.itemStatus = '2'
})
loading.close()
ElMessage.success('弃检成功')
//
await refreshExamData()
} catch (error) {
loading.close()
console.error('弃检失败:', error)
ElMessage.error(`弃检失败: ${error.message || '请稍后重试'}`)
}
} catch {
//
ElMessage.info('已取消弃检')
}
}
</script>
<style scoped>
@ -3226,32 +3310,21 @@ const handleSaveCurrentTab = async () => {
.title-text .el-button[disabled] {
color: #c0c4cc;
}
/* 保存按钮容器样式 - 靠左对齐 */
.save-btn-container {
display: inline-block;
margin-left: 10px;
text-align: left;
}
/* 醒目的保存按钮样式 - 绿色 */
.save-btn {
color: #67c23a; /* 醒目的绿色 */
font-weight: bold;
font-size: 15px;
}
.save-btn:hover {
color: #85ce61; /* 悬停时的浅绿色 */
}
.save-btn:disabled {
color: #c8c9cc;
cursor: not-allowed;
}
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.save-btn-container {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px; /* 按钮之间的间距 */
}
.save-btn-container .el-button {
margin-left: 0; /* 重置按钮的左边距 */
}
</style>