| | |
| | | |
| | | import { IconifyIcon } from '@vben/icons'; |
| | | |
| | | import { Input, Modal, Spin } from 'ant-design-vue'; |
| | | import { Input, message, Modal, Spin } from 'ant-design-vue'; |
| | | |
| | | import { getWorkstationPage } from '#/api/mes/md/workstation'; |
| | | import { getUnfinishedWorkstationCounts } from '#/api/mes/pro/task'; |
| | | |
| | | defineOptions({ name: 'WorkbenchWorkstationSelectDialog' }); |
| | | |
| | |
| | | const loading = ref(false); |
| | | const workstations = ref<MesMdWorkstationApi.Workstation[]>([]); |
| | | const searchKeyword = ref(''); |
| | | const pendingCounts = ref<Record<number, number>>({}); |
| | | const countsAvailable = ref(false); |
| | | |
| | | /** 打开弹窗 */ |
| | | async function open() { |
| | |
| | | async function loadWorkstations() { |
| | | loading.value = true; |
| | | try { |
| | | const result = await getWorkstationPage({ pageNo: 1, pageSize: 200 }); |
| | | pendingCounts.value = {}; |
| | | countsAvailable.value = false; |
| | | const [result, counts] = await Promise.all([ |
| | | getWorkstationPage({ pageNo: 1, pageSize: 200 }), |
| | | getUnfinishedWorkstationCounts().catch(() => { |
| | | message.warning('未能获取工作站任务数量'); |
| | | return null; |
| | | }), |
| | | ]); |
| | | workstations.value = result.list ?? []; |
| | | if (counts) { |
| | | pendingCounts.value = Object.fromEntries(counts.map((item) => [item.workstationId, item.pendingCount])); |
| | | countsAvailable.value = true; |
| | | } |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | |
| | | </span> |
| | | </div> |
| | | <div class="ws-card__name">{{ ws.name }}</div> |
| | | <div class="ws-card__info-row">未完成任务:{{ countsAvailable ? (pendingCounts[ws.id!] ?? 0) : '—' }} 条</div> |
| | | <div class="ws-card__info"> |
| | | <div v-if="ws.workshopName" class="ws-card__info-row"> |
| | | <IconifyIcon icon="lucide:building-2" class="ws-card__info-icon" /> |