IndicatorIncompleteBanner.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view v-if="shouldShow" class="incomplete-banner" :class="bannerClass">
  3. <text class="banner-icon">ⓘ</text>
  4. <text class="banner-text">{{ bannerText }}</text>
  5. </view>
  6. </template>
  7. <script>
  8. /**
  9. * §1.2.2 残缺横幅组件(三处复用:时间轴页 / 旧曲线页 / 报告详情页)
  10. * 硬编码文案,页面不得改写(合规要求)。
  11. */
  12. export default {
  13. name: 'IndicatorIncompleteBanner',
  14. props: {
  15. /** 该成员该 sourceType 下该指标的有值期数 */
  16. pointsCount: { type: Number, default: 0 },
  17. /** 该成员该 sourceType 下的健康报告总数 */
  18. totalReportCount: { type: Number, default: 0 }
  19. },
  20. computed: {
  21. shouldShow: function() {
  22. var n = this.pointsCount || 0
  23. var t = this.totalReportCount || 0
  24. // 数据完整:pointsCount == totalReportCount 时隐藏横幅
  25. return n < t
  26. },
  27. bannerText: function() {
  28. var n = this.pointsCount || 0
  29. var t = this.totalReportCount || 0
  30. if (n === 0 && t === 0) return '该成员暂无报告数据'
  31. if (n === 0 && t > 0) return '该成员共 ' + t + ' 份报告,本指标暂无可显示的历史数据'
  32. if (n > 0 && n < t) return '该成员共 ' + t + ' 份报告,本指标目前 ' + n + ' 期数据(历史数据整理中)'
  33. return ''
  34. },
  35. bannerClass: function() {
  36. var n = this.pointsCount || 0
  37. var t = this.totalReportCount || 0
  38. // n == 0 && t == 0 → 完全无报告 → 灰条;其余 → 橙条
  39. return n === 0 && t === 0 ? 'empty-banner' : 'incomplete-banner'
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .incomplete-banner {
  46. display: flex;
  47. align-items: flex-start;
  48. gap: 8rpx;
  49. padding: 16rpx 24rpx;
  50. margin-bottom: 16rpx;
  51. border-radius: 12rpx;
  52. font-size: calc(22rpx * var(--font-scale, 1));
  53. }
  54. .incomplete-banner .banner-text { flex: 1; }
  55. .incomplete-banner .banner-icon { flex-shrink: 0; }
  56. /* 橙条:数据不完整 */
  57. .incomplete-banner.incomplete-banner {
  58. background: $facade-fill-gray-100;
  59. color: $mat-orange-base;
  60. }
  61. /* 灰条:完全无报告 */
  62. .empty-banner {
  63. background: $facade-fill-slate-50;
  64. color: $facade-text-muted;
  65. }
  66. </style>