riku
2025-03-12 42f42dc88214f283b43c422f37e10ab45c5c5578
src/components/monitor/FactorTrend.vue
@@ -2,18 +2,6 @@
  <BaseCard size="medium" direction="left">
    <template #content>
      <el-scrollbar height="calc(98vh - var(--bevel-length-2))">
        <!-- <div v-for="item in factorTypes" :key="item">
          <el-row>
            <div>{{ allSeries.get(item.value).name }}</div>
            <div>{{ allSeries.get(item.value).currentData }}</div>
            <div>{{ allSeries.get(item.value).min }}</div>
            <div>{{ allSeries.get(item.value).max }}</div>
            <RealTimeLineChart
              v-show="selectFactorType.includes(item.value)"
              :model-value="series(item.value)"
            ></RealTimeLineChart>
          </el-row>
        </div> -->
        <div v-for="item in seriesList" :key="item.key">
          <el-row
            v-show="selectFactorType.includes(item.series.key)"
@@ -22,7 +10,9 @@
          >
            <div class="flex-col">
              <div class="factor-name">{{ item.series.name }}</div>
              <div class="factor-value">{{ item.series.currentData }}</div>
              <div class="factor-value">
                {{ item.series.currentData }}
              </div>
              <div class="factor-unit">
                {{ getUnit(item.series.label) }}
              </div>
@@ -72,18 +62,8 @@
    };
  },
  computed: {
    factorTypes() {
      return checkboxOptions(this.deviceType);
    }
    // seriesList() {
    //   const list = [];
    //   for (const iterator of this.allSeries) {
    //     list.push({
    //       xAxis: this.xAxis,
    //       series: iterator[1]
    //     });
    //   }
    //   return list;
    // factorTypes() {
    //   return checkboxOptions(this.deviceType);
    // }
  },
  watch: {
@@ -163,16 +143,28 @@
    },
    toList() {
      const list = [];
      for (const iterator of this.allSeries) {
        list.push({
          xAxis: this.xAxis,
          series: iterator[1]
        });
      }
      // for (const iterator of this.allSeries) {
      //   list.push({
      //     xAxis: this.xAxis,
      //     series: iterator[1]
      //   });
      // }
      checkboxOptions(this.deviceType).forEach((t) => {
        if (this.allSeries.has(t.value)) {
          list.push({
            xAxis: this.xAxis,
            series: this.allSeries.get(t.value)
          });
        }
      });
      this.seriesList = list;
    },
    // getScaleValue(label, value) {
    //   return (factorUnit[label].scale * value).toFixed();
    // },
    getUnit(label) {
      return factorUnit[label];
      // fixeme 2024.5.15 修复CO展示单位和原始数据不一致问题
      return label == 'CO' ? 'μg/m³' : factorUnit[label].unit;
    }
  }
};
@@ -193,7 +185,7 @@
}
.factor-name {
  color: var(--el-color-warning);
  color: #23dad1;
}
.factor-unit {