WindFarmcard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view>
  3. <view class="windStationCard" @tap="common.navTo('/components/windStationCardDetail/WindStationCardDetail?option=' + plusDrawerList.name.substring(0,2) )" 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="windStationCanvasLineC" id="windStationCanvasLineC" 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. import utils from '../tools/shoyu-date/utils.filter.js'
  86. var _self;
  87. var canvaLineB3 = null;
  88. Date.prototype.Format = function(fmt) {
  89. var o = {
  90. 'M+': this.getMonth() + 1, //月份
  91. 'd+': this.getDate(), //日
  92. 'h+': this.getHours(), //小时
  93. 'm+': this.getMinutes(), //分
  94. 's+': this.getSeconds(), //秒
  95. 'q+': Math.floor((this.getMonth() + 3) / 3), //季度
  96. S: this.getMilliseconds() //毫秒
  97. };
  98. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
  99. for (var k in o)
  100. if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[
  101. k]).substr(('' + o[k]).length));
  102. return fmt;
  103. };
  104. export default {
  105. data: function() {
  106. return {
  107. index_windStation_cardmodule: [],
  108. fdcstatusmodule:[],
  109. lineChartdata:[],
  110. userRights_FDC: [],
  111. cardmodule: true,
  112. module: true,
  113. windStationCardCWidth: '',
  114. windStationCardCHeight: '',
  115. windStationCardPixelRatio: 1,
  116. plusDrawerList: [],
  117. uchartTime:[],
  118. }
  119. },
  120. onLoad: function() {
  121. this.windStationCardCWidth = 250;
  122. this.windStationCardCHeight = 150;
  123. },
  124. methods: {
  125. getWindfieldid:function(plusDrawerList) {
  126. this.plusDrawerList = plusDrawerList;
  127. },
  128. getWindfielddata:function(index_windStation_cardmodule){
  129. this.cardmodule = false;
  130. this.index_windStation_cardmodule = [];
  131. this.index_windStation_cardmodule = index_windStation_cardmodule;
  132. },
  133. getHoursWeatherData: function(fdcstatusmodule) {
  134. this.module = false;
  135. this.fdcstatusmodule = fdcstatusmodule;
  136. },
  137. getUchartData:function(lineChartdata){
  138. this.lineChartdata = [];
  139. this.uchartTime = [];
  140. this.lineChartdata = lineChartdata;
  141. console.log(this.lineChartdata)
  142. let _this = this;
  143. for(let i=0;i<_this.lineChartdata.length;i++){
  144. let time = new Date(
  145. _this.lineChartdata[i].time * 1000).Format('hh');
  146. _this.uchartTime.push(time);
  147. }
  148. console.log(_this.uchartTime)
  149. _this.getLinAcharts();
  150. },
  151. getLinAcharts: function() {
  152. let LineC = {
  153. categories: [],
  154. series: [{
  155. name: '功率',
  156. data: [],
  157. color: '#4BB94B',
  158. textColor: '#FFFFFF',
  159. textSize: this.seriesTextSize,
  160. format: val => {
  161. return val + 'kwh';
  162. },
  163. index: 0,
  164. legendShape: 'circle'
  165. },
  166. {
  167. name: '风速',
  168. data: [],
  169. color: '#E82E2F',
  170. textColor: '#FFFFFF',
  171. textSize: this.seriesTextSize,
  172. format: val => {
  173. return val + 'm/s';
  174. },
  175. index: 1,
  176. legendShape: 'circle'
  177. },
  178. {
  179. name: '理论功率',
  180. data: [],
  181. color: '#F5A83C',
  182. textColor: '#FFFFFF',
  183. textSize: this.seriesTextSize,
  184. format: val => {
  185. return val + 'kwh';
  186. },
  187. index: 0,
  188. legendShape: 'circle'
  189. },
  190. {
  191. name: '预测功率',
  192. data: [],
  193. color: '#4A80B1',
  194. textColor: '#FFFFFF',
  195. textSize: this.seriesTextSize,
  196. format: val => {
  197. return val + 'kwh';
  198. },
  199. index: 1,
  200. legendShape: 'circle'
  201. }
  202. ],
  203. };
  204. let _this = this;
  205. LineC.categories = [];
  206. LineC.series[0].data = [];
  207. LineC.series[1].data = [];
  208. LineC.series[2].data = [];
  209. LineC.series[3].data = [];
  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('windStationCanvasLineC', LineC);
  228. },
  229. showWindStationCardLineA3(canvasId, chartData) {
  230. var _self = this;
  231. canvaLineB3 = new uCharts({
  232. $this: _self,
  233. canvasId: canvasId,
  234. type: 'line',
  235. fontSize: 11,
  236. legend: {
  237. show: true,
  238. position: 'top',
  239. float: 'right',
  240. fontColor: 'silver',
  241. itemGap: '9',
  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: true,
  286. gridColor: '#2E2E2E',
  287. splitNumber: 4,
  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. padding: [10, 0, 0, 0], //画布填充边距,顺序为上右下左,同css,但必须4位
  298. extra: {
  299. line: {
  300. type: 'line',
  301. width: '1'
  302. }
  303. }
  304. });
  305. },
  306. touchLineB3(e) {
  307. canvaLineB3.showToolTip(e, {
  308. format: function(item, category) {
  309. return category + ' ' + item.name + ':' + item.data;
  310. }
  311. });
  312. },
  313. }
  314. }
  315. </script>
  316. <style>
  317. page {
  318. /* background-color: #242424; */
  319. }
  320. .windStation {
  321. clear: both;
  322. width: calc(100% - 18%);
  323. margin-left: 9px;
  324. height: 350px;
  325. color: silver;
  326. margin-bottom: 0px;
  327. background-color: #242424;
  328. }
  329. .scrollWindStationCard {
  330. white-space: nowrap;
  331. }
  332. .windStationCard {
  333. width: 250px;
  334. height: 100%;
  335. margin-right: 9px;
  336. float: left;
  337. background-color: #242424;
  338. }
  339. .windStationCardContainer {
  340. width: 100%;
  341. height: 350px;
  342. margin-top: 10px;
  343. }
  344. .windStationTitle {
  345. width: 90%;
  346. height: 30px;
  347. line-height: 30px;
  348. font-size: 12px;
  349. margin-left: 5px;
  350. }
  351. .powerAndSpeedContainer {
  352. width: 100%;
  353. height: 90px;
  354. }
  355. .powerAndSpeedRed {
  356. margin-top: 8px;
  357. margin-left: 2%;
  358. margin-right: 2%;
  359. width: 46%;
  360. height: 37px;
  361. line-height: 37px;
  362. text-align: left;
  363. font-size: 12px;
  364. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  365. border-radius: 5px;
  366. float: left;
  367. }
  368. .UChartContainer {
  369. width: 250px;
  370. height: 150px;
  371. margin-top: 8px;
  372. }
  373. .windStationUChart {
  374. width: 250px;
  375. height: 150px;
  376. position: absolute;
  377. }
  378. .windStationQiun-charts {
  379. width: 250px;
  380. height: 150px;
  381. background-color: #242424;
  382. }
  383. .windStationCharts {
  384. width: 250px;
  385. height: 150px;
  386. background-color: #242424;
  387. }
  388. .fanStatusContainer {
  389. width: 100%;
  390. height: 70px;
  391. }
  392. .fanStatus {
  393. width: 32%;
  394. height: 30px;
  395. margin-top: 5px;
  396. margin-right: 0.5%;
  397. margin-left: 0.5%;
  398. float: left;
  399. }
  400. .fanStatus {
  401. height: 30px;
  402. line-height: 30px;
  403. font-size: 12px;
  404. }
  405. .statusIcon {
  406. width: 22px;
  407. height: 30px;
  408. margin-left: 3px;
  409. float: left;
  410. }
  411. .UChartTitle {
  412. position: relative;
  413. top: -2px;
  414. left: 2px;
  415. font-size: 12px;
  416. width: 100px;
  417. }
  418. </style>