| | |
| | | <script lang="ts" setup> |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | |
| | |
| | | |
| | | const open = ref(false); // 弹窗是否打开 |
| | | const multiple = ref(false); // 是否多选;默认按单选选择器使用 |
| | | const selectedRows = ref<MesProWorkOrderApi.WorkOrder[]>([]); // 已选工单列表 |
| | | const preSelectedIds = ref<number[]>([]); // 预选工单编号列表 |
| | | const selectedRows = ref<MesProWorkOrderApi.WorkOrder[]>([]); // 已选订单列表 |
| | | const preSelectedIds = ref<number[]>([]); // 预选订单编号列表 |
| | | |
| | | const typeTip = computed(() => { |
| | | if (props.type === undefined) { |
| | | return ''; |
| | | } |
| | | return `仅展示【${getDictLabel(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, props.type)}】类型的工单`; |
| | | return `仅展示【${getDictLabel(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, props.type)}】类型的订单`; |
| | | }); |
| | | |
| | | /** 获取多选记录,包含 VXE reserve 跨页记录 */ |
| | |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** 回显预选工单 */ |
| | | /** 回显预选订单 */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | /** 打开工单选择弹窗 */ |
| | | /** 打开订单选择弹窗 */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean }, |
| | |
| | | await applyPreSelection(); |
| | | } |
| | | |
| | | /** 关闭工单选择弹窗 */ |
| | | /** 关闭订单选择弹窗 */ |
| | | function closeModal() { |
| | | open.value = false; |
| | | } |
| | | |
| | | /** 确认选择工单 */ |
| | | /** 确认选择订单 */ |
| | | function handleConfirm() { |
| | | const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value; |
| | | if (rows.length === 0) { |
| | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | title="生产工单选择" |
| | | title="生产订单选择" |
| | | width="80%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | |
| | | show-icon |
| | | class="!mb-3" |
| | | /> |
| | | <Grid table-title="生产工单列表" /> |
| | | <Grid table-title="生产订单列表" /> |
| | | <template #footer> |
| | | <Button @click="closeModal">取消</Button> |
| | | <Button type="primary" @click="handleConfirm">确定</Button> |