From efd7e8ffc804f703c6686a37cabcc00ebff40d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Fri, 7 Aug 2026 14:25:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8D=AF=E5=93=81=E5=88=AB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chinese-drug-name-bubble.vue | 126 ++++++- .../warehouse-available-drug-search.vue | 39 +- .../product/_shared/drug-alias-api.ts | 45 +++ .../product/_shared/drug-detail-modal.vue | 354 ++++++++++++++++++ .../product/_shared/product-info-cell.vue | 67 +++- .../product/china-medicine/api/index.ts | 7 + .../product/china-medicine/config/form.ts | 27 ++ .../product/china-medicine/config/table.ts | 6 +- .../business/product/china-medicine/index.vue | 74 +++- .../business/product/health-food/api/index.ts | 7 + .../business/product/health-food/index.vue | 50 ++- .../product/medical-device/api/index.ts | 7 + .../business/product/medical-device/index.vue | 50 ++- .../business/product/non-drug/api/index.ts | 7 + .../views/business/product/non-drug/index.vue | 46 ++- .../product/service-pack/api/index.ts | 7 + .../business/product/service-pack/index.vue | 46 ++- .../product/western-medicine/api/index.ts | 7 + .../product/western-medicine/config/form.ts | 27 ++ .../product/western-medicine/index.vue | 50 ++- .../admin/config/table.ts | 4 +- .../warehouse-drug-management/admin/index.vue | 15 + .../components/WarehouseDrugNameCell.vue | 58 +++ .../shop/config/table.ts | 4 +- .../warehouse-drug-management/shop/index.vue | 15 + .../store/config/table.ts | 4 +- .../warehouse-drug-management/store/index.vue | 15 + .../medical-record/MedicalRecordPanel.vue | 25 +- .../components/EntryKeywordBubble.vue | 27 +- 29 files changed, 1158 insertions(+), 58 deletions(-) create mode 100644 apps/web-antd/src/views/business/product/_shared/drug-alias-api.ts create mode 100644 apps/web-antd/src/views/business/product/_shared/drug-detail-modal.vue create mode 100644 apps/web-antd/src/views/business/warehouse-drug-management/shared/components/WarehouseDrugNameCell.vue diff --git a/apps/web-antd/src/components/chinese-drug-name-bubble/chinese-drug-name-bubble.vue b/apps/web-antd/src/components/chinese-drug-name-bubble/chinese-drug-name-bubble.vue index 9574794c..02c7a87a 100644 --- a/apps/web-antd/src/components/chinese-drug-name-bubble/chinese-drug-name-bubble.vue +++ b/apps/web-antd/src/components/chinese-drug-name-bubble/chinese-drug-name-bubble.vue @@ -2,7 +2,8 @@ /** * 中药药名气泡选择器 * - 对齐诊断/医嘱 EntryKeywordBubble:Input 聚焦弹出 Teleport 浮层 - * - 远程搜索药品(getProductListDoctorReception),拼音/名称高亮 + * - 远程搜索药品(getProductListDoctorReception),支持药名/别名/首拼/全拼/数字 + * - 列表展示拼音列;命中别名时展示匹配别名及其拼音 * - 选中后回传完整商品行,供接诊/复诊/特色方/常用方复用现有落库逻辑 */ import { @@ -65,11 +66,11 @@ const emit = defineEmits<{ select: [item: ChineseDrugBubbleItem]; }>(); -const ROW_HEIGHT = 44; +const ROW_HEIGHT = 48; const HINT_HEIGHT = 34; const HEAD_HEIGHT = 32; const PANEL_PAD = 8; -const PREFERRED_PANEL = 320; +const PREFERRED_PANEL = 360; const containerRef = ref(null); const panelRef = ref(null); @@ -127,6 +128,31 @@ function drugNameOf(item: ChineseDrugBubbleItem): string { return String(item?.drug?.drug_name || item?.drug_name || '').trim(); } +/** 关键词命中的别名(后端 matched_alias) */ +function matchedAliasOf(item: ChineseDrugBubbleItem): string { + return String( + item?.matched_alias || item?.drug?.matched_alias || '', + ).trim(); +} + +/** + * 拼音展示:命中别名时用别名拼音,否则用药名首拼(全拼) + */ +function pinyinLabelOf(item: ChineseDrugBubbleItem): string { + const aliasPy = String( + item?.matched_alias_pinyin || item?.drug?.matched_alias_pinyin || '', + ).trim(); + if (matchedAliasOf(item) && aliasPy) return aliasPy; + const display = String(item?.drug?.pinyin_display || '').trim(); + if (display) return display; + const simple = String(item?.drug?.pinyin_simple || '').trim(); + const full = String(item?.drug?.pinyin_full || '').trim(); + if (simple && full && simple.toLowerCase() !== full.toLowerCase()) { + return `${simple}(${full})`; + } + return simple || full || '-'; +} + function unitLabelOf(item: ChineseDrugBubbleItem): string { const unit = item?.drug?.unit || item?.unit; if (typeof unit === 'object' && unit?.name) return String(unit.name); @@ -155,7 +181,8 @@ function updatePanelPlacement() { const panelMax = Math.min(PREFERRED_PANEL, avail); listViewportH.value = Math.max(80, panelMax - HINT_HEIGHT - HEAD_HEIGHT); - const PANEL_MIN_WIDTH = 420; + // 含拼音列后加宽,避免别名/全拼被裁切 + const PANEL_MIN_WIDTH = 560; const width = Math.min( Math.max(rect.width, PANEL_MIN_WIDTH), vw - PANEL_PAD * 2, @@ -228,9 +255,13 @@ async function fetchDrugs(kw: string) { (it) => drugNameOf(it), (it) => [ - it.drug?.pinyin, + it.drug?.pinyin_simple, it.drug?.pinyin_full, - it.drug?.initials_of_pinyin, + it.drug?.pinyin_display, + it.drug?.drug_alias, + it.matched_alias || it.drug?.matched_alias, + it.matched_alias_pinyin || it.drug?.matched_alias_pinyin, + it.drug?.search_digits, it.drug?.specification, ] .map((v) => String(v || '')) @@ -440,7 +471,9 @@ defineExpose({ v-if="!loading && options.length === 0" :image="Empty.PRESENTED_IMAGE_SIMPLE" :description=" - keyword.trim() ? '未找到匹配药材' : '请输入药名/拼音搜索' + keyword.trim() + ? '未找到匹配药材' + : '请输入药名/别名/拼音/数字搜索' " class="py-4" /> @@ -450,6 +483,7 @@ defineExpose({ :class="{ 'has-score': !!keyword.trim() }" > 药名 + 拼音 规格/单位 价格 匹配度 @@ -480,13 +514,47 @@ defineExpose({ @mousedown.prevent="selectItem(item)" @mouseenter="highlightIndex = index" > - - + + + + + + + + + + +