diff --git a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue index 4bc29baa..8ecc11bf 100644 --- a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue +++ b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue @@ -53,6 +53,7 @@ import CommonPrescriptionModal from '#/views/doctor/doctor-reception/components/ // 信息提示模态框 import InfoModal from '#/components/modal/InfoModal.vue'; // 药品搜索选择组件 +import { DrugSearchSelect } from '#/components/drug-search-select'; import { formatPriceDisplay } from '#/utils/formatPrice'; import ChineseMedicineConfig from '#/views/doctor/doctor-reception/components/ChineseMedicineConfig.vue'; @@ -90,6 +91,11 @@ const allowInsuranceCategory = computed( () => Number(prescriptionStore.registerStoreInfo?.allow_insurance_category ?? 0) === 1, ); +/** 仅中药/西药支持常用方模板(保健食品等不提供常用方) */ +const canUseCommonPrescription = computed(() => + [1, 2].includes(prescriptionStore.activeCategory), +); + watch(allowInsuranceCategory, (allow) => { if (!allow) { prescriptionStore.category = 1; @@ -422,6 +428,10 @@ const filterOption = (input: string, option: any) => { * @description 打开常用方弹窗,选择后自动填充药品到处方中 */ function openCommonPrescriptionModal() { + if (!canUseCommonPrescription.value) { + message.warning('当前分类不支持选择常用方'); + return; + } CommonPrescriptionModalApi.setData({ type: prescriptionStore.activeCategory, onSelect: handleSelectCommonPrescription, @@ -522,7 +532,7 @@ async function handleSelectCommonPrescription(data: any, type: number) { } // 保存到本地存储 - prescriptionStore.saveToLocalStorage(); + prescriptionStore.syncToLocalStorage(); message.success('已选择常用方,药品已填充到处方中'); } @@ -533,6 +543,10 @@ async function handleSelectCommonPrescription(data: any, type: number) { * @description 检查是否有药品可保存,然后打开弹窗 */ const openSaveCommonPrescriptionModal = () => { + if (!canUseCommonPrescription.value) { + message.warning('当前分类不支持保存为常用方'); + return; + } // 检查是否有药品 if (prescriptionStore.currentDrugs.length === 0) { message.warning('请先添加药品后再保存为常用方'); @@ -576,7 +590,7 @@ function handleSimpleProductSelect(drug: any) { prescriptionStore.currentDrugs.push(newProduct); // 更新本地存储 - prescriptionStore.saveToLocalStorage(); + prescriptionStore.syncToLocalStorage(); // 提示成功 message.success(`已将${newProduct.drug_name}添加到清单中!`); @@ -600,6 +614,11 @@ const saveAsCommonPrescription = async () => { return; } + if (!canUseCommonPrescription.value) { + message.warning('当前分类不支持保存为常用方'); + return; + } + isSavingCommonPrescription.value = true; try { @@ -875,6 +894,7 @@ const cancelSaveCommonPrescription = () => {