Преглед на файлове

首页发电量完成情况模块和基础指标模块数据接入

limiao преди 4 години
родител
ревизия
9301621c31
променени са 1 файла, в които са добавени 98 реда и са изтрити 19 реда
  1. 98 19
      pages/index/Index.vue

+ 98 - 19
pages/index/Index.vue

@@ -172,46 +172,46 @@
 			<view class="progressBarAll">
 				<view class="progressBarOne">
 					<view class="progressBarLeft">
-						<view class="progressBarLeftText">35kwh</view>
+						<view class="progressBarLeftText">{{windpowerstationdetail.index_electricQuantity.yfdl}}kwh</view>
 					</view>
 					<view class="progressBarText">月计划发电量进度条</view>
 					<view class="progressBarRight">
-						<view class="progressBarRightText">100kwh</view>
+						<view class="progressBarRightText">1000kwh</view>
 					</view>
 				</view>
 				<view class="cu-progress round radius striped active">
-					<view class="bg-olive" :style="[{ width: loading ? '61.8%' : '' }]"></view>
-					<view class="bg-angrey" :style="[{ width: loading ? '38.2%' : '' }]"></view>
+					<view class="bg-olive" :style="[{ width: loading ? monthOlive : '' }]"></view>
+					<view class="bg-angrey" :style="[{ width: loading ? monthAngrey : '' }]"></view>
 				</view>
 			</view>
 			<view class="progressBarAll">
 				<view class="progressBarOne">
 					<view class="progressBarLeft">
-						<view class="progressBarLeftText">135kwh</view>
+						<view class="progressBarLeftText">{{windpowerstationdetail.index_electricQuantity.nfdl}}kwh</view>
 					</view>
 					<view class="progressBarText">年计划发电量进度条</view>
 					<view class="progressBarRight">
-						<view class="progressBarRightText">200kwh</view>
+						<view class="progressBarRightText">10000kwh</view>
 					</view>
 				</view>
 				<view class="cu-progress round radius striped active">
-					<view class="bg-olive" :style="[{ width: loading ? '70%' : '' }]"></view>
-					<view class="bg-angrey" :style="[{ width: loading ? '30%' : '' }]"></view>
+					<view class="bg-olive" :style="[{ width: loading ? yearOlive : '' }]"></view>
+					<view class="bg-angrey" :style="[{ width: loading ? yearAngrey : '' }]"></view>
 				</view>
 			</view>
 		</view>
 		<scroll-view scroll-x class="horizontalSlider">
 		   <view class="slide">
-		       <view class="monthlyUtilizationHours" @tap="common.navTo('/components/detail/Detail')">月利用小时(h):13</view>
-		       <view class="yearlyUtilizationHours" @tap="common.navTo('/components/detail/Detail')">年利用小时(h):13</view>
-		       <view class="comprehensiveServicePowerConsumptionRate" @tap="common.navTo('/components/detail/Detail')">综合厂用电率(%):20</view>
-		       <view class="equipmentAvailability" @tap="common.navTo('/components/detail/Detail')">设备可利用率(%):90</view>
-		       <view class="sulfurDioxideEmissionReduction" @tap="common.navTo('/components/detail/Detail')">减排二氧化硫(吨):21</view>
-		       <view class="carbonDioxideReduction" @tap="common.navTo('/components/detail/Detail')">减排二氧化碳(吨):5</view>
-		       <view class="waterSaving" @tap="common.navTo('/components/detail/Detail')">节约用水(吨):15</view>
-		       <view class="saveStandardCoal" @tap="common.navTo('/components/detail/Detail')">节约标煤(吨):35</view>
-		       <view class="mttr" @tap="common.navTo('/components/detail/Detail')">mttr(h):22</view>
-		       <view class="mtbf" @tap="common.navTo('/components/detail/Detail')">mtbf(h):24</view>
+		       <view class="monthlyUtilizationHours" @tap="common.navTo('/components/detail/Detail')">月利用小时(h):{{windpowerstationdetail.index_target_basic_indicators.ylyxs}}</view>
+		       <view class="yearlyUtilizationHours" @tap="common.navTo('/components/detail/Detail')">年利用小时(h):{{windpowerstationdetail.index_target_basic_indicators.nlyxs}}</view>
+		       <view class="comprehensiveServicePowerConsumptionRate" @tap="common.navTo('/components/detail/Detail')">综合厂用电率(%):{{windpowerstationdetail.index_target_basic_indicators.zhcydl}}</view>
+		       <view class="equipmentAvailability" @tap="common.navTo('/components/detail/Detail')">设备可利用率(%):{{windpowerstationdetail.index_target_basic_indicators.sbklyl}}</view>
+		       <view class="sulfurDioxideEmissionReduction" @tap="common.navTo('/components/detail/Detail')">减排二氧化硫(吨):{{windpowerstationdetail.index_target_basic_indicators.jpeyhl}}</view>
+		       <view class="carbonDioxideReduction" @tap="common.navTo('/components/detail/Detail')">减排二氧化碳(吨):{{windpowerstationdetail.index_target_basic_indicators.jpeyht}}</view>
+		       <view class="waterSaving" @tap="common.navTo('/components/detail/Detail')">节约用水(吨):{{windpowerstationdetail.index_target_basic_indicators.jyys}}</view>
+		       <view class="saveStandardCoal" @tap="common.navTo('/components/detail/Detail')">节约标煤(吨):{{windpowerstationdetail.index_target_basic_indicators.jybm}}</view>
+		       <view class="mttr" @tap="common.navTo('/components/detail/Detail')">mttr(h):{{windpowerstationdetail.index_target_basic_indicators.mttr}}</view>
+		       <view class="mtbf" @tap="common.navTo('/components/detail/Detail')">mtbf(h):{{windpowerstationdetail.index_target_basic_indicators.mtbf}}</view>
 		      </view>
 		  </scroll-view>
 		<!--折线图-->
@@ -731,11 +731,17 @@
 				windStationCardCWidth: '',
 				windStationCardCHeight: '',
 				windStationCardPixelRatio: 1,
+				monthOlive:"",
+				monthAngrey:"",
+				yearOlive:"",
+				yearAngrey:"",
 				FDC:"CL_FDC",
 				socketTask_target_comprehensive_indicators:'',
 				socketTask_target_windSpeed_power:'',
 				socketTask_index_windturbine_status:'',
-				windpowerstationdetail:{target_comprehensive_indicators:"",target_windSpeed_power:"",index_windturbine_status:""},
+				socketTask_index_electricQuantity:'',
+				socketTask_index_target_basic_indicators:'',
+				windpowerstationdetail:{target_comprehensive_indicators:"",target_windSpeed_power:"",index_windturbine_status:"",index_electricQuantity:"",index_target_basic_indicators:""},
 			};
 		},
 		created: function() {
@@ -762,6 +768,8 @@
 			this.target_comprehensive_indicators();
 			this.target_windSpeed_power();
 			this.index_windturbine_status();
+			this.index_electricQuantity();
+			this.index_target_basic_indicators();
 		},
 		computed:{
 		   backStageIp:function(){
@@ -907,6 +915,77 @@
 								});
 						}) */
 					},
+			async index_electricQuantity() {
+			
+						let _this = this;
+						// 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
+						this.socketTask_index_electricQuantity = uni.connectSocket({
+							// 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
+							url: 'ws://'+this.backStageIp+':'+this.backStagePort+'/websocket/pageNumber_6/functionNumber_4',
+							success(data) {
+								console.log('websocket连接成功');
+							}
+						});
+					    let windpowerstationid = uni.getStorageSync('windpowerstationName');
+						// 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
+						this.socketTask_index_electricQuantity.onOpen(res => {
+							console.log('WebSocket连接正常打开中...!');
+							this.is_open_socket = true;
+					
+							// 注:只有连接正常打开中 ,才能正常收到消息
+							this.socketTask_index_electricQuantity.onMessage(res => {
+								//console.log("收到服务器内容:" + res.data);
+								_this.windpowerstationdetail.index_electricQuantity =JSON.parse(res.data)[_this.FDC];
+								_this.monthOlive=(_this.windpowerstationdetail.index_electricQuantity.yfdl/1000)*100+"%";
+								_this.monthAngrey=(1-_this.windpowerstationdetail.index_electricQuantity.yfdl/1000)*100+"%";
+								_this.yearOlive=(_this.windpowerstationdetail.index_electricQuantity.nfdl/10000)*100+"%";
+								_this.yearAngrey=(1-_this.windpowerstationdetail.index_electricQuantity.nfdl/10000)*100+"%";
+			
+							});
+						});
+						// 这里仅是事件监听【如果socket关闭了会执行】
+			/* 			this.socketTask_comprehensive_target.onClose(() => {
+								uni.request({
+								    url: 'http://'+this.backStageIp+':'+this.backStagePort+'/targetdetail/close_targetdetail_target?pointKey='+this.pointKey,
+								    success: (res) => {
+					
+								    }
+								});
+						}) */
+					},
+			async index_target_basic_indicators() {
+			
+						let _this = this;
+						// 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
+						this.socketTask_index_target_basic_indicators = uni.connectSocket({
+							// 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
+							url: 'ws://'+this.backStageIp+':'+this.backStagePort+'/websocket/pageNumber_6/functionNumber_5',
+							success(data) {
+								console.log('websocket连接成功');
+							}
+						});
+					    let windpowerstationid = uni.getStorageSync('windpowerstationName');
+						// 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
+						this.socketTask_index_target_basic_indicators.onOpen(res => {
+							console.log('WebSocket连接正常打开中...!');
+							this.is_open_socket = true;
+					
+							// 注:只有连接正常打开中 ,才能正常收到消息
+							this.socketTask_index_target_basic_indicators.onMessage(res => {
+								//console.log("收到服务器内容:" + res.data);
+								_this.windpowerstationdetail.index_target_basic_indicators =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) => {
+					
+								    }
+								});
+						}) */
+					},
 			getServerData() {
 				// 折线图
 				let LineA = {