fix(ui): 修复多个功能模块的验证和数据处理问题

- 在医生工作站退费功能中添加患者选择验证
- 统一药品管理中的仓库类型选择逻辑,移除重复代码
- 修复统计管理页面清空按钮的数据重置问题
- 修正西药管理页面处方打印按钮的功能绑定
- 完善库存报表查询的SQL过滤条件实现
- 更新多个控制器接口参数类型以支持业务流程
- 优化退费列表对话框的数据加载和错误处理
This commit is contained in:
2026-03-02 23:27:11 +08:00
parent ce8b0b16b1
commit 9116ea4a84
22 changed files with 447 additions and 155 deletions

View File

@@ -608,14 +608,29 @@ function getList() {
}
async function printPrescription() {
// 空值检查 - 防止 tableRef 为空时报错
if (!tableRef.value) {
proxy.$modal.msgWarning("表格组件未初始化,请刷新页面重试");
return;
}
const selectedRows = tableRef.value.getSelectionRows();
if (selectedRows.length === 0) {
if (!selectedRows || selectedRows.length === 0) {
proxy.$modal.msgWarning("未选择要打印的项目,请重新选择,打印失败");
return;
}
let requestIds = selectedRows.map((item) => item.requestId).join(",");
const result = [];
advicePrint({requestIds: requestIds, isPrescription: "1"}).then(async (res) => {
try {
let requestIds = selectedRows.map((item) => item.requestId).join(",");
const result = [];
const res = await advicePrint({requestIds: requestIds, isPrescription: "1"});
if (!res || !res.data || !res.data.adviceItemList) {
proxy.$modal.msgWarning("获取打印数据失败,请稍后重试");
return;
}
const groupedRows = {};
res.data.adviceItemList.forEach((row) => {
const prescriptionNo = row.prescriptionNo;
@@ -633,8 +648,13 @@ async function printPrescription() {
// 获取所有选择数据医生的签名信息
const doctorSignatures = {};
for (const doctorId of uniqueDoctorIds) {
const signatureResult = await getDoctorSignature({practitionerId: doctorId});
doctorSignatures[doctorId] = signatureResult?.data || '';
try {
const signatureResult = await getDoctorSignature({practitionerId: doctorId});
doctorSignatures[doctorId] = signatureResult?.data || '';
} catch (e) {
console.warn('获取医生签名失败:', doctorId, e);
doctorSignatures[doctorId] = '';
}
}
// 将adviceItemList中的chineseHerbsDoseQuantity字段合并到selectedRows中
@@ -712,8 +732,12 @@ async function printPrescription() {
// 发送任务到打印机失败
hiprintTemplate.on('printError', function (e) {
console.log('打印失败');
proxy.$modal.msgError('打印失败,请检查打印机连接');
});
});
} catch (error) {
console.error('处方打印失败:', error);
proxy.$modal.msgError('处方打印失败: ' + (error.message || '未知错误'));
}
}
// 取消打印机选择