work-monitor.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div class="workMonitor">
  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="workTypeList"
  12. aria-placeholder="请选择"
  13. @change="changeSelect"
  14. />
  15. </div>
  16. <div class="work-echart">
  17. <div class="work" ref="work"></div>
  18. </div>
  19. <div class="work-card">
  20. <div class="card-item" v-for="(item, index) in tabList" :key="index">
  21. <div class="item-s">
  22. <div class="item-label">{{ item.name }}</div>
  23. <div class="item-val">{{ item.val }}</div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script lang="ts" setup>
  30. import { ref, reactive, nextTick, onMounted, defineProps, watch } from 'vue';
  31. import { SvgIcon } from '/@/components/Icon';
  32. import * as echarts from 'echarts';
  33. let props = defineProps({
  34. workList: Array,
  35. });
  36. let workData = reactive<any[]>([]);
  37. let searchValue = ref('');
  38. const workTypeList = reactive<any[]>([]);
  39. let tabList = reactive<any[]>([
  40. { name: '进风量(m³/min)', val: null },
  41. { name: '回风量(m³/min)', val: null },
  42. { name: '需风量(m³/min)', val: null },
  43. ]);
  44. let work = ref<any>();
  45. let echartData = reactive({
  46. xdata: [],
  47. ydata: [],
  48. ydata1: [],
  49. });
  50. //跳转详情
  51. function getDetail() {
  52. console.log('跳转详情');
  53. }
  54. //选项切换
  55. function changeSelect(val) {
  56. switch (val) {
  57. case '15212工作面':
  58. tabList[0].val = workData[0].jin;
  59. tabList[1].val = workData[0].hui;
  60. tabList[2].val = workData[0].xufengliang;
  61. echartData.xdata.length = 0;
  62. echartData.ydata.length = 0;
  63. echartData.ydata1.length = 0;
  64. workData[0].history.forEach((el) => {
  65. echartData.xdata.push(el.time);
  66. echartData.ydata.push(el.jin);
  67. echartData.ydata1.push(el.hui);
  68. });
  69. getOption();
  70. break;
  71. case '采煤工作面':
  72. tabList[0].val = workData[1].jin;
  73. tabList[1].val = workData[1].hui;
  74. tabList[2].val = workData[1].xufengliang;
  75. echartData.xdata.length = 0;
  76. echartData.ydata.length = 0;
  77. echartData.ydata1.length = 0;
  78. workData[1].history.forEach((el) => {
  79. echartData.xdata.push(el.time);
  80. echartData.ydata.push(el.jin);
  81. echartData.ydata1.push(el.hui);
  82. });
  83. getOption();
  84. break;
  85. }
  86. }
  87. function getOption() {
  88. nextTick(() => {
  89. const myChart = echarts.init(work.value);
  90. let option = {
  91. tooltip: {
  92. trigger: 'axis',
  93. axisPointer: {
  94. type: 'cross',
  95. },
  96. },
  97. legend: {
  98. align: 'left',
  99. right: '4%',
  100. top: '6%',
  101. type: 'plain',
  102. textStyle: {
  103. color: '#7ec7ff',
  104. fontSize: 12,
  105. },
  106. // icon:'rect',
  107. itemGap: 25,
  108. itemWidth: 18,
  109. icon: 'path://M0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z',
  110. data: [
  111. {
  112. name: '工作面进风',
  113. },
  114. {
  115. name: '工作面回风',
  116. },
  117. // {
  118. // name: '工作面需风'
  119. // }
  120. ],
  121. },
  122. grid: {
  123. top: '28%',
  124. left: '5%',
  125. right: '5%',
  126. bottom: '5%',
  127. containLabel: true,
  128. },
  129. xAxis: [
  130. {
  131. type: 'category',
  132. // boundaryGap: false,
  133. axisLine: {
  134. //坐标轴轴线相关设置。数学上的x轴
  135. show: true,
  136. lineStyle: {
  137. color: 'rgba(62, 103, 164)',
  138. },
  139. },
  140. axisLabel: {
  141. //坐标轴刻度标签的相关设置
  142. textStyle: {
  143. color: '#b3b8cc',
  144. padding: 0,
  145. fontSize: 12,
  146. },
  147. formatter: function (data) {
  148. return data;
  149. },
  150. },
  151. splitLine: {
  152. show: false,
  153. },
  154. axisTick: {
  155. show: false,
  156. },
  157. data: echartData.xdata,
  158. },
  159. ],
  160. yAxis: [
  161. {
  162. name: 'm³/s',
  163. nameTextStyle: {
  164. color: '#b3b8cc',
  165. fontSize: 12,
  166. padding: -10,
  167. },
  168. min: 0,
  169. splitLine: {
  170. show: true,
  171. lineStyle: {
  172. color: 'rgba(62, 103, 164,.4)',
  173. },
  174. },
  175. axisLine: {
  176. show: true,
  177. lineStyle: {
  178. color: 'rgba(62, 103, 164)',
  179. },
  180. },
  181. axisLabel: {
  182. show: true,
  183. textStyle: {
  184. color: '#b3b8cc',
  185. padding: 0,
  186. fontSize: 12,
  187. },
  188. formatter: function (value) {
  189. if (value === 0) {
  190. return value;
  191. }
  192. return value;
  193. },
  194. },
  195. axisTick: {
  196. show: false,
  197. },
  198. },
  199. ],
  200. series: [
  201. {
  202. name: '工作面进风',
  203. type: 'line',
  204. yAxisIndex: 0,
  205. symbolSize: 6,
  206. lineStyle: {
  207. normal: {
  208. width: 2,
  209. color: 'orange', // 线条颜色
  210. },
  211. borderColor: 'rgba(0,0,0,.4)',
  212. },
  213. itemStyle: {
  214. color: 'orange',
  215. borderColor: '#646ace',
  216. borderWidth: 0,
  217. },
  218. data: echartData.ydata,
  219. },
  220. {
  221. name: '工作面回风',
  222. type: 'line',
  223. yAxisIndex: 0,
  224. symbolSize: 6,
  225. lineStyle: {
  226. normal: {
  227. width: 2,
  228. color: '#1891de', // 线条颜色
  229. },
  230. borderColor: 'rgba(0,0,0,.4)',
  231. },
  232. itemStyle: {
  233. color: '#1891de',
  234. borderColor: '#646ace',
  235. borderWidth: 0,
  236. },
  237. data: echartData.ydata1,
  238. },
  239. ],
  240. };
  241. myChart.setOption(option);
  242. window.onresize = function () {
  243. myChart.resize();
  244. };
  245. });
  246. }
  247. watch(
  248. () => props.workList,
  249. (val) => {
  250. console.log(val, '工作面数据');
  251. workData = val;
  252. workTypeList.length = 0;
  253. workData.forEach((el) => {
  254. workTypeList.push({
  255. label: el.deviceName,
  256. value: el.deviceName,
  257. });
  258. });
  259. searchValue.value = workTypeList[0].value;
  260. changeSelect(searchValue.value);
  261. },
  262. {
  263. deep: true,
  264. }
  265. );
  266. onMounted(() => {});
  267. </script>
  268. <style lang="less" scoped>
  269. .workMonitor {
  270. width: 100%;
  271. height: 100%;
  272. position: relative;
  273. .title-top {
  274. position: absolute;
  275. top: 9px;
  276. left: 46px;
  277. color: #fff;
  278. font-size: 16px;
  279. font-family: 'douyuFont';
  280. cursor: pointer;
  281. &:hover {
  282. color: #66ffff;
  283. }
  284. }
  285. .toggle-search {
  286. position: absolute;
  287. left: 9px;
  288. top: 37px;
  289. display: flex;
  290. .icon-search {
  291. position: absolute;
  292. top: 50%;
  293. left: 5px;
  294. transform: translate(0%, -50%);
  295. }
  296. }
  297. .work-echart {
  298. position: absolute;
  299. top: 66px;
  300. left: 0;
  301. height: 110px;
  302. margin: 5px 0px;
  303. padding: 0px 20px;
  304. box-sizing: border-box;
  305. width: 100%;
  306. .work {
  307. height: 100%;
  308. background: url('../../../../../assets/images/home-container/work-bd.png') no-repeat;
  309. background-size: 100% 100%;
  310. }
  311. }
  312. .work-card {
  313. position: absolute;
  314. top: 186px;
  315. left: 0;
  316. width: 100%;
  317. height: calc(100% - 186px);
  318. padding: 0px 15px 15px 15px;
  319. box-sizing: border-box;
  320. display: flex;
  321. justify-content: space-around;
  322. align-items: center;
  323. .card-item {
  324. display: flex;
  325. flex: 1;
  326. justify-content: center;
  327. align-items: center;
  328. height: 100%;
  329. .item-s {
  330. position: relative;
  331. width: 105px;
  332. height: 58px;
  333. background: url('../../../../../assets/images/home-container/line-val.png') no-repeat;
  334. .item-label {
  335. width: 100%;
  336. text-align: center;
  337. color: #b3b8cc;
  338. font-size: 12px;
  339. }
  340. .item-val {
  341. position: absolute;
  342. left: 50%;
  343. top: 31px;
  344. font-size: 14px;
  345. font-family: 'douyuFont';
  346. color: #fff;
  347. transform: translate(-50%, 0);
  348. }
  349. }
  350. }
  351. }
  352. }
  353. :deep .zxm-select-selector {
  354. width: 100%;
  355. height: 30px !important;
  356. padding: 0 11px 0px 25px !important;
  357. background-color: rgba(8, 148, 255, 0.3) !important;
  358. border: 1px solid #1d80da !important;
  359. }
  360. :deep .zxm-select-selection-item {
  361. color: #fff !important;
  362. line-height: 28px !important;
  363. }
  364. :deep .zxm-select-arrow {
  365. color: #fff !important;
  366. }
  367. </style>