Sfoglia il codice sorgente

增加墒情预警

zhangsijie 2 anni fa
parent
commit
f50f8b85ac

+ 3 - 3
manifest.json

@@ -1,9 +1,9 @@
 {
-    "name" : "云飞智控",
+    "name" : "智控",
     "appid" : "__UNI__DBA6730",
     "description" : "",
-    "versionName" : "1.6.3",
-    "versionCode" : 163,
+    "versionName" : "1.6.4",
+    "versionCode" : 164,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 27 - 23
pages/cbqxyj/cbwarn.vue

@@ -147,7 +147,7 @@
 				</view>
 			</u-swipe-action>
 		</view>
-		<view class="addwarnlist" v-show="active == 2" @click="addshow = true">
+		<view class="addwarnlist" v-show="active == 2" @click="addwarning_config">
 			添 加
 		</view>
 		<view class="">
@@ -502,28 +502,31 @@
 				})
 			},
 			async addwarning_config() {
-				this.addshow = true
-				if (this.addvalue == "") {
-					uni.showToast({
-						title: "请填写预警名称",
-						icon: "none"
-					})
-				}else{
-					const res = await this.$myRequest({
-						url: '/api/api_gateway?method=device.device_sms_alert.create_user_warning_config',
-						data: {
-							title: this.addvalue,
-							device_type_id: 3
-						}
-					})
-					console.log(res)
-					if(res){
-						this.addshow = false
-						this.configlist = []
-						this.confpage = 1
-						this.getconfiglist()
-					}
-				}
+				uni.navigateTo({
+					url:'./warnset'
+				})
+				// this.addshow = true
+				// if (this.addvalue == "") {
+				// 	uni.showToast({
+				// 		title: "请填写预警名称",
+				// 		icon: "none"
+				// 	})
+				// }else{
+				// 	const res = await this.$myRequest({
+				// 		url: '/api/api_gateway?method=device.device_sms_alert.create_user_warning_config',
+				// 		data: {
+				// 			title: this.addvalue,
+				// 			device_type_id: 3
+				// 		}
+				// 	})
+				// 	console.log(res)
+				// 	if(res){
+				// 		this.addshow = false
+				// 		this.configlist = []
+				// 		this.confpage = 1
+				// 		this.getconfiglist()
+				// 	}
+				// }
 			},
 			async delconfig(id){
 				const res = await this.$myRequest({
@@ -547,6 +550,7 @@
 		},
 		onShow() {
 			this.getuseriphonelist()
+			this.getconfiglist()
 		},
 		onReachBottom() {
 			if (this.active == 0) {

+ 35 - 11
pages/cbqxyj/warnset.vue

@@ -2,6 +2,14 @@
 	<view style="padding-bottom: 30rpx;">
 		<view class="basesel">
 			<view class="basesel_list">
+				<view class="">
+					<view class="">
+						预警名称
+					</view>
+					<view class="">
+						<u-input v-model="title"/>
+					</view>
+				</view>
 				<view class="basesel_list_tilte">
 					预警设备选择:
 				</view>
@@ -174,7 +182,7 @@
 		},
 		data() {
 			return {
-				warning_id:"",
+				warning_id:'',
 				selbaselist: [],
 				warnjihe: "0",
 				accServiceShow: false,
@@ -184,6 +192,7 @@
 				accServiceShowphone: false,
 				serviceListphone: [],
 				defaultSelectedphone: [],
+				title:'',// 预警名称
 				//预警配置
 				conf: {
 					pestCategory: false,
@@ -239,6 +248,7 @@
 
 				this.conf.pestCategoryNum = res.conf.pestCategoryNum
 				this.conf.pestTotalNum = res.conf.pestTotalNum
+				this.title = res.warning_name
 
 				for (var key in res.device_ids) {
 					this.selbaselist.push(res.device_ids[key]);
@@ -386,6 +396,13 @@
 				} else {
 					console.log(this.device_ids)
 					console.log(this.send_user)
+					if(this.title.length > 32 || this.title == '') {
+						uni.showToast({
+							title: "标题不能为空且长度不大于32个字符",
+							icon: "none"
+						})
+						return
+					}
 					var obj = {
 
 					}
@@ -417,17 +434,22 @@
 							device_ids: this.device_ids.join(","),
 							send_user: this.send_user.join(","),
 							warning_id: this.warning_id,
-							warning_type: this.warnjihe
+							warning_type: this.warnjihe,
+							title: this.title
 						}
 					})
 					console.log(res)
-					uni.showToast({
-						title: "预警配置成功",
-						icon: "none"
-					})
-					uni.navigateBack({
-						delta:1
-					})
+					if(res) {
+						uni.showToast({
+							title: "预警配置成功",
+							icon: "none",
+							complete: () => {
+								uni.navigateBack({
+									delta:1
+								})
+							}
+						})
+					}
 				}
 			}
 		},
@@ -443,8 +465,10 @@
 			}
 			this.getbaselist()
 			this.getuseriphonelist()
-			this.getpeizhi(option.id)
-			this.warning_id = option.id
+			if(option.id) {
+				this.getpeizhi(option.id)
+				this.warning_id = option.id;
+			}
 		}
 	}
 </script>

+ 11 - 4
pages/index/index.vue

@@ -9,7 +9,7 @@
 					{{hello}}
 				</view>
 				<view class="">
-					{{$isneutral?"欢迎登录云飞智控":"欢迎登录控"}}
+					{{$isneutral?"欢迎登录云飞智控":"欢迎登录控"}}
 				</view>
 			</view>
 		</view>
@@ -116,13 +116,20 @@
 						环境监测
 					</view>
 				</view>
-				<view class="facilitybox_item" v-if="$QueryPermission(242)" @click="tabequipment('../qxzyj/cbwarn')">
+				<view class="facilitybox_item" v-if="$QueryPermission(242)" @click="tabequipment('../qxzyj/cbwarn', '5')">
 					<image src="http://www.hnyfwlw.com:8006/bigdata_app/newindex/qxyj.png" mode="" class="itemimg">
 					</image>
 					<view class="">
 						气象预警
 					</view>
 				</view>
+				<view class="facilitybox_item" v-if="$QueryPermission(284)" @click="tabequipment('../qxzyj/cbwarn', '15')">
+					<image src="http://www.hnyfwlw.com:8006/bigdata_app/newindex/sqyj.png" mode="" class="itemimg">
+					</image>
+					<view class="">
+						墒情预警
+					</view>
+				</view>
 				<view class="facilitybox_item" v-if="jurisdiction.ggtf" @click="tabequipment('../irrigate/index')">
 					<image src="http://www.hnyfwlw.com:8006/bigdata_app/newindex/guangai.png" mode="" class="itemimg">
 					</image>
@@ -432,10 +439,10 @@
 					})
 				}
 			},
-			tabequipment(url) {
+			tabequipment(url, type) {
 				console.log(url)
 				uni.navigateTo({
-					url: url
+					url: `${url}${type ? `?typeId=${type}` : ''}` 
 				})
 			},
 			onok(ev) {

+ 65 - 37
pages/qxzyj/cbwarn.vue

@@ -1,9 +1,7 @@
 <template>
 	<view class="content">
 		<view class="cbwtop">
-			<image :src="
-			  'http://www.hnyfwlw.com:8006/bigdata_app/image/cbyj/banner2.png'
-			" mode="" class="image">
+			<image :src="bannersrc" mode="" class="image">
 			</image>
 			<view class="tab-box">
 				<view v-for="(item, index) in equipArr" :key="index" @click="tabClick(index)"
@@ -12,7 +10,7 @@
 					<text class="bottom-line"></text>
 				</view>
 			</view>
-			<view class="timeandtype" v-if="active==0">
+			<view class="timeandtype" v-if="active==0 && wranlistdata.length > 0">
 				<view class="timebox">
 					<view class="firsttime" @click="timeshow=true">
 						{{start_time==""?'请选择开始时间':start_time}}
@@ -30,11 +28,11 @@
 			</view>
 		</view>
 		<view class="" v-show="active==0">
-			<view class="warmlistbox">
+			<view class="warmlistbox" v-if="wranlistdata.length > 0">
 				<view class="warmlistbox_item" v-for="item in wranlistdata" :key="item.id" @click="singleread(item)">
 					<view class="warmlistbox_item_title" :style="{'border-color':item.status==1?'#14A478':'#fd4646'}">
 						<!-- {{recordtypelist[item.warning_type].label}} -->
-						气象预警
+						{{device_type == 5 ? '气象' : '墒情'}}预警
 					</view>
 					<view class="warmlistbox_item_text">
 						<view class="item_text_item">
@@ -75,6 +73,9 @@
 					</view>
 				</view>
 			</view>
+			<view class="warmlistbox empty" v-else>
+				暂无数据
+			</view>
 		</view>
 		<view class="warmissuebox" v-show="active == 1">
 			<view class="warmissue">
@@ -129,6 +130,9 @@
 			</view>
 		</view>
 		<view class="wornsetbox" v-show="active == 2">
+			<view class="empty" v-if="configlist.length == 0">
+				暂无数据
+			</view>
 			<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in configlist" :key="item.id"
 				@click="delconfig(item.id)" :options="options" style="margin-bottom: 30rpx;">
 				<view class="wornsetbox_item" @click="toset(item.id)">
@@ -142,7 +146,7 @@
 				</view>
 			</u-swipe-action>
 		</view>
-		<view class="addwarnlist" v-show="active == 2" @click="addshow = true">
+		<view class="addwarnlist" v-show="active == 2" @click="addwarning_config">
 			添 加
 		</view>
 		<view class="">
@@ -185,6 +189,8 @@
 		},
 		data() {
 			return {
+				bannersrc:'http://www.hnyfwlw.com:8006/bigdata_app/image/cbyj/banner2.png',
+				device_type:'',
 				date: "",
 				active: 0,
 				equipArr: ["预警记录", "预警发布", "预警设置"],
@@ -288,6 +294,7 @@
 						page: this.listpage,
 						page_size: "10",
 						start_time: start_time,
+						device_type: this.device_type
 					}
 				})
 				console.log(res)
@@ -307,6 +314,7 @@
 					url: '/api/api_gateway?method=device.device_sms_alert.user_warning_liaisons_list',
 					data: {
 						page: 1,
+						device_type: this.device_type,
 						page_size: 9999999,
 					}
 				})
@@ -323,7 +331,9 @@
 			async getmessagescounts() {
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=device.device_sms_alert.remaining_messages_counts',
-					data: {}
+					data: {
+						device_type: this.device_type
+					}
 				})
 				console.log(res)
 				this.total_sms_counts = res.total_sms_counts
@@ -349,7 +359,8 @@
 						data: {
 							send_user: list.join(","),
 							content: this.wormvalue,
-							device_type_id: 5
+							device_type_id: this.device_type,
+							device_type: this.device_type
 						}
 					})
 					console.log(res)
@@ -376,6 +387,7 @@
 					url: '/api/api_gateway?method=device.device_sms_alert.user_qxz_warning_record_read',
 					data: {
 						req: "all",
+						device_type: this.device_type
 					}
 				})
 				if (res) {
@@ -396,7 +408,7 @@
 					const res = await this.$myRequest({
 						url: '/api/api_gateway?method=device.device_sms_alert.user_qxz_warning_record_read',
 						data: {
-							id: this.warmstatus.id,
+							id: this.warmstatus.id
 						}
 					})
 					if (res) {
@@ -420,8 +432,9 @@
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=device.device_sms_alert.user_warning_config_list',
 					data: {
-						device_type_id: "5",
+						device_type_id: this.device_type,
 						page: this.confpage,
+						device_type: this.device_type,
 						page_size: "10",
 					}
 				})
@@ -456,32 +469,36 @@
 			toset(id) {
 				console.log(id)
 				uni.navigateTo({
-					url: "./warnset?id=" + id
+					url: "./warnset?id=" + id + '&typeId=' + this.device_type
 				})
 			},
 			async addwarning_config() {
-				this.addshow = true
-				if (this.addvalue == "") {
-					uni.showToast({
-						title: "请填写预警名称",
-						icon: "none"
-					})
-				} else {
-					const res = await this.$myRequest({
-						url: '/api/api_gateway?method=device.device_sms_alert.create_user_warning_config',
-						data: {
-							title: this.addvalue,
-							device_type_id: 5
-						}
-					})
-					console.log(res)
-					if (res) {
-						this.addshow = false
-						this.configlist = []
-						this.confpage = 1
-						this.getconfiglist()
-					}
-				}
+				uni.navigateTo({
+					url: "./warnset?type=new" + '&typeId=' + this.device_type
+				})
+				// this.addshow = true
+				// if (this.addvalue == "") {
+				// 	uni.showToast({
+				// 		title: "请填写预警名称",
+				// 		icon: "none"
+				// 	})
+				// } else {
+				// 	const res = await this.$myRequest({
+				// 		url: '/api/api_gateway?method=device.device_sms_alert.create_user_warning_config',
+				// 		data: {
+				// 			title: this.addvalue,
+				// 			device_type: this.device_type,
+				// 			device_type_id: this.device_type
+				// 		}
+				// 	})
+				// 	console.log(res)
+				// 	if (res) {
+				// 		this.addshow = false
+				// 		this.configlist = []
+				// 		this.confpage = 1
+				// 		this.getconfiglist()
+				// 	}
+				// }
 			},
 			async delconfig(id){
 				const res = await this.$myRequest({
@@ -499,13 +516,20 @@
 			}
 			
 		},
-		onLoad() {
+		onLoad(option) {
+			console.log(option)
+			this.device_type = option.typeId;
+			if(option.typeId == 15) {
+				uni.setNavigationBarTitle({title:'墒情预警'})
+				this.bannersrc = 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/cbyj/banner15.png'
+			}
 			this.getwranlistdata()
 			// this.getmessagescounts()
 			// this.getconfiglist()
 		},
 		onShow() {
-			this.getuseriphonelist()
+			this.getuseriphonelist();
+			this.getconfiglist();
 		},
 		onReachBottom() {
 			if (this.active == 0) {
@@ -662,7 +686,11 @@
 			}
 		}
 	}
-
+	.empty{
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
 	.warmissuebox {
 		width: 95%;
 		margin: 0 auto;

+ 40 - 12
pages/qxzyj/warnset.vue

@@ -2,6 +2,14 @@
 	<view>
 		<view class="basesel">
 			<view class="basesel_list">
+				<view class="">
+					<view class="">
+						预警名称
+					</view>
+					<view class="">
+						<u-input v-model="title"/>
+					</view>
+				</view>
 				<view class="basesel_list_tilte">
 					预警设备选择:
 				</view>
@@ -103,6 +111,8 @@
 		},
 		data() {
 			return {
+				title: '',
+				device_type:'',
 				fanxianid: '',
 				fanxianconf: "",
 				warning_id: "",
@@ -153,6 +163,7 @@
 					data: {
 						page: 1,
 						page_size: 9999999,
+						device_type: this.device_type
 					}
 				})
 				// console.log(res)
@@ -169,7 +180,8 @@
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=device.device_sms_alert.user_warning_device_list',
 					data: {
-						device_type_id: "5",
+						device_type_id: this.device_type,
+						device_type: this.device_type,
 						page: "1",
 						page_size: "999999999"
 					}
@@ -199,6 +211,7 @@
 					url: '/api/api_gateway?method=weather.weather.qxz_early_warning',
 					data: {
 						device_id: device_id,
+						device_type: this.device_type,
 						status: "see"
 					}
 				})
@@ -218,7 +231,7 @@
 						for (var i = 0; i < this.fanxianconf.length; i++) {
 							if (Object.keys(this.fanxianconf[i]) == key) {
 								obj.type = true;
-								var arr = this.fanxianconf[i][key].split('#');
+								var arr = this.fanxianconf[i][key].split('|')[0].split('#');
 								if (arr[1].indexOf('&')) {
 									arr[1] = arr[1].split('&');
 									obj.num[1] = arr[1][1];
@@ -285,14 +298,21 @@
 						icon: "none"
 					})
 				} else {
+					if(this.title.length > 32 || this.title == '') {
+						uni.showToast({
+							title: "标题不能为空且长度不大于32个字符",
+							icon: "none"
+						})
+						return
+					}
 					var conf = [
 
 					]
 					for (var i = 0; i < this.tongdaolist.length; i++) {
 						if (this.tongdaolist[i].type) {
 							var obj = {}
-							obj[this.tongdaolist[i].key] = this.tongdaolist[i].valuenum + "#" + this.tongdaolist[i].num
-								.join("&")
+							obj[this.tongdaolist[i].key] = this.tongdaolist[i].valuenum + "#" + this.tongdaolist[i].num 
+								.join("&") + '|' + this.tongdaolist[i].name
 							conf.push(obj)
 						}
 					}
@@ -304,15 +324,19 @@
 							device_id: this.selbaselist,
 							send_user_id: this.send_user.join(","),
 							warning_id: this.warning_id,
+							device_type: this.device_type,
+							title: this.title						,
 						}
 					})
-					if (res) {
+					if(res) {
 						uni.showToast({
-							title: "预警设置成功",
-							icon: "none"
-						})
-						uni.navigateBack({
-							delta: 1
+							title: "预警配置成功",
+							icon: "none",
+							complete: () => {
+								uni.navigateBack({
+									delta:1
+								})
+							}
 						})
 					}
 					// console.log(res)
@@ -333,6 +357,7 @@
 				this.userphone = []
 				this.send_user = []
 				this.fanxianconf = res.conf;
+				this.title = res.warning_name;
 				for (var key in res.send_user) {
 					this.defaultSelectedphone.push(Number(key))
 					this.userphone.push(res.send_user[key][0] + "/" + res.send_user[key][1])
@@ -342,10 +367,13 @@
 			}
 		},
 		onLoad(option) {
-			this.warning_id = option.id
+			this.device_type = option.typeId;
 			this.getbaselist()
 			this.getuseriphonelist()
-			this.getstatsu()
+			if(option.id) {
+				this.warning_id = option.id;
+				this.getstatsu()
+			}
 		}
 	}
 </script>

BIN
unpackage/cache/apk/__UNI__DBA6730_cm.apk


+ 1 - 1
unpackage/cache/apk/apkurl

@@ -1 +1 @@
-https://ide.dcloud.net.cn/build/download/12773540-4897-11ee-aaa5-93c615e6a1fd
+https://ide.dcloud.net.cn/build/download/fa455290-52e2-11ee-952b-ab7791acaedb

File diff suppressed because it is too large
+ 1 - 1
unpackage/cache/apk/cmManifestCache.json


File diff suppressed because it is too large
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/app-config-service.js


File diff suppressed because it is too large
+ 3 - 3
unpackage/cache/wgt/__UNI__DBA6730/app-service.js


File diff suppressed because it is too large
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/app-view.js


File diff suppressed because it is too large
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/manifest.json


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/build/app-plus/app-config-service.js


File diff suppressed because it is too large
+ 3 - 3
unpackage/dist/build/app-plus/app-service.js


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/build/app-plus/app-view.js


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/build/app-plus/manifest.json


BIN
unpackage/release/apk/__UNI__DBA6730__20230619110532.apk


+ 1 - 1
util/api.js

@@ -5,7 +5,7 @@ export const myRequest = (options) => {
 	console.log(BASE_URL,'my request',process.env.NODE_ENV)
 	if (BASE_URL == '') {
 		// BASE_URL = 'http://8.136.98.49:8002'//线上
-		BASE_URL = process.env.NODE_ENV === 'development' ? "http://8.136.98.49:8002" : "http://8.136.98.49:8002"
+		BASE_URL = process.env.NODE_ENV === 'development' ? "http://192.168.0.36:8003" : "http://8.136.98.49:8002"
 		// BASE_URL = 'http://192.168.1.77:8002'
 	}
 	// BASE_URL = 'http://192.168.1.52:8003'

+ 2 - 2
util/neutral.js

@@ -1,4 +1,4 @@
 export default{
-	isneutral:true//云飞智控
-	// isneutral:false//智控
+	// isneutral:true//云飞智控
+	isneutral:false//智控
 }