diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/utils/AgeCalculatorUtil.java b/openhis-server-new/core-common/src/main/java/com/core/common/utils/AgeCalculatorUtil.java index 142b9eb6..d070a0ef 100644 --- a/openhis-server-new/core-common/src/main/java/com/core/common/utils/AgeCalculatorUtil.java +++ b/openhis-server-new/core-common/src/main/java/com/core/common/utils/AgeCalculatorUtil.java @@ -37,6 +37,10 @@ public final class AgeCalculatorUtil { * 当前年龄取得(床位列表表示年龄用) */ public static String getAge(Date date) { + // 添加空值检查 + if (date == null) { + return ""; + } // 将 Date 转换为 LocalDateTime LocalDateTime dateTime = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); LocalDateTime now = LocalDateTime.now(); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/controller/CommonAppController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/controller/CommonAppController.java index 415a1095..3d70bbc8 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/controller/CommonAppController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/controller/CommonAppController.java @@ -91,7 +91,7 @@ public class CommonAppController { /** * 病区列表 * - * @return 病区列表 + * @return 病区列表 */ @GetMapping(value = "/ward-list") public R getWardList(@RequestParam(value = "orgId", required = false) Long orgId) { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java index b45e26bb..d4cba6c3 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java @@ -233,7 +233,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer // 申请时间 .setApplyTime(DateUtils.getNowDate()); supplyRequestList.add(supplyRequest); - + } // 保存 @@ -245,7 +245,7 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer List requestIdList = supplyRequestIdList.stream().map(SupplyRequest::getId).collect(Collectors.toList()); for (Long list : requestIdList) { idList.add(list.toString()); - } + } // 返回请求id return R.ok(idList, null); diff --git a/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue index 4c883c41..011ffc2a 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue @@ -647,7 +647,7 @@ import { formatDate, formatDateymd } from '@/utils/index'; import { useStore } from '@/store/store'; import useUserStore from '@/store/modules/user'; import { ElMessage } from 'element-plus'; -import { nextTick, ref, watch } from 'vue'; +import { nextTick, ref, watch, onMounted, onUnmounted } from 'vue'; import useTagsViewStore from '@/store/modules/tagsView'; import _, { isEqual } from 'lodash'; import { debounce } from 'lodash-es'; @@ -819,11 +819,21 @@ onMounted(() => { console.log(route, '!1212'); if (route.query.view) { viewStatus.value = route.query.view; + // 查看模式下,不要清空store数据,让watch监听器自然处理 } else { viewStatus.value = ''; + // 正常进入模式下,清空store数据,确保显示空表单 + store.clearCurrentData(); } - if (Object.keys(editData.value).length === 0) { - show(); + // 不再直接调用show(),而是让watch监听器根据store.currentData状态来决定 +}); + +// 关键修复:在组件卸载时清除store数据,确保离开页面后再次进入时不会显示历史记录 +onUnmounted(() => { + document.removeEventListener("click", handleClickOutside); + // 只有在非查看模式下才清除store数据 + if (!viewStatus.value) { + store.clearCurrentData(); } }); @@ -1569,38 +1579,19 @@ function handleTotalAmount() { /** 重置操作表单 */ function reset() { - // form.value = { - // id: undefined, - // name: undefined, - // categoryCode: undefined, - // cwTypeCode: undefined, - // fwTypeCode: undefined, - // specialtyCode: undefined, - // locationId: undefined, - // offeredOrgId: undefined, - // activeFlag: undefined, - // extraDetails: undefined, - // contact: undefined, - // appointmentRequiredFlag: undefined, - // chargeName: undefined, - // price: undefined, - // description: undefined, - // ybType: undefined, - // title: undefined, - // comment: undefined, - // }; - // proxy.resetForm("purchaseinventoryRef"); - - // receiptHeaderForm = { - // busNo: undefined, - // practitionerId: undefined, - // occurrenceTime: undefined, - // supplierId: undefined, - // medicationType: "1", - // purposeTypeEnum: undefined, - // }; proxy.resetForm('receiptHeaderRef'); form.purchaseinventoryList = []; + // 完全重置所有表单字段 + Object.assign(receiptHeaderForm, { + busNo: undefined, + practitionerId: undefined, + occurrenceTime: formatDate(new Date()), + supplierId: undefined, + medicationType: "1", + purposeTypeEnum: undefined + }); + // 重置编辑数据 + editData.value = {}; } // 显示弹框 function show() {