he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<script>
import ScienceBox from "@/components/ScienceBox.vue";
import getItemByKey from "@/assets/js/tools/getItemByKey";
 
export default {
  name: "DiagramToolsBox",
  components: {ScienceBox},
  props: {
    list: {
      type: Array,
      default() {
        return []
      }
    },
  },
  computed: {
    tools() {
      return this.list.map(item=>{
        const itemValue = getItemByKey(item.value, item.list);
        const text = itemValue.label;
        return {
          label: item.label,
          value: text,
          item: itemValue
        };
      });
    }
  }
}
</script>
 
<template>
  <science-box style="position: relative" no-header>
    <div class="hdw-state-list table-layout">
      <div class="table-row" v-for="(item, key) in tools" :key="'key'+key">
        <div class="table-cell text-right">{{ item.label }}</div>
        <div class="table-cell" :class="{'flashing': item.item.flashing}">{{ item.value }}</div>
      </div>
    </div>
  </science-box>
</template>
 
<style scoped lang="less">
.table-row {
  .table-cell {
    padding: 4px 0;
    &.text-right {
      padding-right: 4px;
    }
    &.flashing {
      color: #FF3801;
    }
  }
}
</style>