fix(手术申请): 修复手术部位未保存到cli_surgery表及详情展示为编码的问题
- 后端:保存手术申请单时,从descJson解析surgerySite字段,写入 cli_surgery.body_site和wor_service_request.content_json,解决 手术部位数据未持久化到手术主表的问题 - 前端:手术申请详情弹窗加载字典数据(手术等级、麻醉方式、手术 部位、切口类别、手术性质),将descJson中的字典编码翻译为中文 标签展示,解决详情中显示原始编码(如"1")而非实际名称的问题
This commit is contained in:
@@ -397,11 +397,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, getCurrentInstance, nextTick, ref, watch} from 'vue';
|
||||
import {computed, getCurrentInstance, nextTick, onMounted, ref, watch} from 'vue';
|
||||
import {Refresh, Search} from '@element-plus/icons-vue';
|
||||
import {patientInfo} from '../../store/patient.js';
|
||||
import {getSurgery, deleteRequestForm, withdrawRequestForm} from './api';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import {getDicts} from '@/api/system/dict/data';
|
||||
import SurgeryForm from '../order/applicationForm/surgery.vue';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import auth from '@/plugins/auth';
|
||||
@@ -419,6 +420,51 @@ const editDialogVisible = ref(false);
|
||||
const editRowData = ref(null);
|
||||
const editFormRef = ref(null);
|
||||
|
||||
// 字典选项(用于详情展示时将编码转为中文标签)
|
||||
const surgeryLevelDictMap = ref({});
|
||||
const anesthesiaTypeDictMap = ref({});
|
||||
const surgerySiteDictMap = ref({});
|
||||
const incisionLevelDictMap = ref({});
|
||||
const surgeryNatureDictMap = ref({});
|
||||
|
||||
/** 字段 → 字典映射表,getFieldValue 根据此表将字典编码翻译为标签 */
|
||||
const dictFieldMap = {
|
||||
surgeryLevel: surgeryLevelDictMap,
|
||||
anesthesiaType: anesthesiaTypeDictMap,
|
||||
surgerySite: surgerySiteDictMap,
|
||||
incisionLevel: incisionLevelDictMap,
|
||||
surgeryNature: surgeryNatureDictMap,
|
||||
};
|
||||
|
||||
/** 加载字典选项 */
|
||||
const loadDictOptions = async () => {
|
||||
try {
|
||||
const res = await Promise.all([
|
||||
getDicts('surgery_level'),
|
||||
getDicts('anesthesia_type'),
|
||||
getDicts('surgical_site'),
|
||||
getDicts('incision_level'),
|
||||
getDicts('surgery_type'),
|
||||
]);
|
||||
const toMap = (arr) => {
|
||||
const m = {};
|
||||
(arr || []).forEach(item => { m[item.dictValue] = item.dictLabel; });
|
||||
return m;
|
||||
};
|
||||
surgeryLevelDictMap.value = toMap(res[0]?.data);
|
||||
anesthesiaTypeDictMap.value = toMap(res[1]?.data);
|
||||
surgerySiteDictMap.value = toMap(res[2]?.data);
|
||||
incisionLevelDictMap.value = toMap(res[3]?.data);
|
||||
surgeryNatureDictMap.value = toMap(res[4]?.data);
|
||||
} catch (e) {
|
||||
console.error('加载手术字典数据失败:', e);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadDictOptions();
|
||||
});
|
||||
|
||||
// 获取默认日期范围(近7天)
|
||||
const getDefaultDateRange = () => {
|
||||
const now = new Date();
|
||||
@@ -656,6 +702,13 @@ const getFieldValue = (key, value) => {
|
||||
if (key === 'assistant2Id' && descJsonData.value?.assistant2Name) {
|
||||
return descJsonData.value.assistant2Name;
|
||||
}
|
||||
// 字典字段:将编码翻译为中文标签(如 surgerySite="1" → "头部")
|
||||
if (dictFieldMap[key]) {
|
||||
const dictMap = dictFieldMap[key].value;
|
||||
if (dictMap && dictMap[value] !== undefined) {
|
||||
return dictMap[value];
|
||||
}
|
||||
}
|
||||
return value || '-';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user