WindFarmcard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view>
  3. <view class="windStationCard" @tap="common.navTo('/components/windStationCardDetail/WindStationCardDetail?option=' + plusDrawerList.windId+'&windStationName='+plusDrawerList.name)" v-if="plusDrawerList.windId!=0">
  4. <view class="windStationTitle">{{plusDrawerList.name}}</view>
  5. <view class="powerAndSpeedContainer">
  6. <view class="powerAndSpeedRed">
  7. 预测发(万kwh):
  8. <span v-if="cardmodule"></span>
  9. <span v-if="cardmodule==false">{{index_windStation_cardmodule.ycdl}}</span>
  10. </view>
  11. <view class="powerAndSpeedRed">
  12. 日发(万kwh):
  13. <span v-if="cardmodule"></span>
  14. <span v-if="cardmodule==false"> {{index_windStation_cardmodule.rfdl}}</span>
  15. </view>
  16. <view class="powerAndSpeedRed">
  17. 实风速(m/s):
  18. <span v-if="cardmodule"></span>
  19. <span v-if="cardmodule==false"> {{ index_windStation_cardmodule.ssfs}}</span>
  20. </view>
  21. <view class="powerAndSpeedRed">
  22. 实功率(万kw):
  23. <span v-if="cardmodule"></span>
  24. <span v-if="cardmodule==false"> {{ index_windStation_cardmodule.ssgl}}</span>
  25. </view>
  26. </view>
  27. <!-- HQChart图 -->
  28. <view class="UChartContainer">
  29. <view class="windStationUChart">
  30. <view class="windStationQiun-charts">
  31. <canvas :canvas-id=plusDrawerList.windId :id=plusDrawerList.windId class="windStationCharts" @touchstart="touchLineB3"></canvas>
  32. </view>
  33. </view>
  34. <view class="UChartTitle">风速功率曲线图</view>
  35. </view>
  36. <view class="fanStatusContainer">
  37. <view class="fanStatus">
  38. <view class="statusIcon">
  39. <image src="../../static/picture/001.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  40. </view>
  41. <span v-if="module">接入&nbsp;&nbsp;0</span>
  42. <span v-if="module==false">接入&nbsp;&nbsp;{{ fdcstatusmodule.jr }}</span>
  43. </view>
  44. <view class="fanStatus">
  45. <view class="statusIcon">
  46. <image src="../../static/picture/002.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  47. </view>
  48. <span v-if="module">待机&nbsp;&nbsp;0</span>
  49. <span v-if="module==false">待机&nbsp;&nbsp;{{ fdcstatusmodule.dj }}</span>
  50. </view>
  51. <view class="fanStatus">
  52. <view class="statusIcon">
  53. <image src="../../static/picture/003.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  54. </view>
  55. <span v-if="module">运行&nbsp;&nbsp;0</span>
  56. <span v-if="module==false">运行&nbsp;&nbsp;{{ fdcstatusmodule.yx }}</span>
  57. </view>
  58. <view class="fanStatus">
  59. <view class="statusIcon">
  60. <image src="../../static/picture/004.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  61. </view>
  62. <span v-if="module">故障&nbsp;&nbsp;0</span>
  63. <span v-if="module==false">故障&nbsp;&nbsp;{{ fdcstatusmodule.gz }}</span>
  64. </view>
  65. <view class="fanStatus">
  66. <view class="statusIcon">
  67. <image src="../../static/picture/005.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  68. </view>
  69. <span v-if="module">维护&nbsp;&nbsp;0</span>
  70. <span v-if="module==false">维护&nbsp;&nbsp;{{ fdcstatusmodule.wh }}</span>
  71. </view>
  72. <view class="fanStatus">
  73. <view class="statusIcon">
  74. <image src="../../static/picture/006.png" style="width: 16px;height: 16px;margin-top: 7px;"></image>
  75. </view>
  76. <span v-if="module">离线&nbsp;&nbsp;0</span>
  77. <span v-if="module==false">离线&nbsp;&nbsp;{{ fdcstatusmodule.lx }}</span>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import uCharts from '../tools/u-charts/u-charts.js';
  85. var canvaLineB3 = null;
  86. Date.prototype.Format = function(fmt) {
  87. var o = {
  88. 'M+': this.getMonth() + 1, //月份
  89. 'd+': this.getDate(), //日
  90. 'h+': this.getHours(), //小时
  91. 'm+': this.getMinutes(), //分
  92. 's+': this.getSeconds(), //秒
  93. 'q+': Math.floor((this.getMonth() + 3) / 3), //季度
  94. S: this.getMilliseconds() //毫秒
  95. };
  96. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
  97. for (var k in o)
  98. if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[
  99. k]).substr(('' + o[k]).length));
  100. return fmt;
  101. };
  102. export default {
  103. data: function() {
  104. return {
  105. index_windStation_cardmodule: [],
  106. fdcstatusmodule:[],
  107. lineChartdata:[],
  108. userRights_FDC: [],
  109. cardmodule: true,
  110. module: true,
  111. windStationCardCWidth: '',
  112. windStationCardCHeight: '',
  113. windStationCardPixelRatio: 1,
  114. plusDrawerList: [],
  115. uchartTime:[],
  116. }
  117. },
  118. onLoad: function() {
  119. this.windStationCardCWidth = 250;
  120. this.windStationCardCHeight = 150;
  121. },
  122. methods: {
  123. getWindfieldid:function(plusDrawerList) {
  124. this.plusDrawerList = plusDrawerList;
  125. console.log(this.plusDrawerList);
  126. },
  127. getWindfielddata:function(index_windStation_cardmodule){
  128. this.cardmodule = false;
  129. this.index_windStation_cardmodule = [];
  130. this.index_windStation_cardmodule = index_windStation_cardmodule;
  131. },
  132. getHoursWeatherData: function(fdcstatusmodule) {
  133. this.module = false;
  134. this.fdcstatusmodule = fdcstatusmodule;
  135. },
  136. getUchartData:function(lineChartdata){
  137. this.lineChartdata = [];
  138. this.uchartTime = [];
  139. this.lineChartdata = lineChartdata;
  140. //console.log(this.lineChartdata)
  141. let _this = this;
  142. for(let i=0;i<_this.lineChartdata.length;i++){
  143. let time = new Date(
  144. _this.lineChartdata[i].time * 1000).Format('hh');
  145. _this.uchartTime.push(time);
  146. }
  147. // console.log(_this.uchartTime)
  148. _this.getLinAcharts();
  149. },
  150. getLinAcharts: function() {
  151. let LineC = {
  152. categories: [],
  153. series: [{
  154. name: '功率',
  155. data: [],
  156. color: '#4BB94B',
  157. textColor: '#FFFFFF',
  158. textSize: this.seriesTextSize,
  159. format: val => {
  160. return val + 'kwh';
  161. },
  162. index: 1,
  163. legendShape: 'circle'
  164. },
  165. {
  166. name: '风速',
  167. data: [],
  168. color: '#E82E2F',
  169. textColor: '#FFFFFF',
  170. textSize: this.seriesTextSize,
  171. format: val => {
  172. return val + 'm/s';
  173. },
  174. index: 0,
  175. legendShape: 'circle'
  176. },
  177. {
  178. name: '理论功率',
  179. data: [],
  180. color: '#F5A83C',
  181. textColor: '#FFFFFF',
  182. textSize: this.seriesTextSize,
  183. format: val => {
  184. return val + 'kwh';
  185. },
  186. index: 1,
  187. legendShape: 'circle'
  188. },
  189. {
  190. name: '预测功率',
  191. data: [],
  192. color: '#4A80B1',
  193. textColor: '#FFFFFF',
  194. textSize: this.seriesTextSize,
  195. format: val => {
  196. return val + 'kwh';
  197. },
  198. index: 1,
  199. legendShape: 'circle'
  200. }
  201. ],
  202. };
  203. let _this = this;
  204. LineC.categories = [];
  205. LineC.series[0].data = [];
  206. LineC.series[1].data = [];
  207. LineC.series[2].data = [];
  208. LineC.series[3].data = [];
  209. console.log("======");
  210. console.log( _this.lineChartdata);
  211. for (var i = 0; i < _this.lineChartdata.length; i++) {
  212. LineC.categories.push(_this.uchartTime[i]);
  213. // console.log(LineC.categories)
  214. LineC.series[0].data.push(
  215. _this.lineChartdata[i].value2
  216. );
  217. LineC.series[1].data.push(
  218. _this.lineChartdata[i].value4
  219. );
  220. LineC.series[2].data.push(
  221. _this.lineChartdata[i].value3
  222. );
  223. LineC.series[3].data.push(
  224. _this.lineChartdata[i].value1
  225. );
  226. }
  227. _this.showWindStationCardLineA3(_this.plusDrawerList.windId, LineC);
  228. },
  229. showWindStationCardLineA3(canvasId, chartData) {
  230. var _self = this;
  231. this.plusDrawerList.canvas = new uCharts({
  232. $this: _self,
  233. canvasId: canvasId,
  234. type: 'line',
  235. fontSize: 11,
  236. legend: {
  237. show: true,
  238. position: 'top',
  239. float: 'left',
  240. fontColor: 'silver',
  241. itemGap: '4',
  242. itemWidth: '3'
  243. },
  244. dataLabel: false,
  245. dataPointShape: false,
  246. background: '#FFFFFF',
  247. pixelRatio: _self.windStationCardPixelRatio,
  248. categories: chartData.categories,
  249. series: chartData.series,
  250. animation: true,
  251. xAxis: {
  252. disableGrid: true,
  253. type: 'grid',
  254. gridColor: 'silver',
  255. fontColor: 'silver',
  256. gridType: 'solid',
  257. gridColor: '#2E2E2E',
  258. axisLineColor: '#2E2E2E',
  259. labelCount: '3'
  260. // itemCount:"3"
  261. },
  262. yAxis: {
  263. data: [{
  264. type: 'value',
  265. fontColor: 'silver',
  266. disabled: false, //y轴轴线
  267. min: 0,
  268. max: 40,
  269. position: 'left',
  270. axisLineColor: '#2E2E2E',
  271. title: ' 风速:(m/s)',
  272. titleFontColor: 'silver'
  273. },
  274. {
  275. fontColor: 'silver',
  276. disabled: false, //y轴轴线
  277. min: 0,
  278. max: 40,
  279. position: 'right',
  280. axisLineColor: '#2E2E2E',
  281. title: '功率:(kwh)',
  282. titleFontColor: 'silver'
  283. }
  284. ],
  285. disabled: false,
  286. gridColor: '#2E2E2E',
  287. splitNumber: 5,
  288. gridType: 'solid',
  289. dashLength: 8,
  290. showTitle: 'true',
  291. format: val => {
  292. return val.toFixed(0) + '元';
  293. }
  294. },
  295. // width: _self.windStationCardCWidth * _self.windStationCardPixelRatio,
  296. // height: _self.windStationCardCHeight * _self.windStationCardPixelRatio,
  297. width: 240,
  298. height:150,
  299. padding: [10, 0, 0, 5], //画布填充边距,顺序为上右下左,同css,但必须4位
  300. extra: {
  301. line: {
  302. type: 'line',
  303. width: '1'
  304. }
  305. }
  306. });
  307. },
  308. touchLineB3(e) {
  309. if(this.plusDrawerList.canvas.showToolTip!=undefined)
  310. {
  311. this.plusDrawerList.canvas.showToolTip(e, {
  312. format: function(item, category) {
  313. return category + ' ' + item.name + ':' + item.data;
  314. }
  315. });
  316. }
  317. },
  318. }
  319. }
  320. </script>
  321. <style>
  322. page {
  323. /* background-color: #242424; */
  324. }
  325. .windStation {
  326. clear: both;
  327. width: calc(100% - 18%);
  328. margin-left: 9px;
  329. height: 350px;
  330. color: silver;
  331. margin-bottom: 0px;
  332. background-color: #242424;
  333. }
  334. .scrollWindStationCard {
  335. white-space: nowrap;
  336. }
  337. .windStationCard {
  338. width: 250px;
  339. height: 100%;
  340. margin-right: 9px;
  341. float: left;
  342. background-color: #242424;
  343. }
  344. .windStationCardContainer {
  345. width: 100%;
  346. height: 350px;
  347. margin-top: 10px;
  348. }
  349. .windStationTitle {
  350. width: 90%;
  351. height: 30px;
  352. line-height: 30px;
  353. font-size: 12px;
  354. margin-left: 5px;
  355. }
  356. .powerAndSpeedContainer {
  357. width: 100%;
  358. height: 90px;
  359. }
  360. .powerAndSpeedRed {
  361. margin-top: 8px;
  362. margin-left: 2%;
  363. margin-right: 2%;
  364. width: 46%;
  365. height: 37px;
  366. line-height: 37px;
  367. text-align: left;
  368. font-size: 12px;
  369. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  370. border-radius: 5px;
  371. float: left;
  372. }
  373. .UChartContainer {
  374. width: 250px;
  375. height: 150px;
  376. margin-top: 8px;
  377. }
  378. .windStationUChart {
  379. width: 250px;
  380. height: 150px;
  381. position: absolute;
  382. }
  383. .windStationQiun-charts {
  384. width: 250px;
  385. height: 150px;
  386. background-color: #242424;
  387. }
  388. .windStationCharts {
  389. width: 250px;
  390. height: 150px;
  391. background-color: #242424;
  392. }
  393. .fanStatusContainer {
  394. width: 100%;
  395. height: 70px;
  396. }
  397. .fanStatus {
  398. width: 32%;
  399. height: 30px;
  400. margin-top: 5px;
  401. margin-right: 0.5%;
  402. margin-left: 0.5%;
  403. float: left;
  404. }
  405. .fanStatus {
  406. height: 30px;
  407. line-height: 30px;
  408. font-size: 12px;
  409. }
  410. .statusIcon {
  411. width: 22px;
  412. height: 30px;
  413. margin-left: 3px;
  414. float: left;
  415. }
  416. .UChartTitle {
  417. position: relative;
  418. top: -2px;
  419. left: 2px;
  420. font-size: 12px;
  421. width: 100px;
  422. }
  423. </style>