Workbench.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <script setup lang="ts">
  2. /**
  3. * 工作台(P11):页签容器。页签清单与重构前 `app.js` 的 `TABS` **完全一致**(9 个)。
  4. *
  5. * 已迁移:overview(总览)。其余页签先如实标"迁移中",不做假界面 ——
  6. * 用户令要求"逐页签迁移、对拍通过再删 Python 源码",所以未迁移的页签必须一眼可见。
  7. */
  8. import { computed } from 'vue'
  9. import { t } from '../i18n/zh'
  10. import { DONE, TABS } from '../lib/tabs'
  11. import { winName } from '../lib/render'
  12. import Component from './Component.vue'
  13. import Energy from './Energy.vue'
  14. import Fault from './Fault.vue'
  15. import Overview from './Overview.vue'
  16. const props = defineProps<{ d: any; tab: string; sys?: string | null }>()
  17. const emit = defineEmits<{ (e: 'tab', id: string): void }>()
  18. const pending = computed(() => !DONE.includes(props.tab))
  19. </script>
  20. <template>
  21. <nav class="wb-tabs">
  22. <button v-for="id in TABS" :key="id" :class="{ on: id === tab }" @click="emit('tab', id)">
  23. {{ t('tab.' + id) }}<sup v-if="!DONE.includes(id)" class="todo">迁移中</sup>
  24. </button>
  25. </nav>
  26. <div class="page-head">
  27. <h1>{{ t('tab.' + tab) }}</h1>
  28. <!-- 与旧 app.js:1066 逐字一致:`${t('win.label')} · ${winName(WIN)}`(对拍实逮:写成 win.l 第 1 项就错位) -->
  29. <span class="window-badge">{{ t('win.label') }} · {{ winName(d?.win) }}</span>
  30. </div>
  31. <Overview v-if="tab === 'overview'" :d="d" />
  32. <Energy v-else-if="tab === 'energy'" :d="d" />
  33. <Component v-else-if="tab === 'component'" :d="d" :sys="sys" />
  34. <Fault v-else-if="tab === 'fault'" :d="d" />
  35. <section v-else-if="pending" class="card">
  36. <h2>{{ t('tab.' + tab) }} <small>(本页签尚未迁移到 Vue)</small></h2>
  37. <p class="hint">
  38. 迁移纪律:页签逐个搬,每搬一个就用 <code>tools/render_parity.mjs</code> 与重构前页面
  39. (现网 <code>/detail/v2</code>)对拍文案/数值/类名序列,**通过后**才删对应的 Python 前端源码。
  40. 当前已迁移:{{ DONE.join('、') }}。
  41. </p>
  42. </section>
  43. </template>
  44. <style scoped>
  45. .wb-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
  46. .wb-tabs button {
  47. padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 4px 4px 0 0;
  48. cursor: pointer; color: var(--ink);
  49. }
  50. .wb-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
  51. .todo { font-size: 10px; color: var(--muted); margin-left: 2px; }
  52. .wb-tabs button.on .todo { color: #ffe9a8; }
  53. .page-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 18px 0; }
  54. .page-head h1 { font-size: 18px; margin: 0; }
  55. .window-badge { color: var(--muted); font-size: 12.5px; }
  56. </style>