Jelajahi Sumber

矩阵页面调试

lizaixun 4 tahun lalu
induk
melakukan
4e462febed
2 mengubah file dengan 88 tambahan dan 21 penghapusan
  1. 2 1
      common/common.js
  2. 86 20
      components/monitor/MatrixMonitor.vue

+ 2 - 1
common/common.js

@@ -52,7 +52,8 @@ class Common {
 		} else if (page[page.length - 1].route == "components/monitor/MatrixMonitor") {
 			page[page.length - 1].$vm.FDC = uni.getStorageSync('windPowerStationId');
 			page[page.length - 1].$vm.windStationName = windpowerstationName.replace('风电场', '');
-
+			page[page.length - 1].$vm.getProjectcollection();
+			page[page.length - 1].$vm.getWindfarmconnectioninformation();
 		} else if (page[page.length - 1].route == "pages/forecast/Forecast") {
 
 			//#ifdef H5

+ 86 - 20
components/monitor/MatrixMonitor.vue

@@ -13,7 +13,7 @@
 				</view>
 			</block>
 			<block slot="right">
-		
+
 			</block>
 			<block slot="content">{{address}}</block>
 			<block slot="right">
@@ -30,7 +30,7 @@
 		<scroll-view scroll-y class="DrawerPage" :class="modalName == 'viewModal' ? 'show' : ''">
 			<view class="windStationNameAndChoice">
 				<view class="windStationName">{{ windStationName }}</view>
-				<!--<view class="windStationChoice"><a @click="showCenterVisible = true">其他ㅤ〉</a></view>-->
+				<view class="windStationChoice"><a @click="showCenterVisible = true">其他ㅤ〉</a></view>
 				<!-- @tap="showModal" data-target="DialogModal1" -->
 				<!-- @tap="changeModalStaus" @click="showCenterVisible = true" -->
 			</view>
@@ -132,7 +132,7 @@
 			<swiper class="card-swiper" :class="dotStyle ? 'square-dot' : 'round-dot'" :indicator-dots="true" :circular="true"
 			 :autoplay="false" interval="5000" duration="500" @change="cardSwiper" indicator-color="#8799a3"
 			 indicator-active-color="#F14E51" :current="cardCur">
-				<swiper-item v-for="(item, index) in windStation" :key="index" :class="cardCur == index ? 'cur' : ''">
+				<swiper-item v-for="(item, index) in windFielddata" :key="index" :class="cardCur == index ? 'cur' : ''">
 					<view class="swiper-item"></view>
 				</swiper-item>
 			</swiper>
@@ -164,6 +164,7 @@
 				</view>
 			</view>
 		</scroll-view>
+		<view class="DrawerClose" :class="modalName == 'viewModal' ? 'show' : ''" @tap="hideModal"><text class="cuIcon-pullright"></text></view>
 	</view>
 </template>
 
@@ -179,7 +180,7 @@
 		},
 		data: function() {
 			return {
-				conflict:false,
+				conflict: false,
 				address: '',
 				userid: '',
 				permissionsInformation: [],
@@ -1175,7 +1176,8 @@
 				guZhang: 0,
 				xianDian: 0,
 				shouLei: 0,
-				liXian: 0
+				liXian: 0,
+				windFielddata:[],
 			};
 		},
 		// onLoad(option) {
@@ -1195,11 +1197,14 @@
 
 			this.viewUserid();
 			this.monitoringAuthority();
+			this.getProjectcollection();
+			// this.getWindfarmconnectioninformation();
 		},
 		created: function() {
 			this.viewUserid();
 			this.monitoringAuthority();
-
+			this.getProjectcollection();
+			// this.getWindfarmconnectioninformation();
 			this.address = this.dataprocessing.getWindPowerStationName();
 			this.FDC = this.dataprocessing.getWindPowerStationId();
 			this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
@@ -1214,6 +1219,7 @@
 			this.cHeight40 = uni.upx2px(350);
 
 			this.windStation = this.dataprocessing.getWindPowerStationNameByNames(this.address);
+			
 			this.windStationName = this.windStation[0].replace('风电场', '');
 
 			this.windStationListHeight = this.windStation.length * 50 + 40 + 'px';
@@ -1247,6 +1253,66 @@
 			monitoringAuthority: function() {
 				this.drawerList = uni.getStorageSync('leftlist1');
 			},
+			getProjectcollection: function() {
+				let _this = this;
+				console.log(this.FDC)
+				uni.request({
+					url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeMatrixController/GyeeMatrixList?keyid=' +
+						this.FDC,
+					data: {},
+					method: 'GET',
+					success: function(res) {
+						_this.windFielddata = res.data.data
+						console.log(_this.windFielddata);
+						_this.getWindfarmconnectioninformation();
+					},
+					fail: () => {
+						_this.tips = '网络错误,小程序端请检查合法域名';
+					},
+				});
+			},
+			getWindfarmconnectioninformation: function() {
+				let _this = this;
+				for(let i=0;i<this.windFielddata.length;i++){
+					if(this.windFielddata[i].id.substring(3,6)=="FDC"){
+						this.socketTask = uni.connectSocket({
+							// 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
+							url: 'ws://' + this.backStageIp + ':' + this.backStagePort +
+								'/websocket/pageNumber_4/functionNumber_2/wp_' + this.windFielddata[i].id,
+							success(data) {
+								console.log('websocket连接成功');
+							}
+						});
+						
+					}
+					else{
+						console.log(this.windFielddata[i].id)
+						this.socketTask = uni.connectSocket({
+							// 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
+							url: 'ws://' + this.backStageIp + ':' + this.backStagePort +
+								'/websocket/pageNumber_4/functionNumber_2/pj_' + this.windFielddata[i].id,
+							success(data) {
+								console.log('websocket连接成功');
+							}
+						});
+					}
+				}
+				let windpowerstationid = uni.getStorageSync('windpowerstationName');
+				// 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
+				this.socketTask.onOpen(res => {
+					console.log('WebSocket连接正常打开中...!');
+					_this.is_open_socket = true;
+				
+					// 注:只有连接正常打开中 ,才能正常收到消息
+					_this.socketTask.onMessage(res => {
+						//console.log("收到服务器内容:" + res.data);
+						let json = JSON.parse(res.data);
+						// _this.windMotorMatrixDetail = res.data;
+						console.log(json)
+					});
+				});
+				
+			},
 			pushWindPowerStationNameToSessionStorage(windpowerstationName) {
 				uni.setStorageSync('windpowerstationName', windpowerstationName);
 				//sessionStorage.setItem('windpowerstationName', windpowerstationName);
@@ -1258,19 +1324,20 @@
 				return uni.getStorageSync('windpowerstationName');
 			},
 			openDrawer: function() {
-				if(this.$refs.drawer != undefined){
-				//this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList);
-				this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList, this.leftNavigationtitle);
-				}
-				else{
-					
+				if (this.$refs.drawer != undefined) {
+					//this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList);
+					this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList, this.leftNavigationtitle);
+				} else {
+
 				}
 			},
 			openPlusDrawer(e) {
+				this.conflict = false;
 				this.modalName = e.currentTarget.dataset.target;
 				this.$refs.plusDrawer.showModal(this.plusDrawerList, this.modalName);
 			},
 			closePlusDrawer() {
+				this.conflict = false;
 				this.modalName = null;
 				this.$refs.plusDrawer.hideModal(this.modalName);
 			},
@@ -1281,11 +1348,10 @@
 				this.monitoringAuthority();
 				this.$refs.plusDrawer.showModal(this.plusDrawerList, this.modalName);
 			},
-			hideModal(e) {
+			hideModal() {
 				this.conflict = false;
 				this.modalName = null;
 				this.$refs.plusDrawer.hideModal(this.modalName);
-				this.choiceIndex = -1;
 			},
 			showCardModal(modalName) {
 				this.modalName = modalName;
@@ -1307,7 +1373,6 @@
 					_this.cardCur = index;
 				}, 1000);
 				this.FDC = this.dataprocessing.getWindPowerStationNameById(item);
-
 				this.dataprocessing.putWindPowerStationId(this.FDC);
 			},
 			getWindMotorStatusCard: function() {
@@ -1438,16 +1503,17 @@
 			cardSwiper(e) {
 				let _this = this;
 				this.cardCur = e.detail.current;
-				for (let i = 0; i < this.windStation.length; i++) {
+				for (let i = 0; i < this.windFielddata.length; i++) {
 					if (this.cardCur == i) {
 
-						if (this.windStation[i].search('风电场') != -1) {
+						if (this.windFielddata[i].name.search('风电场') != -1) {
 
-							this.windStationName = this.windStation[i].replace('风电场', '');
+							this.windStationName = this.windFielddata[i].name.replace('风电场', '');
 						} else {
-							this.windStationName = this.windStation[i];
+							this.windStationName = this.windFielddata[i].name;
+							
 						}
-						this.modalWindStationName = this.windStation[i];
+						this.modalWindStationName = this.windFielddata[i].name;
 						this.windMotorMatrixDetailAll = this.windMotorMatrixDetailMaHuagShan;
 						this.getWindMotorStatusCard();
 						this.clickWindMotorStatusCard(this.clickFlag);