弃检功能实现
This commit is contained in:
parent
37fc126c40
commit
e66d1cddac
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user