WindFarmcard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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: 0,
  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: 1,
  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: 0,
  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( _this.lineChartdata)
  210. for (var i = 0; i < _this.lineChartdata.length; i++) {
  211. LineC.categories.push(_this.uchartTime[i]);
  212. // console.log(LineC.categories)
  213. LineC.series[0].data.push(
  214. _this.lineChartdata[i].value2
  215. );
  216. LineC.series[1].data.push(
  217. _this.lineChartdata[i].value4
  218. );
  219. LineC.series[2].data.push(
  220. _this.lineChartdata[i].value3
  221. );
  222. LineC.series[3].data.push(
  223. _this.lineChartdata[i].value1
  224. );
  225. }
  226. _this.showWindStationCardLineA3(_this.plusDrawerList.windId, LineC);
  227. },
  228. showWindStationCardLineA3(canvasId, chartData) {
  229. var _self = this;
  230. this.plusDrawerList.canvas = new uCharts({
  231. $this: _self,
  232. canvasId: canvasId,
  233. type: 'line',
  234. fontSize: 11,
  235. legend: {
  236. show: true,
  237. position: 'top',
  238. float: 'left',
  239. fontColor: 'silver',
  240. itemGap: '4',
  241. itemWidth: '3'
  242. },
  243. dataLabel: false,
  244. dataPointShape: false,
  245. background: '#FFFFFF',
  246. pixelRatio: _self.windStationCardPixelRatio,
  247. categories: chartData.categories,
  248. series: chartData.series,
  249. animation: true,
  250. xAxis: {
  251. disableGrid: true,
  252. type: 'grid',
  253. gridColor: 'silver',
  254. fontColor: 'silver',
  255. gridType: 'solid',
  256. gridColor: '#2E2E2E',
  257. axisLineColor: '#2E2E2E',
  258. labelCount: '3'
  259. // itemCount:"3"
  260. },
  261. yAxis: {
  262. data: [{
  263. type: 'value',
  264. fontColor: 'silver',
  265. disabled: false, //y轴轴线
  266. min: 0,
  267. max: 40,
  268. position: 'left',
  269. axisLineColor: '#2E2E2E',
  270. title: ' 风速:(m/s)',
  271. titleFontColor: 'silver'
  272. },
  273. {
  274. fontColor: 'silver',
  275. disabled: false, //y轴轴线
  276. min: 0,
  277. max: 40,
  278. position: 'right',
  279. axisLineColor: '#2E2E2E',
  280. title: '功率:(kwh)',
  281. titleFontColor: 'silver'
  282. }
  283. ],
  284. disabled: false,
  285. gridColor: '#2E2E2E',
  286. splitNumber: 4,
  287. gridType: 'solid',
  288. dashLength: 8,
  289. showTitle: 'true',
  290. format: val => {
  291. return val.toFixed(0) + '元';
  292. }
  293. },
  294. // width: _self.windStationCardCWidth * _self.windStationCardPixelRatio,
  295. // height: _self.windStationCardCHeight * _self.windStationCardPixelRatio,
  296. width: 240,
  297. height:150,
  298. padding: [10, 0, 0, 5], //画布填充边距,顺序为上右下左,同css,但必须4位
  299. extra: {
  300. line: {
  301. type: 'line',
  302. width: '1'
  303. }
  304. }
  305. });
  306. },
  307. touchLineB3(e) {
  308. if(this.plusDrawerList.canvas.showToolTip!=undefined)
  309. {
  310. this.plusDrawerList.canvas.showToolTip(e, {
  311. format: function(item, category) {
  312. return category + ' ' + item.name + ':' + item.data;
  313. }
  314. });
  315. }
  316. },
  317. }
  318. }
  319. </script>
  320. <style>
  321. page {
  322. /* background-color: #242424; */
  323. }
  324. .windStation {
  325. clear: both;
  326. width: calc(100% - 18%);
  327. margin-left: 9px;
  328. height: 350px;
  329. color: silver;
  330. margin-bottom: 0px;
  331. background-color: #242424;
  332. }
  333. .scrollWindStationCard {
  334. white-space: nowrap;
  335. }
  336. .windStationCard {
  337. width: 250px;
  338. height: 100%;
  339. margin-right: 9px;
  340. float: left;
  341. background-color: #242424;
  342. }
  343. .windStationCardContainer {
  344. width: 100%;
  345. height: 350px;
  346. margin-top: 10px;
  347. }
  348. .windStationTitle {
  349. width: 90%;
  350. height: 30px;
  351. line-height: 30px;
  352. font-size: 12px;
  353. margin-left: 5px;
  354. }
  355. .powerAndSpeedContainer {
  356. width: 100%;
  357. height: 90px;
  358. }
  359. .powerAndSpeedRed {
  360. margin-top: 8px;
  361. margin-left: 2%;
  362. margin-right: 2%;
  363. width: 46%;
  364. height: 37px;
  365. line-height: 37px;
  366. text-align: left;
  367. font-size: 12px;
  368. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  369. border-radius: 5px;
  370. float: left;
  371. }
  372. .UChartContainer {
  373. width: 250px;
  374. height: 150px;
  375. margin-top: 8px;
  376. }
  377. .windStationUChart {
  378. width: 250px;
  379. height: 150px;
  380. position: absolute;
  381. }
  382. .windStationQiun-charts {
  383. width: 250px;
  384. height: 150px;
  385. background-color: #242424;
  386. }
  387. .windStationCharts {
  388. width: 250px;
  389. height: 150px;
  390. background-color: #242424;
  391. }
  392. .fanStatusContainer {
  393. width: 100%;
  394. height: 70px;
  395. }
  396. .fanStatus {
  397. width: 32%;
  398. height: 30px;
  399. margin-top: 5px;
  400. margin-right: 0.5%;
  401. margin-left: 0.5%;
  402. float: left;
  403. }
  404. .fanStatus {
  405. height: 30px;
  406. line-height: 30px;
  407. font-size: 12px;
  408. }
  409. .statusIcon {
  410. width: 22px;
  411. height: 30px;
  412. margin-left: 3px;
  413. float: left;
  414. }
  415. .UChartTitle {
  416. position: relative;
  417. top: -2px;
  418. left: 2px;
  419. font-size: 12px;
  420. width: 100px;
  421. }
  422. </style>