云
5 天以前 f984f80ff5d6c36af7860a17d762fe92731e28bd
src/views/mes/workbench/components/WorkstationSelectDialog.vue
@@ -36,7 +36,7 @@
  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;
@@ -50,14 +50,22 @@
  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 '暂无可报工的工作站';
});
/** 选择工作站 */
@@ -96,7 +104,7 @@
      <!-- 空状态 -->
      <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>
      <!-- 卡片网格 -->