Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # openhis-ui-vue3/src/views/maintainSystem/Inspection/index.vue
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="button-group">
|
||||
<button @click="addNewRow" class="btn btn-primary">
|
||||
<i class="icon-plus"></i> 添加新行
|
||||
</button>
|
||||
<button @click="saveData" class="btn btn-success" :disabled="saveButtonText === '保存中...'">
|
||||
{{ saveButtonText }}
|
||||
</button>
|
||||
<button @click="addNewRow" class="pan-btn blue-btn">
|
||||
<i class="icon-plus"></i> 添加新行
|
||||
</button>
|
||||
<button @click="saveData" class="pan-btn green-btn" :disabled="saveButtonText === '保存中...'">
|
||||
{{ saveButtonText }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 错误提示区域 -->
|
||||
@@ -119,7 +119,7 @@
|
||||
<button
|
||||
v-if="!item.isActive"
|
||||
@click="toggleEdit(item.keyId)"
|
||||
class="btn btn-primary btn-sm mr-1"
|
||||
class="pan-btn-link blue-btn-link"
|
||||
title="编辑"
|
||||
>
|
||||
<i class="icon-edit"></i> 编辑
|
||||
@@ -127,14 +127,14 @@
|
||||
<button
|
||||
v-if="item.isActive"
|
||||
@click="toggleEdit(item.keyId)"
|
||||
class="btn btn-secondary btn-sm mr-1"
|
||||
class="pan-btn-link info-btn-link"
|
||||
title="取消"
|
||||
>
|
||||
<i class="icon-cancel"></i> 取消
|
||||
</button>
|
||||
<button
|
||||
@click="deleteRow(item)"
|
||||
class="btn btn-danger btn-sm"
|
||||
class="pan-btn-link red-btn-link"
|
||||
title="删除"
|
||||
>
|
||||
<i class="icon-delete"></i> 删除
|
||||
@@ -1262,6 +1262,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import '@/assets/styles/btn.scss';
|
||||
.invoice-management {
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
@@ -1330,18 +1331,14 @@ export default {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.button-group .btn {
|
||||
.button-group .pan-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.button-group .btn:hover {
|
||||
.button-group .pan-btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
@@ -1472,9 +1469,7 @@ export default {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.action-buttons .btn {
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
.action-buttons .pan-btn {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
@@ -1550,11 +1545,10 @@ export default {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.button-group .btn {
|
||||
.button-group .pan-btn {
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
min-width: 80px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
@@ -1578,10 +1572,8 @@ export default {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.action-buttons .btn {
|
||||
.action-buttons .pan-btn {
|
||||
margin-right: 0;
|
||||
padding: 4px 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.no-data-row {
|
||||
|
||||
@@ -219,6 +219,7 @@ const templateName = ref('');
|
||||
// 事件
|
||||
const emits = defineEmits(['save']);
|
||||
const { proxy } = getCurrentInstance();
|
||||
console.log('EMR组件初始化,proxy:', proxy);
|
||||
|
||||
// 监听表单变化
|
||||
watch(
|
||||
@@ -325,18 +326,109 @@ function cancel() {
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
getDetail(encounterId) {
|
||||
getEmrDetail(encounterId).then((res) => {
|
||||
if (res.data) {
|
||||
console.log('开始获取病历详情,encounterId:', encounterId);
|
||||
|
||||
// 立即初始化form.value为空对象,确保页面有内容显示
|
||||
form.value = {};
|
||||
|
||||
// 检查API函数是否存在
|
||||
if (typeof getEmrDetail !== 'function') {
|
||||
console.error('getEmrDetail函数未定义');
|
||||
if (proxy) {
|
||||
proxy.$modal.msgError('获取病历详情失败:API函数未定义');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加超时处理,防止请求一直挂起
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error('获取病历详情请求超时'));
|
||||
}, 10000); // 10秒超时
|
||||
});
|
||||
|
||||
// 使用Promise.race处理正常请求和超时
|
||||
Promise.race([getEmrDetail(encounterId), timeoutPromise])
|
||||
.then((res) => {
|
||||
console.log('获取病历详情成功,返回完整数据:', JSON.stringify(res, null, 2));
|
||||
|
||||
// 检查响应是否有效
|
||||
if (!res) {
|
||||
console.error('API返回结果为空');
|
||||
if (proxy) {
|
||||
proxy.$modal.msgError('获取病历详情失败:API返回结果为空');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('res存在,类型:', typeof res);
|
||||
console.log('res的属性:', Object.keys(res));
|
||||
|
||||
// 检查响应码
|
||||
if (res.code !== 200) {
|
||||
console.error('API返回错误代码:', res.code);
|
||||
if (proxy) {
|
||||
proxy.$modal.msgError('获取病历详情失败:' + (res.msg || '未知错误'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
if (!res.data) {
|
||||
console.log('res.data为空,使用默认值');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('res.data存在,类型:', typeof res.data);
|
||||
console.log('res.data的属性:', Object.keys(res.data));
|
||||
|
||||
// 处理contextJson
|
||||
try {
|
||||
form.value = JSON.parse(res.data.contextJson) || {};
|
||||
if (res.data.contextJson) {
|
||||
console.log('contextJson存在,值:', res.data.contextJson);
|
||||
console.log('contextJson类型:', typeof res.data.contextJson);
|
||||
|
||||
// 检查contextJson类型
|
||||
if (typeof res.data.contextJson === 'string') {
|
||||
// 尝试解析JSON字符串
|
||||
const parsedData = JSON.parse(res.data.contextJson);
|
||||
// 确保解析结果是对象
|
||||
if (typeof parsedData === 'object' && parsedData !== null) {
|
||||
form.value = parsedData;
|
||||
console.log('解析后的病历数据:', JSON.stringify(form.value, null, 2));
|
||||
} else {
|
||||
form.value = {};
|
||||
console.error('contextJson解析结果不是有效对象:', parsedData);
|
||||
}
|
||||
} else if (typeof res.data.contextJson === 'object') {
|
||||
// 如果已经是对象,直接使用
|
||||
form.value = res.data.contextJson;
|
||||
console.log('直接使用contextJson作为对象:', JSON.stringify(form.value, null, 2));
|
||||
} else {
|
||||
form.value = {};
|
||||
console.error('contextJson类型无效:', typeof res.data.contextJson);
|
||||
}
|
||||
} else {
|
||||
console.log('contextJson为空,使用默认值');
|
||||
}
|
||||
} catch (e) {
|
||||
form.value = {};
|
||||
console.error('病历数据解析失败:', e);
|
||||
console.error('解析失败的contextJson值:', res.data.contextJson);
|
||||
if (proxy) {
|
||||
proxy.$modal.msgError('病历数据解析失败');
|
||||
}
|
||||
}
|
||||
|
||||
emits('save', true);
|
||||
} else {
|
||||
form.value = {};
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理API调用失败或超时的情况
|
||||
console.error('获取病历详情失败:', error);
|
||||
if (proxy) {
|
||||
proxy.$modal.msgError('获取病历详情失败:' + (error.message || '未知错误'));
|
||||
}
|
||||
});
|
||||
},
|
||||
addEmr
|
||||
});
|
||||
|
||||
@@ -1493,6 +1493,7 @@ const { proxy } = getCurrentInstance();
|
||||
const inputRefs = ref({}); // 存储输入框实例,格式: { rowIndex: { fieldName: el } }
|
||||
const requiredProps = ref([]); // 存储必填项 prop 顺序
|
||||
const totalAmount = ref(0);
|
||||
const groupMarkers = ref([]); // 存储分组标记,用于显示层级关系
|
||||
const { method_code, unit_code, rate_code, distribution_category_code, drord_doctor_type } = proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
<el-icon
|
||||
class="delete-icon"
|
||||
title="删除处方单"
|
||||
@click="handleDeletePrescriptionClick(index)"
|
||||
:class="{ 'disabled-icon': isPrescriptionDeletable(index) !== true }"
|
||||
@click="handleDeletePrescriptionClick(pIndex)"
|
||||
:class="{ 'disabled-icon': isPrescriptionDeletable(pIndex) !== true }"
|
||||
style="font-size: 20px !important; margin-left: 10px; color: #f56c6c"
|
||||
>
|
||||
<minus />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="summary">
|
||||
<span class="summary-item">药品数: {{ getPrescriptionMedicineCount(index) }}种</span>
|
||||
<span class="summary-item">总价: ¥ {{ getPrescriptionTotalPrice(index) }}</span>
|
||||
<span class="summary-item">药品数: {{ getPrescriptionMedicineCount(pIndex) }}种</span>
|
||||
<span class="summary-item">总价: ¥ {{ getPrescriptionTotalPrice(pIndex) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -570,7 +570,10 @@ function getList() {
|
||||
}
|
||||
|
||||
function getListInfo(addNewRow) {
|
||||
isAdding.value = false;
|
||||
// 确保isAdding变量存在
|
||||
if (typeof isAdding !== 'undefined') {
|
||||
isAdding.value = false;
|
||||
}
|
||||
|
||||
// 确保有患者信息
|
||||
if (!props.patientInfo || !props.patientInfo.encounterId) {
|
||||
@@ -580,36 +583,38 @@ function getListInfo(addNewRow) {
|
||||
|
||||
getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
if (res && res.data && Array.isArray(res.data)) {
|
||||
// 清空当前处方列表
|
||||
tcmPrescriptionList.value = [];
|
||||
|
||||
// 处理返回的数据
|
||||
res.data.forEach((item) => {
|
||||
try {
|
||||
// 解析contentJson获取完整的医嘱数据
|
||||
const contentData = item.contentJson ? JSON.parse(item.contentJson) : {};
|
||||
|
||||
// 创建一个新的处方对象
|
||||
const newPrescription = {
|
||||
...item,
|
||||
...contentData,
|
||||
// 确保关键显示字段存在
|
||||
adviceName: contentData.adviceName || item.adviceName || '',
|
||||
quantity: contentData.quantity || item.quantity || '',
|
||||
totalPrice: contentData.totalPrice || item.totalPrice || '',
|
||||
diagnosisName: contentData.diagnosisName || item.diagnosisName || '',
|
||||
positionName: contentData.positionName || item.positionName || '',
|
||||
doseUnitCode_dictText: contentData.doseUnitCode_dictText || item.doseUnitCode_dictText || '',
|
||||
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || '',
|
||||
prescriptionList: [contentData]
|
||||
};
|
||||
|
||||
// 添加到处方列表
|
||||
tcmPrescriptionList.value.push(newPrescription);
|
||||
} catch (error) {
|
||||
console.error('解析医嘱数据失败:', error, '数据项:', item);
|
||||
}
|
||||
});
|
||||
if (res.data.length > 0) {
|
||||
// 如果有数据,清空当前列表并重新添加
|
||||
tcmPrescriptionList.value = [];
|
||||
|
||||
res.data.forEach((item) => {
|
||||
try {
|
||||
// 解析contentJson获取完整的医嘱数据
|
||||
const contentData = item.contentJson ? JSON.parse(item.contentJson) : {};
|
||||
|
||||
// 创建一个新的处方对象
|
||||
const newPrescription = {
|
||||
...item,
|
||||
...contentData,
|
||||
// 确保关键显示字段存在
|
||||
adviceName: contentData.adviceName || item.adviceName || '',
|
||||
quantity: contentData.quantity || item.quantity || '',
|
||||
totalPrice: contentData.totalPrice || item.totalPrice || '',
|
||||
diagnosisName: contentData.diagnosisName || item.diagnosisName || '',
|
||||
positionName: contentData.positionName || item.positionName || '',
|
||||
doseUnitCode_dictText: contentData.doseUnitCode_dictText || item.doseUnitCode_dictText || '',
|
||||
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || '',
|
||||
prescriptionList: [contentData]
|
||||
};
|
||||
|
||||
// 添加到处方列表
|
||||
tcmPrescriptionList.value.push(newPrescription);
|
||||
} catch (error) {
|
||||
console.error('解析医嘱数据失败:', error, '数据项:', item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 重新计算总金额
|
||||
handleTotalAmount();
|
||||
@@ -619,11 +624,11 @@ function getListInfo(addNewRow) {
|
||||
}
|
||||
} else {
|
||||
console.error('获取医嘱列表失败或数据格式错误:', res);
|
||||
tcmPrescriptionList.value = [];
|
||||
// 保持当前列表不变,不要清空
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取医嘱列表异常:', error);
|
||||
tcmPrescriptionList.value = [];
|
||||
// 保持当前列表不变,不要清空
|
||||
});
|
||||
|
||||
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
|
||||
@@ -650,7 +655,7 @@ function getDiagnosisInfo() {
|
||||
});
|
||||
});
|
||||
}
|
||||
// 默认选择第一个诊断
|
||||
// 默认选择第一个诊断
|
||||
if (diagnosisList.value.length > 0) {
|
||||
const firstDiagnosis = diagnosisList.value[0];
|
||||
tcmPrescriptionList.value.forEach((prescription) => {
|
||||
|
||||
@@ -426,11 +426,17 @@ function handleCardClick(item, index) {
|
||||
}
|
||||
activeTab.value = 'emr';
|
||||
nextTick(() => {
|
||||
prescriptionRef.value.getListInfo();
|
||||
tcmRef.value.getListInfo();
|
||||
diagnosisRef.value.getList();
|
||||
eprescriptionRef.value.getList();
|
||||
emrRef.value.getDetail(item.encounterId);
|
||||
// 确保所有组件引用都已初始化
|
||||
if (prescriptionRef.value) prescriptionRef.value.getListInfo();
|
||||
if (tcmRef.value) tcmRef.value.getListInfo();
|
||||
if (diagnosisRef.value) diagnosisRef.value.getList();
|
||||
if (eprescriptionRef.value) eprescriptionRef.value.getList();
|
||||
if (emrRef.value) {
|
||||
emrRef.value.getDetail(item.encounterId);
|
||||
} else {
|
||||
console.error('emr组件未正确初始化');
|
||||
proxy.$modal.msgError('病历组件加载失败,请刷新页面重试');
|
||||
}
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 200);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<span class="menu-icon">👥</span>
|
||||
<span>患者管理</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="navigateToAppoinmentManage">
|
||||
<div class="menu-item">
|
||||
<span class="menu-icon">💉</span>
|
||||
<span>预约管理</span>
|
||||
</div>
|
||||
@@ -203,10 +203,7 @@ function awaitingMedicineBtn() {
|
||||
router.push({ path: '/medicationmanagement/statisticalManagement/earlyWarning' });
|
||||
}
|
||||
|
||||
// 跳转到预约管理页面
|
||||
function navigateToAppoinmentManage() {
|
||||
router.push({ path: '/appoinmentmanage' });
|
||||
}
|
||||
|
||||
function getExpirationWarningCount() {
|
||||
getExpirationWarning({ pageNo: 1, pageSize: 10 }).then((res) => {
|
||||
total.value = res.data.total || 0;
|
||||
|
||||
@@ -16,97 +16,147 @@
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="挂号处理" name="tab3">
|
||||
<el-form ref="formRef" :model="formData" label-width="120px" class="config-form">
|
||||
<el-form ref="formRef" :model="formData" label-width="150px" class="config-form compact-form">
|
||||
<!-- 第一行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="病历本费用(元)" prop="medicalRecordFee" style="margin-right: 20px;">
|
||||
<el-input v-model="formData.medicalRecordFee" style="width: 180px" />
|
||||
<el-form-item label="病历本费用(元)" prop="medicalRecordFee">
|
||||
<el-input-number v-model="formData.medicalRecordFee" style="width: 150px" :controls-position="'right'" :step="1" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 20px;">
|
||||
<el-checkbox v-model="formData.medicalRecordFlag">病历费入账标志</el-checkbox>
|
||||
<el-form-item label="" prop="medicalRecordFlag" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.medicalRecordFlag" style="margin-right: 8px;" />
|
||||
<span>病历费入账标志</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第二行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="就诊卡费(元)" prop="patientCardFee" style="margin-right: 20px;">
|
||||
<el-input v-model="formData.patientCardFee" style="width: 180px" />
|
||||
<el-form-item label="就诊卡费(元)" prop="patientCardFee">
|
||||
<el-input-number v-model="formData.patientCardFee" style="width: 150px" :controls-position="'right'" :step="1" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 20px;">
|
||||
<el-checkbox v-model="formData.isNightShift">是否启用晚班</el-checkbox>
|
||||
<el-form-item label="" prop="isNightShift" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.isNightShift" style="margin-right: 8px;" />
|
||||
<span>是否启用晚班</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第三行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.patientCardFlag">就诊卡记账标志</el-checkbox>
|
||||
<el-form-item label="" prop="patientCardFlag" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.patientCardFlag" style="margin-right: 8px;" />
|
||||
<span>就诊卡记账标志</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item label="上午接诊起始时间" prop="morningStartTime" style="width: 300px; white-space: nowrap;">
|
||||
<el-input v-model="formData.morningStartTime" style="width: 120px" />
|
||||
<el-form-item label="上午接诊起始时间" prop="morningStartTime">
|
||||
<el-input v-model="formData.morningStartTime" style="width: 150px" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第四行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.autoGenerateOutpatientNo">自动产生门诊号</el-checkbox>
|
||||
<el-form-item label="" prop="autoGenerateOutpatientNo" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.autoGenerateOutpatientNo" style="margin-right: 8px;" />
|
||||
<span>自动产生门诊号</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.allowModifyOutpatientNo">建档时是否允许修改门诊号</el-checkbox>
|
||||
<el-form-item label="" prop="allowModifyOutpatientNo" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.allowModifyOutpatientNo" style="margin-right: 8px;" />
|
||||
<span>建档时是否允许修改门诊号</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第五行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="下午起始时间" prop="afternoonStartTime" style="margin-right: 40px;">
|
||||
<el-input v-model="formData.afternoonStartTime" style="width: 120px" />
|
||||
<el-form-item label="下午起始时间" prop="afternoonStartTime">
|
||||
<el-input v-model="formData.afternoonStartTime" style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="晚上起始时间" prop="eveningStartTime">
|
||||
<el-input v-model="formData.eveningStartTime" style="width: 120px" />
|
||||
<el-form-item label="晚上起始时间" prop="eveningStartTime" v-if="formData.isNightShift">
|
||||
<el-input v-model="formData.eveningStartTime" style="width: 150px" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第六行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="挂号有效期" prop="registrationValidity" style="margin-right: 40px;">
|
||||
<el-input v-model="formData.registrationValidity" style="width: 120px" />
|
||||
<el-form-item label="挂号有效期(天)" prop="registrationValidity">
|
||||
<el-input-number v-model="formData.registrationValidity" style="width: 150px" :controls-position="'right'" :step="1" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="挂号单据模式" prop="registrationDocumentMode">
|
||||
<el-select v-model="formData.registrationDocumentMode" style="width: 150px">
|
||||
<el-option label="使用发票" value="使用发票" />
|
||||
<el-option label="其他模式" value="其他模式" />
|
||||
<el-option label="普通单据" value="其他模式" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第七行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.exemptFlag">减免标志</el-checkbox>
|
||||
<el-form-item label="" prop="exemptFlag" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.exemptFlag" style="margin-right: 8px;" />
|
||||
<span>减免标志</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.consultationFlag">义诊标志</el-checkbox>
|
||||
<el-form-item label="" prop="consultationFlag" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.consultationFlag" style="margin-right: 8px;" />
|
||||
<span>义诊标志</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-right: 40px;">
|
||||
<el-checkbox v-model="formData.enableHolidayFeeFloat">启用法定节假日挂号费浮动</el-checkbox>
|
||||
<el-form-item label="" prop="enableHolidayFeeFloat" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.enableHolidayFeeFloat" style="margin-right: 8px;" />
|
||||
<span>启用法定节假日挂号费浮动</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第八行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="监护人规定年龄" prop="guardianAge" style="margin-right: 40px;">
|
||||
<el-input v-model="formData.guardianAge" style="width: 120px" />
|
||||
<el-form-item label="监护人规定年龄(岁)" prop="guardianAge">
|
||||
<el-input-number v-model="formData.guardianAge" style="width: 150px" :controls-position="'right'" :step="1" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="formData.enableDoubleScreen">门诊挂号启用双屏</el-checkbox>
|
||||
<el-form-item label="" prop="enableDoubleScreen" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.enableDoubleScreen" style="margin-right: 8px;" />
|
||||
<span>门诊挂号启用双屏</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 第九行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="formData.optionalRegistrationType">挂号类型可选择</el-checkbox>
|
||||
<el-form-item label="" prop="optionalRegistrationType" checkbox-label>
|
||||
<template #label>
|
||||
<div class="checkbox-label-container">
|
||||
<el-checkbox v-model="formData.optionalRegistrationType" style="margin-right: 8px;" />
|
||||
<span>挂号类型可选择</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
@@ -132,10 +182,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { getConfigKey, addConfig, updateConfig } from '@/api/system/config';
|
||||
import { listConfig, getConfigKey, addConfig, updateConfig } from '@/api/system/config';
|
||||
|
||||
const router = useRouter();
|
||||
const formRef = ref(null);
|
||||
@@ -164,6 +214,61 @@ const formData = reactive({
|
||||
isPrint: false,
|
||||
});
|
||||
|
||||
// 加载配置数据
|
||||
const loadConfigData = async (showSuccessMessage = true) => {
|
||||
try {
|
||||
// 调用系统配置API获取数据,不设置configType过滤条件以获取所有配置
|
||||
const response = await listConfig({ pageSize: 1000 });
|
||||
|
||||
// 处理响应数据,兼容不同的返回格式
|
||||
let configs = [];
|
||||
if (response && response.data) {
|
||||
if (Array.isArray(response.data)) {
|
||||
configs = response.data;
|
||||
} else if (response.data.rows && Array.isArray(response.data.rows)) {
|
||||
configs = response.data.rows;
|
||||
} else {
|
||||
console.error('返回数据格式不符合预期:', response);
|
||||
}
|
||||
} else if (response && response.rows && Array.isArray(response.rows)) {
|
||||
configs = response.rows;
|
||||
} else {
|
||||
console.error('API返回空响应:', response);
|
||||
}
|
||||
|
||||
console.log('loadConfigData - 获取到的配置列表:', configs);
|
||||
console.log('loadConfigData - 配置总数:', configs.length);
|
||||
|
||||
// 将配置数据映射到表单
|
||||
if (configs && configs.length > 0) {
|
||||
configs.forEach(config => {
|
||||
const { configKey, configValue } = config;
|
||||
|
||||
// 处理布尔类型字段
|
||||
if (configKey in formData) {
|
||||
if (typeof formData[configKey] === 'boolean') {
|
||||
formData[configKey] = configValue === '1';
|
||||
} else {
|
||||
formData[configKey] = configValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (showSuccessMessage) {
|
||||
ElMessage.success('配置数据加载成功');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载配置数据失败:', error);
|
||||
ElMessage.warning('无法加载配置数据,使用默认值');
|
||||
}
|
||||
};
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
loadConfigData();
|
||||
});
|
||||
|
||||
// 默认按钮点击事件
|
||||
const handleDefault = () => {
|
||||
// 重置为默认值
|
||||
@@ -211,12 +316,12 @@ const handleSave = async () => {
|
||||
{ configKey: 'allowModifyOutpatientNo', configValue: formData.allowModifyOutpatientNo ? '1' : '0', configName: '建档时是否允许修改门诊号', configType: 'Y' },
|
||||
{ configKey: 'afternoonStartTime', configValue: formData.afternoonStartTime, configName: '下午起始时间', configType: 'Y' },
|
||||
{ configKey: 'eveningStartTime', configValue: formData.eveningStartTime, configName: '晚上起始时间', configType: 'Y' },
|
||||
{ configKey: 'registrationValidity', configValue: formData.registrationValidity, configName: '挂号有效期', configType: 'Y' },
|
||||
{ configKey: 'registrationValidity', configValue: formData.registrationValidity, configName: '挂号有效期(天)', configType: 'Y' },
|
||||
{ configKey: 'registrationDocumentMode', configValue: formData.registrationDocumentMode, configName: '挂号单据模式', configType: 'Y' },
|
||||
{ configKey: 'exemptFlag', configValue: formData.exemptFlag ? '1' : '0', configName: '减免标志', configType: 'Y' },
|
||||
{ configKey: 'consultationFlag', configValue: formData.consultationFlag ? '1' : '0', configName: '义诊标志', configType: 'Y' },
|
||||
{ configKey: 'enableHolidayFeeFloat', configValue: formData.enableHolidayFeeFloat ? '1' : '0', configName: '启用法定节假日挂号费浮动', configType: 'Y' },
|
||||
{ configKey: 'guardianAge', configValue: formData.guardianAge, configName: '监护人规定年龄', configType: 'Y' },
|
||||
{ configKey: 'guardianAge', configValue: formData.guardianAge, configName: '监护人规定年龄(岁)', configType: 'Y' },
|
||||
{ configKey: 'enableDoubleScreen', configValue: formData.enableDoubleScreen ? '1' : '0', configName: '门诊挂号启用双屏', configType: 'Y' },
|
||||
{ configKey: 'optionalRegistrationType', configValue: formData.optionalRegistrationType ? '1' : '0', configName: '挂号类型可选择', configType: 'Y' },
|
||||
{ configKey: 'isPrint', configValue: formData.isPrint ? '1' : '0', configName: '是否打印挂号单', configType: 'Y' },
|
||||
@@ -225,40 +330,88 @@ const handleSave = async () => {
|
||||
let successCount = 0;
|
||||
let failedParams = [];
|
||||
|
||||
// 调用系统配置API保存每个参数
|
||||
for (const config of configData) {
|
||||
try {
|
||||
// 先查询是否存在该配置
|
||||
const existingConfig = await getConfigKey(config.configKey, { skipErrorMsg: true });
|
||||
|
||||
if (existingConfig.data && existingConfig.data.configId) {
|
||||
// 如果存在则更新,保留原有数据的configId
|
||||
await updateConfig({
|
||||
...config,
|
||||
configId: existingConfig.data.configId,
|
||||
createTime: existingConfig.data.createTime, // 保留创建时间
|
||||
remark: existingConfig.data.remark || '收费系统配置参数' // 保留或设置默认备注
|
||||
});
|
||||
} else {
|
||||
// 如果不存在则新增,添加默认备注
|
||||
await addConfig({
|
||||
...config,
|
||||
remark: '收费系统配置参数'
|
||||
});
|
||||
try {
|
||||
// 先获取所有配置,避免重复调用API
|
||||
const allConfigsResponse = await listConfig({ pageSize: 1000 });
|
||||
console.log('handleSave - listConfig返回完整结果:', JSON.stringify(allConfigsResponse));
|
||||
|
||||
// 检查返回结果结构
|
||||
let allConfigs = [];
|
||||
if (allConfigsResponse.code === 200) {
|
||||
if (allConfigsResponse.data && Array.isArray(allConfigsResponse.data)) {
|
||||
allConfigs = allConfigsResponse.data;
|
||||
} else if (allConfigsResponse.data && allConfigsResponse.data.rows) {
|
||||
allConfigs = allConfigsResponse.data.rows;
|
||||
} else if (Array.isArray(allConfigsResponse.rows)) {
|
||||
allConfigs = allConfigsResponse.rows;
|
||||
} else if (Array.isArray(allConfigsResponse)) {
|
||||
allConfigs = allConfigsResponse;
|
||||
}
|
||||
successCount++;
|
||||
} catch (paramError) {
|
||||
console.error(`保存参数 ${config.configName} (${config.configKey}) 失败:`, paramError);
|
||||
failedParams.push(config.configName);
|
||||
// 继续处理下一个参数,不中断整体流程
|
||||
}
|
||||
|
||||
console.log('handleSave - 最终获取到的所有配置:', allConfigs);
|
||||
console.log('handleSave - 配置总数:', allConfigs.length);
|
||||
|
||||
// 构建配置项映射表,方便快速查找
|
||||
const configMap = new Map();
|
||||
allConfigs.forEach(config => {
|
||||
configMap.set(config.configKey, config);
|
||||
console.log('handleSave - 添加到映射表:', config.configKey);
|
||||
});
|
||||
|
||||
// 调用系统配置API保存每个参数
|
||||
for (const config of configData) {
|
||||
try {
|
||||
const existingConfig = configMap.get(config.configKey);
|
||||
|
||||
console.log(`处理参数: ${config.configName} (${config.configKey})`);
|
||||
console.log(`现有配置:`, existingConfig);
|
||||
console.log(`要保存的值:`, config.configValue);
|
||||
|
||||
if (existingConfig && existingConfig.configId) {
|
||||
// 如果存在则更新,保留原有数据的configId和创建时间
|
||||
console.log(`更新参数 ${config.configKey},使用configId: ${existingConfig.configId}`);
|
||||
const updateResult = await updateConfig({
|
||||
...config,
|
||||
configId: existingConfig.configId,
|
||||
createTime: existingConfig.createTime,
|
||||
remark: existingConfig.remark || '收费系统配置参数',
|
||||
configType: existingConfig.configType || 'N'
|
||||
});
|
||||
console.log(`更新结果:`, updateResult);
|
||||
} else {
|
||||
// 如果不存在则新增,添加默认备注
|
||||
console.log(`新增参数 ${config.configKey}`);
|
||||
const addResult = await addConfig({
|
||||
...config,
|
||||
remark: '收费系统配置参数',
|
||||
configType: 'N'
|
||||
});
|
||||
console.log(`新增结果:`, addResult);
|
||||
}
|
||||
successCount++;
|
||||
} catch (paramError) {
|
||||
console.error(`保存参数 ${config.configName} (${config.configKey}) 失败:`, paramError);
|
||||
console.error(`错误详情:`, paramError.response || paramError);
|
||||
failedParams.push(config.configName);
|
||||
// 继续处理下一个参数,不中断整体流程
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取配置列表失败:', error);
|
||||
ElMessage.error('获取配置列表失败,无法保存参数');
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据保存结果显示相应消息
|
||||
if (failedParams.length === 0) {
|
||||
ElMessage.success(`所有 ${successCount} 个参数保存成功`);
|
||||
ElMessage.success(`保存成功`);
|
||||
// 保存成功后重新加载数据,确保页面显示最新配置
|
||||
loadConfigData(false); // 不显示加载成功消息
|
||||
} else if (successCount > 0) {
|
||||
ElMessage.warning(`${successCount} 个参数保存成功,但以下 ${failedParams.length} 个参数保存失败: ${failedParams.join(', ')}`);
|
||||
// 部分成功也重新加载数据
|
||||
loadConfigData(false); // 不显示加载成功消息
|
||||
} else {
|
||||
ElMessage.error(`所有参数保存失败,请检查系统配置`);
|
||||
}
|
||||
@@ -300,23 +453,96 @@ const handleClose = () => {
|
||||
.form-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 15px;
|
||||
flex-wrap: nowrap; /* 禁止行内元素换行 */
|
||||
overflow-x: hidden; /* 防止溢出 */
|
||||
}
|
||||
|
||||
.config-form .el-form-item {
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
margin-right: 60px; /* 增加间距 */
|
||||
min-width: 350px; /* 增加最小宽度 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0; /* 禁止压缩 */
|
||||
}
|
||||
|
||||
/* 紧凑表单样式 */
|
||||
.compact-form {
|
||||
label-width: 150px !important;
|
||||
}
|
||||
|
||||
.compact-form .el-form-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 所有表单标签的统一样式 */
|
||||
.config-form .el-form-item__label {
|
||||
font-weight: 500;
|
||||
width: 120px;
|
||||
width: 220px !important; /* 足够宽的标签宽度 */
|
||||
text-align: right;
|
||||
padding-right: 15px;
|
||||
white-space: nowrap !important; /* 强制不换行 */
|
||||
overflow: visible !important; /* 允许内容溢出(确保不截断) */
|
||||
text-overflow: clip !important; /* 不显示省略号 */
|
||||
flex-shrink: 0 !important; /* 禁止压缩 */
|
||||
font-size: 14px !important; /* 统一字体大小 */
|
||||
line-height: 32px !important; /* 统一行高 */
|
||||
height: 32px !important; /* 统一高度 */
|
||||
margin: 0 !important; /* 清除默认边距 */
|
||||
padding: 0 15px 0 0 !important; /* 统一内边距 */
|
||||
}
|
||||
|
||||
/* 复选框标签样式 */
|
||||
.compact-form .el-form-item[checkbox-label] .el-form-item__label {
|
||||
padding-right: 10px;
|
||||
width: 150px !important;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.compact-form .el-form-item[checkbox-label] .el-form-item__content {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
/* 自定义复选框标签容器 */
|
||||
.checkbox-label-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.checkbox-label-container span {
|
||||
font-size: 14px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 空标签的样式,用于对齐 */
|
||||
.config-form .el-form-item__label:empty {
|
||||
width: 18px !important;
|
||||
padding-right: 5px !important;
|
||||
}
|
||||
|
||||
.config-form .el-form-item--medium .el-form-item__content {
|
||||
line-height: 28px;
|
||||
line-height: 32px;
|
||||
flex-shrink: 0;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.config-form .el-checkbox {
|
||||
margin-left: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 确保输入框与标签对齐 */
|
||||
.config-form .el-input {
|
||||
height: 32px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.config-form .el-input__wrapper {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
|
||||
Reference in New Issue
Block a user