powerPredictionPage.vue 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  1. <template>
  2. <div class="powerPredictionPage" :class="!theme ? 'themeDark' : 'themeLight'">
  3. <el-row class="windStstus">
  4. <el-col :span="6" class="scrollbar">
  5. <!-- <span class="scrollbarName">场站名称:</span> -->
  6. <div class="seachPower">
  7. <el-form class="generat-seach" :inline="true">
  8. <el-form-item label="场站">
  9. <el-select v-model="reportStation" placeholder="选择场站" @change="changeWindNo">
  10. <el-option v-for="item in stationData" :key="item.no" :label="item.stationName"
  11. :value="item.no">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button type="primary" @click="seachData">查询</el-button>
  17. </el-form-item>
  18. </el-form>
  19. </div>
  20. <!-- <el-scrollbar>
  21. <div class="scrollbar-flex-content">
  22. <p v-for="item in stationData" :key="item.no" class="scrollbar-demo-item"
  23. :class="item.showBac ? 'changeBacksty' : 'defaultBacksty'" @click="changeStation(item.no)">
  24. {{ item.stationName }}
  25. </p>
  26. </div>
  27. </el-scrollbar> -->
  28. </el-col>
  29. <el-col :span="17">
  30. <div class="everyOne" v-for="(item, index) in !theme ? statusData : statusDataW" :key="index"
  31. :style="statusSty(item)">
  32. <div class="everyOneImg" style="width: 39px">
  33. <img :src="item.img" alt="" />
  34. </div>
  35. <span class="statusName"
  36. :style="{ color: `${!theme ? item.borderSty : '#fff'}` }">{{ item.name }}</span>
  37. <span class="statusNum" :style="statusNumSty(item)">{{
  38. item.number
  39. }}</span>
  40. </div>
  41. </el-col>
  42. </el-row>
  43. <div class="lineMain" :style="pageHeight">
  44. <el-row>
  45. <el-col :span="14">
  46. <div class="lineStyle" v-on:dblclick="doubleclick('功率预测')" style="position: relative">
  47. <div style="
  48. display: flex;
  49. float: right;
  50. justify-content: end;
  51. margin-right: 23px;
  52. ">
  53. <div v-for="item in showpowerLegend" :key="item.name">
  54. <span class="lineColor" :style="{ background: item.color }"></span>
  55. <span class="powerLegendColor" :style="{ background: item.color }"></span>
  56. <span :style="!theme ? 'color: #fff' : ''" style="
  57. font-size: 12px;
  58. margin-left: 12px;
  59. position: relative;
  60. top: 1px;
  61. ">{{ item.name }}</span>
  62. </div>
  63. </div>
  64. <div class="chart-name">
  65. <div class="point point-left bottom"></div>
  66. <div class="point point-right bottom"></div>
  67. </div>
  68. <div id="powerChart" :style="chartStyle"></div>
  69. </div>
  70. <div class="lineStyle" v-on:dblclick="doubleclick('风速预测')" style="position: relative">
  71. <div class="chart-name">
  72. <div class="point point-left bottom"></div>
  73. <div class="point point-right bottom"></div>
  74. </div>
  75. <div id="windChart" :style="chartStyle"></div>
  76. </div>
  77. <div class="lineStyle" style="position: relative">
  78. <div class="chart-name">
  79. <div class="point point-left bottom"></div>
  80. <div class="point point-right bottom"></div>
  81. </div>
  82. <div id="assessmentChart" :style="chartStyle"></div>
  83. </div>
  84. </el-col>
  85. <el-col :span="10">
  86. <div class="lineStyle1" style="position: relative">
  87. <div class="chart-name">
  88. <div class="point point-left bottom"></div>
  89. <div class="point point-right bottom"></div>
  90. </div>
  91. <div id="installChart" :style="messageStyle"></div>
  92. </div>
  93. <div class="lineStyle1" :style="messageStylexc">
  94. <div style="display: flex" :style="messageStyle">
  95. <div style="width: 50%">
  96. <div id="guageChart" style="width: 100%; height: 100%"></div>
  97. </div>
  98. <div style="width: 50%">
  99. <div id="radarChart" style="width: 100%; height: 100%"></div>
  100. </div>
  101. </div>
  102. <div style="display: flex" :style="messageStyle">
  103. <div style="width: 50%">
  104. <div id="guageChart1" style="width: 100%; height: 100%"></div>
  105. </div>
  106. <div style="width: 50%">
  107. <div id="guageChart2" style="width: 100%; height: 100%"></div>
  108. </div>
  109. </div>
  110. </div>
  111. </el-col>
  112. </el-row>
  113. </div>
  114. <power-prediction-dialog ref="prediction" :ExceedTimeList="ExceedTimeList" :echartsTheme="echartsTheme"
  115. :theme="theme"></power-prediction-dialog>
  116. </div>
  117. </template>
  118. <script>
  119. import powerPredictionDialog from "../../components/powerPredictionComponent/powerPredictionDialog/predictionDialogPage.vue";
  120. import {
  121. apiGetStationGL,
  122. apiGetglobalPowerCharts,
  123. apiGetglobalWindSpeedCharts,
  124. apiGetinstalledCapacity,
  125. apiGetpredictedAssessmentScores,
  126. apiGetmeteorologicalElements,
  127. apiGetwindRosetteChart,
  128. apiGetUnitStatusInfoByStationNo,
  129. } from "../../api/api";
  130. import oneimg from "@/assets/windStatusPic/yunxing.png";
  131. import twoimg from "@/assets/windStatusPic/daiji.png";
  132. import threeimg from "@/assets/windStatusPic/weihu.png";
  133. import fourimg from "@/assets/windStatusPic/tingji.png";
  134. import fiveimg from "@/assets/windStatusPic/xiandian.png";
  135. import siximg from "@/assets/windStatusPic/shoulei.png";
  136. import sevenimg from "@/assets/windStatusPic/guzhang.png";
  137. import oneimg1 from "@/assets/windStatusPic/yunxing_W.png";
  138. import twoimg1 from "@/assets/windStatusPic/daiji_W.png";
  139. import threeimg1 from "@/assets/windStatusPic/weihu_W.png";
  140. import fourimg1 from "@/assets/windStatusPic/tingji_W.png";
  141. import fiveimg1 from "@/assets/windStatusPic/xiandian_W.png";
  142. import siximg1 from "@/assets/windStatusPic/shoulei_W.png";
  143. import sevenimg1 from "@/assets/windStatusPic/guzhang_W.png";
  144. import jsonData from "./component/power.json";
  145. import {
  146. apiGethomeData
  147. } from "@/api/gengra";
  148. export default {
  149. components: {
  150. powerPredictionDialog,
  151. },
  152. data() {
  153. return {
  154. windTurbines: "",
  155. reportStation: "",
  156. stationCode: "",
  157. statusData: [],
  158. statusDataW: [],
  159. stationData: [],
  160. pickerTime: [],
  161. pickerTimeDia: [],
  162. itemVal: "",
  163. planFiveMin: "",
  164. showpowerLegend: [],
  165. echartsTheme: "",
  166. theme: null,
  167. };
  168. },
  169. watch: {
  170. "$store.state.theme": {
  171. handler: function (newVal, oldVal) {
  172. this.theme = newVal;
  173. this.echartsTheme = !newVal ? "dark" : "";
  174. this.pickerTime = [
  175. new Date(
  176. new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 900 * 1000
  177. ),
  178. new Date(
  179. new Date(new Date().getTime()).setHours(0, 0, 0, 0) +
  180. 24 * 60 * 60 * 1000
  181. ),
  182. ];
  183. this.pickerTimeDia = [
  184. new Date(
  185. new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 900 * 1000
  186. ),
  187. new Date(
  188. new Date(new Date().getTime()).setHours(0, 0, 0, 0) +
  189. 24 * 60 * 60 * 1000 -
  190. 1000
  191. ),
  192. ];
  193. this.getStationData();
  194. },
  195. immediate: true,
  196. },
  197. },
  198. created() {
  199. this.statusData = [{
  200. img: oneimg,
  201. name: "运行",
  202. nameEn: "yxsum",
  203. borderSty: "#1C99FF",
  204. backSty: "#0046C7",
  205. numBack: "#212223",
  206. number: 0,
  207. },
  208. {
  209. img: twoimg,
  210. name: "待机",
  211. nameEn: "djsum",
  212. borderSty: "#05BB4C",
  213. backSty: "#258952",
  214. numBack: "#212223",
  215. number: 0,
  216. },
  217. {
  218. img: sevenimg,
  219. name: "故障",
  220. nameEn: "jxsum",
  221. borderSty: "#BA3237",
  222. backSty: "#73262B",
  223. numBack: "#212223",
  224. number: 0,
  225. },
  226. {
  227. img: threeimg,
  228. name: "维护",
  229. nameEn: "whsum",
  230. borderSty: "#E17D24",
  231. backSty: "#694119",
  232. numBack: "#212223",
  233. number: 0,
  234. },
  235. {
  236. img: fiveimg,
  237. name: "限电",
  238. nameEn: "xdsum",
  239. borderSty: "#C530C8",
  240. backSty: "#7A277F",
  241. numBack: "#212223",
  242. number: 0,
  243. },
  244. {
  245. img: siximg,
  246. name: "受累",
  247. nameEn: "tjsum",
  248. borderSty: "#fff",
  249. backSty: "#38393B",
  250. numBack: "#212223",
  251. number: 0,
  252. },
  253. {
  254. img: fourimg,
  255. name: "离线",
  256. nameEn: "lxsum",
  257. borderSty: "#52595B",
  258. backSty: "#272a2b",
  259. numBack: "#212223",
  260. number: 0,
  261. },
  262. ];
  263. this.statusDataW = [{
  264. img: oneimg1,
  265. name: "运行",
  266. nameEn: "yxsum",
  267. borderSty: "#3777E8",
  268. backSty: "#1850B3",
  269. numBack: "#073484",
  270. number: 0,
  271. },
  272. {
  273. img: twoimg1,
  274. name: "待机",
  275. nameEn: "djsum",
  276. borderSty: "#6BDB97",
  277. backSty: "#0EAC4C",
  278. numBack: "#077C35",
  279. number: 0,
  280. },
  281. {
  282. img: sevenimg1,
  283. name: "故障",
  284. nameEn: "jxsum",
  285. borderSty: "#73262B",
  286. backSty: "#BA3237",
  287. numBack: "#881B1F",
  288. number: 0,
  289. },
  290. {
  291. img: threeimg1,
  292. name: "维护",
  293. nameEn: "whsum",
  294. borderSty: "#F1AF74",
  295. backSty: "#E17D24",
  296. numBack: "#A6530A",
  297. number: 0,
  298. },
  299. {
  300. img: fiveimg1,
  301. name: "限电",
  302. nameEn: "xdsum",
  303. borderSty: "#E757EA",
  304. backSty: "#C530C8",
  305. numBack: "#901193",
  306. number: 0,
  307. },
  308. {
  309. img: fourimg1,
  310. name: "受累",
  311. nameEn: "tjsum",
  312. borderSty: "#CDCDCD",
  313. backSty: "#A8A8A8",
  314. numBack: "#878787",
  315. number: 0,
  316. },
  317. {
  318. img: siximg1,
  319. name: "离线",
  320. nameEn: "lxsum",
  321. borderSty: "#595D61",
  322. backSty: "#38393B",
  323. numBack: "#151719",
  324. number: 0,
  325. },
  326. ];
  327. this.pickerTime = [
  328. new Date(
  329. new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 900 * 1000
  330. ),
  331. new Date(
  332. new Date(new Date().getTime()).setHours(0, 0, 0, 0) +
  333. 24 * 60 * 60 * 1000
  334. ),
  335. ];
  336. this.pickerTimeDia = [
  337. new Date(
  338. new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 900 * 1000
  339. ),
  340. new Date(
  341. new Date(new Date().getTime()).setHours(0, 0, 0, 0) +
  342. 24 * 60 * 60 * 1000 -
  343. 1000
  344. ),
  345. ];
  346. this.ExceedTimeList = [{
  347. label: "超前15分钟",
  348. value: 0,
  349. },
  350. {
  351. label: "超前30分钟",
  352. value: 1,
  353. },
  354. {
  355. label: "超前45分钟",
  356. value: 2,
  357. },
  358. {
  359. label: "超前1小时",
  360. value: 3,
  361. },
  362. {
  363. label: "超前1小时15分钟",
  364. value: 4,
  365. },
  366. {
  367. label: "超前1小时30分钟",
  368. value: 5,
  369. },
  370. {
  371. label: "超前1小时45分钟",
  372. value: 6,
  373. },
  374. {
  375. label: "超前2小时",
  376. value: 7,
  377. },
  378. {
  379. label: "超前2小时15分钟",
  380. value: 8,
  381. },
  382. {
  383. label: "超前2小时30分钟",
  384. value: 9,
  385. },
  386. {
  387. label: "超前2小时45分钟",
  388. value: 10,
  389. },
  390. {
  391. label: "超前3小时",
  392. value: 11,
  393. },
  394. {
  395. label: "超前3小时15分钟",
  396. value: 12,
  397. },
  398. {
  399. label: "超前3小时30分钟",
  400. value: 13,
  401. },
  402. {
  403. label: "超前3小时45分钟",
  404. value: 14,
  405. },
  406. {
  407. label: "超前4小时",
  408. value: 15,
  409. },
  410. {
  411. label: "超前5小时",
  412. value: 19,
  413. },
  414. {
  415. label: "超前6小时",
  416. value: 23,
  417. },
  418. ];
  419. this.showpowerLegend = [{
  420. name: "理论",
  421. color: "#5672c4",
  422. },
  423. {
  424. name: "可用",
  425. color: "#95cc7a",
  426. },
  427. {
  428. name: "AGC",
  429. color: "#f7c75f",
  430. },
  431. {
  432. name: "超短期",
  433. color: "#e96366",
  434. },
  435. {
  436. name: "实际",
  437. color: "#7ac1dd",
  438. },
  439. ];
  440. // this.getStationData();
  441. },
  442. computed: {
  443. pageHeight() {
  444. return {
  445. height: document.documentElement.clientHeight - 110 + "px",
  446. };
  447. },
  448. chartStyle() {
  449. let height =
  450. (document.documentElement.clientHeight - 100 - 100) / 3 + "px";
  451. return {
  452. width: "100%",
  453. height: height,
  454. };
  455. },
  456. messageStyle() {
  457. let height =
  458. (document.documentElement.clientHeight - 100 - 100) / 3 + "px";
  459. return {
  460. width: "96%",
  461. height: height,
  462. };
  463. },
  464. messageStylexc() {
  465. let height =
  466. ((document.documentElement.clientHeight - 100 - 60) / 3) * 2 + "px";
  467. return {
  468. width: "96%",
  469. height: height,
  470. };
  471. },
  472. },
  473. mounted() {
  474. let that = this;
  475. that.initPageData();
  476. that.planFiveMin = setInterval(function () {
  477. // that.seachData();
  478. }, 300000);
  479. },
  480. beforeRouteLeave(to, from, next) {
  481. next();
  482. if (this.planFiveMin) {
  483. clearInterval(this.planFiveMin);
  484. this.planFiveMin = null;
  485. }
  486. },
  487. methods: {
  488. initPageData() {
  489. const that = this;
  490. {
  491. let xAxis = [];
  492. let series = [];
  493. let legend = [];
  494. jsonData.globalPowerPredictionChartData2.dateList.forEach((item) => {
  495. xAxis.push(item.substring(item.indexOf(" ") + 1));
  496. });
  497. jsonData.globalPowerPredictionChartData2.dataFormatList.forEach(
  498. (iten) => {
  499. if (iten.name !== "短期") {
  500. legend.push(iten.name);
  501. let seriesObj = {
  502. name: iten.name,
  503. type: "line",
  504. data: iten.data.map((it) => {
  505. return that.$utils.isHasNum(it);
  506. }),
  507. symbol: "none",
  508. };
  509. series.push(seriesObj);
  510. }
  511. }
  512. );
  513. that.getPowerLine("powerChart", "功率预测", xAxis, legend, series);
  514. }
  515. {
  516. let xAxis = [];
  517. let series = [];
  518. let legend = [];
  519. jsonData.globalWindSpeedForecastChartData.dateList.forEach((item) => {
  520. xAxis.push(item.substring(item.indexOf(" ") + 1));
  521. });
  522. jsonData.globalWindSpeedForecastChartData.dataFormatList.forEach(
  523. (iten) => {
  524. legend.push(iten.name);
  525. let seriesObj = {
  526. name: iten.name,
  527. type: "line",
  528. data: iten.data.map((it) => {
  529. return that.$utils.isHasNum(it);
  530. }),
  531. symbol: "none",
  532. };
  533. series.push(seriesObj);
  534. }
  535. );
  536. that.getPowerLine("windChart", "风速预测", xAxis, legend, series);
  537. }
  538. {
  539. let xAxis = [];
  540. let series = [];
  541. let legend = [];
  542. jsonData.installedCapacityData.name.forEach((item) => {
  543. xAxis.push(item);
  544. });
  545. jsonData.installedCapacityData.dataFormatList.forEach((iten, index) => {
  546. legend.push(iten.name);
  547. let seriesObj = {
  548. name: iten.name,
  549. type: "bar",
  550. barGap: 0,
  551. emphasis: {
  552. focus: "series",
  553. },
  554. data: iten.data.map((it) => {
  555. return that.$utils.isHasNum(it);
  556. }),
  557. };
  558. series.push(seriesObj);
  559. });
  560. that.getPowerBar("installChart", "功率统计", xAxis, legend, series);
  561. }
  562. {
  563. let xAxis = [];
  564. let series = [];
  565. let legend = [];
  566. jsonData.predictedAssessmentScoresData.name.forEach((item) => {
  567. xAxis.push(item);
  568. });
  569. jsonData.predictedAssessmentScoresData.dataFormatList.forEach(
  570. (iten, index) => {
  571. legend.push(iten.name);
  572. let seriesObj = {
  573. name: iten.name,
  574. type: "bar",
  575. barGap: 0,
  576. emphasis: {
  577. focus: "series",
  578. },
  579. data: iten.data.map((it) => {
  580. return that.$utils.isHasNum(it);
  581. }),
  582. };
  583. series.push(seriesObj);
  584. }
  585. );
  586. that.getPowerBar(
  587. "assessmentChart",
  588. "预测考核分数",
  589. xAxis,
  590. legend,
  591. series
  592. );
  593. }
  594. {
  595. // let radar = [];
  596. // let radaxr = [0, 45, 90, 135, 180, 225, 270, 315, 360];
  597. // let serise = [{
  598. // value: [],
  599. // name: "实际风向",
  600. // },
  601. // {
  602. // value: [],
  603. // name: "预测风向",
  604. // },
  605. // ];
  606. // jsonData.windRosetteChartData.dataFormatList[0].data.forEach(
  607. // (item, index) => {
  608. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  609. // let obj = {
  610. // name: (index + 1) * 5,
  611. // };
  612. // radar.unshift(obj);
  613. // }
  614. // }
  615. // );
  616. // jsonData.windRosetteChartData.dataFormatList.forEach((itn) => {
  617. // let ser1 = [];
  618. // let ser2 = [];
  619. // if (itn.name === "预测风速") {
  620. // itn.data.forEach((it, index) => {
  621. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  622. // ser1.unshift(it && it !== 0 ? it.toFixed(1) : 0);
  623. // }
  624. // });
  625. // serise[1].value = ser1;
  626. // } else {
  627. // itn.data.forEach((it, index) => {
  628. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  629. // ser2.unshift(it && it !== 0 ? it.toFixed(1) : 0);
  630. // }
  631. // });
  632. // serise[0].value = ser2;
  633. // }
  634. // });
  635. // radar.forEach((itb) => {
  636. // if (itb.name === 360) {
  637. // itb.name = "北";
  638. // } else if (itb.name === 45) {
  639. // itb.name = "东北";
  640. // } else if (itb.name === 90) {
  641. // itb.name = "东";
  642. // } else if (itb.name === 135) {
  643. // itb.name = "东南";
  644. // } else if (itb.name === 180) {
  645. // itb.name = "南";
  646. // } else if (itb.name === 225) {
  647. // itb.name = "西南";
  648. // } else if (itb.name === 270) {
  649. // itb.name = "西";
  650. // } else if (itb.name === 315) {
  651. // itb.name = "西北";
  652. // }
  653. // });
  654. let serise = []
  655. jsonData.meteorologicalElementsData.dataFormatList.forEach(it => {
  656. if (it.name === '风向') {
  657. serise = it.data
  658. }
  659. })
  660. that.getRose(serise);
  661. }
  662. const gaugeData = [{
  663. title: {
  664. offsetCenter: ["-40%", "85%"],
  665. },
  666. detail: {
  667. offsetCenter: ["-40%", "110%"],
  668. },
  669. },
  670. {
  671. title: {
  672. offsetCenter: ["40%", "85%"],
  673. },
  674. detail: {
  675. offsetCenter: ["40%", "110%"],
  676. },
  677. },
  678. ];
  679. jsonData.meteorologicalElementsData.dataFormatList.forEach((item) => {
  680. gaugeData[0].name = "实际" + item.name;
  681. gaugeData[0].value = Math.ceil(item.data[1]);
  682. gaugeData[1].name = "预测" + item.name;
  683. gaugeData[1].value = Math.ceil(item.data[0]);
  684. if (item.name === "温度") {
  685. that.getGaugeX("guageChart", gaugeData);
  686. } else if (item.name === "湿度") {
  687. that.getGaugeX("guageChart1", gaugeData);
  688. } else {
  689. that.getGaugeX("guageChart2", gaugeData);
  690. }
  691. });
  692. that.statusData.forEach((item) => {
  693. for (let it in jsonData.unitStatusInfoByStationNoData) {
  694. if (item.nameEn === it) {
  695. item.number = jsonData.unitStatusInfoByStationNoData[it];
  696. }
  697. }
  698. });
  699. that.statusDataW.forEach((item) => {
  700. for (let it in jsonData.unitStatusInfoByStationNoData) {
  701. if (item.nameEn === it) {
  702. item.number = jsonData.unitStatusInfoByStationNoData[it];
  703. }
  704. }
  705. });
  706. },
  707. statusSty(item) {
  708. return `border: 1px solid ${item.borderSty};background: ${item.backSty}`;
  709. },
  710. statusNumSty(item) {
  711. return `border: 1px solid ${item.borderSty};background:${item.numBack}`;
  712. },
  713. doubleclick(name) {
  714. let title = this.reportStation;
  715. // debugger
  716. // this.stationData.forEach((item) => {
  717. // if (item.stationName === this.windTurbines) {
  718. // title = item.stationName;
  719. // }
  720. // });
  721. this.$refs.prediction.dialogVisible = true;
  722. this.$refs.prediction.isPower = false;
  723. this.$refs.prediction.tableData = [];
  724. this.$refs.prediction.dateType = 1;
  725. this.$refs.prediction.title = title + name;
  726. this.$refs.prediction.loading = true;
  727. this.$refs.prediction.pickerTime = this.pickerTimeDia;
  728. this.$refs.prediction.windTurbines = this.windTurbines;
  729. this.$refs.prediction.windTurbinesVal = this.itemVal;
  730. this.$nextTick(() => {
  731. const myChart1 = this.$echarts.init(
  732. document.getElementById("powerChart"),
  733. this.echartsTheme
  734. );
  735. const myChart2 = this.$echarts.init(
  736. document.getElementById("windChart"),
  737. this.echartsTheme
  738. );
  739. myChart1.dispatchAction({
  740. type: "hideTip",
  741. });
  742. myChart2.dispatchAction({
  743. type: "hideTip",
  744. });
  745. if (name === "功率预测") {
  746. this.$refs.prediction.isPower = true;
  747. this.$refs.prediction.getChartsData();
  748. this.$refs.prediction.getTableData();
  749. } else {
  750. this.$refs.prediction.isPower = false;
  751. this.$refs.prediction.getwindChartsData();
  752. this.$refs.prediction.getwindTableData();
  753. }
  754. });
  755. },
  756. getStationData() {
  757. apiGetStationGL().then((datas) => {
  758. this.stationData = datas.data.list;
  759. this.stationData[0].showBac = true;
  760. this.windTurbines = datas.data.list[0].no;
  761. this.reportStation = datas.data.list[0].stationName;
  762. this.stationCode = datas.data.list[0].stationCode;
  763. this.itemVal = datas.data.list[0].itemVal;
  764. this.getPowerPrediction();
  765. this.getWindSpeed();
  766. this.getCapacity();
  767. this.getAssessmentScore();
  768. this.getIrradiance();
  769. // this.getwindRosetteChart();
  770. this.getUnitStatus();
  771. });
  772. },
  773. // 根据场站编号获取机组状态信息
  774. getUnitStatus() {
  775. let that = this;
  776. // let params = {
  777. // stationNo: that.windTurbines,
  778. // };
  779. // apiGetUnitStatusInfoByStationNo(params).then((datas) => {
  780. // if (datas) {
  781. // if (datas.data) {
  782. // that.statusData.forEach((item) => {
  783. // for (let it in datas.data) {
  784. // if (item.nameEn === it) {
  785. // item.number = datas.data[it];
  786. // }
  787. // }
  788. // });
  789. // that.statusDataW.forEach((item) => {
  790. // for (let it in datas.data) {
  791. // if (item.nameEn === it) {
  792. // item.number = datas.data[it];
  793. // }
  794. // }
  795. // });
  796. // }
  797. // }
  798. // });
  799. let params = {
  800. wpId: this.stationCode,
  801. };
  802. apiGethomeData(params)
  803. .then((res) => {
  804. if (res && res.data.ztmap) {
  805. that.statusData.forEach((item) => {
  806. for (let it in res.data.ztmap) {
  807. if (item.nameEn === it) {
  808. item.number = res.data.ztmap[it];
  809. }
  810. }
  811. });
  812. that.statusDataW.forEach((item) => {
  813. for (let it in res.data.ztmap) {
  814. if (item.nameEn === it) {
  815. item.number = res.data.ztmap[it];
  816. }
  817. }
  818. });
  819. }
  820. })
  821. },
  822. changeWindNo(val) {
  823. this.windTurbines = val
  824. this.stationData.forEach((item) => {
  825. if (item.no === val) {
  826. this.stationCode = item.stationCode
  827. this.reportStation = item.stationName;
  828. }
  829. });
  830. },
  831. statusIcon(type) {
  832. let picture = "";
  833. if (type === "1") {
  834. picture = "yunxingPic";
  835. } else if (type === "2") {
  836. picture = "daijiPic";
  837. } else if (type === "3") {
  838. picture = "weihuPic";
  839. } else if (type === "4") {
  840. picture = "tingjiPic";
  841. } else if (type === "5") {
  842. picture = "xiandianPic";
  843. } else if (type === "6") {
  844. picture = "lixianPic";
  845. } else if (type === "7") {
  846. picture = "jianxiuPic";
  847. }
  848. return picture;
  849. },
  850. seachData() {
  851. this.getPowerPrediction();
  852. this.getWindSpeed();
  853. this.getCapacity();
  854. this.getAssessmentScore();
  855. // this.getwindRosetteChart();
  856. this.getIrradiance();
  857. this.getUnitStatus();
  858. },
  859. // 今日功率预测
  860. getPowerPrediction() {
  861. let pickStartTime = this.$utils.getTime(this.pickerTime[0]);
  862. let pickEndTime = this.$utils.getTime(this.pickerTime[1]);
  863. let type = 2;
  864. // if (
  865. // new Date(pickEndTime).getTime() - new Date(pickStartTime).getTime() <=
  866. // 10 * 86400000
  867. // ) {
  868. // type = 1;
  869. // } else {
  870. // type = 2;
  871. // }
  872. let params = {
  873. beginDataTime: pickStartTime,
  874. endDataTime: pickEndTime,
  875. stationNumber: this.windTurbines,
  876. timeType: type,
  877. // itemVal: this.itemVal,
  878. itemVal: 0,
  879. leadTime: 0
  880. };
  881. apiGetglobalPowerCharts(params).then((datas) => {
  882. if (datas && datas.data) {
  883. let xAxis = [];
  884. let series = [];
  885. let legend = [];
  886. if (datas.data.dateList.length > 0) {
  887. datas.data.dateList.forEach((item) => {
  888. xAxis.push(item.substring(item.indexOf(" ") + 1));
  889. });
  890. }
  891. if (datas.data.dataFormatList.length > 0) {
  892. datas.data.dataFormatList.forEach((iten) => {
  893. if (iten.name !== "短期") {
  894. legend.push(iten.name);
  895. let seriesObj = {
  896. name: iten.name,
  897. type: "line",
  898. data: iten.data.map((it) => {
  899. return this.$utils.isHasNum(it);
  900. }),
  901. symbol: "none",
  902. };
  903. series.push(seriesObj);
  904. }
  905. });
  906. }
  907. this.getPowerLine("powerChart", "功率预测", xAxis, legend, series);
  908. }
  909. });
  910. },
  911. // 今日风速预测
  912. getWindSpeed() {
  913. let pickStartTime = this.$utils.getTime(this.pickerTime[0]);
  914. let pickEndTime = this.$utils.getTime(this.pickerTime[1]);
  915. let type;
  916. if (
  917. new Date(pickEndTime).getTime() - new Date(pickStartTime).getTime() <=
  918. 10 * 86400000
  919. ) {
  920. type = 1;
  921. } else {
  922. type = 2;
  923. }
  924. let params = {
  925. beginDataTime: pickStartTime,
  926. endDataTime: pickEndTime,
  927. stationNumber: this.windTurbines,
  928. timeType: type,
  929. };
  930. apiGetglobalWindSpeedCharts(params).then((datas) => {
  931. if (datas && datas.data) {
  932. let xAxis = [];
  933. let series = [];
  934. let legend = [];
  935. if (datas.data.dateList.length > 0) {
  936. datas.data.dateList.forEach((item) => {
  937. xAxis.push(item.substring(item.indexOf(" ") + 1));
  938. });
  939. }
  940. if (datas.data.dataFormatList.length > 0) {
  941. datas.data.dataFormatList.forEach((iten) => {
  942. legend.push(iten.name);
  943. let seriesObj = {
  944. name: iten.name,
  945. type: "line",
  946. data: iten.data.map((it) => {
  947. return this.$utils.isHasNum(it);
  948. }),
  949. symbol: "none",
  950. };
  951. series.push(seriesObj);
  952. });
  953. }
  954. this.getPowerLine("windChart", "风速预测", xAxis, legend, series);
  955. }
  956. });
  957. },
  958. getPowerLine(name, title, xAxis, legend, series) {
  959. let option = {
  960. backgroundColor: "",
  961. title: {
  962. text: title,
  963. textStyle: {
  964. fontSize: "16",
  965. fontWeight: "bold",
  966. },
  967. },
  968. tooltip: {
  969. trigger: "axis",
  970. formatter: name === "powerChart" ?
  971. (item) => {
  972. let str =
  973. `<span style="display:inline-block;margin-bottom: 5px">${item[0].axisValue}</span></br>`;
  974. let strMsg = "";
  975. if (item.length > 1) {
  976. item.forEach((it, index) => {
  977. // if (index !== 3) {
  978. if (it.seriesName !== "超短期") {
  979. strMsg = `<div style="margin-bottom: 5px">
  980. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${it.color};\"></span>&nbsp;
  981. <span style="display:inline-block;">${it.seriesName}:</span>&nbsp;&nbsp;<span>${it.value}</span>
  982. </div>`;
  983. this.showpowerLegend[index].name = it.seriesName;
  984. this.showpowerLegend[index].color = it.color;
  985. } else {
  986. if (it.axisValue === "00:15:00") {
  987. it.color = "#e96366";
  988. }
  989. strMsg = `<div style="margin-bottom: 5px">
  990. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${
  991. it.color
  992. };\"></span>&nbsp;
  993. <span style="display:inline-block;">${
  994. it.color === "#e96366" ? "超短期" : "短期"
  995. }:</span>&nbsp;&nbsp;<span>${it.value}</span>
  996. </div>`;
  997. if (it.color === "#e96366") {
  998. this.showpowerLegend[index].name = "超短期";
  999. } else {
  1000. this.showpowerLegend[index].name = "短期";
  1001. }
  1002. this.showpowerLegend[index].color = it.color;
  1003. }
  1004. str = str + strMsg;
  1005. });
  1006. } else {
  1007. if (item[0].axisValue === "00:15:00") {
  1008. item[0].color = "#e96366";
  1009. }
  1010. strMsg = `<div style="margin-bottom: 5px">
  1011. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${
  1012. item[0].color
  1013. };\"></span>&nbsp;
  1014. <span style="display:inline-block;">${
  1015. item[0].color === "#e96366" ? "超短期" : "短期"
  1016. }:</span>&nbsp;&nbsp;<span>${item[0].value}</span>
  1017. </div>`;
  1018. if (item[0].color === "#e96366") {
  1019. this.showpowerLegend[3].name = "超短期";
  1020. } else {
  1021. this.showpowerLegend[3].name = "短期";
  1022. }
  1023. this.showpowerLegend[3].color = item[0].color;
  1024. str = str + strMsg;
  1025. }
  1026. return str;
  1027. } : "",
  1028. },
  1029. legend: {
  1030. // width: '380',
  1031. right: "20",
  1032. data: legend,
  1033. // show: name === 'powerChart' ? false : true
  1034. show: false,
  1035. },
  1036. grid: {
  1037. left: "5%",
  1038. right: "5%",
  1039. bottom: "3%",
  1040. containLabel: true,
  1041. },
  1042. xAxis: {
  1043. type: "category",
  1044. boundaryGap: false,
  1045. data: xAxis,
  1046. },
  1047. yAxis: {
  1048. type: "value",
  1049. name: title === "功率预测" ? "兆瓦(Mw)" : "m/s",
  1050. },
  1051. series: series,
  1052. };
  1053. if (name === "powerChart") {
  1054. let hour = new Date().getHours() + 6;
  1055. let min = new Date().getMinutes();
  1056. let allTime = "";
  1057. let num = 0;
  1058. if (0 <= min && min < 15) {
  1059. allTime = hour + ":00:00";
  1060. } else if (15 <= min && min < 30) {
  1061. allTime = hour + ":15:00";
  1062. } else if (30 <= min && min < 45) {
  1063. allTime = hour + ":30:00";
  1064. } else if (45 <= min && min < 60) {
  1065. allTime = hour + ":45:00";
  1066. }
  1067. xAxis.forEach((item, index) => {
  1068. if (item === allTime) {
  1069. num = index;
  1070. }
  1071. });
  1072. if (num > 0) {
  1073. option.visualMap = {
  1074. show: false,
  1075. dimension: 0,
  1076. seriesIndex: 3,
  1077. pieces: [{
  1078. gt: 0,
  1079. lte: num,
  1080. color: "#e96366",
  1081. },
  1082. {
  1083. gt: num,
  1084. color: "#39ccd9",
  1085. },
  1086. ],
  1087. };
  1088. }
  1089. } else {
  1090. option.legend.show = true;
  1091. option.data = legend;
  1092. option.right = "20";
  1093. }
  1094. // 基于准备好的dom,初始化echarts实例
  1095. let dom = document.getElementById(name);
  1096. dom.removeAttribute("_echarts_instance_") ?
  1097. dom.removeAttribute("_echarts_instance_") :
  1098. "";
  1099. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1100. myChart.setOption(option);
  1101. myChart.on("mousemove", this.setTooltip("powerChart", "windChart", 0));
  1102. myChart.on("mouseover", function (params) {
  1103. console.log("myChart1=====>>>>>", params);
  1104. });
  1105. window.addEventListener("resize", function () {
  1106. myChart.resize();
  1107. });
  1108. },
  1109. setTooltip(name1, name2, num) {
  1110. const myChart1 = this.$echarts.init(
  1111. document.getElementById(name1),
  1112. this.echartsTheme
  1113. );
  1114. const myChart2 = this.$echarts.init(
  1115. document.getElementById(name2),
  1116. this.echartsTheme
  1117. );
  1118. this.$utils.setTooltip(myChart1, myChart2, num);
  1119. },
  1120. // 装机,并网,实时,可用电量
  1121. getCapacity() {
  1122. let params = {
  1123. stationNumber: this.windTurbines,
  1124. // itemVal: this.itemVal
  1125. itemVal: 0,
  1126. };
  1127. apiGetinstalledCapacity(params).then((datas) => {
  1128. if (datas && datas.data) {
  1129. let xAxis = [];
  1130. let series = [];
  1131. let legend = [];
  1132. if (datas.data.name.length > 0) {
  1133. datas.data.name.forEach((item) => {
  1134. xAxis.push(item);
  1135. });
  1136. }
  1137. if (datas.data.dataFormatList.length > 0) {
  1138. datas.data.dataFormatList.forEach((iten, index) => {
  1139. legend.push(iten.name);
  1140. let seriesObj = {
  1141. name: iten.name,
  1142. type: "bar",
  1143. barGap: 0,
  1144. emphasis: {
  1145. focus: "series",
  1146. },
  1147. data: iten.data.map((it) => {
  1148. return this.$utils.isHasNum(it);
  1149. }),
  1150. };
  1151. series.push(seriesObj);
  1152. });
  1153. }
  1154. this.getPowerBar("installChart", "功率统计", xAxis, legend, series);
  1155. }
  1156. });
  1157. },
  1158. // 预测考核分数
  1159. getAssessmentScore() {
  1160. let params = {
  1161. stationNumber: this.windTurbines,
  1162. };
  1163. apiGetpredictedAssessmentScores(params).then((datas) => {
  1164. if (datas && datas.data) {
  1165. let xAxis = [];
  1166. let series = [];
  1167. let legend = [];
  1168. if (datas.data.name.length > 0) {
  1169. datas.data.name.forEach((item) => {
  1170. xAxis.push(item);
  1171. });
  1172. }
  1173. if (datas.data.dataFormatList.length > 0) {
  1174. datas.data.dataFormatList.forEach((iten, index) => {
  1175. legend.push(iten.name);
  1176. let seriesObj = {
  1177. name: iten.name,
  1178. type: "bar",
  1179. barGap: 0,
  1180. emphasis: {
  1181. focus: "series",
  1182. },
  1183. data: iten.data.map((it) => {
  1184. return this.$utils.isHasNum(it);
  1185. }),
  1186. };
  1187. series.push(seriesObj);
  1188. });
  1189. }
  1190. this.getPowerBar(
  1191. "assessmentChart",
  1192. "预测考核分数",
  1193. xAxis,
  1194. legend,
  1195. series
  1196. );
  1197. }
  1198. });
  1199. },
  1200. getPowerBar(name, title, xAxis, legend, series) {
  1201. let option = {
  1202. backgroundColor: "",
  1203. title: {
  1204. text: title,
  1205. textStyle: {
  1206. fontSize: "16",
  1207. fontWeight: "bold",
  1208. },
  1209. },
  1210. tooltip: {
  1211. trigger: "axis",
  1212. axisPointer: {
  1213. type: "shadow",
  1214. },
  1215. },
  1216. grid: {
  1217. left: "5%",
  1218. right: "5%",
  1219. bottom: "3%",
  1220. containLabel: true,
  1221. },
  1222. legend: {
  1223. // bottom: bott,
  1224. right: "20",
  1225. data: legend,
  1226. },
  1227. xAxis: [{
  1228. type: "category",
  1229. axisTick: {
  1230. show: false,
  1231. },
  1232. data: xAxis,
  1233. }, ],
  1234. yAxis: [{
  1235. type: "value",
  1236. name: title === "预测考核分数" ? "分" : "兆瓦(M/w)",
  1237. }, ],
  1238. series: series,
  1239. };
  1240. // 基于准备好的dom,初始化echarts实例
  1241. let dom = document.getElementById(name);
  1242. dom.removeAttribute("_echarts_instance_") ?
  1243. dom.removeAttribute("_echarts_instance_") :
  1244. "";
  1245. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1246. myChart.setOption(option);
  1247. window.addEventListener("resize", function () {
  1248. myChart.resize();
  1249. });
  1250. },
  1251. // 仪表盘,玫瑰图
  1252. getIrradiance() {
  1253. let params = {
  1254. dateTime: this.getPowerTime(new Date()),
  1255. stationNumber: this.windTurbines,
  1256. };
  1257. apiGetmeteorologicalElements(params).then((datas) => {
  1258. if (datas.data && datas.data.dataFormatList.length > 0) {
  1259. const gaugeData = [{
  1260. title: {
  1261. offsetCenter: ["-40%", "85%"],
  1262. },
  1263. detail: {
  1264. offsetCenter: ["-40%", "110%"],
  1265. },
  1266. },
  1267. {
  1268. title: {
  1269. offsetCenter: ["40%", "85%"],
  1270. },
  1271. detail: {
  1272. offsetCenter: ["40%", "110%"],
  1273. },
  1274. },
  1275. ];
  1276. datas.data.dataFormatList.forEach((item) => {
  1277. gaugeData[0].name = "实际" + item.name;
  1278. gaugeData[0].value = Math.ceil(item.data[1]);
  1279. gaugeData[1].name = "预测" + item.name;
  1280. gaugeData[1].value = Math.ceil(item.data[0]);
  1281. if (item.name === "温度") {
  1282. this.getGaugeX("guageChart", gaugeData);
  1283. } else if (item.name === "湿度") {
  1284. this.getGaugeX("guageChart1", gaugeData);
  1285. } else if (item.name === '风向') {
  1286. this.getRose(item.data);
  1287. } else {
  1288. this.getGaugeX("guageChart2", gaugeData);
  1289. }
  1290. });
  1291. }
  1292. });
  1293. },
  1294. //转换时间
  1295. getPowerTime(date) {
  1296. var y = date.getFullYear();
  1297. var m = date.getMonth() + 1;
  1298. m = m < 10 ? "0" + m : m;
  1299. var d = date.getDate();
  1300. d = d < 10 ? "0" + d : d;
  1301. var h = date.getHours();
  1302. h = h < 10 ? "0" + h : h;
  1303. var minute = date.getMinutes();
  1304. minute = minute < 10 ? "0" + minute : minute;
  1305. // var second=date.getSeconds();
  1306. // second=second < 10 ? ('0' + second) : second;
  1307. // return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;
  1308. let timeF = "";
  1309. timeF = y + "-" + m + "-" + d + " " + h + ":" + minute;
  1310. return this.$utils.changePowerPickDate(timeF);
  1311. },
  1312. getGaugeX(name, servies) {
  1313. let formatVal = "";
  1314. let maxNum = null;
  1315. let minNum = null;
  1316. if (name === "guageChart") {
  1317. formatVal = "{value}℃";
  1318. maxNum = 50;
  1319. minNum = -50;
  1320. } else if (name === "guageChart1") {
  1321. formatVal = "{value}%";
  1322. maxNum = 100;
  1323. minNum = 0;
  1324. } else {
  1325. formatVal = "{value}Pa";
  1326. maxNum = 1500;
  1327. minNum = 0;
  1328. }
  1329. let option = {
  1330. series: [{
  1331. type: "gauge",
  1332. min: minNum,
  1333. max: maxNum,
  1334. anchor: {
  1335. show: true,
  1336. showAbove: true,
  1337. size: 18,
  1338. itemStyle: {
  1339. color: "#FAC858",
  1340. },
  1341. },
  1342. pointer: {
  1343. icon: "path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z",
  1344. width: 8,
  1345. length: "80%",
  1346. offsetCenter: [0, "8%"],
  1347. },
  1348. progress: {
  1349. show: true,
  1350. overlap: true,
  1351. roundCap: true,
  1352. },
  1353. axisLine: {
  1354. roundCap: true,
  1355. },
  1356. data: servies,
  1357. title: {
  1358. fontSize: 14,
  1359. },
  1360. detail: {
  1361. width: 40,
  1362. height: 14,
  1363. fontSize: 14,
  1364. color: "#fff",
  1365. backgroundColor: "auto",
  1366. borderRadius: 3,
  1367. formatter: formatVal,
  1368. },
  1369. }, ],
  1370. };
  1371. if (!this.theme) {
  1372. option.backgroundColor = "";
  1373. }
  1374. // 基于准备好的dom,初始化echarts实例
  1375. let dom = document.getElementById(name);
  1376. dom.removeAttribute("_echarts_instance_") ?
  1377. dom.removeAttribute("_echarts_instance_") :
  1378. "";
  1379. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1380. // let that = this
  1381. // setInterval(function () {
  1382. // that.getIrradiance()
  1383. // }, 2000);
  1384. myChart.setOption(option);
  1385. window.addEventListener("resize", function () {
  1386. myChart.resize();
  1387. });
  1388. },
  1389. //风向玫瑰图
  1390. getwindRosetteChart() {
  1391. let params = {
  1392. stationNumber: this.windTurbines,
  1393. };
  1394. apiGetwindRosetteChart(params).then((datas) => {
  1395. if (datas && datas.data) {
  1396. // let radar = [];
  1397. // let radaxr = [0, 45, 90, 135, 180, 225, 270, 315, 360];
  1398. // let serise = [{
  1399. // value: [],
  1400. // name: "实际风向",
  1401. // },
  1402. // {
  1403. // value: [],
  1404. // name: "预测风向",
  1405. // },
  1406. // ];
  1407. // datas.data.dataFormatList[0].data.forEach((item, index) => {
  1408. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  1409. // let obj = {
  1410. // name: (index + 1) * 5,
  1411. // };
  1412. // radar.unshift(obj);
  1413. // }
  1414. // });
  1415. // datas.data.dataFormatList.forEach((itn) => {
  1416. // let ser1 = [];
  1417. // let ser2 = [];
  1418. // if (itn.name === "预测风速") {
  1419. // itn.data.forEach((it, index) => {
  1420. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  1421. // ser1.unshift(it && it !== 0 ? it.toFixed(1) : 0);
  1422. // }
  1423. // });
  1424. // serise[1].value = ser1;
  1425. // } else {
  1426. // itn.data.forEach((it, index) => {
  1427. // if (radaxr.indexOf((index + 1) * 5) !== -1) {
  1428. // ser2.unshift(it && it !== 0 ? it.toFixed(1) : 0);
  1429. // }
  1430. // });
  1431. // serise[0].value = ser2;
  1432. // }
  1433. // });
  1434. // radar.forEach((itb) => {
  1435. // if (itb.name === 360) {
  1436. // itb.name = "北";
  1437. // } else if (itb.name === 45) {
  1438. // itb.name = "东北";
  1439. // } else if (itb.name === 90) {
  1440. // itb.name = "东";
  1441. // } else if (itb.name === 135) {
  1442. // itb.name = "东南";
  1443. // } else if (itb.name === 180) {
  1444. // itb.name = "南";
  1445. // } else if (itb.name === 225) {
  1446. // itb.name = "西南";
  1447. // } else if (itb.name === 270) {
  1448. // itb.name = "西";
  1449. // } else if (itb.name === 315) {
  1450. // itb.name = "西北";
  1451. // }
  1452. // });
  1453. let serise = []
  1454. datas.data.dataFormatList.forEach(it => {
  1455. if (it.name === '风向') {
  1456. serise = it.data
  1457. }
  1458. })
  1459. console.log("风向", datas.data.dataFormatList)
  1460. this.getRose(serise);
  1461. }
  1462. });
  1463. },
  1464. getRadar(radar, serise) {
  1465. let option = {
  1466. backgroundColor: "",
  1467. legend: {
  1468. bottom: "-5",
  1469. data: ["实际", "预测"],
  1470. },
  1471. tooltip: {
  1472. trigger: "item",
  1473. formatter: (item) => {
  1474. let str =
  1475. `<span style="display:inline-block;margin-bottom:5px;">${item.name}(风向: 风速)</span></br>`;
  1476. let strMsg = "";
  1477. radar.forEach((it, index) => {
  1478. strMsg = `<div>
  1479. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${item.color};\"></span>&nbsp;
  1480. <span style="display:inline-block;width: 55%">${it.name}:</span>&nbsp;&nbsp;<span>${item.data.value[index]}</span>
  1481. </div>`;
  1482. str = str + strMsg;
  1483. });
  1484. return str;
  1485. },
  1486. },
  1487. radar: {
  1488. // shape: 'circle',
  1489. indicator: radar,
  1490. },
  1491. series: [{
  1492. type: "radar",
  1493. data: serise,
  1494. }, ],
  1495. };
  1496. // 基于准备好的dom,初始化echarts实例
  1497. let dom = document.getElementById("radarChart");
  1498. dom.removeAttribute("_echarts_instance_") ?
  1499. dom.removeAttribute("_echarts_instance_") :
  1500. "";
  1501. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1502. myChart.setOption(option);
  1503. window.addEventListener("resize", function () {
  1504. myChart.resize();
  1505. });
  1506. },
  1507. getRose(serise) {
  1508. let option = {
  1509. backgroundColor: '',
  1510. polar: {
  1511. radius: [10, '80%']
  1512. },
  1513. radiusAxis: {
  1514. // max: 25,
  1515. startAngle: 75
  1516. },
  1517. angleAxis: {
  1518. type: 'category',
  1519. data: ["北", "东北", "东", "东南", "南", "西南", "西", "西北"],
  1520. boundaryGap: false,
  1521. axisLabel: {
  1522. show: true,
  1523. interval: 0,
  1524. formatter: '{value}',
  1525. align: 'center',
  1526. margin: 10
  1527. },
  1528. axisTick: {
  1529. show: true,
  1530. alignWithLabel: true
  1531. }
  1532. },
  1533. tooltip: {},
  1534. series: [{
  1535. name: '实际',
  1536. type: 'bar',
  1537. data: serise[1],
  1538. coordinateSystem: 'polar',
  1539. barWidth: 15
  1540. },
  1541. {
  1542. name: '预测',
  1543. type: 'bar',
  1544. data: serise[0],
  1545. coordinateSystem: 'polar',
  1546. barWidth: 15
  1547. }
  1548. ],
  1549. animation: false
  1550. };
  1551. // 基于准备好的dom,初始化echarts实例
  1552. let dom = document.getElementById("radarChart");
  1553. dom.removeAttribute("_echarts_instance_") ?
  1554. dom.removeAttribute("_echarts_instance_") :
  1555. "";
  1556. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1557. myChart.setOption(option);
  1558. window.addEventListener("resize", function () {
  1559. myChart.resize();
  1560. });
  1561. },
  1562. },
  1563. };
  1564. </script>
  1565. <style lang="less" scoped>
  1566. @import "../../viewsCss/powerPredictionPageLess.less";
  1567. .themeDark {
  1568. .windStstus {
  1569. background: #040c0b;
  1570. }
  1571. .lineMain {
  1572. background: #040c0b;
  1573. .lineStyle,
  1574. .lineStyle1 {
  1575. background: #161f1e;
  1576. .chart-name {
  1577. display: flex;
  1578. align-items: center;
  1579. position: absolute;
  1580. top: 0;
  1581. height: 39px;
  1582. width: 96%;
  1583. border-bottom: 1px solid rgba(153, 153, 153, 0.5);
  1584. .point {
  1585. width: 6px;
  1586. height: 1px;
  1587. background-color: #ffffff;
  1588. position: absolute;
  1589. &.point-left {
  1590. left: 0;
  1591. }
  1592. &.point-right {
  1593. right: 0;
  1594. }
  1595. &.top {
  1596. top: -1px;
  1597. }
  1598. &.bottom {
  1599. bottom: -1px;
  1600. }
  1601. }
  1602. }
  1603. }
  1604. }
  1605. }
  1606. .themeLight {
  1607. .windStstus {
  1608. // background: linear-gradient(0deg, transparent, #373590);
  1609. }
  1610. .lineMain {
  1611. background: #edeffb;
  1612. .lineStyle,
  1613. .lineStyle1 {
  1614. background: #fff;
  1615. }
  1616. }
  1617. }
  1618. </style>