homePageNoMap.vue 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  1. <template>
  2. <div class="homePageNoMap" :class="!theme ? 'themeDark' : 'themeLight'" :style="pageHeight">
  3. <div class="windStstus">
  4. <div class="everyOne" v-for="(item, index) in statusData" :key="index">
  5. <img :src="item.img" alt="">
  6. <span class="statusName">{{item.name}}</span>
  7. <span class="statusNum">{{item.number}}</span>
  8. </div>
  9. </div>
  10. <div class="homePage_main">
  11. <div class="mainLeft">
  12. <div class="lineStyle" v-on:dblclick="doubleclick('全域功率预测')">
  13. <div style="display: flex;float: right;justify-content: end;margin-right: 53px;">
  14. <div v-for="item in showpowerLegend" :key="item.name">
  15. <span class="lineColor" :style="{'background': item.color}"></span>
  16. <span class="powerLegendColor" :style="{'background': item.color}"></span>
  17. <span :style="!theme ? 'color: #fff' : ''"
  18. style="font-size: 12px;margin-left: 12px;position: relative;top: 1px;">{{item.name}}</span>
  19. </div>
  20. </div>
  21. <div id="lineChart" :style="lineChartStyle"></div>
  22. </div>
  23. <div class="lineStyle" v-on:dblclick="doubleclick('全域风速预测')" style="position: relative">
  24. <div class="styleData">
  25. <span :class="windShow ? 'changeStyle' : 'defaultSty'" @click="getWindorSunDate('风速')">风速</span>
  26. <span :class="sunShow ? 'changeStyle' : 'defaultSty'"
  27. @click="getWindorSunDate('辐照度')">辐照度</span>
  28. </div>
  29. <div id="lineChart1" :style="lineChartStyle"></div>
  30. </div>
  31. </div>
  32. <div class="mainRight">
  33. <div class="lineStyle">
  34. <div id="barChart" :style="barChartStyle"></div>
  35. </div>
  36. <div class="lineStyle">
  37. <div class="styleData">
  38. <span :class="dayShow ? 'changeStyle' : 'defaultSty'" @click="getbarDate('日')">日</span>
  39. <span :class="monthShow ? 'changeStyle' : 'defaultSty'" @click="getbarDate('月')">月</span>
  40. <span :class="yearShow ? 'changeStyle' : 'defaultSty'" @click="getbarDate('年')">年</span>
  41. </div>
  42. <div id="barChart1" :style="barChartStyle"></div>
  43. </div>
  44. <div class="messageData">
  45. <div :style="barChartStyle">
  46. <p style="margin-bottom:30px">温馨提示:</p>
  47. <div class="msgHeight">
  48. <div v-for="(item, index) in messageDataxc" :key="index">
  49. <div style="display:flex">
  50. <span class="stationSty">{{item.name}}</span>
  51. <span class="titleSty"
  52. :style="{color: item.data[0].color}">【{{item.data[0].name}}】</span>
  53. <span class="msgSty" @click="showDetail(item, index)">{{item.data[0].msg}}</span>
  54. </div>
  55. <el-divider></el-divider>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="footer">
  63. <div class="exitV">
  64. <div class="time">
  65. <span>服务器时间:{{currentTime}}</span>
  66. </div>
  67. <div class="earlywarning">
  68. <div class="warningdata" v-for="item in warningData" :key="item.name">
  69. <span style="color:#fff">{{item.name}}</span>
  70. <span class="warningColor" :style="`background:${item.color}`"></span>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <global-dialog ref="global" from="index" :echartsTheme="echartsTheme" :theme="theme" @notReload="notReload"
  76. :ExceedTimeList="ExceedTimeList" :stationData="stationData"></global-dialog>
  77. <weather-detail ref="weatherDetail"></weather-detail>
  78. </div>
  79. </template>
  80. <script>
  81. import {
  82. apiGetStationGL,
  83. apiGetPowerPrediction,
  84. apiGetWindSpeed,
  85. apiGetCapacity,
  86. apiGetAssessmentScore,
  87. apiGetEarlyWarningInfo,
  88. apiGetallWeatherInfo,
  89. apiGetirradianceForecast,
  90. apiGetStatusInfoAll,
  91. apiGetinsertLoginInformation,
  92. apiGetpersonalInformation,
  93. apiGetsinglePointToLogin
  94. } from '@/api/api'
  95. import globalDialog from '@/components/powerPredictionComponent/homePageAssembly/globalDialogPage.vue'
  96. import weatherDetail from '@/components/powerPredictionComponent/homePageAssembly/weatherDetail.vue'
  97. //状态图片
  98. import oneimg from '@/assets/windStatusPic/000.png'
  99. import twoimg from '@/assets/windStatusPic/001.png'
  100. import threeimg from '@/assets/windStatusPic/002.png'
  101. import fourimg from '@/assets/windStatusPic/003.png'
  102. import fiveimg from '@/assets/windStatusPic/004.png'
  103. import siximg from '@/assets/windStatusPic/005.png'
  104. import sevenimg from '@/assets/windStatusPic/006.png'
  105. //大风预警图片
  106. import windBlue from '@/assets/weather/windBlue.png'
  107. import windYellow from '@/assets/weather/windYellow.png'
  108. import windOrange from '@/assets/weather/windOrange.png'
  109. import windRed from '@/assets/weather/windRed.png'
  110. //暴雨预警图片
  111. import rainBlue from '@/assets/weather/rainBlue.png'
  112. import rainYellow from '@/assets/weather/rainYellow.png'
  113. import rainOrange from '@/assets/weather/rainOrange.png'
  114. import rainRed from '@/assets/weather/rainRed.png'
  115. //雷电预警图片
  116. import thunderYellow from '@/assets/weather/thunderYellow.png'
  117. import thunderOrange from '@/assets/weather/thunderOrange.png'
  118. import thunderRed from '@/assets/weather/thunderRed.png'
  119. //暴雪预警图片
  120. import snowBlue from '@/assets/weather/snowBlue.png'
  121. import snowYellow from '@/assets/weather/snowYellow.png'
  122. import snowOrange from '@/assets/weather/snowOrange.png'
  123. import snowRed from '@/assets/weather/snowRed.png'
  124. //正常天气
  125. import sunshine from '@/assets/weather/sunshine.png'
  126. import overcast from '@/assets/weather/overcast.png'
  127. import cloudy from '@/assets/weather/cloudy.png'
  128. import rain from '@/assets/weather/rain.png'
  129. import snow from '@/assets/weather/snow.png'
  130. import thunder from '@/assets/weather/thunder.png'
  131. import {
  132. setToken
  133. } from '@/utils/auth'
  134. export default {
  135. components: {
  136. // commonHeader,
  137. // twopointfiveEcharts,
  138. globalDialog,
  139. weatherDetail
  140. },
  141. data() {
  142. return {
  143. statusTimer: '',
  144. statusData: [],
  145. planFiveMin: '',
  146. currentTime: '',
  147. warningData: [],
  148. messageDataxc: [],
  149. messageDataAll: [],
  150. ExceedTimeList: [],
  151. stationData: [],
  152. pickerTime: [],
  153. bodyHeight: document.documentElement.clientHeight - 60 + 'px',
  154. isreload: true,
  155. dayShow: true,
  156. monthShow: false,
  157. yearShow: false,
  158. windShow: true,
  159. sunShow: false,
  160. showpowerLegend: [],
  161. echartsTheme: '',
  162. theme: null
  163. }
  164. },
  165. created() {
  166. console.log('aaaa', process.env)
  167. this.warningData = [{
  168. name: '通讯预警',
  169. nameEn: 'txyj',
  170. color: ''
  171. },
  172. {
  173. name: '测风塔预警',
  174. nameEn: 'cftyj',
  175. color: ''
  176. },
  177. {
  178. name: '风机数据',
  179. nameEn: 'fjsj',
  180. color: ''
  181. },
  182. {
  183. name: '中国数值气象',
  184. nameEn: 'zgszqx',
  185. color: ''
  186. },
  187. {
  188. name: '欧洲数值气象',
  189. nameEn: 'ozszqx',
  190. color: ''
  191. },
  192. ]
  193. this.messageDataAll = [{
  194. id: 1,
  195. name: '大风蓝色预警',
  196. color: '#5599ff',
  197. img: windBlue,
  198. typeName: 'windBlue',
  199. msg: '未来24小时内,大风蓝色预警。做好防大风工作,关好门窗,加固围板、棚架,行人尽量不骑自行车,防高空坠物。'
  200. },
  201. {
  202. id: 2,
  203. name: '大风黄色预警',
  204. color: '#fac858',
  205. img: windYellow,
  206. typeName: 'windYellow',
  207. msg: '未来12小时,大风黄色预警。应该停止露天活动和高空作业,切断户外危险电源,注意森林、草原火灾。'
  208. },
  209. {
  210. id: 3,
  211. name: '大风橙色预警',
  212. color: '#fc8452',
  213. img: windOrange,
  214. typeName: 'windOrange',
  215. msg: '未来6小时大风橙色预警,检修人员减少外出,切断危险电源,注意防高空坠物。'
  216. },
  217. {
  218. id: 4,
  219. name: '大风红色预警',
  220. color: '#e73e3e',
  221. img: windRed,
  222. typeName: 'windRed',
  223. msg: '未来6小时大风红色预警。应做好防范大风应急工作,工作人员不要随意外出,切断危险电源,设备设施尽快转移到安全地带。'
  224. },
  225. {
  226. id: 5,
  227. name: '暴雨蓝色预警',
  228. color: '#5599ff',
  229. img: rainBlue,
  230. typeName: 'rainBlue',
  231. msg: '未来12小时内降雨量将达50毫米以上,注意山路湿滑。'
  232. },
  233. {
  234. id: 6,
  235. name: '暴雨黄色预警',
  236. color: '#fac858',
  237. img: rainYellow,
  238. typeName: 'rainYellow',
  239. msg: '未来6小时内降雨量将达50毫米以上,降雨可能持续,检修人员提前返回场里。'
  240. },
  241. {
  242. id: 7,
  243. name: '暴雨橙色预警',
  244. color: '#fc8452',
  245. img: rainOrange,
  246. typeName: 'rainOrange',
  247. msg: '未来3小时内降雨量将达50毫米以上,检修人员尽量避免现场工作。'
  248. },
  249. {
  250. id: 8,
  251. name: '暴雨红色预警',
  252. color: '#e73e3e',
  253. img: rainRed,
  254. typeName: 'rainRed',
  255. msg: '未来3小时内降雨量将达100毫米以上,检修人员尽量避免现场工作或提前返回场里。'
  256. },
  257. {
  258. id: 9,
  259. name: '雷电黄色预警',
  260. color: '#fac858',
  261. img: thunderYellow,
  262. typeName: 'thunderYellow',
  263. msg: '可能会造成雷电灾害事故,做好防雷工作。密切关注天气变化,尽量避免户外检修工作。'
  264. },
  265. {
  266. id: 10,
  267. name: '雷电橙色预警',
  268. color: '#fc8452',
  269. img: thunderOrange,
  270. typeName: 'thunderOrange',
  271. msg: '雷电活动影响可能持续,出现雷电灾害事故的可能性比较大。落实防雷应急措施。工作人员避免户外活动,切断危险电源,不要在树下、电杆下、塔吊下避雨。'
  272. },
  273. {
  274. id: 11,
  275. name: '雷电红色预警',
  276. color: '#e73e3e',
  277. img: thunderRed,
  278. typeName: 'thunderRed',
  279. msg: '未来2小时内有强烈的雷电活动发生,且可能持续,出现雷电灾害事故的可能性非常大。做好防雷应急抢险工作。工作人员躲入室内并关好门窗。切勿接触天线、水管、铁丝网、金属门窗、建筑物外墙,远离电线等带电设备和其他类似金属装置。密切注意雷电预警信息的发布。'
  280. },
  281. {
  282. id: 12,
  283. name: '暴雪蓝色预警',
  284. color: '#5599ff',
  285. img: snowBlue,
  286. typeName: 'snowBlue',
  287. msg: '交通路面湿滑,可能会影响检修工作。'
  288. },
  289. {
  290. id: 13,
  291. name: '暴雪黄色预警',
  292. color: '#fac858',
  293. img: snowYellow,
  294. typeName: 'snowYellow',
  295. msg: '交通路面湿滑,可能会影响检修工作。'
  296. },
  297. {
  298. id: 14,
  299. name: '暴雪橙色预警',
  300. color: '#fc8452',
  301. img: snowOrange,
  302. typeName: 'snowOrange',
  303. msg: '可能影响交通,影响车行,避免坡路打滑。'
  304. },
  305. {
  306. id: 15,
  307. name: '暴雪红色预警',
  308. color: '#e73e3e',
  309. img: snowRed,
  310. typeName: 'snowRed',
  311. msg: '对交通影响较大,车量出行困难,建议减少非必要出行。'
  312. },
  313. // {
  314. // id: 16,
  315. // type: '冻雨天气预警',
  316. // color: '#fc8452',
  317. // msg: '未来24小时可能有冻雨气象天气发生,请防范冻雨导致生产受累。'
  318. // },
  319. {
  320. id: 17,
  321. name: '晴天',
  322. color: '#3ba272',
  323. img: sunshine,
  324. typeName: 'sunshine',
  325. msg: '蓝天真的很温柔,他将那些零零散散的云,都拥入自己的怀里。'
  326. },
  327. {
  328. id: 18,
  329. name: '阴天',
  330. color: '#3ba272',
  331. img: overcast,
  332. typeName: 'overcast',
  333. msg: '乌云一片接着一片,板着脸走过,不时还传来一两声可怕的怒吼似箭的光,告诉着人们他的厉害。'
  334. },
  335. {
  336. id: 19,
  337. name: '多云',
  338. color: '#3ba272',
  339. img: cloudy,
  340. typeName: 'cloudy',
  341. msg: '最美的天气,不是下雨天,不是大太阳天,而是多云的阴天,出门淋不着,晒不着。'
  342. },
  343. {
  344. id: 20,
  345. name: '雨天',
  346. color: '#3ba272',
  347. img: rain,
  348. typeName: 'rain',
  349. msg: '再温柔平和宁静的落雨,也有把人浸透的威力。'
  350. },
  351. {
  352. id: 21,
  353. name: '雪天',
  354. color: '#3ba272',
  355. img: snow,
  356. typeName: 'snow',
  357. msg: '雪花落入掌心,融化思念,释放温情,雪花落入大地,存储牵挂,诠释纯洁。'
  358. },
  359. {
  360. id: 22,
  361. name: '雷电',
  362. color: '#3ba272',
  363. img: thunder,
  364. typeName: 'thunder',
  365. msg: '所有的雷声闪电,都是在雷雨云中发生的。'
  366. },
  367. ]
  368. this.ExceedTimeList = [{
  369. label: '超前15分钟',
  370. value: 0
  371. },
  372. {
  373. label: '超前30分钟',
  374. value: 1
  375. },
  376. {
  377. label: '超前45分钟',
  378. value: 2
  379. },
  380. {
  381. label: '超前1小时',
  382. value: 3
  383. },
  384. {
  385. label: '超前1小时15分钟',
  386. value: 4
  387. },
  388. {
  389. label: '超前1小时30分钟',
  390. value: 5
  391. },
  392. {
  393. label: '超前1小时45分钟',
  394. value: 6
  395. },
  396. {
  397. label: '超前2小时',
  398. value: 7
  399. },
  400. {
  401. label: '超前2小时15分钟',
  402. value: 8
  403. },
  404. {
  405. label: '超前2小时30分钟',
  406. value: 9
  407. },
  408. {
  409. label: '超前2小时45分钟',
  410. value: 10
  411. },
  412. {
  413. label: '超前3小时',
  414. value: 11
  415. },
  416. {
  417. label: '超前3小时15分钟',
  418. value: 12
  419. },
  420. {
  421. label: '超前3小时30分钟',
  422. value: 13
  423. },
  424. {
  425. label: '超前3小时45分钟',
  426. value: 14
  427. },
  428. {
  429. label: '超前4小时',
  430. value: 15
  431. },
  432. {
  433. label: '超前5小时',
  434. value: 19
  435. },
  436. {
  437. label: '超前6小时',
  438. value: 23
  439. }
  440. ]
  441. this.statusData = [{
  442. img: oneimg,
  443. name: '运行',
  444. nameEn: 'yx',
  445. number: 0
  446. },
  447. {
  448. img: twoimg,
  449. name: '待机',
  450. nameEn: 'dj',
  451. number: 0
  452. },
  453. {
  454. img: threeimg,
  455. name: '维护',
  456. nameEn: 'wh',
  457. number: 0
  458. },
  459. {
  460. img: fourimg,
  461. name: '停机',
  462. nameEn: 'tj',
  463. number: 0
  464. },
  465. {
  466. img: fiveimg,
  467. name: '限电',
  468. nameEn: 'xd',
  469. number: 0
  470. },
  471. {
  472. img: siximg,
  473. name: '离线',
  474. nameEn: 'lx',
  475. number: 0
  476. },
  477. {
  478. img: sevenimg,
  479. name: '检修',
  480. nameEn: 'jx',
  481. number: 0
  482. }
  483. ]
  484. this.pickerTime = [
  485. new Date(new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 900 * 1000),
  486. new Date(new Date(new Date().getTime()).setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1000)
  487. ]
  488. this.showpowerLegend = [{
  489. name: '理论功率',
  490. color: '#5672c4'
  491. },
  492. {
  493. name: '可用功率',
  494. color: '#95cc7a'
  495. },
  496. {
  497. name: 'AGC',
  498. color: '#f7c75f'
  499. },
  500. {
  501. name: '超短期',
  502. color: '#e96366'
  503. },
  504. {
  505. name: '实际',
  506. color: '#7ac1dd'
  507. },
  508. ]
  509. if (this.$route.query.markKey) {
  510. this.fromCustom(this.$route.query.userid)
  511. }
  512. },
  513. computed: {
  514. pageHeight() {
  515. return {
  516. 'height': document.documentElement.clientHeight - 115 + 'px'
  517. }
  518. },
  519. lineChartStyle() {
  520. let pageHeight = document.documentElement.clientHeight - 210
  521. let heightChart = pageHeight / 2 + 'px'
  522. return {
  523. 'width': '98%',
  524. 'height': heightChart
  525. }
  526. },
  527. barChartStyle() {
  528. // let pageHeight = document.documentElement.clientHeight-220-240
  529. let pageHeight = document.documentElement.clientHeight - 260
  530. let heightChart = pageHeight / 3 + 'px'
  531. return {
  532. 'width': '100%',
  533. 'height': heightChart
  534. }
  535. }
  536. },
  537. watch: {
  538. '$store.state.theme': {
  539. handler: function (newVal, oldVal) {
  540. this.theme = newVal
  541. this.echartsTheme = !newVal ? 'dark' : ''
  542. if (oldVal != undefined) {
  543. this.getPowerPrediction()
  544. this.getWindSpeed('风速')
  545. this.getCapacity()
  546. this.getAssessmentScore(0)
  547. this.getAllStationWeather()
  548. this.getWarningInfo()
  549. this.getWindStstus()
  550. }
  551. },
  552. immediate: true
  553. }
  554. },
  555. mounted() {
  556. if (!this.$route.query.markKey) {
  557. let that = this
  558. that.getStationData()
  559. that.statusTimer = setInterval(function () {
  560. that.currentTime = that.changeDate(new Date())
  561. }, 1000)
  562. that.planFiveMin = setInterval(function () {
  563. that.getPowerPrediction()
  564. that.getWindSpeed(that.windShow ? '风速' : '辐照度')
  565. }, 300000)
  566. that.getPowerPrediction()
  567. that.getWindSpeed('风速')
  568. that.getCapacity()
  569. that.getAssessmentScore(0)
  570. that.getAllStationWeather()
  571. that.getWarningInfo()
  572. that.getWindStstus()
  573. }
  574. },
  575. beforeRouteLeave(to, from, next) {
  576. next()
  577. if (this.statusTimer) {
  578. clearInterval(this.statusTimer);
  579. this.statusTimer = null;
  580. }
  581. if (this.planFiveMin) {
  582. clearInterval(this.planFiveMin);
  583. this.planFiveMin = null;
  584. }
  585. },
  586. methods: {
  587. fromCustom(name) {
  588. let that = this
  589. let params = {
  590. markKey: this.$route.query.markKey,
  591. userid: this.$route.query.userid
  592. }
  593. apiGetsinglePointToLogin(params).then(datas => {
  594. if (datas) {
  595. setToken(datas.token)
  596. that.LoginInfor(name, datas.id)
  597. }
  598. }).catch(e => {
  599. let url = location.origin + '/#/login'
  600. window.open(url, '_self')
  601. location.reload()
  602. })
  603. },
  604. // 插入登录信息
  605. LoginInfor(name, id) {
  606. let that = this
  607. let params = {
  608. loginName: name
  609. }
  610. apiGetinsertLoginInformation(params).then(datas => {
  611. if (datas) {
  612. window.sessionStorage.setItem('userDatamsg', JSON.stringify(datas.data))
  613. that.personalInfo(id)
  614. }
  615. })
  616. },
  617. // 用户信息
  618. personalInfo(id) {
  619. let that = this
  620. let params = {
  621. userId: id
  622. }
  623. apiGetpersonalInformation(params).then(datas => {
  624. if (datas) {
  625. window.sessionStorage.setItem('usermsg', JSON.stringify(datas.data.user))
  626. that.$router.push({
  627. name: 'homePageNoMap'
  628. })
  629. setTimeout(() => {
  630. that.getStationData()
  631. that.statusTimer = setInterval(function () {
  632. that.currentTime = that.changeDate(new Date())
  633. }, 1000)
  634. that.planFiveMin = setInterval(function () {
  635. that.getPowerPrediction()
  636. that.getWindSpeed(that.windShow ? '风速' : '辐照度')
  637. }, 300000)
  638. that.getPowerPrediction()
  639. that.getWindSpeed('风速')
  640. that.getCapacity()
  641. that.getAssessmentScore(0)
  642. that.getAllStationWeather()
  643. that.getWarningInfo()
  644. that.getWindStstus()
  645. for (let i = 0; i < 1; i++) {
  646. window.location.reload();
  647. }
  648. }, 500)
  649. }
  650. })
  651. },
  652. // 获取风机状态服务
  653. getWindStstus() {
  654. let that = this
  655. apiGetStatusInfoAll().then(datas => {
  656. if (datas) {
  657. if (datas.data) {
  658. that.statusData.forEach(item => {
  659. for (let it in datas.data) {
  660. if (item.nameEn === it) {
  661. item.number = datas.data[it]
  662. }
  663. }
  664. })
  665. that.allStatus = datas.data
  666. }
  667. }
  668. })
  669. },
  670. showDetail(item, index) {
  671. this.$refs.weatherDetail.dialogVisible = true
  672. this.$refs.weatherDetail.title = '天气预警'
  673. this.$refs.weatherDetail.messageAll = this.messageDataxc
  674. this.$refs.weatherDetail.activeName = index.toString()
  675. this.$refs.weatherDetail.statusName = item.data[0].name
  676. console.log(item)
  677. },
  678. //获取预警状态信息
  679. getWarningInfo() {
  680. let that = this
  681. apiGetEarlyWarningInfo().then(datas => {
  682. if (datas) {
  683. if (datas.data) {
  684. that.warningData.forEach(item => {
  685. for (let it in datas.data) {
  686. if (item.nameEn === it) {
  687. if (datas.data[it] === 1) {
  688. item.color = '#ee6666'
  689. } else if (datas.data[it] === 2) {
  690. item.color = '#91cc75'
  691. } else {
  692. item.color = '#fac858'
  693. }
  694. }
  695. }
  696. })
  697. }
  698. }
  699. })
  700. },
  701. // 获取所有场站天气
  702. getAllStationWeather() {
  703. let that = this
  704. apiGetallWeatherInfo().then(datas => {
  705. if (datas && datas.data) {
  706. that.messageDataxc = []
  707. datas.data.forEach(item => {
  708. let weatherDataFromWeb = null
  709. weatherDataFromWeb = JSON.parse(item.content)
  710. that.everyStationWeather(weatherDataFromWeb, item.terminalName)
  711. })
  712. console.log('messageDataxc', that.messageDataxc)
  713. }
  714. })
  715. },
  716. //处理每个场站天气数据
  717. everyStationWeather(weatherDataFromWeb, stationName) {
  718. console.log('weatherDataFromWeb', weatherDataFromWeb)
  719. let weatherTit = {
  720. windBlue: 0,
  721. windYellow: 0,
  722. windOrange: 0,
  723. windRed: 0,
  724. rainBlue: 0,
  725. rainYellow: 0,
  726. rainOrange: 0,
  727. rainRed: 0,
  728. thunderYellow: 0,
  729. thunderOrange: 0,
  730. thunderRed: 0,
  731. snowBlue: 0,
  732. snowYellow: 0,
  733. snowOrange: 0,
  734. snowRed: 0
  735. }
  736. weatherDataFromWeb['24_hour_forecast'].info.forEach((item, index) => {
  737. if (index < 24) {
  738. if (item.wind_power_num === '6' || item.wind_power_num === '7') {
  739. //大风蓝色预警
  740. weatherTit.windBlue += 1
  741. }
  742. if (index < 13) {
  743. if (item.wind_power_num === '8' || item.wind_power_num === '9') {
  744. //大风黄色预警
  745. weatherTit.windYellow += 1
  746. weatherTit.windBlue = 0
  747. } else if (item.precipitation > '40' && item.precipitation <= '50' && item.weather
  748. .indexOf('雨') !== -1) {
  749. //暴雨蓝色预警
  750. weatherTit.rainBlue += 1
  751. } else if (item.precipitation > '3' && item.precipitation <= '4' && item.weather
  752. .indexOf('雪') !== -1) {
  753. //暴雪蓝色预警
  754. weatherTit.snowBlue += 1
  755. } else if (item.precipitation >= '6' && item.weather.indexOf('雪') !== -1) {
  756. //暴雪黄色预警
  757. weatherTit.snowYellow += 1
  758. weatherTit.snowBlue = 0
  759. }
  760. if (index < 7) {
  761. if (item.wind_power_num === '10' || item.wind_power_num === '11') {
  762. //大风橙色预警
  763. weatherTit.windOrange += 1
  764. weatherTit.windYellow = 0
  765. weatherTit.windBlue = 0
  766. } else if (item.wind_power_num === '12' || item.wind_power_num === '13') {
  767. //大风红色预警
  768. weatherTit.windRed += 1
  769. weatherTit.windOrange = 0
  770. weatherTit.windYellow = 0
  771. weatherTit.windBlue = 0
  772. } else if (item.weather.indexOf('雷') !== -1 || item.weather.indexOf('电') !== -
  773. 1) {
  774. //雷电黄色预警
  775. weatherTit.thunderYellow += 1
  776. } else if (item.precipitation > '40' && item.precipitation <= 50 && item.weather
  777. .indexOf('雨') !== -1) {
  778. //暴雨黄色预警
  779. weatherTit.rainYellow += 1
  780. weatherTit.rainBlue = 0
  781. } else if (item.precipitation >= '10' && item.weather.indexOf('雪') !== -1) {
  782. //暴雪橙色预警
  783. weatherTit.snowOrange += 1
  784. weatherTit.snowYellow = 0
  785. weatherTit.snowBlue = 0
  786. } else if (item.precipitation >= '15' && item.weather.indexOf('雪') !== -1) {
  787. //暴雪红色预警
  788. weatherTit.snowRed += 1
  789. weatherTit.snowOrange = 0
  790. weatherTit.snowYellow = 0
  791. weatherTit.snowBlue = 0
  792. }
  793. if (index < 5) {
  794. if (item.weather.indexOf('雷') !== -1 || item.weather.indexOf('电') !== -1) {
  795. //雷电橙色预警
  796. weatherTit.thunderOrange += 1
  797. weatherTit.thunderYellow = 0
  798. }
  799. if (index < 4) {
  800. if (item.precipitation > '50' && item.weather.indexOf('雨') !== -1) {
  801. //暴雨橙色预警
  802. weatherTit.rainOrange += 1
  803. weatherTit.rainYellow = 0
  804. weatherTit.rainBlue = 0
  805. } else if (item.precipitation >= '100' && item.weather.indexOf('雨') !==
  806. -1) {
  807. //暴雨红色预警
  808. weatherTit.rainRed += 1
  809. weatherTit.rainOrange = 0
  810. weatherTit.rainYellow = 0
  811. weatherTit.rainBlue = 0
  812. }
  813. if (index < 3) {
  814. if (item.weather.indexOf('雷') !== -1 || item.weather.indexOf(
  815. '电') !== -1) {
  816. //雷电红色预警
  817. weatherTit.thunderRed += 1
  818. weatherTit.thunderOrange = 0
  819. weatherTit.thunderYellow = 0
  820. }
  821. }
  822. }
  823. }
  824. }
  825. }
  826. }
  827. })
  828. // let weatherStatus = ['wind', 'rain', 'thunder', 'snow']
  829. // let weatherLeave = ['Blue', 'Yellow', 'Orange', 'Red']
  830. let useweatherTit = {}
  831. for (let i in weatherTit) {
  832. if (weatherTit[i] > 0) {
  833. useweatherTit[i] = weatherTit[i]
  834. }
  835. }
  836. if (Object.keys(useweatherTit).length > 0) {
  837. for (let i in useweatherTit) {
  838. let showMsgObj = {
  839. name: stationName,
  840. data: [],
  841. weatherDetail: {},
  842. weather: {}
  843. }
  844. for (let j = 0; j < this.messageDataAll.length; j++) {
  845. if (this.messageDataAll[j].typeName === i) {
  846. showMsgObj.data.push(this.messageDataAll[j])
  847. this.getOnlyWeatherData(weatherDataFromWeb['24_hour_forecast'].info, weatherDataFromWeb
  848. .weather, showMsgObj, 'Y')
  849. this.messageDataxc.push(showMsgObj)
  850. }
  851. }
  852. }
  853. } else {
  854. let showMsgObj = {
  855. name: stationName,
  856. data: [],
  857. weatherDetail: {},
  858. weather: {}
  859. }
  860. if (weatherDataFromWeb.weather.weather.indexOf('晴') !== -1 ||
  861. weatherDataFromWeb.weather.weather.indexOf('扬沙') !== -1 ||
  862. weatherDataFromWeb.weather.weather.indexOf('霾') !== -1 ||
  863. weatherDataFromWeb.weather.weather.indexOf('浮尘') !== -1) {
  864. showMsgObj.data.push(this.messageDataAll[15])
  865. } else if (weatherDataFromWeb.weather.weather.indexOf('阴') !== -1 ||
  866. weatherDataFromWeb.weather.weather.indexOf('雾') !== -1) {
  867. showMsgObj.data.push(this.messageDataAll[16])
  868. } else if (weatherDataFromWeb.weather.weather.indexOf('多云') !== -1) {
  869. showMsgObj.data.push(this.messageDataAll[17])
  870. } else if (weatherDataFromWeb.weather.weather.indexOf('雨') !== -1) {
  871. showMsgObj.data.push(this.messageDataAll[18])
  872. } else if (weatherDataFromWeb.weather.weather.indexOf('雪') !== -1) {
  873. showMsgObj.data.push(this.messageDataAll[19])
  874. } else if (weatherDataFromWeb.weather.weather.indexOf('雷电') !== -1) {
  875. showMsgObj.data.push(this.messageDataAll[20])
  876. }
  877. this.messageDataxc.push(showMsgObj)
  878. // weatherDataFromWeb['15_day_forecast'].info[0]
  879. // weatherDataFromWeb['24_hour_forecast'].info[0]
  880. this.getOnlyWeatherData(weatherDataFromWeb['24_hour_forecast'].info[0], weatherDataFromWeb.weather,
  881. showMsgObj, 'N')
  882. }
  883. console.log('weatherTit', weatherTit)
  884. },
  885. //获取天气预警的相关天气数据
  886. getOnlyWeatherData(datas, weather, obj, type) {
  887. if (type === 'Y') {
  888. for (let j = 0; j < datas.length; j++) {
  889. let item = datas[j]
  890. if (j < 24) {
  891. if ((item.wind_power_num === '6' || item.wind_power_num === '7') && obj.data[0].typeName ===
  892. 'windBlue') {
  893. //大风蓝色预警
  894. obj.weatherDetail = item
  895. obj.weather = weather
  896. }
  897. if (j < 13) {
  898. if ((item.wind_power_num === '8' || item.wind_power_num === '9') && obj.data[0]
  899. .typeName === 'windYellow') {
  900. //大风黄色预警
  901. obj.weatherDetail = item
  902. obj.weather = weather
  903. } else if (item.precipitation > '40' && item.precipitation <= '50' &&
  904. item.weather.indexOf('雨') !== -1 && obj.data[0].typeName === 'rainBlue') {
  905. //暴雨蓝色预警
  906. obj.weatherDetail = item
  907. obj.weather = weather
  908. } else if (item.precipitation > '3' && item.precipitation <= '4' &&
  909. item.weather.indexOf('雪') !== -1 && obj.data[0].typeName === 'snowBlue') {
  910. //暴雪蓝色预警
  911. obj.weatherDetail = item
  912. obj.weather = weather
  913. } else if (item.precipitation >= '6' && item.weather.indexOf('雪') !== -1 && obj.data[0]
  914. .typeName === 'snowYellow') {
  915. //暴雪黄色预警
  916. obj.weatherDetail = item
  917. obj.weather = weather
  918. }
  919. if (j < 7) {
  920. if ((item.wind_power_num === '10' || item.wind_power_num === '11') && obj.data[0]
  921. .typeName === 'windOrange') {
  922. //大风橙色预警
  923. obj.weatherDetail = item
  924. obj.weather = weather
  925. } else if ((item.wind_power_num === '12' || item.wind_power_num === '13') && obj
  926. .data[0].typeName === 'windRed') {
  927. //大风红色预警
  928. obj.weatherDetail = item
  929. obj.weather = weather
  930. } else if ((item.weather.indexOf('雷') !== -1 || item.weather.indexOf('电') !== -1) &&
  931. obj.data[0].typeName === 'thunderYellow') {
  932. //雷电黄色预警
  933. item.weatherDetail = item
  934. item.weather = weather
  935. } else if (item.precipitation > '40' && item.precipitation <= 50 &&
  936. item.weather.indexOf('雨') !== -1 && obj.data[0].typeName === 'rainYellow') {
  937. //暴雨黄色预警
  938. obj.weatherDetail = item
  939. obj.weather = weather
  940. } else if (item.precipitation >= '10' && item.weather.indexOf('雪') !== -1 && obj
  941. .data[0].typeName === 'snowOrange') {
  942. //暴雪橙色预警
  943. obj.weatherDetail = item
  944. obj.weather = weather
  945. } else if (item.precipitation >= '15' && item.weather.indexOf('雪') !== -1 && obj
  946. .data[0].typeName === 'snowRed') {
  947. //暴雪红色预警
  948. obj.weatherDetail = item
  949. obj.weather = weather
  950. }
  951. if (j < 5) {
  952. if ((item.weather.indexOf('雷') !== -1 || item.weather.indexOf('电') !== -1) &&
  953. obj.data[0].typeName === 'thunderOrange') {
  954. //雷电橙色预警
  955. obj.weatherDetail = item
  956. obj.weather = weather
  957. }
  958. if (j < 4) {
  959. if (item.precipitation > '50' && item.weather.indexOf('雨') !== -1 && obj
  960. .data[0].typeName === 'rainOrange') {
  961. //暴雨橙色预警
  962. item.weatherDetail = item
  963. item.weather = weather
  964. } else if (item.precipitation >= '100' && item.weather.indexOf('雨') !== -
  965. 1 && obj.data[0].typeName === 'rainRed') {
  966. //暴雨红色预警
  967. obj.weatherDetail = item
  968. obj.weather = weather
  969. }
  970. if (j < 3) {
  971. if ((item.weather.indexOf('雷') !== -1 || item.weather.indexOf('电') !== -
  972. 1) && obj.data[0].typeName === 'thunderRed') {
  973. //雷电红色预警
  974. obj.weatherDetail = item
  975. obj.weather = weather
  976. }
  977. }
  978. }
  979. }
  980. }
  981. }
  982. }
  983. }
  984. } else {
  985. obj.weatherDetail = datas
  986. obj.weather = weather
  987. }
  988. },
  989. notReload(val) {
  990. this.isreload = val
  991. },
  992. getStationData() {
  993. apiGetStationGL().then(datas => {
  994. this.stationData = datas.data.list
  995. })
  996. },
  997. getWindorSunDate(type) {
  998. this.windShow = false
  999. this.sunShow = false
  1000. if (type === '风速') {
  1001. this.windShow = true
  1002. this.getWindSpeed('风速')
  1003. } else {
  1004. this.sunShow = true
  1005. this.getWindSpeed('辐照度')
  1006. }
  1007. },
  1008. getbarDate(type) {
  1009. this.dayShow = false
  1010. this.monthShow = false
  1011. this.yearShow = false
  1012. if (type === '日') {
  1013. this.dayShow = true
  1014. this.getAssessmentScore(0)
  1015. } else if (type === '月') {
  1016. this.monthShow = true
  1017. this.getAssessmentScore(1)
  1018. } else {
  1019. this.yearShow = true
  1020. this.getAssessmentScore(2)
  1021. }
  1022. },
  1023. doubleclick(name) {
  1024. if (this.stationData.length > 0) {
  1025. this.isreload = false
  1026. this.$refs.global.dialogVisible = true
  1027. this.$refs.global.tableData = []
  1028. this.$refs.global.dateType = 1
  1029. this.$refs.global.loading = true
  1030. this.$refs.global.pickerTime = this.pickerTime
  1031. this.$refs.global.windShow = this.windShow
  1032. this.$refs.global.init(name)
  1033. this.$nextTick(() => {
  1034. const myChart1 = this.$echarts.init(document.getElementById('lineChart'), this
  1035. .echartsTheme)
  1036. const myChart2 = this.$echarts.init(document.getElementById('lineChart1'), this
  1037. .echartsTheme)
  1038. myChart1.dispatchAction({
  1039. type: 'hideTip'
  1040. });
  1041. myChart2.dispatchAction({
  1042. type: 'hideTip'
  1043. });
  1044. if (name === '全域功率预测') {
  1045. this.$refs.global.getChartsData()
  1046. this.$refs.global.getTableData()
  1047. } else {
  1048. this.$refs.global.getwindChartsData()
  1049. this.$refs.global.getwindTableData()
  1050. }
  1051. })
  1052. }
  1053. },
  1054. changeDate(date) {
  1055. var y = date.getFullYear();
  1056. var m = date.getMonth() + 1;
  1057. m = m < 10 ? ('0' + m) : m;
  1058. var d = date.getDate();
  1059. d = d < 10 ? ('0' + d) : d;
  1060. var h = date.getHours();
  1061. h = h < 10 ? ('0' + h) : h;
  1062. var minute = date.getMinutes();
  1063. minute = minute < 10 ? ('0' + minute) : minute;
  1064. var second = date.getSeconds();
  1065. second = second < 10 ? ('0' + second) : second;
  1066. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
  1067. },
  1068. // 今日功率预测
  1069. getPowerPrediction() {
  1070. let that = this
  1071. apiGetPowerPrediction().then(datas => {
  1072. if (datas && datas.data) {
  1073. let xAxis = []
  1074. let series = []
  1075. let legend = []
  1076. if (datas.data.dateList.length > 0) {
  1077. datas.data.dateList.forEach(item => {
  1078. xAxis.push(item.substring(item.indexOf(' ') + 1))
  1079. })
  1080. }
  1081. if (datas.data.dataFormatList.length > 0) {
  1082. datas.data.dataFormatList.forEach(iten => {
  1083. if (iten.name !== '短期') {
  1084. legend.push(iten.name)
  1085. let seriesObj = {
  1086. name: iten.name,
  1087. type: 'line',
  1088. data: iten.data.map(it => {
  1089. return that.$utils.isHasNum(it)
  1090. }),
  1091. symbol: 'none'
  1092. }
  1093. series.push(seriesObj)
  1094. }
  1095. })
  1096. }
  1097. that.getPowerLine('lineChart', '今日功率预测', xAxis, legend, series)
  1098. }
  1099. })
  1100. },
  1101. // 今日风速预测
  1102. getWindSpeed(type) {
  1103. let that = this
  1104. if (type === '风速') {
  1105. apiGetWindSpeed().then(datas => {
  1106. that.handleWindSunData(datas, type)
  1107. })
  1108. } else {
  1109. apiGetirradianceForecast().then(datas => {
  1110. that.handleWindSunData(datas, type)
  1111. })
  1112. }
  1113. },
  1114. //处理风速和辐照度数据
  1115. handleWindSunData(datas, type) {
  1116. if (datas && datas.data) {
  1117. let xAxis = []
  1118. let series = []
  1119. let legend = []
  1120. if (datas.data.dateList.length > 0) {
  1121. datas.data.dateList.forEach(item => {
  1122. xAxis.push(item.substring(item.indexOf(' ') + 1))
  1123. })
  1124. }
  1125. if (datas.data.dataFormatList.length > 0) {
  1126. datas.data.dataFormatList.forEach(iten => {
  1127. legend.push(iten.name)
  1128. let seriesObj = {
  1129. name: iten.name,
  1130. type: 'line',
  1131. data: iten.data.map(it => {
  1132. return this.$utils.isHasNum(it)
  1133. }),
  1134. symbol: 'none'
  1135. }
  1136. series.push(seriesObj)
  1137. })
  1138. }
  1139. this.getPowerLine('lineChart1', type === '风速' ? '今日风速预测' : '今日辐照度预测', xAxis, legend, series)
  1140. }
  1141. },
  1142. getPowerLine(name, title, xAxis, legend, series) {
  1143. let option = {
  1144. title: {
  1145. text: title,
  1146. textStyle: {
  1147. fontSize: '16',
  1148. fontWeight: 'bold'
  1149. }
  1150. },
  1151. tooltip: {
  1152. trigger: 'axis',
  1153. formatter: name === 'lineChart' ? (item) => {
  1154. let str =
  1155. `<span style="display:inline-block;margin-bottom: 5px">${item[0].axisValue}</span></br>`
  1156. let strMsg = ''
  1157. item.forEach((it, index) => {
  1158. if (index !== 3) {
  1159. strMsg = `<div style="margin-bottom: 5px">
  1160. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${it.color};\"></span>&nbsp;
  1161. <span style="display:inline-block;">${it.seriesName}:</span>&nbsp;&nbsp;<span>${it.value}</span>
  1162. </div>`
  1163. this.showpowerLegend[index].name = it.seriesName
  1164. this.showpowerLegend[index].color = it.color
  1165. } else {
  1166. if (it.axisValue === '00:15:00') {
  1167. it.color = '#e96366'
  1168. }
  1169. strMsg = `<div style="margin-bottom: 5px">
  1170. <span style="display:inline-block;margin-right:4px;margin-top:3px;border-radius:10px;width:10px;height:10px;background-color:${it.color};\"></span>&nbsp;
  1171. <span style="display:inline-block;">${it.color === '#e96366' ? '超短期' : '短期'}:</span>&nbsp;&nbsp;<span>${it.value}</span>
  1172. </div>`
  1173. if (it.color === '#e96366') {
  1174. this.showpowerLegend[index].name = '超短期'
  1175. } else {
  1176. this.showpowerLegend[index].name = '短期'
  1177. }
  1178. this.showpowerLegend[index].color = it.color
  1179. }
  1180. str = str + strMsg
  1181. })
  1182. return str
  1183. } : ''
  1184. },
  1185. // axisPointer: {
  1186. // link: {
  1187. // xAxisIndex: 'all'
  1188. // },
  1189. // label: {
  1190. // formatter: (params) =>{
  1191. // // debugger
  1192. // this.lengedObj = params.seriesData[3]
  1193. // console.log('lengedObj======>>>>', this.lengedObj)
  1194. // if (this.lengedObj.color !== '#39ccd9') {
  1195. // option.legend.data = legend
  1196. // } else {
  1197. // legend.forEach(it =>{
  1198. // if (it === '超短期') {
  1199. // it = '短期'
  1200. // }
  1201. // })
  1202. // option.legend.data = legend
  1203. // }
  1204. // }
  1205. // }
  1206. // },
  1207. legend: {
  1208. right: '20',
  1209. data: legend,
  1210. // show: name === 'lineChart' ? false : true
  1211. show: false
  1212. // formatter: name === 'lineChart' ? (name, type) => {
  1213. // // debugger
  1214. // if (!type) {
  1215. // switch (name) {
  1216. // case '超短期':
  1217. // return this.lengedObj.seriesName ? this.lengedObj.seriesName : name
  1218. // break;
  1219. // default:
  1220. // return name
  1221. // }
  1222. // } else {
  1223. // let datalen = []
  1224. // name.seriesData.forEach(it =>{
  1225. // if (it.color === '#39ccd9') {
  1226. // it.seriesName = '短期'
  1227. // }
  1228. // datalen.push(it.seriesName)
  1229. // })
  1230. // return datalen
  1231. // }
  1232. // } : ''
  1233. },
  1234. grid: {
  1235. left: '5%',
  1236. right: '5%',
  1237. bottom: '3%',
  1238. containLabel: true
  1239. },
  1240. xAxis: {
  1241. type: 'category',
  1242. boundaryGap: false,
  1243. data: xAxis
  1244. },
  1245. yAxis: {
  1246. type: 'value',
  1247. name: title === '今日功率预测' ? '兆瓦(Mw)' : title === '今日风速预测' ? 'm/s' : 'W/㎡'
  1248. },
  1249. series: series
  1250. };
  1251. if (!this.theme) {
  1252. option.backgroundColor = ''
  1253. }
  1254. if (name === 'lineChart') {
  1255. let hour = new Date().getHours() + 6
  1256. let min = new Date().getMinutes()
  1257. let allTime = ''
  1258. let num = 0
  1259. if (0 <= min && min < 15) {
  1260. allTime = hour + ':00:00'
  1261. } else if (15 <= min && min < 30) {
  1262. allTime = hour + ':15:00'
  1263. } else if (30 <= min && min < 45) {
  1264. allTime = hour + ':30:00'
  1265. } else if (45 <= min && min < 60) {
  1266. allTime = hour + ':45:00'
  1267. }
  1268. xAxis.forEach((item, index) => {
  1269. if (item === allTime) {
  1270. num = index
  1271. }
  1272. })
  1273. if (num > 0) {
  1274. option.visualMap = {
  1275. show: false,
  1276. dimension: 0,
  1277. seriesIndex: 3,
  1278. pieces: [{
  1279. gt: 0,
  1280. lte: num,
  1281. color: '#e96366'
  1282. },
  1283. {
  1284. gt: num,
  1285. color: '#39ccd9'
  1286. }
  1287. ]
  1288. }
  1289. }
  1290. } else {
  1291. option.legend.show = true
  1292. option.data = legend
  1293. option.right = '20'
  1294. }
  1295. // 基于准备好的dom,初始化echarts实例
  1296. let dom = document.getElementById(name);
  1297. dom.removeAttribute("_echarts_instance_") ? dom.removeAttribute("_echarts_instance_") : ''
  1298. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1299. myChart.setOption(option);
  1300. myChart.on('mousemove', this.setTooltip('lineChart', 'lineChart1', this.windShow ? 3 : 0))
  1301. window.addEventListener("resize", function () {
  1302. myChart.resize()
  1303. })
  1304. },
  1305. setTooltip(name1, name2, num) {
  1306. const myChart1 = this.$echarts.init(document.getElementById(name1), this.echartsTheme)
  1307. const myChart2 = this.$echarts.init(document.getElementById(name2), this.echartsTheme)
  1308. this.$utils.setTooltip(myChart1, myChart2, num)
  1309. },
  1310. // 装机,并网,实时,可用电量
  1311. getCapacity() {
  1312. let that = this
  1313. apiGetCapacity().then(datas => {
  1314. if (datas && datas.data) {
  1315. let xAxis = []
  1316. let series = []
  1317. let legend = []
  1318. if (datas.data.name.length > 0) {
  1319. datas.data.name.forEach(item => {
  1320. let XaObj = {
  1321. value: item,
  1322. textStyle: {
  1323. width: 100,
  1324. height: 25,
  1325. backgroundColor: '#edeffb',
  1326. color: '#36348e',
  1327. borderRadius: 10,
  1328. align: 'center',
  1329. verticalAlign: 'middle'
  1330. }
  1331. }
  1332. xAxis.push(XaObj)
  1333. })
  1334. }
  1335. if (datas.data.dataFormatList.length > 0) {
  1336. datas.data.dataFormatList.forEach((iten, index) => {
  1337. legend.push(iten.name)
  1338. let seriesObj = {
  1339. name: iten.name,
  1340. type: 'bar',
  1341. barGap: 0,
  1342. emphasis: {
  1343. focus: 'series'
  1344. },
  1345. data: iten.data.map(it => {
  1346. return that.$utils.isHasNum(it)
  1347. }),
  1348. // itemStyle:{
  1349. // normal: {
  1350. // color: color[index]
  1351. // }
  1352. // }
  1353. }
  1354. series.push(seriesObj)
  1355. })
  1356. }
  1357. that.getPowerBar('barChart', '功率统计', xAxis, legend, series)
  1358. }
  1359. })
  1360. },
  1361. // 预测考核分数
  1362. getAssessmentScore(type) {
  1363. let that = this
  1364. let params = {
  1365. statisticType: type
  1366. }
  1367. apiGetAssessmentScore(params).then(datas => {
  1368. if (datas && datas.data) {
  1369. let xAxis = []
  1370. let series = []
  1371. let legend = []
  1372. if (datas.data.name.length > 0) {
  1373. datas.data.name.forEach(item => {
  1374. let XaObj = {
  1375. value: item,
  1376. textStyle: {
  1377. width: 100,
  1378. height: 25,
  1379. backgroundColor: '#edeffb',
  1380. color: '#36348e',
  1381. borderRadius: 10,
  1382. align: 'center',
  1383. verticalAlign: 'middle'
  1384. }
  1385. }
  1386. xAxis.push(XaObj)
  1387. })
  1388. }
  1389. if (datas.data.dataFormatList.length > 0) {
  1390. datas.data.dataFormatList.forEach((iten, index) => {
  1391. legend.push(iten.name)
  1392. let seriesObj = {
  1393. name: iten.name,
  1394. type: 'bar',
  1395. barGap: 0,
  1396. emphasis: {
  1397. focus: 'series'
  1398. },
  1399. data: iten.data.map(it => {
  1400. return that.$utils.isHasNum(it)
  1401. }),
  1402. }
  1403. series.push(seriesObj)
  1404. })
  1405. }
  1406. that.getPowerBar('barChart1', '预测考核分数', xAxis, legend, series)
  1407. }
  1408. })
  1409. },
  1410. getPowerBar(name, title, xAxis, legend, series) {
  1411. let option = {
  1412. title: {
  1413. text: title,
  1414. textStyle: {
  1415. fontSize: '16',
  1416. fontWeight: 'bold'
  1417. }
  1418. },
  1419. tooltip: {
  1420. trigger: 'axis',
  1421. axisPointer: {
  1422. type: 'shadow'
  1423. }
  1424. },
  1425. legend: {
  1426. right: '20',
  1427. data: title === '功率统计' ? legend : []
  1428. },
  1429. grid: {
  1430. left: '1%',
  1431. right: '5%',
  1432. bottom: '2%',
  1433. containLabel: true
  1434. },
  1435. xAxis: [{
  1436. type: 'category',
  1437. axisTick: {
  1438. show: false
  1439. },
  1440. axisLabel: {
  1441. margin: 18
  1442. },
  1443. data: xAxis
  1444. }],
  1445. yAxis: [{
  1446. type: 'value',
  1447. name: title === '预测考核分数' ? '分' : '兆瓦(M/w)'
  1448. }],
  1449. series: series
  1450. };
  1451. if (!this.theme) {
  1452. option.backgroundColor = ''
  1453. }
  1454. if (title === '预测考核分数') {
  1455. option.grid.height = '70%'
  1456. option.legend.width = '100%'
  1457. option.legend.top = 25
  1458. } else {
  1459. option.legend.right = '20'
  1460. }
  1461. // 基于准备好的dom,初始化echarts实例
  1462. let dom = document.getElementById(name);
  1463. dom.removeAttribute("_echarts_instance_") ? dom.removeAttribute("_echarts_instance_") : ''
  1464. let myChart = this.$echarts.init(dom, this.echartsTheme);
  1465. myChart.setOption(option);
  1466. window.addEventListener("resize", function () {
  1467. myChart.resize()
  1468. })
  1469. }
  1470. }
  1471. }
  1472. </script>
  1473. <style lang="less" scoped>
  1474. @import '../../viewsCss/homePageNoMapLess.less';
  1475. .themeDark {
  1476. .windStstus,
  1477. .homePage_main {
  1478. background: #040c0b;
  1479. }
  1480. .homePage_main {
  1481. .mainLeft,
  1482. .mainRight {
  1483. .lineStyle {
  1484. background: #161f1e;
  1485. }
  1486. }
  1487. .mainRight {
  1488. .messageData {
  1489. background: #161f1e;
  1490. p {
  1491. color: #fff;
  1492. }
  1493. .msgHeight {
  1494. .stationSty,
  1495. .msgSty {
  1496. color: #fff;
  1497. }
  1498. }
  1499. }
  1500. }
  1501. }
  1502. }
  1503. .themeLight {
  1504. .windStstus {
  1505. background: linear-gradient(0deg, transparent, #373590);
  1506. }
  1507. .homePage_main {
  1508. background: #edeffb;
  1509. .mainLeft,
  1510. .mainRight {
  1511. .lineStyle {
  1512. background: #fff;
  1513. }
  1514. }
  1515. .mainRight {
  1516. .messageData {
  1517. background: #fff;
  1518. p {
  1519. color: #000;
  1520. }
  1521. .msgHeight {
  1522. .stationSty,
  1523. .msgSty {
  1524. color: #000;
  1525. }
  1526. }
  1527. }
  1528. }
  1529. }
  1530. }
  1531. </style>