WindFarmcard.vue 11 KB

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