VentilateAnalysis.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <ModuleBasic :title="config.moduleName" :version="config.showStyle?.version" :size="config.showStyle?.size" :position="config.showStyle?.position">
  4. <CostumeHeader v-model:value="selectedDeviceID" :options="options">
  5. <!-- <div class="w-200px flex flex-items-center">
  6. <RightCircleOutlined class="w-30px" />
  7. <div class="flex-grow-1">
  8. {{ selectedDevice.strinstallpos }}
  9. </div>
  10. </div> -->
  11. </CostumeHeader>
  12. <Pie :option="chartOption" :chart-data="chartData" height="140px" />
  13. <div class="flex justify-around mt-10px">
  14. <MiniBoard
  15. v-for="(label, prop) in config.moduleData?.main"
  16. :key="`vhccva-${prop}`"
  17. :label="label"
  18. :value="get(selectedDevice, prop)"
  19. layout="label-top"
  20. type="D"
  21. />
  22. </div>
  23. </ModuleBasic>
  24. </template>
  25. <script lang="ts" setup>
  26. import CostumeHeader from './CostumeHeader.vue';
  27. import { computed, onMounted, ref } from 'vue';
  28. import Pie from '/@/components/chart/Pie.vue';
  29. import { EChartsOption } from 'echarts';
  30. import { useInitDevices } from '../hooks/useInit';
  31. import { get } from '../../billboard/utils';
  32. import _ from 'lodash-es';
  33. import MiniBoard from './MiniBoard.vue';
  34. import ModuleBasic from './moduleBasic.vue';
  35. // import mapComponent from './components/3Dmap/index.vue';
  36. // 设备类别,是个枚举 TODO: 将手动换为自动获取类别
  37. const devicekind = 'sys_majorpath';
  38. const config = ref({
  39. moduleName: '关键通风路线', // 通风系统监测与分析
  40. moduleData: {
  41. main: {
  42. // m3_total: '总风量',
  43. // drag_total: '总阻力',
  44. // dengjikong: '等积孔',
  45. 'majorpath.drag_1': '阻力1',
  46. 'majorpath.drag_2': '阻力2',
  47. 'majorpath.drag_3': '阻力3',
  48. },
  49. chart: {
  50. 'majorpath.drag_1': '阻力1',
  51. 'majorpath.drag_2': '阻力2',
  52. 'majorpath.drag_3': '阻力3',
  53. },
  54. },
  55. showStyle: {
  56. size: 'width:450px;height:280px;',
  57. position: 'right:0px;top:60px;',
  58. version: 'enhanced',
  59. },
  60. });
  61. // const { config: remoteConfig, fetchConfig } = useInitConfig(devicekind);
  62. const { options, selectedDevice, selectedDeviceID, fetchDevices } = useInitDevices(devicekind);
  63. onMounted(() => {
  64. // fetchConfig();
  65. fetchDevices();
  66. });
  67. const chartData = computed(() => {
  68. return _.map(config.value.moduleData?.chart || [], (label, prop) => {
  69. return {
  70. value: parseInt(get(selectedDevice.value, prop, 0)),
  71. name: label,
  72. };
  73. });
  74. });
  75. onMounted(() => {});
  76. // 图表配置项
  77. const chartOption: EChartsOption = {
  78. series: [
  79. {
  80. type: 'pie',
  81. radius: ['50%', '75%'],
  82. center: ['50%', '55%'],
  83. data: [],
  84. labelLine: { show: false },
  85. label: {
  86. show: false,
  87. // formatter: '{b} \n ({d}%)',
  88. // color: '#B1B9D3',
  89. },
  90. itemStyle: {
  91. shadowBlur: 20,
  92. shadowColor: '#259bcf',
  93. },
  94. },
  95. ],
  96. color: ['#d9a1ff', '#00d1ff', '#82fe78'],
  97. };
  98. </script>
  99. <style scoped></style>