modeControl.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <div class="body">
  3. <div class="control">
  4. <div :class="current===0?'smart_on':'smart'" @click="ChangeBar(0)">智能</div>
  5. <div :class="current===1?'recommend_on':'recommend'" @click="ChangeBar(1)">推荐</div>
  6. <div :class="current===2?'manual_on':'manual'" @click="ChangeBar(2)">手动</div>
  7. </div>
  8. <div style="display: flex;flex-direction: row;z-index: 2;">
  9. <div class="showData">
  10. <div class="dataBox" @dblclick="dbClicks()">
  11. <div class="dataTitle">健康指数</div>
  12. <div class="datas">{{showDate.healthIndex}}</div>
  13. </div>
  14. <div class="dataBox">
  15. <div class="dataTitle">资源指数</div>
  16. <div class="datas">{{showDate.resourceIndex}}</div>
  17. </div>
  18. </div>
  19. <div id="mainEcharts" @dblclick="dbClick()" class="echarts"></div>
  20. <div class="showData">
  21. <div class="dataBox-right">
  22. <div class="dataTitle">风能利用率</div>
  23. <div class="datas">{{showDate.windEnergyRate}}%</div>
  24. </div>
  25. <div class="dataBox-right">
  26. <div class="dataTitle">曲线跟随率</div>
  27. <div class="datas">{{showDate.curveFollowingRate}}%</div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <DetailPages ref="detials" @closed="closed()" v-model="dialogVisible">
  33. </DetailPages>
  34. <Details title='健康指数' @closed="closeds()" v-model="display"></Details>
  35. </template>
  36. <script>
  37. import BackgroundData from 'utils/BackgroundData'
  38. import api from "api/index";
  39. import MessageBridge from 'utils/MessageBridge'
  40. import * as echarts from "echarts";
  41. import DetailPages from "./detailPages.vue";
  42. import Details from "./dataDetails.vue";
  43. export default {
  44. props: {
  45. // current: {
  46. // type: Number,
  47. // },
  48. },
  49. components: {
  50. DetailPages,
  51. Details
  52. },
  53. data() {
  54. return {
  55. current: 1,
  56. datas: {},
  57. list: {},
  58. showDate: {},
  59. winFlag: 0,
  60. curveFlag: 0,
  61. fieldFlag: 0,
  62. dialogVisible: false,
  63. display: false,
  64. };
  65. },
  66. created() {
  67. this.initData();
  68. // this.getData(),
  69. // this.refreshTimer = setInterval(this.getData, 20000);
  70. },
  71. computed: {
  72. // healthStyle() {
  73. // return `width: ${this.healthWidth}%;`
  74. // },
  75. // resourceStyle() {
  76. // return `width: ${this.resourceWidth}%;`
  77. // },
  78. // windStyle() {
  79. // return `width: ${this.windWidth}%;`
  80. // },
  81. // curveStyle() {
  82. // return `width: ${this.curveWidth}%;`
  83. // },
  84. },
  85. mounted() {
  86. // this.current = this.$props.current
  87. this.$nextTick(() => {
  88. if (document.getElementById('mainEcharts')) {
  89. this.getEcharts()
  90. }
  91. });
  92. },
  93. methods: {
  94. initData() {
  95. var mb = MessageBridge.getInstance();
  96. var vss = [{ key: "/topic/voice-control", action: this.windturbineMessage }];
  97. var vs = [{ key: "/topic/title-info", action: this.getEchartss }];
  98. mb.register(vs);
  99. mb.register(vss);
  100. },
  101. windturbineMessage(msg) {
  102. let arr = []
  103. if (msg === 'CLOSE') {
  104. arr.push(msg)
  105. } else {
  106. arr = msg.split('-')
  107. }
  108. this.dialogVisible = false
  109. this.showSvg = false
  110. this.svgWeb = ''
  111. console.log(arr);
  112. if (arr[0] === 'OPEN_PAGE_MANUAL') {
  113. this.ChangeBar(2)
  114. } else if (arr[0] === 'OPEN_PAGE_AUTOMATIC') {
  115. this.ChangeBar(0)
  116. } else if (arr[0] === 'OPEN_PAGE_RECOMMENDATION') {
  117. this.ChangeBar(1)
  118. }else if(msg === 'OPEN_AGC-GS'){
  119. this.dbClick()
  120. }
  121. },
  122. getEchartss(msg) {
  123. let data = JSON.parse(msg)
  124. data.healthIndex = Number(data.healthIndex).toFixed(0)
  125. data.resourceIndex = Number(data.resourceIndex).toFixed(0)
  126. data.realTimePower = data.realTimePower.toFixed(2)
  127. data.theoreticalPower = data.theoreticalPower.toFixed(2)
  128. data.agcPowerSet = data.agcPowerSet.toFixed(2)
  129. data.windEnergyRate = data.windEnergyRate.toFixed(2)
  130. data.curveFollowingRate = data.curveFollowingRate.toFixed(2)
  131. this.showDate = data
  132. this.getEcharts()
  133. },
  134. getEcharts() {
  135. var chartDom = document.getElementById('mainEcharts');
  136. var myChart = echarts.init(chartDom, '#000000');
  137. var option;
  138. option = {
  139. series: [{
  140. type: 'gauge',
  141. max: 664,
  142. splitNumber: 8,
  143. anchor: {
  144. show: true,
  145. showAbove: true,
  146. size: 9,
  147. width: 5,
  148. itemStyle: {
  149. color: '#FAC858'
  150. }
  151. },
  152. pointer: {
  153. icon: '',
  154. width: 3,
  155. length: '80%',
  156. offsetCenter: [0, '8%']
  157. },
  158. progress: {
  159. show: true,
  160. overlap: true,
  161. roundCap: true
  162. },
  163. axisLine: {
  164. lineStyle: {//仪表盘轴线相关配置。
  165. width: 2,
  166. color: [[1, 'rgba(83, 92, 93, 0.5)']]
  167. }
  168. },
  169. axisLabel: {
  170. // textStyle: {//数字刻度样式
  171. // color: '#000000',
  172. // fontSize: 12,
  173. // }
  174. },
  175. splitLine: {//分隔线样式相关
  176. length: 0,//分割线的长度
  177. lineStyle: {
  178. width: 1,
  179. color: '#000000'
  180. }
  181. },
  182. data: [{
  183. value: 125.85,
  184. name: '实际功率',
  185. itemStyle: {
  186. color: 'rgba(75, 85, 174, 1)'
  187. },
  188. title: {
  189. color: '#999999',
  190. offsetCenter: ['-70%', '90%']
  191. },
  192. detail: {
  193. width: 50,
  194. height: 12,
  195. fontSize: 18,
  196. offsetCenter: ['-70%', '110%']
  197. }
  198. },
  199. {
  200. value: 137.63,
  201. name: '理论功率',
  202. itemStyle: {
  203. color: 'rgba(05, 187, 76, 1)'
  204. },
  205. title: {
  206. color: '#999999',
  207. offsetCenter: ['0%', '90%']
  208. },
  209. detail: {
  210. width: 50,
  211. height: 12,
  212. fontSize: 18,
  213. offsetCenter: ['0%', '110%']
  214. }
  215. },
  216. {
  217. value: 132.04,
  218. name: 'AGC有功设定',
  219. itemStyle: {
  220. color: 'rgba(186, 50, 55, 1)'
  221. },
  222. title: {
  223. color: '#999999',
  224. offsetCenter: ['70%', '90%']
  225. },
  226. detail: {
  227. align: 'center',
  228. width: 50,
  229. height: 12,
  230. fontSize: 18,
  231. offsetCenter: ['70%', '110%']
  232. }
  233. }
  234. ],
  235. title: {
  236. fontSize: 12
  237. },
  238. detail: {
  239. width: 20,
  240. height: 7,
  241. fontSize: 12,
  242. color: '#fff',
  243. backgroundColor: 'auto',
  244. borderRadius: 3,
  245. formatter: ''
  246. }
  247. }]
  248. };
  249. option.series[0].data[0].value = Number(this.showDate.realTimePower);
  250. option.series[0].data[1].value = Number(this.showDate.theoreticalPower);
  251. option.series[0].data[2].value = Number(this.showDate.agcPowerSet);
  252. myChart.setOption(option, true);
  253. },
  254. ChangeBar(values) {
  255. var bd = BackgroundData.getInstance();
  256. var mb = MessageBridge.getInstance();
  257. var vss = { key: "/topic/voice-control"};
  258. var popup = { key: "/topic/fault-popup"};
  259. mb.unregister(popup);
  260. mb.unregister(vss);
  261. if (!bd.LoginUser) {
  262. this.$notify({
  263. title: "请登录",
  264. message: "切换模式需要先登录!",
  265. type: "warning",
  266. position: "bottom-right",
  267. offset: 60,
  268. duration: 3000,
  269. });
  270. return;
  271. }
  272. if (this.current !== values) {
  273. this.$store.commit('current', Number(values))
  274. if (values === 2) {
  275. this.current = values
  276. this.$router.push(`/ManualPage?current=${values}`)
  277. } else if (values === 1) {
  278. this.$store.commit('current', values)
  279. if (this.current === 0) {
  280. this.current = values
  281. } else {
  282. this.current = values
  283. this.$router.push(`/?current=${values}`)
  284. }
  285. } else if (values === 0) {
  286. this.$store.commit('current', values)
  287. if (this.current === 2) {
  288. this.current = values
  289. this.$router.push(`/?current=${values}`)
  290. } else {
  291. this.current = values
  292. }
  293. }
  294. }
  295. },
  296. dbClick(){
  297. this.dialogVisible = true;
  298. this.$refs.detials.getDate()
  299. },
  300. dbClicks(){
  301. this.display = true;
  302. },
  303. closed(){
  304. this.dialogVisible = false;
  305. },
  306. closeds(){
  307. this.display = false;
  308. }
  309. },
  310. }
  311. </script>
  312. <style scoped>
  313. .body {
  314. width: 100%;
  315. height: 28.5vh;
  316. /* background-color: #ffffff; */
  317. margin-left: 15px;
  318. margin-top: 20px;
  319. border-left: 1px solid #373737;
  320. border-right: 1px solid #373737;
  321. border-bottom: 1px solid #373737;
  322. /* background-image: url('../../assets/img/type/background.png'); */
  323. background-repeat: no-repeat;
  324. background-position: center;
  325. background-size: cover;
  326. }
  327. .control {
  328. display: flex;
  329. flex-direction: row-reverse;
  330. align-items: center;
  331. font-size: 14px;
  332. color: #ffffff;
  333. /* margin-right: 5px; */
  334. position: absolute;
  335. right: 10px;
  336. z-index: 99;
  337. }
  338. .manual {
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. height: 29px;
  343. width: 86px;
  344. border-left: 1px solid rgba(51, 51, 51, 1);
  345. border-top: 1px solid rgba(51, 51, 51, 1);
  346. border-bottom: 1px solid rgba(51, 51, 51, 1);
  347. border-top-left-radius: 15px;
  348. border-bottom-left-radius: 15px;
  349. }
  350. .manual_on {
  351. display: flex;
  352. align-items: center;
  353. justify-content: center;
  354. height: 29px;
  355. width: 86px;
  356. border-left: 1px solid rgba(37, 116, 219, 1);
  357. border-top: 1px solid rgba(37, 116, 219, 1);
  358. border-bottom: 1px solid rgba(37, 116, 219, 1);
  359. border-top-left-radius: 15px;
  360. border-bottom-left-radius: 15px;
  361. background-color: rgba(37, 116, 219, 1);
  362. }
  363. .recommend {
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. height: 29px;
  368. width: 86px;
  369. border-top: 1px solid rgba(51, 51, 51, 1);
  370. border-bottom: 1px solid rgba(51, 51, 51, 1);
  371. }
  372. .recommend_on {
  373. display: flex;
  374. align-items: center;
  375. justify-content: center;
  376. height: 29px;
  377. width: 86px;
  378. border-top: 1px solid rgba(37, 116, 219, 1);
  379. border-bottom: 1px solid rgba(37, 116, 219, 1);
  380. background-color: rgba(37, 116, 219, 1);
  381. }
  382. .smart {
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. height: 29px;
  387. width: 86px;
  388. border-right: 1px solid rgba(51, 51, 51, 1);
  389. border-top: 1px solid rgba(51, 51, 51, 1);
  390. border-bottom: 1px solid rgba(51, 51, 51, 1);
  391. border-top-right-radius: 15px;
  392. border-bottom-right-radius: 15px;
  393. }
  394. .smart_on {
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. height: 29px;
  399. width: 86px;
  400. border-right: 1px solid rgba(37, 116, 219, 1);
  401. border-top: 1px solid rgba(37, 116, 219, 1);
  402. border-bottom: 1px solid rgba(37, 116, 219, 1);
  403. border-top-right-radius: 15px;
  404. border-bottom-right-radius: 15px;
  405. background-color: rgba(37, 116, 219, 1);
  406. }
  407. .dataArea {
  408. display: flex;
  409. flex-direction: row;
  410. align-items: center;
  411. }
  412. .dataBlock {
  413. width: 29%;
  414. height: 82px;
  415. background-color: #242424;
  416. border: 1px solid #3D3D3D;
  417. margin-left: 18px;
  418. margin-top: 35px;
  419. display: flex;
  420. flex-direction: column;
  421. justify-content: center;
  422. }
  423. .dataName {
  424. display: flex;
  425. flex-direction: row-reverse;
  426. font-size: 12px;
  427. color: #999999;
  428. /* margin-bottom: 6px; */
  429. margin-left: 26px;
  430. /* margin-bottom: 20px; */
  431. }
  432. .dataName-right {
  433. display: flex;
  434. flex-direction: row;
  435. font-size: 14px;
  436. color: #999999;
  437. /* margin-bottom: 6px; */
  438. margin-right: 50px;
  439. /* margin-bottom: 20px; */
  440. }
  441. .numerical {
  442. display: flex;
  443. flex-direction: row;
  444. color: #05BB4C;
  445. align-items: center;
  446. margin-left: 26px;
  447. }
  448. .data {
  449. display: flex;
  450. flex-direction: row;
  451. color: #05BB4C;
  452. align-items: baseline;
  453. }
  454. .values {
  455. font-size: 16px;
  456. }
  457. .unit {
  458. font-size: 12px;
  459. margin-left: 8px;
  460. }
  461. .images {
  462. width: 18px;
  463. height: 18px;
  464. margin-left: 10px;
  465. margin-top: 3px;
  466. }
  467. .images_none {
  468. width: 18px;
  469. height: 3px;
  470. background-color: #FFA500;
  471. margin-left: 10px;
  472. border-radius: 1px;
  473. margin-top: -3px;
  474. }
  475. .dataShow {
  476. display: flex;
  477. flex-direction: column;
  478. width: 200px;
  479. position: absolute;
  480. left: 1px;
  481. top: 62%;
  482. line-height: 35px;
  483. }
  484. .dataShows {
  485. display: flex;
  486. flex-direction: column;
  487. width: 200px;
  488. position: absolute;
  489. right: -35px;
  490. top: 62%;
  491. line-height: 35px;
  492. }
  493. .number {
  494. display: flex;
  495. flex-direction: row;
  496. align-items: center;
  497. font-size: 16px;
  498. color: #ffffff;
  499. align-items: center;
  500. justify-content: space-between;
  501. }
  502. .progress {
  503. display: flex;
  504. align-items: center;
  505. margin-left: 20px;
  506. width: 130px;
  507. height: 10px;
  508. border: 1px solid rgba(83, 92, 93, 0.5);
  509. background-color: #000000;
  510. margin-bottom: 20px;
  511. }
  512. .progress-right {
  513. display: flex;
  514. flex-direction: row-reverse;
  515. align-items: center;
  516. margin-left: 20px;
  517. width: 130px;
  518. height: 10px;
  519. border: 1px solid rgba(83, 92, 93, 0.5);
  520. background-color: #000000;
  521. margin-bottom: 20px;
  522. }
  523. .progressNum {
  524. /* width: 60%; */
  525. height: 40%;
  526. background-color: rgba(75, 85, 174, 1);
  527. border-radius: 2px;
  528. }
  529. .progressNum-right {
  530. /* width: 60%; */
  531. height: 40%;
  532. background-color: rgba(75, 85, 174, 1);
  533. border-radius: 2px;
  534. }
  535. .echarts {
  536. width: 300px;
  537. height: 280px;
  538. margin-top: 20px;
  539. /* background-color: #000000; */
  540. margin-left: 10px;
  541. }
  542. .wind {
  543. display: flex;
  544. flex-direction: column;
  545. align-items: center;
  546. margin-top: 20px;
  547. }
  548. .windNum {
  549. font-size: 14px;
  550. color: #ffffff;
  551. }
  552. .windTitle {
  553. font-size: 18px;
  554. color: #ffffff;
  555. }
  556. .follow {
  557. display: flex;
  558. flex-direction: column;
  559. align-items: center;
  560. margin-top: 20px;
  561. margin-right: 20px;
  562. }
  563. .followNum {
  564. font-size: 14px;
  565. color: #ffffff;
  566. }
  567. .followTitle {
  568. font-size: 18px;
  569. color: #ffffff;
  570. }
  571. .numbers {
  572. margin-right: 48px;
  573. }
  574. .numbers-right {
  575. margin-left: 18px;
  576. }
  577. .showData {
  578. display: flex;
  579. flex-direction: column;
  580. align-items: center;
  581. justify-content: center;
  582. }
  583. .dataBox {
  584. display: flex;
  585. flex-direction: column;
  586. width: 120px;
  587. height: 60px;
  588. border: 1px solid rgba(83, 92, 93, 1);
  589. margin-bottom: 15px;
  590. margin-top: 15px;
  591. margin-left: 30px;
  592. }
  593. .dataBox-right {
  594. display: flex;
  595. flex-direction: column;
  596. width: 120px;
  597. height: 60px;
  598. border: 1px solid rgba(83, 92, 93, 1);
  599. margin-bottom: 15px;
  600. margin-top: 15px;
  601. margin-right: 30px;
  602. }
  603. .dataTitle {
  604. height: 50%;
  605. display: flex;
  606. flex-direction: row;
  607. align-items: center;
  608. font-size: 12px;
  609. color: rgba(153, 162, 163, 1);
  610. margin-left: 5px;
  611. }
  612. .datas {
  613. height: 50%;
  614. display: flex;
  615. flex-direction: row-reverse;
  616. align-items: center;
  617. font-size: 16px;
  618. color: rgba(05, 187, 76, 1);
  619. margin-right: 5px;
  620. }
  621. </style>