AirVolumeMonitor.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 :api="fetchOptions" @change="selectDeviceByID">
  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. <PictorialBar :option="chartOption" series-prop-type="y" x-axis-prop-type="x" :chart-data="chartData" height="100%" />
  13. <!-- <div class="flex justify-around mt-10px">
  14. <MiniBoard v-for="item in configs" :key="item.prop" :label="item.label" :value="selectedDevice[item.prop]" />
  15. </div> -->
  16. </ModuleBasic>
  17. </template>
  18. <script lang="ts" setup>
  19. import { computed, onMounted, ref } from 'vue';
  20. import PictorialBar from '/@/components/chart/PictorialBar.vue';
  21. import { EChartsOption, graphic } from 'echarts';
  22. import { useInitScene } from '../hooks/useInit';
  23. import _ from 'lodash-es';
  24. import { get } from '../../billboard/utils';
  25. import ModuleBasic from './moduleBasic.vue';
  26. // import mapComponent from './components/3Dmap/index.vue';
  27. // 设备类别,是个枚举 TODO: 将手动换为自动获取类别
  28. const devicekind = 'sys_wind';
  29. const config = ref({
  30. moduleName: '矿井风量实时监测',
  31. moduleData: {
  32. chart: {
  33. x: 'stationname',
  34. y: 'readData.m3',
  35. },
  36. },
  37. showStyle: {
  38. size: 'width:1000px;height:280px;',
  39. position: 'left:460px;top:640px;',
  40. version: 'enhanced',
  41. },
  42. });
  43. // const { config: remoteConfig, fetchConfig } = useInitConfig(devicekind);
  44. const { scene, fetchScene } = useInitScene(devicekind);
  45. const chartData = computed(() => {
  46. return scene.value.map((ele) => {
  47. return {
  48. x: get(ele, get(config.value, 'moduleData.chart.x', 'x')),
  49. y: get(ele, get(config.value, 'moduleData.chart.y', 'y')),
  50. };
  51. });
  52. });
  53. onMounted(() => {
  54. // fetchConfig();
  55. fetchScene();
  56. });
  57. // 图表的配置项
  58. const chartOption: EChartsOption = {
  59. grid: {
  60. top: 50,
  61. height: 150,
  62. },
  63. yAxis: {
  64. splitLine: {
  65. lineStyle: {
  66. color: '#ffffff',
  67. opacity: 0.3,
  68. },
  69. },
  70. },
  71. legend: { show: false },
  72. series: [
  73. {
  74. type: 'pictorialBar',
  75. name: 'pictorial element',
  76. symbol: 'circle',
  77. symbolPosition: 'end',
  78. symbolSize: [16, 16],
  79. symbolOffset: [0, -8],
  80. itemStyle: {
  81. color: '#66ffff',
  82. },
  83. data: [],
  84. },
  85. {
  86. name: 'reference bar',
  87. type: 'bar',
  88. silent: true,
  89. itemStyle: {
  90. color: new graphic.LinearGradient(0, 0, 0, 1, [
  91. { offset: 0, color: '#66ffff' },
  92. { offset: 0.2, color: '#66ffff' },
  93. { offset: 1, color: '#66ffff22' },
  94. ]),
  95. },
  96. tooltip: {
  97. show: false,
  98. },
  99. barWidth: 8,
  100. data: [],
  101. },
  102. ],
  103. textStyle: {
  104. color: '#fff',
  105. },
  106. };
  107. </script>
  108. <style scoped></style>