1. 对账单、订单的改良
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
@@ -17,6 +17,10 @@ import { debounce } from 'lodash-es';
|
||||
|
||||
import { getProductListDoctorReception } from '#/views/doctor/doctor-reception/api';
|
||||
|
||||
/** 中药无图时与仓库列表一致的占位图 */
|
||||
const TCM_PLACEHOLDER_IMAGE =
|
||||
'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk_upload_20250510/cd470ebf97e31c4048ba502ba71b66a3.jpg';
|
||||
|
||||
// ==================== Props 定义 ====================
|
||||
|
||||
interface Props {
|
||||
@@ -88,6 +92,12 @@ const containerRef = ref<HTMLElement | null>(null);
|
||||
*/
|
||||
const highlightIndex = ref(-1);
|
||||
|
||||
function resolveDropdownImage(item: any): string {
|
||||
if (item._image) return item._image;
|
||||
if (props.type === 1) return TCM_PLACEHOLDER_IMAGE;
|
||||
return '';
|
||||
}
|
||||
|
||||
// ==================== 方法定义 ====================
|
||||
|
||||
/**
|
||||
@@ -296,8 +306,8 @@ watch(
|
||||
<!-- 药品图片 -->
|
||||
<div class="drug-item__image">
|
||||
<img
|
||||
v-if="item._image"
|
||||
:src="item._image"
|
||||
v-if="resolveDropdownImage(item)"
|
||||
:src="resolveDropdownImage(item)"
|
||||
alt=""
|
||||
class="drug-item__img"
|
||||
@error="(e) => (e.target as HTMLImageElement).style.display = 'none'"
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<script lang="ts" setup>
|
||||
/**
|
||||
* 超级仓库 Admin:选品字段,与常用方「药品搜索」一致(DrugSearchSelect)
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
|
||||
import { DrugSearchSelect } from '#/components/drug-search-select';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** vben-form:药品 ID */
|
||||
value?: number;
|
||||
/** 列表筛选类型:1 中药,2 西药 */
|
||||
productType?: number;
|
||||
}>(),
|
||||
{
|
||||
productType: 1,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:value': [value: number | undefined];
|
||||
}>();
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const selectedLabel = ref('');
|
||||
|
||||
const searchType = computed(() => (props.productType === 2 ? 2 : 1));
|
||||
|
||||
const storeId = computed(() => userStore.userInfo?.store_id ?? 2);
|
||||
|
||||
const placeholder = computed(() => {
|
||||
const name = props.productType === 2 ? '西药' : '中药';
|
||||
return `输入${name}名称搜索(显示图片、供应商、规格、价格)`;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
(v) => {
|
||||
if (v == null || v === undefined) {
|
||||
selectedLabel.value = '';
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function onSelect(drug: any) {
|
||||
const id = drug._drugId ?? drug.drug?.id ?? drug.drug_id;
|
||||
selectedLabel.value =
|
||||
drug._drugName || drug.drug?.drug_name || drug.drug_name || '';
|
||||
emit('update:value', id);
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedLabel.value = '';
|
||||
emit('update:value', undefined);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full space-y-2">
|
||||
<DrugSearchSelect
|
||||
:type="searchType"
|
||||
:store-id="storeId"
|
||||
:placeholder="placeholder"
|
||||
@select="onSelect"
|
||||
/>
|
||||
<div
|
||||
v-if="value != null"
|
||||
class="flex items-center gap-2 text-sm text-muted-foreground"
|
||||
>
|
||||
<span>已选:{{ selectedLabel || `ID ${value}` }}</span>
|
||||
<Button type="link" size="small" class="!p-0" @click="clearSelection">
|
||||
清除
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,4 +4,5 @@ export type CustomComponentType =
|
||||
| 'ApiRadioGroup'
|
||||
| 'ApiSelect'
|
||||
| 'ApiTreeSelect'
|
||||
| 'IconPicker';
|
||||
| 'IconPicker'
|
||||
| 'WarehouseAdminDrugSearch';
|
||||
|
||||
Reference in New Issue
Block a user