MonitorCenter.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="monitor-center pt-10px pl-2px pr-2px pb-10px">
  4. <div class="flex">
  5. <div class="monitor-center__item_A">
  6. <span>吨煤通风费用(元)</span>
  7. <span class="color-green">32</span>
  8. </div>
  9. <div class="monitor-center__item_B flex flex-items-center">
  10. <span>吨煤通风费用(元)</span>
  11. <span class="color-yellow">32</span>
  12. </div>
  13. </div>
  14. <div class="flex">
  15. <div class="ml-7px text-center">
  16. <span>总风量</span>
  17. <div class="number_grid">
  18. <span>1</span>
  19. <span>2</span>
  20. <span>.</span>
  21. <span>3</span>
  22. <span>4</span>
  23. </div>
  24. </div>
  25. <div class="ml-7px text-center">
  26. <span>吨煤通风</span>
  27. <div class="number_grid">
  28. <span>1</span>
  29. <span>2</span>
  30. <span>.</span>
  31. <span>3</span>
  32. <span>4</span>
  33. </div>
  34. </div>
  35. <div class="ml-7px text-center">
  36. <span>吨煤通风</span>
  37. <div class="number_grid">
  38. <span>1</span>
  39. <span>2</span>
  40. <span>.</span>
  41. <span>3</span>
  42. <span>4</span>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- <div class="justify-end monitor-center w-300px">
  48. <div class="flex">
  49. <Pie
  50. class="w-50% text-center"
  51. :option="chartOption"
  52. :chart-data="[
  53. {
  54. value: 70,
  55. name: 'A',
  56. },
  57. {
  58. value: 30,
  59. name: 'B',
  60. },
  61. ]"
  62. height="100px"
  63. />
  64. <Pie
  65. class="w-50% text-center"
  66. :option="chartOption"
  67. :chart-data="[
  68. {
  69. value: 70,
  70. name: 'A',
  71. },
  72. {
  73. value: 30,
  74. name: 'B',
  75. },
  76. ]"
  77. height="100px"
  78. />
  79. </div>
  80. </div> -->
  81. </template>
  82. <script lang="ts" setup>
  83. import { onMounted, ref } from 'vue';
  84. import { list as cfgList } from '@/views/vent/deviceManager/configurationTable/configuration.api';
  85. import { list } from '@/views/vent/deviceManager/deviceTable/device.api';
  86. import Pie from '/@/components/chart/Pie.vue';
  87. import { EChartsOption } from 'echarts';
  88. // import mapComponent from './components/3Dmap/index.vue';
  89. // 设备类别,是个枚举 TODO: 将手动换为自动获取类别
  90. const devicekind = 'fanlocal';
  91. const configs = ref<{ prop: string; label: string }[]>([]);
  92. function fetchConfig() {
  93. cfgList({
  94. deviceType: 'devicekind',
  95. }).then(({ records }) => {
  96. const moduleData = JSON.parse(records[0]?.moduleData);
  97. configs.value = Object.keys(moduleData).map((k) => {
  98. return {
  99. prop: k,
  100. label: moduleData[k],
  101. };
  102. });
  103. });
  104. }
  105. const devices = ref<any[]>([]);
  106. const selectedDevice = ref<any>({});
  107. function selectDeviceByID(id: string) {
  108. selectedDevice.value = devices.value.find((e) => {
  109. return e.id === id;
  110. });
  111. }
  112. // 获取全部局扇的数据,并以选项格式返回给 Header 消费
  113. function fetchOptions() {
  114. return list({
  115. devicekind,
  116. }).then(({ records }) => {
  117. devices.value = records;
  118. selectDeviceByID(records[0]?.id);
  119. return records.map((e) => {
  120. return {
  121. label: e.strinstallpos,
  122. key: e.id,
  123. };
  124. });
  125. });
  126. }
  127. // 图标相关
  128. const chartOption: EChartsOption = {
  129. series: [
  130. {
  131. type: 'pie',
  132. radius: ['50%', '75%'],
  133. center: ['50%', '55%'],
  134. data: [],
  135. labelLine: { show: false },
  136. label: {
  137. show: false,
  138. // formatter: '{b} \n ({d}%)',
  139. // color: '#B1B9D3',
  140. },
  141. itemStyle: {
  142. shadowBlur: 20,
  143. shadowColor: '#259bcf',
  144. },
  145. },
  146. ],
  147. color: ['#d9a1ff', '#00d1ff', '#82fe78'],
  148. };
  149. onMounted(() => {
  150. fetchConfig();
  151. });
  152. </script>
  153. <style lang="less" scoped>
  154. @import '@/design/vent/color.less';
  155. .monitor-center__primary_text {
  156. font-size: 20px;
  157. color: @vent-gas-primary-text;
  158. }
  159. .monitor-center {
  160. background-image: @vent-configurable-home-bg-img;
  161. border-top: 2px solid @vent-configurable-home-light-border;
  162. color: @white;
  163. }
  164. .monitor-center__item_A {
  165. width: 201px;
  166. height: 36px;
  167. background-image: url('@/assets/images/home-container/configurable/list_item_green.png');
  168. padding-left: 45px;
  169. line-height: 36px;
  170. }
  171. .monitor-center__item_B {
  172. width: 201px;
  173. height: 36px;
  174. background-image: url('@/assets/images/home-container/configurable/list_item_yellow.png');
  175. padding-left: 45px;
  176. line-height: 36px;
  177. }
  178. .number_grid {
  179. width: 125px;
  180. height: 37px;
  181. background-image: url('@/assets/images/home-container/configurable/number_grid.png');
  182. line-height: 37px;
  183. display: flex;
  184. justify-content: flex-start;
  185. padding: 0 2px 0 2px;
  186. span {
  187. flex-basis: 20%;
  188. }
  189. }
  190. </style>