modeControl.vue 22 KB

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