| | |
| | | try { |
| | | const [result, counts] = await Promise.all([ |
| | | getWorkstationPage({ pageNo: 1, pageSize: 200 }), |
| | | getPendingFeedbackCountByWorkstation().catch(() => null), |
| | | getPendingFeedbackCountByWorkstation(true).catch(() => null), |
| | | ]); |
| | | workstations.value = result.list ?? []; |
| | | pendingCounts.value = counts; |
| | |
| | | return pendingCounts.value?.[String(ws.id)] ?? 0; |
| | | } |
| | | |
| | | /** 过滤后的工作站 */ |
| | | /** 过滤后的工作站:仅展示当前用户有可报工任务的;统计失败时不过滤,避免全部隐藏 */ |
| | | const filtered = computed(() => { |
| | | const kw = searchKeyword.value.trim().toLowerCase(); |
| | | if (!kw) return workstations.value; |
| | | return workstations.value.filter((ws) => { |
| | | if (pendingCounts.value && getPendingCount(ws) <= 0) return false; |
| | | if (!kw) return true; |
| | | const fields = [ws.code, ws.name, ws.processName, ws.workshopName, ws.address]; |
| | | return fields.some((f) => String(f ?? '').toLowerCase().includes(kw)); |
| | | }); |
| | | }); |
| | | |
| | | /** 空状态文案 */ |
| | | const emptyText = computed(() => { |
| | | if (!pendingCounts.value) return '暂无工作站数据'; |
| | | if (searchKeyword.value.trim()) return '没有匹配的工作站'; |
| | | return '暂无可报工的工作站'; |
| | | }); |
| | | |
| | | /** 选择工作站 */ |
| | |
| | | <!-- 空状态 --> |
| | | <div v-if="!filtered.length && !loading" class="ws-select__empty"> |
| | | <IconifyIcon icon="lucide:inbox" class="ws-select__empty-icon" /> |
| | | <p>暂无工作站数据</p> |
| | | <p>{{ emptyText }}</p> |
| | | </div> |
| | | |
| | | <!-- 卡片网格 --> |