GasStatus.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <Row justify="space-around">
  4. <Col v-for="(item, i) in GAS_STATUS_HEADER_CONFIG" :key="`svvhbcgs${i}`" :span="10">
  5. <LargeBoard :label="item.label" :value="headerData[item.prop]" :type="item.type" />
  6. </Col>
  7. </Row>
  8. <CollapseTable class="mt-10px" :columns="GAS_STATUS_COLUMN" :data="tableData" :collapses="GAS_COLLAPSES" content-height="160px" />
  9. </template>
  10. <script lang="ts" setup>
  11. import _ from 'lodash-es';
  12. import { Row, Col } from 'ant-design-vue';
  13. import { GAS_STATUS_HEADER_CONFIG, GAS_STATUS_COLUMN, DEFAULT_TEST_DATA, GAS_COLLAPSES, BillboardType } from '../billboard.data';
  14. import LargeBoard from './LargeBoard.vue';
  15. import { onMounted, shallowRef } from 'vue';
  16. import CollapseTable from './CollapseTable.vue';
  17. import { get } from '../utils';
  18. // import mapComponent from './components/3Dmap/index.vue';
  19. const props = withDefaults(
  20. defineProps<{
  21. data?: BillboardType;
  22. }>(),
  23. {
  24. data: () => DEFAULT_TEST_DATA,
  25. }
  26. );
  27. const headerData = shallowRef({});
  28. const tableData = shallowRef<BillboardType['gasInfo']['gasTypeList']>([]);
  29. function fetchData() {
  30. const info = props.data.gasInfo;
  31. if (!info) return;
  32. const riskTrans = {
  33. 0: '低风险',
  34. 101: '低风险',
  35. 102: '普通风险',
  36. 103: '较高风险',
  37. 104: '高风险',
  38. 201: '低风险',
  39. 1001: '低风险',
  40. };
  41. const trans = {
  42. 0: '低风险',
  43. 101: '低风险',
  44. 102: '一般风险',
  45. 103: '较大风险',
  46. 104: '重大风险',
  47. 201: '报警',
  48. 1001: '网络断开',
  49. };
  50. headerData.value = {
  51. gasWarnLevel: riskTrans[get(info, 'gasWarnLevel', 0)],
  52. // gasJudgeLevel: '低风险',
  53. gasJudgeLevel: props.data.orgcode == 'sdmtjtbdmk' ? '高瓦斯' : '低瓦斯',
  54. };
  55. tableData.value = get(info, 'gasTypeList', []).map((e) => {
  56. return {
  57. ...e,
  58. warnLevelStr: trans[e.warnLevel],
  59. };
  60. });
  61. }
  62. onMounted(() => {
  63. fetchData();
  64. });
  65. </script>
  66. <style lang="less" scoped></style>