DustStatus.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <Result v-if="unavailble" status="error" title="网络异常" sub-title="无法获取到粉尘风险等级信息" />
  3. <template v-else>
  4. <CommonTitle class="mb-10px" label="矿井粉尘风险性等级" :value="risk" />
  5. <CollapseTable :columns="DUST_STATUS_COLUMN" :data="tableData" :collapses="DUST_COLLAPSES" />
  6. </template>
  7. </template>
  8. <script lang="ts" setup>
  9. import CollapseTable from './CollapseTable.vue';
  10. import CommonTitle from './CommonTitle.vue';
  11. import { Result } from 'ant-design-vue';
  12. import { BillboardType, DUST_STATUS_COLUMN, DUST_COLLAPSES } from '../billboard.data';
  13. import { computed } from 'vue';
  14. import { get } from '../utils';
  15. // import mapComponent from './3Dmap/index.vue';
  16. const props = defineProps<{
  17. data: Partial<BillboardType>;
  18. }>();
  19. const unavailble = computed<boolean>(() => {
  20. return props.data.dustInfo === undefined;
  21. });
  22. const risk = computed(() => {
  23. const info = props.data.dustInfo;
  24. return trans[get(info, 'dustWarnLevel', 0)];
  25. });
  26. const tableData = computed(() => {
  27. const info = props.data.dustInfo;
  28. return get(info, 'dustTypeList', []).map((e) => {
  29. return {
  30. ...e,
  31. warnLevelStr: trans[e.warnLevel],
  32. };
  33. });
  34. });
  35. const trans = {
  36. 0: '低风险',
  37. 101: '低风险',
  38. 102: '一般风险',
  39. 103: '较大风险',
  40. 104: '重大风险',
  41. 201: '报警',
  42. 1001: '网络断开',
  43. };
  44. </script>
  45. <style lang="less" scoped></style>