| | |
| | | |
| | | import { computed, onMounted, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { Select, SelectOption, Tag, Tooltip } from 'ant-design-vue'; |
| | | import { Select, SelectOption, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | disabled?: boolean; |
| | | excludeCodes?: string[]; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | excludeCodes: undefined, |
| | | modelValue: undefined, |
| | | placeholder: '请选择仓库', |
| | | }, |
| | |
| | | const attrs = useAttrs(); |
| | | const allList = ref<MesWmWarehouseApi.Warehouse[]>([]); |
| | | const selectedItem = ref<MesWmWarehouseApi.Warehouse>(); |
| | | |
| | | /** 按 excludeCodes 过滤后的仓库列表 */ |
| | | const filteredList = computed(() => { |
| | | if (!props.excludeCodes?.length) { |
| | | return allList.value; |
| | | } |
| | | return allList.value.filter((w) => !props.excludeCodes!.includes(w.code ?? '')); |
| | | }); |
| | | |
| | | const selectValue = computed({ |
| | | get: () => props.modelValue, |
| | |
| | | :disabled="disabled" |
| | | :filter-option="filterOption" |
| | | :placeholder="placeholder" |
| | | :popup-match-select-width="false" |
| | | show-search |
| | | @change="handleChange" |
| | | > |
| | | <SelectOption v-for="item in allList" :key="item.id" :value="item.id"> |
| | | <div class="flex items-center gap-2"> |
| | | <span>{{ item.name }}</span> |
| | | <Tag v-if="item.code" color="blue">编号: {{ item.code }}</Tag> |
| | | </div> |
| | | <SelectOption v-for="item in filteredList" :key="item.id" :value="item.id"> |
| | | {{ item.name }} |
| | | </SelectOption> |
| | | </Select> |
| | | </Tooltip> |