Browse Source

表单验证,回显联调等

ming 4 years ago
parent
commit
70e65d584c

+ 10 - 0
common/common.scss

@@ -1,6 +1,15 @@
 /* common */
 body {
 	font-size: 32rpx;
+}
+
+*:not(input) {
+    -webkit-touch-callout: none;
+    -webkit-user-select: none;
+    -khtml-user-select: none;
+    -moz-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
 }
 
 radio,checkbox {
@@ -298,6 +307,7 @@ radio,checkbox {
 		.site-item{
 			background:#fff;
 			padding:10rpx;
+			font-size:28rpx;
 			
 		}
 		

+ 7 - 2
components/list-test/list-test.vue

@@ -7,7 +7,7 @@
 				<view class="search-form round bg-white">
 					<text class="cuIcon-search"></text>
 					<input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
-					 confirm-type="search"></input>
+					 confirm-type="search" v-model="bindModel"></input>
 				</view>
 				<view class="action">
 					<button class="cu-btn bg-blue round">查询</button>
@@ -87,6 +87,10 @@
 				type:String,
 				default: ''
 			},
+			bindModel:{
+				type:String,
+				default: ''
+			}
 		},
 		data() {
 			return {
@@ -96,7 +100,8 @@
 				nowDetailUrl:this.bindDetailUrl,
 				nowIcon:this.bindIcon,
 				nowNum:this.bindNum,
-				nowType:this.bindType
+				nowType:this.bindType,
+				nowModal:this.bindModel,
 				
 			};
 		},

+ 1 - 1
manifest.json

@@ -120,7 +120,7 @@
     "h5" : {
         "title" : "伍继",
         "router" : {
-            "mode" : "history"
+            "mode" : "hash"
         },
         "devServer" : {
             "https" : false

+ 9 - 8
pages.json

@@ -20,15 +20,16 @@
 				"app-plus": {
 
 					"titleNView": {
-						"buttons": [{
-								"text": "\ue607",
-								"fontSize": "18px",
-								 // "redDot": true,
-								 "float":"right",
-								"fontSrc": "/static/iconfont/iconfont.ttf",
-								 "width": "auto"
+						"buttons": [
+							// {
+							// 	"text": "\ue607",
+							// 	"fontSize": "18px",
+							// 	 // "redDot": true,
+							// 	 "float":"right",
+							// 	"fontSrc": "/static/iconfont/iconfont.ttf",
+							// 	 "width": "auto"
 								
-							}
+							// }
 							// {
 
 							// 	"text": "\ue63d",

+ 65 - 41
pages/authAdd/authAdd.vue

@@ -71,7 +71,7 @@
 					用户名称
 				</view>
 		
-				<select name="" id="" v-model="authorityData.phone" filterable clearable>
+				<select name="" id="" v-model="authorityData.phone" filterable clearable disabled="disabled"> 
 					<option :value=item.mobile v-for="item in maintainStates">{{ item.mobile}}</option>
 				</select>
 		
@@ -83,7 +83,7 @@
 					站点:
 				</view>
 				<view style="position:relative" class="innerZd">
-					<input name="siteName" v-model="formMess.siteName" @click="test" @focus="focusfns" @input="handleInput()"
+					<input name="siteName" v-model="authorityData.siteName" @click="test" @focus="focusfns" @input="handleInput()"
 					 placeholder="请输入或选择"></input>
 		
 					<view class="siteItems" v-if="isShow" style="max-height:60vh;overflow:auto">
@@ -92,7 +92,7 @@
 						<view class="site-item" v-for="(item,index) in siteItemData" @click="add(item,index)" :key="index">{{item.siteName}}</view>
 					</view>
 					<view style="width:500rpx;max-height:30vh;overflow:scroll" class="selectedBox">
-						<button class="cu-btn  sm margin-xs" v-for="(item,index) in selectedData" @click="deleteItem(item,index)">
+						<button class="cu-btn  margin-xs" v-for="(item,index) in selectedData" @click="deleteItem(item,index)">
 							{{item.siteName}}
 							<text class="lg text-gray cuIcon-close"></text>
 						</button>
@@ -110,10 +110,10 @@
 				</view>
 				<radio-group name="gender" @change="radioChange">
 					<label class="margin-right">
-						<radio value="3" :checked='authorityData.permissionLabel == 2' /><text>全部告警</text>
+						<radio value="3" :checked='authorityData.permissionLabel == 3' /><text>全部告警</text>
 					</label>
 					<label>
-						<radio value="2" :checked='authorityData.permissionLabel == 3' /><text>维保告警</text>
+						<radio value="2" :checked='authorityData.permissionLabel == 2' /><text>维保告警</text>
 					</label>
 				</radio-group>
 			</view>
@@ -170,7 +170,15 @@
 					},
 					{
 						value: 2,
-						mobile: '13262908432'
+						mobile: '13262908432'  
+					},
+					{
+						value: 3,
+						mobile: '13971482380' 
+					},
+					{
+						value: 4,
+						mobile: '13000000000' 
 					}
 				]
 			}
@@ -189,6 +197,7 @@
 				uni.setNavigationBarTitle({
 					title: '权限修改'
 				});
+				this.getAuthority({"phone":this.phone})
 			} else {
 				uni.setNavigationBarTitle({
 					title: '权限新增'
@@ -197,7 +206,7 @@
 			this.getSiteList();
 			
 			
-			this.getAuthority({"phone":this.phone})
+			
 
 
 		},
@@ -205,7 +214,24 @@
 			
 			//修改提交
 			editSbuimt(){
-				this.addAuthority({
+				this.selectedArr = [];
+				this.selectedData.forEach(item => {
+					this.selectedArr.push(item.id)
+				})
+				
+				//修改验证
+				
+				if (!this.selectedData.length) {
+					uni.showToast({
+						title: "请选择站点",
+						icon: "none"
+					});
+					return
+				}
+				console.log('this.selectedData')
+				console.log(this.selectedData)
+				this.selectedString = this.selectedArr.toString();
+				this.setEditAuthority({
 					"phone": this.authorityData.phone,
 					"siteId": this.selectedString,
 					"permissionLabel": this.radioOne
@@ -220,7 +246,22 @@
 					url: 'AuthorityManagement/setEditAuthority',
 					data:ming
 				})
-				this.authorityData=res.data.data[0]
+				if (!res.data.flag) {
+					uni.showToast({
+						title: "添加失败",
+						icon: "none"
+					});
+				} else {
+					uni.showToast({
+						title: "添加成功",
+					});
+				}
+				setTimeout(() => {
+					uni.navigateTo({
+						url: '/pages/authManage/authManage',
+				
+					});
+				}, 1000);
 			
 			},
 			
@@ -232,6 +273,7 @@
 					data:ming
 				})
 				this.authorityData=res.data.data[0]
+				this.selectedData=res.data.data[0].siteIdData
 			
 			},
 			
@@ -241,7 +283,8 @@
 				this.radioOne = e.detail.value;
 			},
 			//新增提交
-			async addSubmit() {
+			async addSubmit() {
+				this.selectedArr = [];
 				this.selectedData.forEach(item => {
 					this.selectedArr.push(item.id)
 				})
@@ -300,35 +343,23 @@
 					url: 'AuthorityManagement/setaddAuthority',
 					data: ming
 				})
-
-
 			},
 
 			add: function(item, index) {
-				this.selectedData.push(item);
+				this.selectedData.push(item);
+				console.log('1111')
+				console.log(this.selectedData)	
 				this.isShow = false;
-				this.formMess.siteName = ''
+				this.formMess.siteName = '';
 				this.siteItemData.splice(index, 1);
 
 			},
 			deleteItem: function(item, index) {
-				// this.selectedData.remove(item);
-
-
 				this.selectedData.splice(index, 1);
 				this.siteItemDataOrigin.push(item);
-
 				//将元素根据搜索内容过滤出来  这里改变了siteItemData
-
 				this.siteItemData = this.getNotSelectItem();
 				this.siteItemData = this.siteItemData.filter(item => item.siteName.indexOf(this.formMess.siteName) > -1);
-				// console.log('这是过滤来的');
-				// console.log(this.siteItemData);
-
-				// this.selectedData = newlist;
-				// console.log(this.selectedData)
-
-
 			},
 
 			// 站点多选下拉
@@ -339,28 +370,17 @@
 				this.isShow = false;
 			},
 			handleInput() {
-				// this.getNotSelectItem();
-
 				//将元素根据搜索内容过滤出来  这里改变了siteItemData
-
 				this.siteItemData = this.getNotSelectItem();
 				this.siteItemData = this.siteItemData.filter(item => item.siteName.indexOf(this.formMess.siteName) > -1);
 
-				// this.selectedData = newlist;
-				// console.log(this.selectedData)
-
 			},
 			// 站点多选下拉 end
 
-
-
 			getNotSelectItem() {
 
 				let ok1 = this.siteItemDataOrigin;
 				let ok2 = this.selectedData;
-				// console.log('选中值',ok2);
-				// console.log('全部值',ok1);
-
 
 				if (ok2.length) {
 					for (let i = 0; i < ok2.length; i++) {
@@ -372,11 +392,7 @@
 					}
 
 				}
-
-
 				return ok1;
-
-
 			},
 
 			formSubmit: function(e) {
@@ -606,6 +622,14 @@
 	.siteSelect {
 		width: 71%;
 		display: inline-block;
+	}
+	.selectedBox .cu-btn{
+		padding: 6rpx 20rpx;
+		    font-size: 22rpx;
+		    height: auto;
+		    line-height: 36rpx;
+		    text-align: left;
+		
 	}
 
 

+ 1 - 1
pages/authManage/authManage.vue

@@ -23,7 +23,7 @@
 
 				<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in authList" :key="index"
 				 @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
-					<view class="cu-avatar round lg" style="background-image: url(../../static/site-icon.png);"></view>
+					<view class="cu-avatar round lg" style="background-image: url(../../static/auth-icon.jpg);"></view>
 					<view class="content">
 						<view class="text-grey site-tit">{{item.phone}}</view>
 					</view>

+ 280 - 179
pages/deviceAdd/deviceAdd.vue

@@ -1,8 +1,8 @@
 <template>
-	<view class="appWrapper">
-		
+	<view class="appWrapper">
+
 		<!-- 站点新增start -->
-		<form action="" @submit="formSubmit" v-if="!id">
+		<form action="" @submit="formSubmit" v-if="!deviceCode">
 			<view class="form-item margin-top">
 				<view class="title">
 					<text class="necessary">*</text>
@@ -11,83 +11,109 @@
 				<input name="deviceCode" v-model="formMess.deviceCode"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">设备名称:</view>
+				<view class="title"><text class="necessary">*</text>设备名称:</view>
 				<input name="input" v-model="formMess.deviceName"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">安装位置:</view>
+				<view class="title"><text class="necessary">*</text>安装位置:</view>
 				<input name="input" v-model="formMess.deviceInstallationPosition"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">所属楼层:</view>
-				<select name="" id="" v-model="formMess.floor" filterable clearable>
-					<option value="1" >楼层1</option>
-					<option value="2" >楼层2</option>
+				<view class="title"><text class="necessary">*</text>所属楼层:</view>
+				<!-- <select name="" id="" v-model="formMess.floor" filterable clearable>
+					<option value="1" >楼层1</option>
+					<option value="2" >楼层2</option>
+				</select> -->
+				<select name="" id="" v-model="formMess.floor" filterable clearable>
+					<!-- <option value="" >请选择</option> -->
+					<option value="-10">楼层B10</option>
+					<option value="-9">楼层B9</option>
+					<option value="-8">楼层B8</option>
+					<option value="-7">楼层B7</option>
+					<option value="-6">楼层B6</option>
+					<option value="-5">楼层B5</option>
+					<option value="-4">楼层B4</option>
+					<option value="-3">楼层B3</option>
+					<option value="-2">楼层B2</option>
+					<option value="-1">楼层B1</option>
+					<option value="item" v-for="item in 60">楼层{{item}}</option>
 				</select>
 			</view>
 			<view class="form-item">
-				<view class="title">站点:</view>
-				<select name="" id="" v-model="formMess.siteId" filterable clearable>
-					<option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
+				<view class="title"><text class="necessary">*</text>设备类型:</view>
+				<select name="" id="" v-model="formMess.deviceType" filterable clearable>
+					<option value="1">智慧用电</option>
+					<option value="2">视频监测</option>
 				</select>
 			</view>
 			<view class="form-item">
-				<view class="title">设备类型:</view>
-				<select name="" id="" v-model="formMess.deviceType" filterable clearable>
-					<option value="1" >智慧用电</option>
-					<option value="2" >视频监测</option>
+				<view class="title"><text class="necessary">*</text>站点:</view>
+				<select name="" id="" v-model="formMess.siteId" filterable clearable>
+					<option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
 				</select>
 			</view>
 
 
+
 			<view class="btn-area submitBottomBtn padding-lr-sm">
 				<button class="bg-blue round  margin-top" @click="addSubmit">提 交 </button>
 			</view>
-		</form>
-		<!-- 站点新增end -->
-		
-		<!-- 站点修改start -->
-		<form action="" @submit="formSubmit" v-else>
-			<view class="form-item margin-top">
-				<view class="title">
-					<text class="necessary">*</text>
-					设备编号:
-				</view>
-				<input name="deviceCode" v-model="deviceMessage.deviceCode"></input>
-			</view>
-			<view class="form-item">
-				<view class="title">设备名称:</view>
-				<input name="input" v-model="deviceMessage.deviceName"></input>
-			</view>
-			<view class="form-item">
-				<view class="title">安装位置:</view>
-				<input name="input" v-model="deviceMessage.deviceInstallationPosition"></input>
-			</view>
-			<view class="form-item">
-				<view class="title">所属楼层:</view>
-				<select name="" id="" v-model="deviceMessage.floor" filterable clearable>
-					<option value="1" >楼层1</option>
-					<option value="2" >楼层2</option>
-				</select>
-			</view>
-			<view class="form-item">
-				<view class="title">站点:</view>
-				<select name="" id="" v-model="deviceMessage.siteId" filterable clearable>
-					<option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
-				</select>
-			</view>
-			<view class="form-item">
-				<view class="title">设备类型:</view>
-				<select name="" id="" v-model="deviceMessage.deviceType" filterable clearable>
-					<option value="1" >智慧用电</option>
-					<option value="2" >视频监测</option>
-				</select>
-			</view>
-		
-		
-			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="editSubmit">提 交 </button>
-			</view>
+		</form>
+		<!-- 站点新增end -->
+
+		<!-- 站点修改start -->
+		<form action="" @submit="formSubmit" v-else>
+			<view class="form-item margin-top">
+				<view class="title">
+					<text class="necessary">*</text>
+					设备编号:
+				</view>
+				<input name="deviceCode" v-model="deviceMessage.deviceCode"></input>
+			</view>
+			<view class="form-item">
+				<view class="title"><text class="necessary">*</text>设备名称:</view>
+				<input name="input" v-model="deviceMessage.deviceName"></input>
+			</view>
+			<view class="form-item">
+				<view class="title"><text class="necessary">*</text>安装位置:</view>
+				<input name="input" v-model="deviceMessage.deviceInstallationPosition"></input>
+			</view>
+			<view class="form-item">
+				<view class="title"><text class="necessary">*</text>所属楼层:</view>
+				<select name="" id="" v-model="deviceMessage.floor" filterable clearable>
+					<!-- <option value="" >请选择</option> -->
+					<option value="-10">楼层B10</option>
+					<option value="-9">楼层B9</option>
+					<option value="-8">楼层B8</option>
+					<option value="-7">楼层B7</option>
+					<option value="-6">楼层B6</option>
+					<option value="-5">楼层B5</option>
+					<option value="-4">楼层B4</option>
+					<option value="-3">楼层B3</option>
+					<option value="-2">楼层B2</option>
+					<option value="-1">楼层B1</option>
+					<option :value=index+1 v-for="(item,index) in 60">楼层{{item}}</option>
+				</select>
+			</view>
+			<view class="form-item">
+				<view class="title"><text class="necessary">*</text>设备类型:</view>
+				<select name="" id="" v-model="deviceMessage.deviceType" filterable clearable>
+					<option value="1">智慧用电</option>
+					<option value="2">视频监测</option>
+				</select>
+			</view>
+			<view class="form-item">
+				<view class="title"><text class="necessary">*</text>站点:</view>
+				<select name="" id="" v-model="deviceMessage.siteId" filterable clearable>
+					<option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
+				</select>
+			</view>
+
+
+
+			<view class="btn-area submitBottomBtn padding-lr-sm">
+				<button class="bg-blue round  margin-top" @click="editSubmit">提 交 </button>
+			</view>
 		</form>
 		<!-- 站点修改end -->
 	</view>
@@ -96,52 +122,91 @@
 <script>
 	export default {
 		data() {
-			return {
-				siteList:[],
-				
-				id: 0,
-				formMess: {
-					
+			return {
+				siteList: [],
+				id: 0,
+				deviceCode:'',
+				formMess: {
 					"deviceCode": "",
 					"siteId": "",
 					"deviceType": "",
 					"deviceName": "",
 					"deviceInstallationPosition": "",
 					"floor": "",
-				},
-				deviceMessage:{}
+				},
+				deviceMessage: {}
 			}
-		},
-		
-		onLoad: function(option) {
-			this.id=option.id
-				this.getSiteList()
-			if (option.id) {
-				uni.setNavigationBarTitle({
-					title: '设备修改'
-				});
-				this.getDeviceList({"siteId":option.id})
-			} else {
-				uni.setNavigationBarTitle({
-					title: '设备新增'
-				});
-			
-			}
-			
+		},
+
+		onLoad: function(option) {
+			this.id = option.id
+			this.deviceCode=option.deviceCode
+			this.getSiteList()
+			if (option.deviceCode) {
+				uni.setNavigationBarTitle({
+					title: '设备修改'
+				});
+				this.getDeviceList({
+					"siteId": option.id,
+					"deviceCode": option.deviceCode
+				})
+			} else {
+				uni.setNavigationBarTitle({
+					title: '设备新增'
+				});
+
+			}
+
 
 		},
 
 		methods: {
 
 			//新增验证并提交
-			addSubmit() {
-				if (!this.formMess.deviceCode) {
-					uni.showToast({
-						title: "请填写设备名称",
-						icon: "none"
-					});
-					return
+			addSubmit() {
+				if (!this.formMess.deviceCode) {
+					uni.showToast({
+						title: "请填写设备编号",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.deviceName) {
+					uni.showToast({
+						title: "请填写设备名称",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.deviceInstallationPosition) {
+					uni.showToast({
+						title: "请填写安装位置",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.floor) {
+					uni.showToast({
+						title: "请选择所属楼层",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.deviceType) {
+					uni.showToast({
+						title: "请选择设备类型",
+						icon: "none"
+					});
+					return
 				}
+				if (!this.formMess.siteId) {
+					uni.showToast({
+						title: "请选择站点",
+						icon: "none"
+					});
+					return
+				}
+
 				this.setAddDevice({
 					"deviceCode": this.formMess.deviceCode,
 					"siteId": this.formMess.siteId,
@@ -150,99 +215,135 @@
 					"deviceInstallationPosition": this.formMess.deviceInstallationPosition,
 					"floor": this.formMess.floor
 				})
-			},
-			
-			//编辑验证并提交
-			editSubmit() {
-				if (!this.deviceMessage.deviceCode) {
-					uni.showToast({
-						title: "请填写设备名称",
-						icon: "none"
-					});
-					return
-				}
-				this.setEditDevice({
-					"deviceCode": this.deviceMessage.deviceCode,
-					"siteId": this.deviceMessage.siteId,
-					"deviceType": this.deviceMessage.deviceType,
-					"deviceName": this.deviceMessage.deviceName,
-					"deviceInstallationPosition": this.deviceMessage.deviceInstallationPosition,
-					"floor": this.deviceMessage.floor
-				})
-			},
-			
+			},
+
+			//编辑验证并提交
+			editSubmit() {
+				if (!this.deviceMessage.deviceCode) {
+					uni.showToast({
+						title: "请填写设备编号",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.deviceMessage.deviceName) {
+					uni.showToast({
+						title: "请填写设备名称",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.deviceMessage.deviceInstallationPosition) {
+					uni.showToast({
+						title: "请填写安装位置",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.deviceMessage.floor) {
+					uni.showToast({
+						title: "请选择所属楼层",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.deviceMessage.deviceType) {
+					uni.showToast({
+						title: "请选择设备类型",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.deviceMessage.siteId) {
+					uni.showToast({
+						title: "请选择站点",
+						icon: "none"
+					});
+					return
+				}
+				this.setEditDevice({
+					"deviceCode": this.deviceMessage.deviceCode,
+					"siteId": this.deviceMessage.siteId,
+					"deviceType": this.deviceMessage.deviceType,
+					"deviceName": this.deviceMessage.deviceName,
+					"deviceInstallationPosition": this.deviceMessage.deviceInstallationPosition,
+					"floor": this.deviceMessage.floor
+				})
+			},
+
 			// 新增请求
 			async setAddDevice(ming = {}) {
 				const res = await this.$myRequest({
 					url: 'DeviceManagement/setAddDevice',
 					data: ming
-				})
-				if (!res.data.flag) {
-					uni.showToast({
-						title: "添加失败",
-						icon: "none"
-					});
-				} else {
-					uni.showToast({
-						title: "添加成功",
-					});
-				}
-				setTimeout(() => {
-					uni.navigateTo({
-						url: '/pages/deviceManage/deviceManage',
-					});
+				})
+				if (!res.data.flag) {
+					uni.showToast({
+						title: "添加失败",
+						icon: "none"
+					});
+				} else {
+					uni.showToast({
+						title: "添加成功",
+					});
+				}
+				setTimeout(() => {
+					uni.navigateTo({
+						url: '/pages/siteManage/siteManage',
+					});
 				}, 1000);
 
-			},
-			
-			
-		
-			
-			// 站点下拉
-			async getSiteList(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'SiteManagement/getSiteList',
-					data: ming
-				})
-				// this.deviceMessage=res.data.data[0];
-				 this.siteList=res.data.data
-				// console.log(res.data.data)
-			},
-			
-			
-			// 修改回显请求
-			async getDeviceList(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'DeviceManagement/getDeviceList',
-					data: ming
-				})
-				console.log('res.data.data')
-				console.log(res.data.data[0])
-				this.deviceMessage=res.data.data[0];
-			},
-			
-			
-			// 编辑请求
-			async setEditDevice(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'DeviceManagement/setEditDevice',
-					data: ming
-				})
-				if (!res.data.flag) {
-					uni.showToast({
-						title: "编辑失败",
-						icon: "none"
-					});
-				} else {
-					uni.showToast({
-						title: "编辑成功",
-					});
-				}
-				setTimeout(() => {
-					uni.navigateTo({
-						url: '/pages/deviceManage/deviceManage',
-					});
-				}, 1000);
+			},
+
+
+
+
+			// 站点下拉
+			async getSiteList(ming = {}) {
+				const res = await this.$myRequest({
+					url: 'SiteManagement/getSiteList',
+					data: ming
+				})
+				// this.deviceMessage=res.data.data[0];
+				this.siteList = res.data.data
+				// console.log(res.data.data)
+			},
+
+
+			// 修改回显请求
+			async getDeviceList(ming = {}) {
+				const res = await this.$myRequest({
+					url: 'DeviceManagement/getDeviceList',
+					data: ming
+				})
+				console.log('res.data.data')
+				console.log(res.data.data[0])
+				this.deviceMessage = res.data.data[0];
+				console.log(this.deviceMessage)
+			},
+
+
+			// 编辑请求
+			async setEditDevice(ming = {}) {
+				const res = await this.$myRequest({
+					url: 'DeviceManagement/setEditDevice',
+					data: ming
+				})
+				if (!res.data.flag) {
+					uni.showToast({
+						title: "编辑失败",
+						icon: "none"
+					});
+				} else {
+					uni.showToast({
+						title: "编辑成功",
+					});
+				}
+				setTimeout(() => {
+					uni.navigateTo({
+						url: '/pages/deviceManage/deviceManage',
+					});
+				}, 1000);
 			},
 
 		}

+ 9 - 8
pages/deviceManage/deviceManage.vue

@@ -20,7 +20,7 @@
 			<view class="cu-list menu-avatar">
 				<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteList" :key="index"
 				 @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
-					<view class="cu-avatar round lg" style="background-image: url(../../static/site-icon.png);"></view>
+					<view class="cu-avatar round lg" style="background-image: url(/static/device-icon.png);"></view>
 
 					<view class="content">
 						<view class="text-grey site-tit">{{item.deviceName}}</view>
@@ -58,14 +58,15 @@
 
 				deviceName: '',
 				siteList: [],
-				siteListRes: 0,
+				siteListRes: 0,
+				siteId:''
 			};
 		},
 
 		onLoad: function(option) {
-			
-			//站点列表渲染
-			this.getDeviceList()
+			this.siteId=option.siteId;
+			//设备列表渲染
+			this.getDeviceList({"siteId":option.siteId})
 			
 		},
 		
@@ -80,7 +81,7 @@
 			//编辑
 			editItem(item) {
 				uni.navigateTo({
-					url: '/pages/deviceAdd/deviceAdd?id=' + item.siteId + '',
+					url: '/pages/deviceAdd/deviceAdd?id=' + item.siteId + '&deviceCode=' + item.deviceCode + '',
 				});
 			},
 
@@ -117,7 +118,7 @@
 						title: "删除成功",
 					});
 					setTimeout(() => {
-						this.getDeviceList()
+						this.getDeviceList({"siteId":this.siteId})
 					}, 1000);
 				}
 				
@@ -137,7 +138,7 @@
 			// 新增跳转
 			goAddPage() {
 				uni.navigateTo({
-					url: '/pages/deviceAdd/deviceAdd',
+					url: '/pages/deviceAdd/deviceAdd?id=' + this.siteId + '',
 					success: res => {},
 					fail: () => {},
 					complete: () => {}

+ 199 - 133
pages/index/index.vue

@@ -96,20 +96,6 @@
 				searchList: [],
 				searchList2: [],
 				staticData: {}
-				// staticData: {
-				// 	"statisticalPeriod": "2021-02-22~2021-03-22",
-				// 	"smartElectricityCount": "5",
-				// 	"videoMonitoringCount": "75",
-				// 	"alarmCount": 80,
-				// 	"eventCount": 0,
-				// 	"hiddenDangerCount": 0,
-				// 	"offlineCount": "0",
-				// 	"faultCount": 0,
-				// 	"earlyWarningCount": 0,
-				// 	"otherCount": 0,
-				// 	"normalCount": "0",
-				// 	"integratedAlarmCount": 80
-				// }
 			};
 		},
 		onNavigationBarButtonTap(e) {
@@ -144,16 +130,19 @@
 		},
 
 		onLoad(option) {
-			// console.log('option')
-			// console.log(option)
-			// if(!option.code){
-			// 	alert(1)
-			// 	 this.getPageAuthorization()
+			let ua = navigator.userAgent.toLowerCase();
+			
+			if (ua.match(/MicroMessenger/i) == "micromessenger"){
+				//是
+				this.init();
+			}else{
+				//不是
+				uni.navigateTo({
+					url: '/pages/login/login',
+				});
 				
-			// }else{
-			// 	alert(option.code);
-			// 	this.getPageAuthorization({"code":option.code})
-			// }
+			}
+			
 
 			this.hackReset = false;
 			this.$nextTick(() => {
@@ -162,125 +151,202 @@
 			this.getData();
 			this.getSearchList();
 		},
-		methods: {
-			//首页初始化授权
-			async getPageAuthorization(ming={}) {
-				const res = await this.$myRequest({
-					url: 'Com/getPageAuthorization',
-					data:ming
-				})
-				alert(res.data.flag)
-				
-				console.log('res.data'); 
-				console.log(res.data); 
-		
-				if(res.data.flag==3000){
-					uni.navigateTo({
-						url: '/pages/login/login',
-					});
-				}
-				if(res.data.flag==3002){
-					uni.navigateTo({
-						url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' +res.data.tourl+'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect',
-					});
-				}
-		
+		methods: {
+
+			// start
+
+			getUrlCode() {
+				var url = location.search
+				this.winUrl = url
+				var theRequest = new Object()
+				if (url.indexOf("?") != -1) {
+					var str = url.substr(1)
+					var strs = str.split("&")
+					for (var i = 0; i < strs.length; i++) {
+						theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
+					}
+				}
+				return theRequest
 			},
-
-			async getData() {
-				const res = await this.$myRequest({
-					url: 'Index/getDataStatistics',
-					showLoading:true
-				})
+			async getUrlPrams(key) {
+				var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i");
+				var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+				var context = "";
+				if (r != null) {
+					context = r[2];
+				}
+				return context;
+			},
+			async init() {
+			    var appId = "wx4eab2e3b5531d58b";
+			    var params = {};
+			    var CODE = this.getUrlCode();
+			    var code = CODE['code'];
+			    // alert("CODE="+code);
+			    if (code) {
+			     // console.log("打印参数",JSON.stringify(params));
+			     params.code=code;
+			     // alert(code);
+			     // alert(JSON.stringify(params));
+			   
+			     //使用code请求服务器接口,换取用户用户openID
+			     const res = await this.$myRequest({
+			      url: 'Com/getPageAuthorization',
+			      data:params
+			     })
+			     // alert(res.data.flag);
+			     if(res.data.flag==3000){
+			      alert("授权失败,请重新登录");
+			      uni.navigateTo({
+			       url: '/pages/login/login',
+			      });
+			     }
+			     if(res.data.flag==3002){
+			      alert("授权失败,请重新登录");
+			      uni.navigateTo({
+			       url: '/pages/login/login',
+			      });
+			     }
+			     return "ok";
+			    }
+			    // alert("授权开始");
+			    var cs = {};
+			    var curl=window.location.href;
+			    cs.curl=curl;
+			    // alert("当前页面路径"+curl);
+			    const res1 = await this.$myRequest({
+			     url: 'Com/getAuthorizationUrl',
+			     data:cs
+			    })
+			    // alert(res1.data);
+			    var turl=res1.data.turl;
+			    // alert(turl)
+			    window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri='+turl+'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
+			   },
+
+				// end
+				
 				
-				// alert(res.data.flag);
 				
-				this.staticData = res.data.data[0]
-			},
-
-
-			async getSearchList(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'Index/getSiteDropDownBox',
-					data: ming
-				})
-				res.data.data.forEach(item => {
-					this.searchList.push(item.siteName)
-					this.searchList2.push(item.siteName)
-				});
-			},
-
-			clickSelectItem(item, index) {
-				// alert(index);
-				alert(item);
-				this.getSearchList({
-					"siteName": item
-				});
-				this.flag = false
-			},
-
-			handleInput() {
-				// this.searchList = this.searchList.filter(item => item.indexOf(this.searchInput) > -1);
-
-				var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
-				this.searchList = newlist
-			},
-
-			navItemClick(index) {
-				// log(index)
-				let url = "";
-				switch (index) {
-					case 0:
-						url = "/pages/siteListAlarming/siteListAlarming"
-						break;
-					case 1:
-						url = "/pages/siteList/siteList"
-						break;
-					default:
-						break;
-				}
-				if (url) {
-					uni.navigateTo({
-						url: url
-					})
-				} else {
-					// uni.showToast({
-					// 	title: '此模块开发中~',
-					// 	icon: 'none'
-					// });
-					uni.showModal({
-						title: 'Tips',
-						content: '此模块开发中~',
-						showCancel: false,
-						success: function(res) {
-							if (res.confirm) {
-								console.log('用户点击确定');
-							} else if (res.cancel) {
-								console.log('用户点击取消');
-							}
+				//首页初始化授权
+				async getPageAuthorization(ming = {}) {
+						const res = await this.$myRequest({
+							url: 'Com/getPageAuthorization',
+							data: ming
+						})
+						alert(res.data.flag)
+
+						console.log('res.data');
+						console.log(res.data);
+
+						if (res.data.flag == 3000) {
+							uni.navigateTo({
+								url: '/pages/login/login',
+							});
+						}
+						if (res.data.flag == 3002) {
+							uni.navigateTo({
+								url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + res.data
+									.tourl + '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect',
+							});
 						}
-					});
-				}
-			},
-
-			showTag() {
-				this.flag = !this.flag;
-			},
 
-			InputFocus(e) {
-				this.InputBottom = e.detail.height
-			},
-			InputBlur(e) {
-				this.InputBottom = 0
-			},
+					},
 
-			changeTab(Inv) {
-				that.navIdx = Inv;
+					async getData() {
+							const res = await this.$myRequest({
+								url: 'Index/getDataStatistics',
+								showLoading: true
+							})
 
-			},
+							// alert(res.data.flag);
+
+							this.staticData = res.data.data[0]
+						},
+
+
+						async getSearchList(ming = {}) {
+								const res = await this.$myRequest({
+									url: 'Index/getSiteDropDownBox',
+									data: ming
+								})
+								res.data.data.forEach(item => {
+									this.searchList.push(item.siteName)
+									this.searchList2.push(item.siteName)
+								});
+							},
+
+							clickSelectItem(item, index) {
+								// alert(index);
+								alert(item);
+								this.getSearchList({
+									"siteName": item
+								});
+								this.flag = false
+							},
+
+							handleInput() {
+								// this.searchList = this.searchList.filter(item => item.indexOf(this.searchInput) > -1);
+
+								var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
+								this.searchList = newlist
+							},
+
+							navItemClick(index) {
+								// log(index)
+								let url = "";
+								switch (index) {
+									case 0:
+										url = "/pages/siteListAlarming/siteListAlarming"
+										break;
+									case 1:
+										url = "/pages/siteList/siteList"
+										break;
+									default:
+										break;
+								}
+								if (url) {
+									uni.navigateTo({
+										url: url
+									})
+								} else {
+									// uni.showToast({
+									// 	title: '此模块开发中~',
+									// 	icon: 'none'
+									// });
+									uni.showModal({
+										title: 'Tips',
+										content: '此模块开发中~',
+										showCancel: false,
+										success: function(res) {
+											if (res.confirm) {
+												console.log('用户点击确定');
+											} else if (res.cancel) {
+												console.log('用户点击取消');
+											}
+										}
+									});
+								}
+							},
+
+							showTag() {
+								this.flag = !this.flag;
+							},
+
+							InputFocus(e) {
+								this.InputBottom = e.detail.height
+							},
+							InputBlur(e) {
+								this.InputBottom = 0
+							},
+
+							changeTab(Inv) {
+								that.navIdx = Inv;
+
+							},
 
+			}
 		}
-	}
 </script>
 
 <style lang="scss">

+ 168 - 103
pages/login/login.vue

@@ -8,7 +8,7 @@
 		<form class="padding-lg flex flex-direction">
 			<view class="login-box shadow ">
 				<view class="phone-box">
-					<input type="text" placeholder="请输入手机号码" onfocus="this.placeholder=''"  v-model="phone">
+					<input type="text" placeholder="请输入手机号码" onfocus="this.placeholder=''" v-model="phone">
 					<span class="icon iconfont left-icon">&#xe64f;</span>
 					<span class="icon iconfont right-icon">&#xe610;</span>
 				</view>
@@ -18,13 +18,13 @@
 					<view class="right-icon verify" @click="getVerifyCode">获取验证码</view>
 				</view>
 
-				<view class="btn-area">
-						<button class="submit" @click="submitRes">提 交 </button>
+				<view class="btn-area">
+					<button class="submit" @click="submitRes">提 交 </button>
 				</view>
 			</view>
 		</form>
 
-		
+
 	</view>
 
 
@@ -34,16 +34,19 @@
 <script>
 	export default {
 		data() {
-			return {
-				phone:'',
-				verify:'',
-				VerificationCodeOne:''
-				
-				
-				
+			return {
+				phone: '',
+				verify: '',
+				VerificationCodeOne: ''
+
+
+
 			}
 		},
 		onLoad() {
+
+			this.init()
+
 			uni.setNavigationBarColor({
 				frontColor: "#ffffff", //文字颜色
 				backgroundColor: "#4866DF", //底部背景色
@@ -51,102 +54,164 @@
 			})
 			uni.setNavigationBarTitle({
 				title: '登录'
-			});
-			
-			
+			});
+
+
 			this.getLoginAuthorize()
 
 
 		},
-		methods: {
-			
-			
-			//短信验证码验证
-			getVerifyCode(){
-				if(!this.phone){
-					uni.showToast({
-						title: "请输入手机号码...",
-						icon:"none"
-					});
-					
-				}else if (!/^1[345678]\d{9}$/.test(this.phone)){
-					uni.showToast({
-						title: "请输入正确的手机号码...",
-						icon:"none"
-					});
-				 }else{
-					 this.getVerifyData({"phone":this.phone})
-				 }
-				
-			},
-			async getVerifyData(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'Login/getVerificationCode',
-					data:ming
-				})
-				console.log('res.data')    
-				console.log(res.data)
-				console.log(eval('(' + res.data + ')'))
-				
-				
-				 // this.VerificationCodeOne=eval('(' + res.data + ')').data[0].VerificationCode
-			},
-			
-			// 登录提交按钮
-			submitRes(){
-				if(!this.phone){
-					uni.showToast({
-						title: "请输入手机号码...",
-						icon:"none"
-					});
-					return
-					
-				}
-				if (!/^1[345678]\d{9}$/.test(this.phone)){
-					uni.showToast({
-						title: "请输入正确的手机号码...",
-						icon:"none"
-					});
-					return
-				 }
-				if (!this.verify){
-					uni.showToast({
-						title: "请输入验证码...",
-						icon:"none"
-					});
-					return
-				 }
-
-			    this.getData({"phone":this.phone,"VerificationCode":this.verify,"VerificationCodeOne":this.VerificationCodeOne})
-				 
-				
-				
-			},
-			async getData(ming = {}) {
-				const res = await this.$myRequest({
-					url: 'Login/setSignUp',
-					data:ming
-				})
-				console.log(res)
-				console.log(res.data.flag)
-				if(res.data.flag==true){
-					alert(1)
-					uni.switchTab({
-					    url: '/pages/index/index'
-					});
-					
-				}
-			},
-			
-			//登录页初始化
-			async getLoginAuthorize() {
-				const res = await this.$myRequest({
-					url: 'Login/getLoginAuthorize',
-				})
-				// console.log('res')
-				// console.log(res)
-				
-			},
+		methods: {
+
+			// setNavigationBarTitle
+			getUrlCode() {
+				var url = location.search
+				this.winUrl = url
+				var theRequest = new Object()
+				if (url.indexOf("?") != -1) {
+					var str = url.substr(1)
+					var strs = str.split("&")
+					for (var i = 0; i < strs.length; i++) {
+						theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
+					}
+				}
+				return theRequest
+			},
+			async init() {
+				let ua = navigator.userAgent.toLowerCase();
+
+				if (ua.match(/MicroMessenger/i) == "micromessenger") {
+					//是
+					var appId = "wx4eab2e3b5531d58b";
+					var params = {};
+					var CODE = this.getUrlCode();
+					var code = CODE['code'];
+					if (code) {
+						params.code = code;
+						const res = await this.$myRequest({
+							url: 'Login/getLoginAuthorize',
+							data: params
+						})
+						// if (res.data.flag == true) {
+						// 	uni.switchTab({
+						// 		url: '/pages/index/index'
+						// 	});
+						// }
+						return "ok";
+					}
+					var cs = {};
+					var curl = window.location.href;
+					cs.curl = curl;
+					const res1 = await this.$myRequest({
+						url: 'Login/getLoginAuthorize',
+						data: cs
+					})
+					var turl = res1.data.turl;
+					window.location.href =
+						'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + turl +
+						'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
+				} else {
+					const res = await this.$myRequest({
+						url: 'Login/getLoginAuthorize',
+						data: params
+					})
+					
+
+				}
+
+			},
+			// end
+
+
+			//短信验证码验证
+			getVerifyCode() {
+				if (!this.phone) {
+					uni.showToast({
+						title: "请输入手机号码...",
+						icon: "none"
+					});
+
+				} else if (!/^1[345678]\d{9}$/.test(this.phone)) {
+					uni.showToast({
+						title: "请输入正确的手机号码...",
+						icon: "none"
+					});
+				} else {
+					this.getVerifyData({
+						"phone": this.phone
+					})
+				}
+
+			},
+			async getVerifyData(ming = {}) {
+				const res = await this.$myRequest({
+					url: 'Login/getVerificationCode',
+					data: ming
+				})
+
+
+				this.VerificationCodeOne = eval('(' + res.data + ')').data[0].VerificationCode
+			},
+
+			// 登录提交按钮
+			submitRes() {
+				if (!this.phone) {
+					uni.showToast({
+						title: "请输入手机号码...",
+						icon: "none"
+					});
+					return
+
+				}
+				if (!/^1[345678]\d{9}$/.test(this.phone)) {
+					uni.showToast({
+						title: "请输入正确的手机号码...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.verify) {
+					uni.showToast({
+						title: "请输入验证码...",
+						icon: "none"
+					});
+					return
+				}
+
+
+
+				this.getData({
+					"phone": this.phone,
+					"VerificationCode": this.verify,
+					"VerificationCodeOne": this.VerificationCodeOne
+				})
+
+			},
+			async getData(ming = {}) {
+				const res = await this.$myRequest({
+					url: 'Login/setSignUp',
+					data: ming
+				})
+		
+				if (res.data.flag == true) {
+					uni.switchTab({
+						url: '/pages/index/index'
+					});
+
+				} else {
+				
+				}
+			},
+
+			//登录页初始化
+			async getLoginAuthorize() {
+				const res = await this.$myRequest({
+					url: 'Login/getLoginAuthorize',
+				})
+				// console.log('res')
+				// console.log(res)
+
+			},
 
 
 		}

+ 92 - 8
pages/siteAdd/siteAdd.vue

@@ -11,23 +11,23 @@
 				<input name="userName" v-model="formMess.siteName"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">地址:</view>
+				<view class="title"><text class="necessary">*</text>地址:</view>
 				<input name="input" v-model="formMess.address"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">经度:</view>
+				<view class="title"><text class="necessary">*</text>经度:</view>
 				<input name="input" v-model="formMess.longitude"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">维度:</view>
+				<view class="title"><text class="necessary">*</text>维度:</view>
 				<input name="input" v-model="formMess.latitude"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">联系人:</view>
+				<view class="title"><text class="necessary">*</text>联系人:</view>
 				<input name="input" v-model="formMess.userName"></input>
 			</view>
 			<view class="form-item">
-				<view class="title">手机号码:</view>
+				<view class="title"><text class="necessary">*</text>手机号码:</view>
 				<input name="input" v-model="formMess.phone"></input>
 			</view>
 
@@ -115,11 +115,53 @@
 			addSubmit() {
 				if (!this.formMess.siteName) {
 					uni.showToast({
-						title: "请填写站点名称",
+						title: "请输入站点名称...",
 						icon: "none"
 					});
 					return
-				}
+				}
+				if (!this.formMess.address) {
+					uni.showToast({
+						title: "请输入地址...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.longitude) {
+					uni.showToast({
+						title: "请输入经度...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.latitude) {
+					uni.showToast({
+						title: "请输入纬度...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.userName) {
+					uni.showToast({
+						title: "请输入联系人...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.formMess.phone) {
+					uni.showToast({
+						title: "请输入手机号码...",
+						icon: "none"
+					});
+					return
+				}
+				if (!/^1[345678]\d{9}$/.test(this.formMess.phone)){
+					uni.showToast({
+						title: "请输入正确的手机号码...",
+						icon:"none"
+					});
+					return
+				 }
 				this.getAddSite({
 					"siteName": this.formMess.siteName,
 					"userName": this.formMess.userName,
@@ -134,11 +176,53 @@
 			editSubmit() {
 				if (!this.siteMessage.siteName) {
 					uni.showToast({
-						title: "请填写站点名称",
+						title: "请填写站点名称...",
 						icon: "none"
 					});
 					return
 				}
+				if (!this.siteMessage.address) {
+					uni.showToast({
+						title: "请输入地址...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.siteMessage.longitude) {
+					uni.showToast({
+						title: "请输入经度...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.siteMessage.latitude) {
+					uni.showToast({
+						title: "请输入纬度...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.siteMessage.userName) {
+					uni.showToast({
+						title: "请输入联系人...",
+						icon: "none"
+					});
+					return
+				}
+				if (!this.siteMessage.phone) {
+					uni.showToast({
+						title: "请输入手机号码...",
+						icon: "none"
+					});
+					return
+				}
+				if (!/^1[345678]\d{9}$/.test(this.siteMessage.phone)){
+					uni.showToast({
+						title: "请输入正确的手机号码...",
+						icon:"none"
+					});
+					return
+				 }
 				this.setEditSite({
 					"id":this.id,
 					"siteName": this.siteMessage.siteName,

+ 17 - 16
pages/siteList/siteList.vue

@@ -6,11 +6,11 @@
 			<view class="cu-bar search bg-gray filter-section">
 				<view class="search-form round bg-white">
 					<text class="cuIcon-search"></text>
-					<input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
+					<input class="" @focus="InputFocus" v-model="siteName" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
 					 confirm-type="search"></input>
 				</view>
 				<view class="action">
-					<button class="cu-btn bg-blue round">查询</button>
+					<button class="cu-btn bg-blue round" @click=searchData()>查询</button>
 				</view>
 			</view>
 		</view>
@@ -22,18 +22,10 @@
 			<view class="cu-list menu-avatar">
 				<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in newSiteListData"
 				 :key="index" :data-target="'move-box-' + index">
-					<view class="cu-avatar round lg" v-if="type==1" style="background-image: url(../../static/site-icon-alarm.png);"></view>
-					<view class="cu-avatar round lg" v-else style="background-image: url(../../static/site-icon.png);"></view>
-					<view class="content" v-if="type==1" @tap="goAlarmingList()">
-						<view class="text-grey site-tit">
-							{{item.siteName}}
-							<text>(共3个未处理告警)</text>
-						</view>
-					</view>
-					<view class="content" v-else @tap="goDeviceType(item)" @longpress="showDetail(item)">
+					<view class="cu-avatar round lg"  style="background-image: url(../../static/site-icon-alarm.png);"></view>
+					<view class="content"  @tap="goDeviceType(item)" @longpress="showDetail(item)">
 						<view class="text-grey site-tit">
 							<text style="width:260rpx;" class="inOneLine">{{item.siteName}}</text>
-							
 							<text style="font-size:28rpx;text-align:right"> 
 							   ( 共{{item.count}}个未处理告警 )
 							</text>
@@ -46,7 +38,9 @@
 						</view>
 					</view>
 				</view>
-			</view>
+			</view>
+			
+			<view v-if="!siteListData.length&&siteListRes==1" class="text-center margin-top"> 暂无数据</view>
 		</view>
 		<!-- 站点列表end -->
 
@@ -60,7 +54,9 @@
 
 	export default {
 		data() {
-			return {
+			return {
+				siteListRes: 0,
+				siteName:'',
 				type: '0',
 				siteListData: [],
 				modalName: null,
@@ -102,13 +98,18 @@
 		},
 
 		methods: {
+			searchData(){
+				this.getSiteList({"siteName":this.siteName})
+			},
 			
 			
-			async getSiteList() {
+			async getSiteList(ming) {
 				const res= await this.$myRequest({
 					url:'OperationMonitoring/getSiteList',
-					showLoading:true
+					showLoading:true,
+					data:ming
 				})
+				this.siteListRes = 1;
 				console.log(res.data.data)
 				this.siteListData=res.data.data
 			},

+ 3 - 2
pages/siteListAlarming/siteListAlarming.vue

@@ -1,5 +1,5 @@
 <template>
-	<list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type"
+	<list-test :bindData="siteListData" :bindUrl="linkUrl" :bindIcon="linkIcon" :bindNum="num" :bindType="type" :bindModel="siteName"
 	 :bindDetailUrl="detailUrl">
 	</list-test>
 
@@ -17,7 +17,8 @@
 				linkIcon: '../../static/site-icon-alarm.png',
 				siteListData: [],
 				num: ' 共3个未处理告警',
-				detailUrl: '/pages/siteDetail/siteDetail'
+				detailUrl: '/pages/siteDetail/siteDetail',
+				siteName:''
 			};
 		},
 

+ 3 - 3
pages/siteManage/siteManage.vue

@@ -22,7 +22,7 @@
 				 @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
 					<view class="cu-avatar round lg" style="background-image: url(../../static/site-icon.png);"></view>
 
-					<view class="content" @tap="goDeviceManage">
+					<view class="content" @tap="goDeviceManage(item)">
 						<view class="text-grey site-tit">{{item.siteName}}</view>
 					</view>
 
@@ -157,9 +157,9 @@
 			},
 			
 			//跳转到设备管理页面
-			goDeviceManage() {
+			goDeviceManage(item) {
 				uni.navigateTo({
-					url: '/pages/deviceManage/deviceManage',
+					url: '/pages/deviceManage/deviceManage?siteId='+item.id+'',
 					success: res => {},
 					fail: () => {},
 					complete: () => {}

BIN
static/auth-icon.jpg


BIN
static/device-icon.png


+ 1 - 1
util/api.js

@@ -28,7 +28,7 @@ export const myRequest = (options) => {
 			success: (res) => {
 				if (res.data.flag == false) { //登录失效
 					return uni.showToast({
-						title: '获取数据失败!',
+						title: res.data.msg?res.data.msg:"获取数据失败",
 						icon: "none"
 					})
 				}