Kaynağa Gözat

统一编码引入

wangjiawen 4 yıl önce
ebeveyn
işleme
578d592058

+ 3 - 0
common/store.js

@@ -7,6 +7,9 @@ const store = new Vuex.Store({
     state: {
 		wholeSituationBackStageIp:'192.168.1.104',
 		wholeSituationBackStagePort:'8082',
+		windpowerstationNameToId:{
+           "宁夏新能源公司":"0","麻黄山风电场":"MHS_FDC","牛首山风电场":"NSS_FDC","青山风电场":"SBQ_FDC","石板泉风电场":"QS_FDC","香山风电场":"QS_FDC"
+		},
         memberData:'',
         initName:''
     },

+ 62 - 1
components/detail/Detail.vue

@@ -92,7 +92,9 @@ export default {
 		  return this.$store.state.wholeSituationBackStageIp;
 	   }, backStagePort:function(){
 		  return this.$store.state.wholeSituationBackStagePort;
-	   },
+	   },windpowerstationNameToId:function(){
+		  return this.$store.state.windpowerstationNameToId;
+	   }
 	},
 	methods: {
 		targetInformation(pointKey,callTargetName,callTargetUnit){
@@ -171,6 +173,65 @@ export default {
 				this.socketTask_targetdetail_curve.onMessage(res => {
 					//console.log("收到服务器内容:" + res.data);
 					_this.targetdetail.targetdetail_curve = JSON.parse(res.data)[ip];
+					
+					let LineA = {
+						categories: [
+							'17:26',
+							'18:56',
+							'19:56',
+							'20:56',
+							'21:56',
+							'22:56',
+							'23:56',
+							'00:56',
+							'01:56',
+							'02:56',
+							'03:56',
+							'04:56',
+							'05:56',
+							'06:56',
+							'07:56',
+							'08:56',
+							'09:56',
+							'10:56',
+							'11:56',
+							'12:56',
+							'13:56',
+							'14:56',
+							'15:56',
+							'16:56',
+							'17:56            '
+						],
+						series: [
+							{
+								name: '功率',
+								data: [17, 21, 19, 22, 20.2, 19.1, 22.4, 23.8, 21.5, 22.9, 19.2, 22.4, 18.7, 22.1, 21.4, 22.7, 18.4, 18.4, 21.8, 22.5, 22.9, 19.8, 22.7, 23, 22.8],
+								color: '#4A80B1',
+								textColor: '#FFFFFF',
+								textSize: this.seriesTextSize,
+								format: val => {
+									return val + 'kwh';
+								},
+								index: 0,
+								legendShape: 'circle'
+							}
+						]
+					};
+					
+					LineA.categories=[];
+					LineA.series[0].data=[];
+					LineA.series[0].name=this.targetName;
+					for(var i=0;i<_this.targetdetail.targetdetail_curve.length;i++){
+						_this.targetdetail.targetdetail_curve[i].pointTime = new Date(_this.targetdetail.targetdetail_curve[i].pointTime*1000).Format("MM/dd");
+						LineA.categories.push(_this.targetdetail.targetdetail_curve[i].pointTime);
+						LineA.series[0].data.push(_this.targetdetail.targetdetail_curve[i].pointValueInDouble);
+					}
+					
+					
+					this.showLineA('canvasLineA', LineA);
+					
+					
+					
 				});
 			});
 			// 这里仅是事件监听【如果socket关闭了会执行】

+ 54 - 6
components/windStationCardDetail/WindStationCardDetail.vue

@@ -15,25 +15,25 @@
 				<view class="informationCardTextOne">
 					<view class="informationCardText">
 						<view class="textSilver" @tap="common.navTo('/components/detail/Detail')">安全天数(&nbsp;天&nbsp;)&nbsp;:</view>
-						<view class="textWhite">15</view>
+						<view class="textWhite">{{windpowerstationdetail.comprehensive_target.aqts}}</view>
 					</view>
 					<view class="informationCardTextzj">
 						<view class="textSilver" @tap="common.navTo('/components/detail/Detail')">装机容量(MV):</view>
-						<view class="textWhite">15</view>
+						<view class="textWhite">{{windpowerstationdetail.comprehensive_target.zjrl}}</view>
 					</view>
 				</view>
 				<view class="informationCardTextTwo">
 					<view class="informationCardTextNo1">
 						<view class="textSilver" @tap="common.navTo('/components/detail/Detail')">日发电量(kwh):</view>
-						<view class="textWhite">150</view>
+						<view class="textWhite">{{windpowerstationdetail.comprehensive_target.rfdl}}</view>
 					</view>
 					<view class="informationCardText3">
 						<view class="textSilver" @tap="common.navTo('/components/detail/Detail')">预测发电量(kwh):</view>
-						<view class="textWhite2">15</view>
+						<view class="textWhite2">{{windpowerstationdetail.comprehensive_target.ycfdl}}</view>
 					</view>
 					<view class="informationCardText2">
 						<view class="textSilver" @tap="common.navTo('/components/detail/Detail')">上网电量(kwh):</view>
-						<view class="textWhite">15</view>
+						<view class="textWhite">{{windpowerstationdetail.comprehensive_target.swdl}}</view>
 						<view class="img"></view>
 					</view>
 				</view>
@@ -164,6 +164,9 @@ var canvaColumn = null;
 export default {
 	data: function() {
 		return {
+			FDC:"CL_FDC",
+			socketTask_comprehensive_target:'',
+			windpowerstationdetail:{comprehensive_target:""},
 			windStationName: '',
 			isFrameShow: false,
 			count: 0,
@@ -171,7 +174,8 @@ export default {
 			cHeight: '',
 			pixelRatio: 1,
 			serverData: '',
-			sanJiao: 'sanJiaoDown'
+			sanJiao: 'sanJiaoDown',
+			
 		};
 	},
 	onLoad(option) {
@@ -180,8 +184,52 @@ export default {
 		this.cHeight = uni.upx2px(400);
 		this.getServerData();
 		this.getColumnServerData();
+		this.comprehensive_target();
+	},
+	computed:{
+	   backStageIp:function(){
+		  return this.$store.state.wholeSituationBackStageIp;
+	   }, backStagePort:function(){
+		  return this.$store.state.wholeSituationBackStagePort;
+	   },windpowerstationNameToId:function(){
+		  return this.$store.state.windpowerstationNameToId;
+	   }
 	},
 	methods: {
+		async comprehensive_target() {
+
+			let _this = this;
+			// 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
+			this.socketTask_comprehensive_target = uni.connectSocket({
+				// 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
+				url: 'ws://'+this.backStageIp+':'+this.backStagePort+'/websocket/pageNumber_7/functionNumber_1',
+				success(data) {
+					console.log('websocket连接成功');
+				}
+			});
+		    let windpowerstationid = uni.getStorageSync('windpowerstationName');
+			// 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
+			this.socketTask_comprehensive_target.onOpen(res => {
+				console.log('WebSocket连接正常打开中...!');
+				this.is_open_socket = true;
+		
+				// 注:只有连接正常打开中 ,才能正常收到消息
+				this.socketTask_comprehensive_target.onMessage(res => {
+					//console.log("收到服务器内容:" + res.data);
+					_this.windpowerstationdetail.comprehensive_target =JSON.parse(res.data)[_this.FDC];
+
+				});
+			});
+			// 这里仅是事件监听【如果socket关闭了会执行】
+/* 			this.socketTask_comprehensive_target.onClose(() => {
+					uni.request({
+					    url: 'http://'+this.backStageIp+':'+this.backStagePort+'/targetdetail/close_targetdetail_target?pointKey='+this.pointKey,
+					    success: (res) => {
+		
+					    }
+					});
+			}) */
+		},
 		frameShow: function() {
 			this.count = this.count + 1;
 			if (this.count % 2 == 0) {