Procházet zdrojové kódy

详细页面风速功率曲线图数据获取

lizaixun před 4 roky
rodič
revize
25e9ce7d00

+ 75 - 3
components/windStationCardDetail/WindStationCardDetail.vue

@@ -168,6 +168,23 @@
 </template>
 
 <script>
+	Date.prototype.Format = function(fmt) {
+							var o = {
+								"M+": this.getMonth() + 1, //月份
+								"d+": this.getDate(), //日
+								"h+": this.getHours(), //小时
+								"m+": this.getMinutes(), //分
+								"s+": this.getSeconds(), //秒
+								"q+": Math.floor((this.getMonth() + 3) / 3), //季度
+								"S": this.getMilliseconds() //毫秒
+							};
+							if(/(y+)/.test(fmt))
+								fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+							for(var k in o)
+								if(new RegExp("(" + k + ")").test(fmt))
+									fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+							return fmt;
+				};
 	import uCharts from '../tools/u-charts/u-charts.js';
 	var _self;
 	var canvaLineA = null;
@@ -175,7 +192,7 @@
 	export default {
 		data: function() {
 			return {
-				FDC: "CL_FDC",
+				FDC: "MHS_FDC",
 				socketTask_comprehensive_target: '',
 				socketTask_index_windSpeed_power_target_detail: '',
 				socketTask_windpowerstationdetail_springbox_target: '',
@@ -190,6 +207,10 @@
 				windspeedpowercurvedetail:{
 					windpowerstationdetail_twentyfourhourlinechart_target:""
 				},
+				gl:[],
+				fs:[],
+				llgl:[],
+				ycgl:[],
 				windStationName: '',
 				isFrameShow: false,
 				count: 0,
@@ -203,6 +224,21 @@
 		},
 		onLoad(option) {
 			this.windStationName = option.option;
+			if(this.windStationName == '麻黄山'){
+				this.FDC = 'MHS_FDC'
+			};
+			if(this.windStationName == '牛首山'){
+				this.FDC = 'NSS_FDC'
+			};
+			if(this.windStationName == "石板泉"){
+				this.FDC = 'SBQ_FDC'
+			};
+			if(this.windStationName == "香山"){
+				this.FDC = 'XS_FDC'
+			};
+			if(this.windStationName == "青山"){
+				this.FDC = 'QS_FDC'
+			};
 			this.cWidth = uni.upx2px(750);
 			this.cHeight = uni.upx2px(400);
 			this.getServerData();
@@ -326,8 +362,11 @@
 					this.socketTask_windpowerstationdetail_twentyfourhourlinechart_target.onMessage(res => {
 						//console.log("收到服务器内容:" + res.data);
 						_this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target = JSON.parse(res.data)[_this.FDC];
-						// console.log(_this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target);
-						console.log(_this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target)
+						_this.gl = _this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target.gl;
+						_this.fs = _this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target.fs;
+						_this.llgl = _this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target.llgl;
+						_this.ycgl = _this.windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target.ycgl;
+						_this.getServerData();
 					});
 				});
 			},
@@ -434,6 +473,39 @@
 						}
 					]
 				};
+				let _this = this;
+				LineA.categories = [];
+				LineA.series[0].data = [];
+				LineA.series[1].data = [];
+				LineA.series[2].data = [];
+				LineA.series[3].data = [];
+				
+				// for(let i=0;i<_this.gl.length;i++){
+				// 	_this.gl[i].pointTime = new Date(_this.gl[i].pointTime*1000).Format("hh");
+				// 	LineA.categories.push(_this.gl[i].pointTime);
+				// 	LineA.series[1].data.push(_this.gl[i].pointValueInDouble);
+				// 	console.log(_this.gl[i].pointValueInDouble)
+				// };
+				for(let i=0;i<_this.gl.length;i++){
+					_this.gl[i].pointTime = new Date(_this.gl[i].pointTime*1000).Format("hh");
+					// LineA.categories.push(_this.fs[i].pointTime);
+					LineA.series[0].data.push(_this.gl[i].pointValueInDouble);
+				}
+				for(let i=0;i<_this.fs.length;i++){
+						_this.fs[i].pointTime = new Date(_this.fs[i].pointTime*1000).Format("hh");
+					    LineA.categories.push(_this.fs[i].pointTime);
+						LineA.series[1].data.push(_this.fs[i].pointValueInDouble);
+				}
+				for(let i=0;i<_this.llgl.length;i++){
+					_this.llgl[i].pointTime = new Date(_this.llgl[i].pointTime*1000).Format("hh");
+					// LineA.categories.push(_this.ycgl[i].pointTime);
+					LineA.series[2].data.push(_this.llgl[i].pointValueInDouble);
+				}
+				for(let i=0;i<_this.ycgl.length;i++){
+					_this.ycgl[i].pointTime = new Date(_this.ycgl[i].pointTime*1000).Format("hh");
+					// LineA.categories.push(_this.ycgl[i].pointTime);
+					LineA.series[3].data.push(_this.ycgl[i].pointValueInDouble);
+				}
 				this.showLineA('canvasLineA', LineA);
 			},
 			showLineA(canvasId, chartData) {