fan-monitor.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <div class="fanMonitor">
  3. <div class="title-top" @click="getDetail">局部通风系统</div>
  4. <div class="toggle-search">
  5. <i class="icon-search">
  6. <SvgIcon class="icon" size="14" name="toggle" />
  7. </i>
  8. <a-select
  9. v-model:value="searchValue"
  10. style="width: 180px; margin-right: 10px"
  11. :options="fanTypeList"
  12. aria-placeholder="请选择"
  13. @change="changeSelect"
  14. />
  15. <div class="status-yx">
  16. <div class="now-name">
  17. <i style="margin: 0px 5px 0px 5px">
  18. <SvgIcon class="icon" size="14" name="yxfj" />
  19. </i>
  20. <span style="color: #fff">运行风机</span>
  21. </div>
  22. <div class="now-status">{{ fjStatus }}</div>
  23. </div>
  24. </div>
  25. <div class="fan-contents">
  26. <div class="fan" ref="fan"></div>
  27. </div>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import { ref, reactive, onMounted, nextTick, defineProps, watch } from 'vue';
  32. import { SvgIcon } from '/@/components/Icon';
  33. import * as echarts from 'echarts';
  34. import { useGo } from '/@/hooks/web/usePage';
  35. let props = defineProps({
  36. fandata: Array,
  37. });
  38. const emit = defineEmits(['goDetail']);
  39. const go = useGo();
  40. let searchValue = ref('');
  41. let fanList = reactive<any[]>([]);
  42. let fanTypeList = reactive<any[]>([]); //下拉列表
  43. let fjStatus = ref(''); //运行风机
  44. //获取dom节点
  45. let fan = ref<any>();
  46. //echart图表数据
  47. let echartData = reactive<any>({
  48. xdata: 0,
  49. ydata: 0,
  50. });
  51. //跳转详情
  52. function getDetail() {
  53. emit('goDetail', 'ju');
  54. }
  55. //选项切换
  56. function changeSelect(val) {
  57. switch (val) {
  58. case '局扇监测':
  59. fjStatus.value =
  60. fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan1StartStatus == '1'
  61. ? '1号风机'
  62. : fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan2StartStatus == '1'
  63. ? '2号风机'
  64. : '';
  65. echartData.xdata = fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.windQuantity1;
  66. echartData.ydata = fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.windQuantity2;
  67. getOption();
  68. break;
  69. case '局部通风机系统':
  70. fjStatus.value =
  71. fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.Fan1StartStatus == '1'
  72. ? '1号风机'
  73. : fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan2StartStatus == '1'
  74. ? '2号风机'
  75. : '';
  76. echartData.xdata = fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.windQuantity1;
  77. echartData.ydata = fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.windQuantity2;
  78. getOption();
  79. break;
  80. }
  81. }
  82. function getOption() {
  83. nextTick(() => {
  84. const myChart = echarts.init(fan.value);
  85. let option = {
  86. grid: {
  87. top: '20%',
  88. left: '7%',
  89. bottom: '14%',
  90. right: '7%',
  91. containLabel: true,
  92. },
  93. xAxis: [
  94. {
  95. type: 'category',
  96. data: ['吸风量', '供风量'],
  97. axisTick: {
  98. alignWithLabel: true,
  99. },
  100. nameTextStyle: {
  101. color: 'red',
  102. },
  103. axisLine: {
  104. //坐标轴轴线相关设置。数学上的x轴
  105. show: true,
  106. lineStyle: {
  107. color: 'rgba(62, 103, 164)',
  108. },
  109. },
  110. axisLabel: {
  111. //坐标轴刻度标签的相关设置
  112. textStyle: {
  113. color: '#b3b8cc',
  114. padding: 10,
  115. fontSize: 14,
  116. },
  117. formatter: function (data) {
  118. return data;
  119. },
  120. },
  121. },
  122. ],
  123. yAxis: [
  124. {
  125. type: 'value',
  126. min: 0,
  127. name: '(m³/min)',
  128. nameTextStyle: {
  129. color: '#b3b8cc',
  130. fontSize: 12,
  131. padding: 0,
  132. },
  133. splitLine: {
  134. show: false,
  135. lineStyle: {
  136. color: 'rgba(62, 103, 164,.4)',
  137. },
  138. },
  139. axisLine: {
  140. show: true,
  141. lineStyle: {
  142. color: 'rgba(62, 103, 164)',
  143. },
  144. },
  145. axisLabel: {
  146. show: true,
  147. textStyle: {
  148. color: '#b3b8cc',
  149. padding: 0,
  150. fontSize: 14,
  151. },
  152. formatter: function (value) {
  153. if (value === 0) {
  154. return value;
  155. }
  156. return value;
  157. },
  158. },
  159. axisTick: {
  160. show: false,
  161. },
  162. },
  163. ],
  164. series: [
  165. {
  166. name: '',
  167. type: 'pictorialBar',
  168. symbolSize: [60, 16],
  169. symbolOffset: [0, -10],
  170. symbolPosition: 'end',
  171. z: 12,
  172. //"barWidth": "20",
  173. label: {
  174. normal: {
  175. show: true,
  176. position: 'top',
  177. formatter: '{c}',
  178. color: '#fff',
  179. },
  180. },
  181. data: [
  182. {
  183. value: echartData.xdata,
  184. itemStyle: {
  185. color: '#59cb42',
  186. },
  187. },
  188. {
  189. value: echartData.ydata,
  190. itemStyle: {
  191. color: '#3cefff',
  192. },
  193. },
  194. ],
  195. },
  196. {
  197. name: '',
  198. type: 'pictorialBar',
  199. symbolSize: [60, 16],
  200. symbolOffset: [0, 10],
  201. // "barWidth": "20",
  202. z: 12,
  203. data: [
  204. {
  205. value: 100,
  206. itemStyle: {
  207. color: '#59cb42',
  208. },
  209. },
  210. {
  211. value: 100,
  212. itemStyle: {
  213. color: '#3cefff',
  214. },
  215. },
  216. ],
  217. },
  218. {
  219. name: '',
  220. type: 'pictorialBar',
  221. symbolSize: [90, 30],
  222. symbolOffset: [0, 20],
  223. z: 10,
  224. itemStyle: {
  225. normal: {
  226. color: 'transparent',
  227. borderColor: '#14b1eb',
  228. borderType: 'dashed',
  229. borderWidth: 5,
  230. },
  231. },
  232. data: [100, 100],
  233. },
  234. {
  235. type: 'bar',
  236. itemStyle: {
  237. normal: {
  238. //color: '#14b1eb',
  239. opacity: 0.7,
  240. },
  241. },
  242. //silent: true,
  243. barWidth: '60',
  244. //barGap: '-100%', // Make series be overlap
  245. data: [
  246. {
  247. value: echartData.xdata,
  248. itemStyle: {
  249. color: '#59cb42',
  250. },
  251. },
  252. {
  253. value: echartData.ydata,
  254. itemStyle: {
  255. color: '#3cefff',
  256. },
  257. },
  258. ],
  259. markLine: {
  260. symbol: 'none',
  261. label: {
  262. position: 'middle',
  263. formatter: '{b}',
  264. },
  265. data: [
  266. {
  267. name: '目标值',
  268. yAxis: 40, //res.targetTwo,
  269. lineStyle: {
  270. color: 'rgba(0, 119, 233,.8)',
  271. },
  272. },
  273. ],
  274. },
  275. },
  276. ],
  277. };
  278. myChart.setOption(option);
  279. window.onresize = function () {
  280. myChart.resize();
  281. };
  282. });
  283. }
  284. watch(
  285. () => props.fandata,
  286. (val) => {
  287. console.log(val, '局部风机数据');
  288. fanList = val[0];
  289. fanTypeList.length = 0;
  290. fanList.forEach((el) => {
  291. fanTypeList.push({
  292. label: el.strinstallpos,
  293. value: el.strinstallpos,
  294. });
  295. });
  296. searchValue.value = fanTypeList[0].value;
  297. console.log(searchValue.value, '77777');
  298. changeSelect(searchValue.value);
  299. },
  300. {
  301. deep: true,
  302. }
  303. );
  304. onMounted(() => {});
  305. </script>
  306. <style lang="less" scoped>
  307. @font-face {
  308. font-family: 'douyuFont';
  309. src: url('../../../../../assets/font/douyuFont.otf');
  310. }
  311. .fanMonitor {
  312. width: 100%;
  313. height: 100%;
  314. position: relative;
  315. .title-top {
  316. position: absolute;
  317. top: 9px;
  318. left: 46px;
  319. color: #fff;
  320. font-size: 16px;
  321. font-family: 'douyuFont';
  322. cursor: pointer;
  323. &:hover {
  324. color: #66ffff;
  325. }
  326. }
  327. .toggle-search {
  328. position: absolute;
  329. left: 9px;
  330. top: 37px;
  331. display: flex;
  332. .icon-search {
  333. position: absolute;
  334. top: 50%;
  335. left: 5px;
  336. transform: translate(0%, -50%);
  337. }
  338. .status-yx {
  339. height: 30px;
  340. width: 180px;
  341. background-color: rgba(8, 148, 255, 0.3);
  342. border: 1px solid #1d80da;
  343. display: flex;
  344. justify-content: space-between;
  345. align-items: center;
  346. .now-status {
  347. margin-right: 5px;
  348. padding-top: 3px;
  349. font-family: 'douyuFont';
  350. color: #3df6ff;
  351. }
  352. }
  353. }
  354. .fan-contents {
  355. position: absolute;
  356. top: 66px;
  357. left: 0;
  358. height: calc(100% - 66px);
  359. width: 100%;
  360. .fan {
  361. width: 100%;
  362. height: 100%;
  363. }
  364. }
  365. }
  366. :deep .zxm-select-selector {
  367. width: 100%;
  368. height: 30px !important;
  369. padding: 0 11px 0px 25px !important;
  370. background-color: rgba(8, 148, 255, 0.3) !important;
  371. border: 1px solid #1d80da !important;
  372. }
  373. :deep .zxm-select-selection-item {
  374. color: #fff !important;
  375. line-height: 28px !important;
  376. }
  377. :deep .zxm-select-arrow {
  378. color: #fff !important;
  379. }
  380. </style>