diff --git a/src/App.vue b/src/App.vue
index b84e83a..26bd32d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -185,6 +185,33 @@
}
.quick_times{
padding: 18rpx 24rpx 24rpx 24rpx;
+ .tab-section{
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ overflow: hidden;
+ position: relative;
+ height: 72rpx;
+ background-color: rgb(238, 238, 239);
+ padding: 6rpx;
+ border-radius: 10rpx;
+ .tab-item{
+ flex: 1;
+ text-align: center;
+ font-size: 28rpx;
+ height: 100%;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ color: #303133;
+ padding: 0 6rpx;
+ &.active{
+ font-weight: bold;
+ background-color: rgb(255, 255, 255);
+ }
+ }
+ }
}
}
// 图表标题通用
@@ -207,4 +234,51 @@
}
}
}
+ .u-popup-section{
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ .top_box{
+ height: 96rpx;
+ padding: 0 40rpx;
+ .title{
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 32rpx;
+ font-weight: bold;
+ }
+ }
+ .form_cont{
+ padding: 0 30rpx;
+ .title2{
+ font-size: 30rpx;
+ font-weight: bold;
+ padding: 20rpx 0;
+ }
+ .label_tit{
+ padding-top: 28rpx;
+ }
+ }
+ .label_tit{
+ padding: 18rpx 0;
+ }
+ .scroll-y{
+ flex: 1;
+ flex-shrink: 0;
+ min-height: 1px;
+ }
+ .input_unit_ibox{
+ padding: 0 24rpx;
+ }
+ .buttom_section{
+ display: flex;
+ padding: 40rpx 24rpx 40rpx 24rpx;
+ .btn{
+ width: 220rpx;
+ }
+ }
+ }
diff --git a/src/pages.json b/src/pages.json
index 73334e3..e212d34 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -73,6 +73,15 @@
}
}
+ ,{
+ "path" : "pages/index/water-quality",
+ "style" :
+ {
+ "navigationBarTitleText": "水质监控",
+ "enablePullDownRefresh": false
+ }
+
+ }
],
"globalStyle": {
"navigationBarTextStyle": "white",
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 5974f5d..c37fa5a 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -109,6 +109,10 @@
uni.navigateTo({
url:'/pages/index/soil-monitoring'
})
+ }else if(item.label=='水质监控'){
+ uni.navigateTo({
+ url:'/pages/index/water-quality'
+ })
}
}
}
diff --git a/src/pages/index/soil-monitoring.vue b/src/pages/index/soil-monitoring.vue
index f64745e..23d70da 100644
--- a/src/pages/index/soil-monitoring.vue
+++ b/src/pages/index/soil-monitoring.vue
@@ -1,5 +1,5 @@
-
+
@@ -30,8 +30,40 @@
-
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+ 预警数据统计
+
+ 设置
+
+
+
+
+ Ⅰ级预警
+ {{deviceWarning[1]?deviceWarning[1]:0}}个
+
+
+ Ⅱ级预警
+ {{deviceWarning[2]?deviceWarning[2]:0}}个
+
+
+ Ⅲ级预警
+ {{deviceWarning[3]?deviceWarning[3]:0}}个
+
+
+ Ⅳ级预警
+ {{deviceWarning[4]?deviceWarning[4]:0}}个
+
@@ -119,6 +151,44 @@
+
+
+
+
@@ -135,7 +205,8 @@
padding:[10,40,25,25],
xAxis: {
disableGrid: true,
- labelCount:5
+ labelCount:5,
+
},
yAxis: {
gridType: "dash",
@@ -183,7 +254,31 @@
},
],
currentIndex:0,
-
+ deviceWarning:{},//设备预警
+ warningShow:false,
+ formInfo:{},//设置表单
+ keyToName:{
+ temperature:'温度',
+ conductivity:'电导率',
+ humidity:'湿度',
+ n:'磷',
+ p:'钾',
+ k:'氮',
+ },
+ keyToUnit:{
+ temperature:'℃',
+ conductivity:'us/cm',
+ humidity:'%',
+ n:'mg/kg',
+ p:'mg/kg',
+ k:'mg/kg',
+ },
+ numberToString:{
+ 1:'Ⅰ',
+ 2:'Ⅱ',
+ 3:'Ⅲ',
+ 4:'Ⅳ'
+ }
};
},
onLoad(){
@@ -193,6 +288,11 @@
},
methods:{
+ //设置预警值
+ setWarnInfo(){
+ this.getDeviceWarningRules();
+ this.warningShow = true;
+ },
//地区
change(val){
console.log(val);
@@ -203,12 +303,14 @@
this.addressName = narray[0].name;
this.$refs.uDropdown.highlight(0);
this.queryAddressDevicePoints(val);
+
},
//地区下设备id
change2(val){
this.$refs.uDropdown.highlight(1);
this.queryMonitoringData();
+ this.getDeviceWarningNums();//报警查询
},
//日期范围
calendarChange(e){
@@ -221,6 +323,12 @@
this.q_end_time = this.end_date_c;
this.queryMonitoringData();
this.$refs.uDropdown.close();
+ if(this.q_start_time!=this.q_end_time){
+ this.currentIndex = -1;
+ }else{
+ this.currentIndex = 0;
+ }
+
},
//删除选择的时间
deleteDateFn(){
@@ -259,6 +367,24 @@
this.q_end_time = '';
}
this.queryMonitoringData();
+
+ },
+ //设置警戒值
+ warningInfoBtn(){
+ let params = {
+ slug: "device_warning_rule_soil",
+ value:this.formInfo
+ }
+ this.$http.put('/api/device-warning-rules',params).then(({data})=>{
+ this.warningShow = false;
+ if(data.code==200){
+ uni.showToast({ title: '设置成功', icon: 'none' });
+ }else{
+ uni.showToast({ title: '设置失败', icon: 'none' });
+ }
+ }).catch(()=>{
+ uni.showToast({ title: '设置失败', icon: 'none' });
+ })
},
//查询地址筛选
queryDeviceBasics(){
@@ -306,6 +432,7 @@
this.device_id = options[0].value;
console.log(this.options2,this.device_id,'this.options2')
this.queryMonitoringData();
+ this.getDeviceWarningNums();//报警查询
}
}).catch(()=>{
@@ -351,12 +478,16 @@
}else{
let len = chartInfo.conductivity.categories.length-1;
let v = 5;
- if(len>5){
- v = len%5>0?v-1:v;
- }
+ let aw = len>10?len%6:len%5;
+ if(aw==3||aw==0||aw==1){
+ v = 4;
+ }else if(aw==2){
+ v = 3;
+ }else{v=5}
this.opts.xAxis.labelCount = v;
+ console.log(this.opts,v,len,'配置',aw)
}
- console.log(this.opts,'配置')
+
//start 电导率 conductivity
let res = {
categories: chartInfo.conductivity.categories,
@@ -443,8 +574,42 @@
}).catch(()=>{
})
+
},
-
+ //预警查询
+ getDeviceWarningNums(){
+ let params = {
+ base:this.addressValue,
+ device:this.device_id,
+ status:0,
+ _t: new Date().getTime()
+ }
+ this.$http.get('/api/device-warning-nums',{params:params}).then(({data})=>{
+ if(data.code==200){
+ this.deviceWarning = data.data;
+ }
+ }).catch(()=>{
+
+ })
+ },
+ //预警规则
+ getDeviceWarningRules(){
+ this.$http.get('/api/device-warning-rules',{params:{}}).then(({data})=>{
+ if(data.code==200){
+ let _data = data.data;
+ let info = {};
+ for(let item of _data){
+ if(item.slug=='device_warning_rule_soil'){//土壤警报
+ info = item;
+ break;
+ }
+ }
+ this.formInfo = info.value;
+ }
+ }).catch(()=>{
+
+ })
+ }
}
}
@@ -453,4 +618,46 @@
.content-box{
padding-bottom: 60rpx;
}
+
+.warning-section{
+ padding: 20rpx 24rpx;
+ background-color: #fff;
+ border-top: 14rpx solid #f5f5f5;
+ border-bottom: 14rpx solid #f5f5f5;
+ .top_box{
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 24rpx;
+ padding-bottom: 20rpx;
+ .tit{
+ font-weight: bold;
+ }
+ .set_warning{
+ display: flex;
+ align-items: center;
+ }
+ }
+ .cont-box{
+ display: flex;
+ padding-bottom: 12rpx;
+
+ }
+ .warning-item{
+ flex: 1;
+ text-align: center;
+ .name{
+ margin-bottom: 15rpx;
+ }
+ .val{
+ font-size: 34rpx;
+ font-weight: bold;
+ }
+ .unit{
+ font-size: 24rpx;
+ font-weight: 500;
+ margin-left: 6rpx;
+ }
+ }
+}
diff --git a/src/pages/index/water-quality.vue b/src/pages/index/water-quality.vue
new file mode 100644
index 0000000..a1b1cda
--- /dev/null
+++ b/src/pages/index/water-quality.vue
@@ -0,0 +1,667 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 选择日期:
+
+
+ 开始日期-结束日期
+ {{start_date_c}} ~ {{end_date_c}}
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+ 预警数据统计
+
+ 设置
+
+
+
+
+ Ⅰ级预警
+ {{deviceWarning[1]?deviceWarning[1]:0}}个
+
+
+ Ⅱ级预警
+ {{deviceWarning[2]?deviceWarning[2]:0}}个
+
+
+ Ⅲ级预警
+ {{deviceWarning[3]?deviceWarning[3]:0}}个
+
+
+ Ⅳ级预警
+ {{deviceWarning[4]?deviceWarning[4]:0}}个
+
+
+
+
+
+
+ 氯mg/L
+ {{addressName}}
+
+
+
+
+
+
+
+
+ 电导率us/cm
+ {{addressName}}
+
+
+
+
+
+
+
+
+
+ 氧气mg/L
+ {{addressName}}
+
+
+
+
+
+
+
+
+ PH
+ {{addressName}}
+
+
+
+
+
+
+
+
+ 温度℃
+ {{addressName}}
+
+
+
+
+
+
+
+
+ 浊度NTU
+ {{addressName}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+