DustStatus.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <CommonTitle class="mb-10px" label="矿井粉尘风险性等级" :value="risk" />
  3. <CollapseTable :columns="DUST_STATUS_COLUMN" :data="tableData" :collapses="DUST_COLLAPSES" />
  4. </template>
  5. <script lang="ts" setup>
  6. import CollapseTable from './CollapseTable.vue';
  7. import CommonTitle from './CommonTitle.vue';
  8. import { BillboardType, DEFAULT_TEST_DATA, DUST_STATUS_COLUMN, DUST_COLLAPSES } from '../billboard.data';
  9. import { ref, shallowRef, onMounted } from 'vue';
  10. import { get } from '../utils';
  11. // import mapComponent from './3Dmap/index.vue';
  12. const props = withDefaults(
  13. defineProps<{
  14. data?: BillboardType;
  15. }>(),
  16. {
  17. data: () => DEFAULT_TEST_DATA,
  18. }
  19. );
  20. const risk = ref('低风险');
  21. const tableData = shallowRef<any[]>([]);
  22. function fetchData() {
  23. const info = props.data.dustInfo;
  24. if (!info) return;
  25. const trans = {
  26. 0: '低风险',
  27. 101: '低风险',
  28. 102: '一般风险',
  29. 103: '较大风险',
  30. 104: '重大风险',
  31. 201: '报警',
  32. 1001: '网络断开',
  33. };
  34. risk.value = trans[get(info, 'dustWarnLevel', 0)];
  35. tableData.value = get(info, 'dustTypeList', []).map((e) => {
  36. return {
  37. ...e,
  38. warnLevelStr: trans[e.warnLevel],
  39. };
  40. });
  41. }
  42. onMounted(() => {
  43. fetchData();
  44. });
  45. </script>
  46. <style lang="less" scoped></style>