Merge remote-tracking branch 'origin/develop' into guanyu

This commit is contained in:
2026-06-17 16:35:19 +08:00

View File

@@ -472,7 +472,6 @@ function getDetail(encounterId) {
if (res.code === 200) { if (res.code === 200) {
allowAdd.value = res.data ? true : false; allowAdd.value = res.data ? true : false;
console.log('设置 allowAdd =', allowAdd.value, ', 病历数据:', res.data); console.log('设置 allowAdd =', allowAdd.value, ', 病历数据:', res.data);
} else {
allowAdd.value = false; allowAdd.value = false;
console.warn('获取病历详情失败:', res.msg); console.warn('获取病历详情失败:', res.msg);
} }
@@ -710,32 +709,15 @@ function getTree() {
*/ */
function handleAddDiagnosis() { function handleAddDiagnosis() {
console.log('点击新增诊断按钮allowAdd:', allowAdd.value); console.log('点击新增诊断按钮allowAdd:', allowAdd.value);
// 检查表单ref是否存在 // 检查是否有未填写的空行(名称为空的行),防止不保存一直新增
if (!proxy.$refs.formRef) { const hasEmptyRow = form.value.diagnosisList.some(item => !item.name);
console.error('表单ref不存在'); if (hasEmptyRow) {
// 直接添加诊断,不经过表单验证 proxy.$modal.msgWarning('请先完善已有的诊断信息后再新增');
addDiagnosisItem();
return; return;
} }
proxy.$refs.formRef.validate((valid, fields) => { addDiagnosisItem();
console.log('表单验证结果:', valid, '错误字段:', fields);
if (valid) {
if (!allowAdd.value) {
proxy.$modal.msgWarning('请先填写病历');
return;
}
addDiagnosisItem();
} else {
console.warn('表单验证失败:', fields);
// 验证失败时也允许添加(因为是新增空行)
if (allowAdd.value) {
console.log('验证失败但允许添加,强制添加诊断');
addDiagnosisItem();
}
}
});
} }
/** /**
@@ -1133,3 +1115,4 @@ defineExpose({ getList, getDetail, handleSaveDiagnosis });
align-items: center; align-items: center;
} }
</style> </style>