Browse Source

左右导航代码抽取

shilin 4 years ago
parent
commit
00a3186347

+ 187 - 76
common/dataprocessing.js

@@ -1,137 +1,248 @@
+import store from '../common/store.js'
+
 class Dataprocessing {
 	constructor() {
 
 	}
 
-	
+
 	//
 	putWindPowerStationName(windPowerStationName) {
 		uni.setStorageSync('windpowerstationName', windPowerStationName);
 	}
-	
+
 	putWindPowerStationId(windPowerStationId) {
 		uni.setStorageSync('windPowerStationId', windPowerStationId);
 	}
-	
+
 	getWindPowerStationName() {
 		return uni.getStorageSync('windpowerstationName');
 	}
-	
+
 	getWindPowerStationId() {
 		return uni.getStorageSync('windPowerStationId');
 	}
-	
-	getWindPowerStationNameById(name)
-	{
+
+	getWindPowerStationNameById(name) {
 		if (name == '宁夏新能源公司') {
-			let  wpId = '0';
+			let wpId = '0';
 			return wpId;
-		}else if (name == '麻黄山风电场') {
-		
-			let  wpId = 'MHS_FDC';
+		} else if (name == '麻黄山风电场') {
+
+			let wpId = 'MHS_FDC';
 			return wpId;
-		}else if (name == '牛首山风电场') {
-			let  wpId = 'NSS_FDC';
+		} else if (name == '牛首山风电场') {
+			let wpId = 'NSS_FDC';
 			return wpId;
-		}else if (name == '石板泉风电场') {
-			let  wpId = 'SBQ_FDC';
+		} else if (name == '石板泉风电场') {
+			let wpId = 'SBQ_FDC';
 			return wpId;
-		}else if (name == '青山风电场') {
-			let  wpId = 'QS_FDC';
+		} else if (name == '青山风电场') {
+			let wpId = 'QS_FDC';
 			return wpId;
-		}else if (name == '香山风电场') {
-			let  wpId = 'XS_FDC';
+		} else if (name == '香山风电场') {
+			let wpId = 'XS_FDC';
 			return wpId;
-		}else if (name == '河北能源集团') {
-			let  wpId = '0';
+		} else if (name == '河北能源集团') {
+			let wpId = '0';
 			return wpId;
-		}else if (name == '崇礼风电场') {
-			let  wpId = 'CL_FDC';
+		} else if (name == '崇礼风电场') {
+			let wpId = 'CL_FDC';
 			return wpId;
-		}else if (name == '康保风电场') {
-			let  wpId = 'KB_FDC';
+		} else if (name == '康保风电场') {
+			let wpId = 'KB_FDC';
 			return wpId;
-		}else if (name == '代县风电场') {
-			let  wpId = 'DX_FDC';
+		} else if (name == '代县风电场') {
+			let wpId = 'DX_FDC';
 			return wpId;
 		}
 	}
-	
-	getWindPowerStationNameByWeatherId(name)
-	{
-		
+
+	getWindPowerStationNameByWeatherId(name) {
+
 		if (name == '宁夏新能源公司') {
-			let  wpId = 'MHS_FDC';
+			let wpId = 'MHS_FDC';
 			return wpId;
-		}else if (name == '麻黄山风电场') {
-		
-			let  wpId = 'MHS_FDC';
+		} else if (name == '麻黄山风电场') {
+
+			let wpId = 'MHS_FDC';
 			return wpId;
-		}else if (name == '牛首山风电场') {
-			let  wpId = 'NSS_FDC';
+		} else if (name == '牛首山风电场') {
+			let wpId = 'NSS_FDC';
 			return wpId;
-		}else if (name == '石板泉风电场') {
-			let  wpId = 'SBQ_FDC';
+		} else if (name == '石板泉风电场') {
+			let wpId = 'SBQ_FDC';
 			return wpId;
-		}else if (name == '青山风电场') {
-			let  wpId = 'QS_FDC';
+		} else if (name == '青山风电场') {
+			let wpId = 'QS_FDC';
 			return wpId;
-		}else if (name == '香山风电场') {
-			let  wpId = 'XS_FDC';
+		} else if (name == '香山风电场') {
+			let wpId = 'XS_FDC';
 			return wpId;
-		}else if (name == '河北能源集团') {
-			let  wpId = 'CL_FDC';
+		} else if (name == '河北能源集团') {
+			let wpId = 'CL_FDC';
 			return wpId;
-		}else if (name == '崇礼风电场') {
-			let  wpId = 'CL_FDC';
+		} else if (name == '崇礼风电场') {
+			let wpId = 'CL_FDC';
 			return wpId;
-		}else if (name == '康保风电场') {
-			let  wpId = 'KB_FDC';
+		} else if (name == '康保风电场') {
+			let wpId = 'KB_FDC';
 			return wpId;
-		}else if (name == '代县风电场') {
-			let  wpId = 'DX_FDC';
+		} else if (name == '代县风电场') {
+			let wpId = 'DX_FDC';
 			return wpId;
 		}
 	}
-	
-	getWindPowerStationNameByNames(name)
-	{	
+
+	getWindPowerStationNameByNames(name) {
 		if (name == '宁夏新能源公司') {
-			
-			let  windStations=['麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
+
+			let windStations = ['麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
 			return windStations;
-		}else if (name == '麻黄山风电场') {
-			let  windStations = ['麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
+		} else if (name == '麻黄山风电场') {
+			let windStations = ['麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
 			return windStations;
-		}else if (name == '牛首山风电场') {
-			let  windStations = ['牛首山风电场', '麻黄山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
+		} else if (name == '牛首山风电场') {
+			let windStations = ['牛首山风电场', '麻黄山风电场', '石板泉风电场', '青山风电场', '香山风电场'];
 			return windStations;
-		}else if (name == '石板泉风电场') {
-			let  windStations = ['石板泉风电场', '麻黄山风电场', '牛首山风电场', '青山风电场', '香山风电场'];
+		} else if (name == '石板泉风电场') {
+			let windStations = ['石板泉风电场', '麻黄山风电场', '牛首山风电场', '青山风电场', '香山风电场'];
 			return windStations;
-		}else if (name == '香山风电场') {
-			let  windStations = ['香山风电场', '麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场'];
+		} else if (name == '香山风电场') {
+			let windStations = ['香山风电场', '麻黄山风电场', '牛首山风电场', '石板泉风电场', '青山风电场'];
 			return windStations;
-		}else if (name == '青山风电场') {
-			let  windStations = ['青山风电场', '麻黄山风电场', '牛首山风电场', '石板泉风电场', '香山风电场'];
+		} else if (name == '青山风电场') {
+			let windStations = ['青山风电场', '麻黄山风电场', '牛首山风电场', '石板泉风电场', '香山风电场'];
 			return windStations;
-		}else if (name == '河北能源集团') {
-			let  windStations = ['崇礼风电场', '康保风电场', '代县风电场'];
+		} else if (name == '河北能源集团') {
+			let windStations = ['崇礼风电场', '康保风电场', '代县风电场'];
 			return windStations;
-		}else if (name == '崇礼风电场') {
-			let  windStations = ['崇礼风电场', '康保风电场', '代县风电场'];
+		} else if (name == '崇礼风电场') {
+			let windStations = ['崇礼风电场', '康保风电场', '代县风电场'];
 			return windStations;
-		}else if (name == '康保风电场') {
-			let  windStations = ['康保风电场', '崇礼风电场', '代县风电场'];
+		} else if (name == '康保风电场') {
+			let windStations = ['康保风电场', '崇礼风电场', '代县风电场'];
 			return windStations;
-		}else if (name == '代县风电场') {
-			let  windStations = ['代县风电场', '康保风电场', '崇礼风电场'];
+		} else if (name == '代县风电场') {
+			let windStations = ['代县风电场', '康保风电场', '崇礼风电场'];
 			return windStations;
 		}
 	}
-	
-	
 
+	viewUserid() {
+		let userid = uni.getStorageSync('userid');
+		let ip = store.state.wholeSituationBackStageIp;
+		let port = store.state.wholeSituationBackStagePort;
+		uni.request({
+			url: 'http://' + ip + ':' + port + '/GyeeorganController/GyeeOrganList?userid=' + userid,
+			data: {},
+			method: 'GET',
+			success: function(res) {
+
+				let plusDrawerList = [];
+				let plusDrawerList_weather = [];
+				for (let j = 0; j < res.data.data.length; j++) {
+
+					var obj = {};
+					obj.name = res.data.data[j].describes;
+					obj.windId = res.data.data[j].name;
+
+					plusDrawerList.push(obj);
+				}
+
+				for (let j = 0; j < res.data.data.length; j++) {
+
+					var obj = {};
+					obj.name = res.data.data[j].describes;
+
+					if (res.data.data[j].describes == '宁夏新能源公司') {
+						obj.windId = 'MHS_FDC';
+					} else if (res.data.data[j].describes == '河北能源集团') {
+						obj.windId = 'CL_FDC';
+					} else {
+						obj.windId = res.data.data[j].name;
+					}
+					plusDrawerList_weather.push(obj);
+				}
+
+				uni.setStorageSync('plusList', plusDrawerList);
+				uni.setStorageSync('plusList_we', plusDrawerList_weather);
+			}
+		})
+	}
+
+
+	monitoringAuthority() {
+		let userid = uni.getStorageSync('userid');
+		let ip = store.state.wholeSituationBackStageIp;
+		let port = store.state.wholeSituationBackStagePort;
+		uni.request({
+				url: 'http://' + ip + ':' + port + '/GyeepermissionController/GyeePermissionList?userid=' + userid,
+				data: {},
+				method: 'GET',
+				success: function(res) {
+
+					let leftlist1 = [];
+					let leftlist2 = [];
+					let leftlist3 = [];
+					let leftlist4 = [];
+					let leftlist5 = [];
+
+					for (let j = 0; j < res.data.data.length; j++) {
+
+						let gyeePermissionList = res.data.data[j].gyeePermissionList;
+
+						if (j == 0) {
+							for (let k = 0; k < gyeePermissionList.length; k++) {
+								var obj = {};
+								obj.name = gyeePermissionList[k].permisssionname;
+								obj.remark1 = gyeePermissionList[k].remark1;
+								leftlist1.push(obj);
+							}
+						} else if (j == 1) {
+
+							for (let k = 0; k < gyeePermissionList.length; k++) {
+								var obj = {};
+								obj.name = gyeePermissionList[k].permisssionname;
+								obj.remark1 = gyeePermissionList[k].remark1;
+								leftlist2.push(obj);
+							}
+						} else if (j == 2) {
+
+							for (let k = 0; k < gyeePermissionList.length; k++) {
+								var obj = {};
+								obj.name = gyeePermissionList[k].permisssionname;
+								obj.remark1 = gyeePermissionList[k].remark1;
+								leftlist3.push(obj);
+							}
+						} else if (j == 3) {
+
+							for (let k = 0; k < gyeePermissionList.length; k++) {
+								var obj = {};
+								obj.name = gyeePermissionList[k].permisssionname;
+								obj.remark1 = gyeePermissionList[k].remark1;
+								leftlist4.push(obj);
+							}
+						} else if (j == 4) {
+
+							for (let k = 0; k < gyeePermissionList.length; k++) {
+								var obj = {};
+								obj.name = gyeePermissionList[k].permisssionname;
+								obj.remark1 = gyeePermissionList[k].remark1;
+								leftlist5.push(obj);
+							}
+						}
+
+					}
+					uni.setStorageSync('leftlist1', leftlist1);
+					uni.setStorageSync('leftlist2', leftlist2);
+					uni.setStorageSync('leftlist3', leftlist3);
+					uni.setStorageSync('leftlist4', leftlist4);
+					uni.setStorageSync('leftlist5', leftlist5);
+				}
+
+		})
+	}
 }
 
 let dataprocessing = new Dataprocessing();

+ 4 - 1
components/drawer/threeLineDrawer.vue

@@ -66,7 +66,10 @@
 			},
 			closeDrawer: function() {
 				this.drawerIsShow = false;
-				this.$parent.leftbar();
+				if(this.$parent!=undefined)
+				{
+					this.$parent.leftbar();
+				}
 			},
 			clickChangeColor: function(index) {
 				this.changeGary = index;

+ 9 - 0
components/login/Login.vue

@@ -78,6 +78,7 @@ export default {
 		};
 	},
 	created() {
+
 		this.windowWidth = uni.getSystemInfoSync().windowWidth;
 		this.windowHeight = uni.getSystemInfoSync().windowHeight;
 		//console.log(this.windowWidth);
@@ -220,6 +221,11 @@ export default {
 		getFingerPrintPassword: function() {
 
 			if (uni.getStorageSync('fingerPrintname') != '' && uni.getStorageSync('fingerPrintpassword') != '') {
+
+				uni.setStorageSync('gyeeusername', uni.getStorageSync('fingerPrintname'));
+				uni.setStorageSync('gyeepassword', uni.getStorageSync('fingerPrintpassword'));
+				this.dataprocessing.viewUserid();
+				this.dataprocessing.monitoringAuthority();
 				uni.switchTab({
 					url: '/pages/index/Index'
 				});
@@ -260,6 +266,9 @@ export default {
 						
 						_this.dataprocessing.putWindPowerStationId(_this.$store.state.default_wpid);
 						_this.dataprocessing.putWindPowerStationName(_this.$store.state.default_wpname);
+						
+						_this.dataprocessing.viewUserid();
+						_this.dataprocessing.monitoringAuthority();
 						// if(_this.dataprocessing.getWindPowerStationId()=='')
 						// {
 						// 	//debugger

+ 13 - 64
components/weatherProphethomepage/WeatherProphethomepage.vue

@@ -822,8 +822,10 @@
 			this.monitoringAuthority();
 			
 			this.address = this.dataprocessing.getWindPowerStationName();
-			this.FDC=this.dataprocessing.getWindPowerStationId();
-			this.windPowerStationId =this.dataprocessing.getWindPowerStationId();
+			
+			this.FDC=this.dataprocessing.getWindPowerStationNameByWeatherId(this.address);
+
+	
 			
 			this.$nextTick(function() {
 				this.getWeatherDataToday();
@@ -921,9 +923,11 @@
 		},
 		onShow() {
 			
-			this.address = this.dataprocessing.getWindPowerStationName();
-			this.FDC=this.dataprocessing.getWindPowerStationId();
-			this.windPowerStationId =this.dataprocessing.getWindPowerStationId();
+		this.address = this.dataprocessing.getWindPowerStationName();
+		
+			this.FDC=this.dataprocessing.getWindPowerStationNameByWeatherId(this.address);
+		
+
 			
 			this.getWeatherData();
 			this.getWeatherDataToday();
@@ -955,66 +959,11 @@
 					}
 				},
 		methods: {
-			viewUserid:function(){
-				let _this = this;
-				_this.userid =uni.getStorageSync('userid')
-				//_this.userid = sessionStorage.getItem('userid');
-				uni.request({
-					url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeorganController/GyeeOrganList?userid=' + _this.userid,
-					data: {},
-					method: 'GET',
-					success: function(res) {
-						for(let i=0;i<res.data.data.length;i++){
-							// _this.name.push(res.data.data[i].describes);
-							// _this.windId.push(res.data.data[i].name);
-						}
-						for(let j=0;j<res.data.data.length;j++){
-							var a = {};
-							_this.$set(a,"name",res.data.data[j].describes);
-							
-							if (res.data.data[j].describes == '宁夏新能源公司') {
-								_this.$set(a,"windId",'MHS_FDC');
-							}else if(res.data.data[j].describes == '河北能源集团')
-							{
-								_this.$set(a,"windId",'CL_FDC');
-							}else{
-								_this.$set(a,"windId",res.data.data[j].name);
-							}
-							
-							_this.plusDrawerList.push(a);
-						}
-					},
-					})
+			viewUserid: function() {
+				this.plusDrawerList=uni.getStorageSync('plusList_we');
 			},
-			monitoringAuthority:function(){
-				let _this = this;
-				uni.request({
-					url: 'http://' + this.backStageIp + ':' + this.backStagePort +
-						'/GyeepermissionController/GyeePermissionList?userid=' + _this.userid,
-					data: {},
-					method: 'GET',
-					success: function(res) {
-						console.log(res);
-						for (let i = 0; i < res.data.data.length; i++) {
-							if (res.data.data[i].describes == "预测") {
-								var b = {};
-								_this.$set(b, "gyeePermissionList", res.data.data[i].gyeePermissionList);
-								_this.permissionsInformation.push(b);
-								console.log(_this.permissionsInformation);
-								for (let k = 0; k < _this.permissionsInformation[0].gyeePermissionList.length; k++) {
-									if (_this.permissionsInformation[0].gyeePermissionList[k].parent == 3) {
-										var c = {};
-										var d = {};
-										_this.$set(c, "name", _this.permissionsInformation[0].gyeePermissionList[k].permisssionname);
-										_this.$set(c, "remark1",_this.permissionsInformation[0].gyeePermissionList[k].remark1);
-										_this.drawerList.push(c);
-									}
-								}
-								console.log(_this.drawerList)
-							}
-						}
-					}
-				})
+			monitoringAuthority: function() {
+				this.drawerList=uni.getStorageSync('leftlist3');
 			},
 			openDrawer: function() {
 				this.outThreeLineDrawerIsShow=true;

+ 4 - 50
pages/forecast/Forecast.vue

@@ -402,57 +402,11 @@ export default {
 	},
 	
 	methods: {
-		viewUserid:function(){
-			let _this = this;
-			_this.userid =uni.getStorageSync('userid')
-			//_this.userid = sessionStorage.getItem('userid');
-			uni.request({
-				url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeorganController/GyeeOrganList?userid=' + _this.userid,
-				data: {},
-				method: 'GET',
-				success: function(res) {
-					for(let i=0;i<res.data.data.length;i++){
-						// _this.name.push(res.data.data[i].describes);
-						// _this.windId.push(res.data.data[i].name);
-					}
-					for(let j=0;j<res.data.data.length;j++){
-						var a = {};
-						_this.$set(a,"name",res.data.data[j].describes);
-						_this.$set(a,"windId",res.data.data[j].name);
-						_this.plusDrawerList.push(a);
-					}
-				},
-				})
+		viewUserid: function() {
+			this.plusDrawerList=uni.getStorageSync('plusList');
 		},
-		monitoringAuthority:function(){
-			let _this = this;
-			uni.request({
-				url: 'http://' + this.backStageIp + ':' + this.backStagePort +
-					'/GyeepermissionController/GyeePermissionList?userid=' + _this.userid,
-				data: {},
-				method: 'GET',
-				success: function(res) {
-					console.log(res);
-					for (let i = 0; i < res.data.data.length; i++) {
-						if (res.data.data[i].describes == "预测") {
-							var b = {};
-							_this.$set(b, "gyeePermissionList", res.data.data[i].gyeePermissionList);
-							_this.permissionsInformation.push(b);
-							console.log(_this.permissionsInformation);
-							for (let k = 0; k < _this.permissionsInformation[0].gyeePermissionList.length; k++) {
-								if (_this.permissionsInformation[0].gyeePermissionList[k].parent == 3) {
-									var c = {};
-									var d = {};
-									_this.$set(c, "name", _this.permissionsInformation[0].gyeePermissionList[k].permisssionname);
-									_this.$set(c, "remark1",_this.permissionsInformation[0].gyeePermissionList[k].remark1);
-									_this.drawerList.push(c);
-								}
-							}
-							console.log(_this.drawerList)
-						}
-					}
-				}
-			})
+		monitoringAuthority: function() {
+			this.drawerList=uni.getStorageSync('leftlist3');
 		},
 		mapDate(){