substationJc.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="substationJc">
  3. <div class="substation-box" v-for="(item, index) in substationList" :key="index">
  4. <div class="substation-title">{{ item.title }}</div>
  5. <div class="substation-label">{{ item.label }}</div>
  6. <div class="substation-val">{{ `${item.val}${item.dw}` || '--' }}</div>
  7. <div class="substation-val">{{ item.warn=='1' ? '报警' : '正常' }}</div>
  8. <div class="substation-val">{{ item.levels==1 ? '低风险' : item.levels==2 ? '一般风险' : item.levels==3 ? '较大风险' : item.levels==4 ? '重大风险' : '--' }}</div>
  9. </div>
  10. </div>
  11. </template>
  12. <script setup lang="ts">
  13. import { ref, reactive, defineProps, watch } from 'vue';
  14. let props = defineProps({
  15. substationData: {
  16. type: Array,
  17. default: () => {
  18. return []
  19. }
  20. }
  21. })
  22. let substationList = ref<any[]>([]);
  23. watch(() => props.substationData, (newS, oldS) => {
  24. console.log(newS, 'newS--------')
  25. if (newS.length != 0) {
  26. substationList.value = newS
  27. }
  28. }, { immediate: true, deep: true })
  29. </script>
  30. <style lang="less" scoped>
  31. .substationJc {
  32. display: flex;
  33. position: relative;
  34. flex-direction: column;
  35. align-items: center;
  36. justify-content: center;
  37. width: 100%;
  38. height: 100%;
  39. .substation-box {
  40. display: flex;
  41. box-sizing: border-box;
  42. width: 90%;
  43. height: 145px;
  44. padding-top: 30px;
  45. background: url('../../../../../assets/images/fire/firehome/list.png') no-repeat bottom;
  46. background-size: 100% 100%;
  47. color: #fff;
  48. font-size: 14px;
  49. .substation-title {
  50. display: flex;
  51. flex: 1;
  52. justify-content: center;
  53. height: 100%;
  54. font-size: 12px;
  55. }
  56. .substation-label {
  57. display: flex;
  58. flex: 1;
  59. justify-content: center;
  60. height: 100%;
  61. font-size: 12px;
  62. }
  63. .substation-val {
  64. display: flex;
  65. flex: 1;
  66. justify-content: center;
  67. height: 100%;
  68. color: #089dff;
  69. }
  70. }
  71. }
  72. </style>