| | |
| | | |
| | | import { computed, nextTick, ref } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '..\..\..\..\..\packages\constants\src'; |
| | | import { getDictLabel } from '..\..\..\..\..\packages\effects\hooks\src'; |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictLabel } from '@vben/hooks'; |
| | | |
| | | import { Alert, Button, message, Modal } from 'ant-design-vue'; |
| | | |
| | |
| | | defineProps<{ |
| | | status?: number; |
| | | type?: number; |
| | | checkMethod?: (row: MesProWorkOrderApi.WorkOrder) => boolean; |
| | | }>(), |
| | | { |
| | | status: undefined, |
| | | type: undefined, |
| | | checkMethod: undefined, |
| | | }, |
| | | ); |
| | | const emit = defineEmits<{ |
| | |
| | | |
| | | 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; |
| | |
| | | highlight: true, |
| | | range: true, |
| | | reserve: true, |
| | | checkMethod: props.checkMethod ? ({ row }) => props.checkMethod!(row) : undefined, |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | checkMethod: props.checkMethod ? ({ row }) => props.checkMethod!(row) : undefined, |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | |
| | | } |
| | | } |
| | | |
| | | /** 打开工单选择弹窗 */ |
| | | /** 打开订单选择弹窗 */ |
| | | 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> |