| | |
| | | <script lang="ts" setup> |
| | | <script lang="ts" setup> |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | |
| | | allowClear: true, |
| | | disabled: false, |
| | | modelValue: undefined, |
| | | placeholder: '请选择工单', |
| | | placeholder: '请选择订单', |
| | | status: undefined, |
| | | type: undefined, |
| | | }, |
| | |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); // 透传属性 |
| | | const dialogRef = ref<InstanceType<typeof ProWorkOrderSelectDialog>>(); // 工单选择弹窗 |
| | | const dialogRef = ref<InstanceType<typeof ProWorkOrderSelectDialog>>(); // 订单选择弹窗 |
| | | const hovering = ref(false); // 是否悬停 |
| | | const selectedItem = ref<MesProWorkOrderApi.WorkOrder>(); // 当前选中工单 |
| | | const selectedItem = ref<MesProWorkOrderApi.WorkOrder>(); // 当前选中订单 |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.code ?? ''); // 选择器展示编码 |
| | | const showClear = computed( |
| | |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** 根据编号单条查询工单信息(用于编辑回显) */ |
| | | /** 根据编号单条查询订单信息(用于编辑回显) */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** 清空已选工单 */ |
| | | /** 清空已选订单 */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** 打开工单选择弹窗 */ |
| | | /** 打开订单选择弹窗 */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |