diff --git a/page_Beehive/Beehive_detail.vue b/page_Beehive/Beehive_detail.vue index 5739abb..4f48a2d 100644 --- a/page_Beehive/Beehive_detail.vue +++ b/page_Beehive/Beehive_detail.vue @@ -6,7 +6,7 @@ - + 未找到位置信息 - + + 已读 - + - - 福鼎蜂场-001 + + {{item.apiaryName}} + + + {{item.beehiveName}} - - 温度过低 + {{item.msg}} - + - 2024-05-15 15:23:56 + {{item.createTime}} + + + + + + + + + 当前暂无预警记录... + + @@ -79,90 +113,254 @@ bgc: { backgroundColor: " #F4FAF8", }, - title: "蜂箱预警", + showmiyuan: false, + title: "蜂箱预警记录", currentIndex: 0, - imglist: [], - token: '', - sn:'', - upurl:'', + wuflag: false, + yjtxt:'', tabs: [{ - title: '京东超市', + title: '全部', + type: null }, { - title: '男装', + title: '温度', + type: 1 }, { - title: '奢侈品', + title: '湿度', + type: 2 }, { - title: '女装', + title: '重量', + type: 3 }, { - title: '鞋靴', + title: '电量', + type: 4 }, { - title: '内衣饰品', - imageSrc: '' + title: '进出量', + type: 5 }, { - title: '箱包', - imageSrc: '' - }, - { - title: '美妆护肤', - imageSrc: '' - }, - + title: '声音', + type: 6 + }, { + title: '电子围栏', + type: 7 + }, { + title: '定位异常', + type: 8 + } ], + textValue: '', + currentCount: 0, + showxy: false, + apiaryId: '', + beehiveId: '', + pageNum: 1, + pageSize: 10, + rzlist: [], + fclist: [], + apiaryName: '', + type: null, + total: 0, + imglist: [] } }, - onLoad() { + onLoad(option) { + this.apiaryId = option.apiaryId + this.title = option.tit }, onShow() { + this.pageNum = 1 + this.rzlist = [] + if (this.title == '蜂箱预警记录') { + this.yjtxt = '该蜂场其他蜂箱' + this.getfx() + this.getyuj() + } else { + this.yjtxt = '其他蜂场' + this.getfc() + this.getyuj() + } }, methods: { - changeTag(idx){ - this.currentIndex=idx + + loadMore() { + if (this.rzlist.length < this.total) { + this.getyuj() + } else { + uni.showToast({ + title: '没有更多预警记录了', + icon: 'none', + duration: 1000 + }) + } }, - btn() { - let _this = this - let math = 'static/' + _this.$u.guid(20) - uni.chooseImage({ - count: 9, - type: 'all', - success(res) { - // tempFilePath可以作为img标签的src属性显示图片 - const tempFilePaths = res.tempFiles - // let tempFilePaths = chooseImageRes.tempFilePaths; - // console.log(tempFilePaths) - // tempFilePaths.forEach(item=>{ - // // 上传图片到七牛云 - - // }) - wx.uploadFile({ - url: 'https://up-z2.qiniup.com', - name: 'file', - filePath: tempFilePaths[0].path, - formData: { - token: _this.token, //后端返回的token - key: 'smartmeter/img/' + math - }, - success: function(res) { - console.log(res,'resres'); - let str = JSON.parse(res.data) - console.log(str.key) - _this.userImgs = _this.upurl +'/'+ str.key - console.log(_this.userImgs) - _this.imglist.push(_this.userImgs) + confirmmy(e) { + this.rzlist = [] + this.pageNum = 1 + this.apiaryId = e[0].value + this.apiaryName = e[0].label + this.getyuj() + }, + // 点击处理预警 + btnzdl(recordId) { + this.$u.put(`/farm/record/warn/${recordId}/read`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '处理成功', + icon: 'success', + duration: 1000 + }) + this.rzlist.forEach(item => { + if (item.recordId == recordId) { + item.status = 2 } - }); + }) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 1000 + }) } }) - }, + // 请求蜂箱 + getfx() { + this.$u.get(`/farm/beehive/listAll`).then(res => { + if (res.code == 200) { + if (res.data.length >= 1) { + res.data.forEach(item => { + if (item.beehiveId == this.apiaryId) { + this.apiaryName = item.name + } + }) + this.fclist = res.data.map(item => ({ + value: item.beehiveId, + label: item.name + })) + } + } + }) + }, + // 请求蜂场 + getfc() { + this.$u.get(`/farm/apiary/listAll`).then(res => { + if (res.code == 200) { + if (res.data.length >= 1) { + res.data.forEach(item => { + if (item.apiaryId == this.apiaryId) { + this.apiaryName = item.name + } + }) + this.fclist = res.data.map(item => ({ + value: item.apiaryId, + label: item.name + })) + } + } + }) + }, + // 请求预警 + getyuj() { + if (this.title == '蜂箱预警记录') { + let queryParams = { + pageNum: this.pageNum, + pageSize: this.pageSize, + beehiveId: this.apiaryId, + type: this.type + }; + if (this.type == null) { + delete queryParams.type; + } + let queryString = Object.keys(queryParams).filter(key => queryParams[key] != null).map(key => + `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`).join('&') + this.$u.get(`/farm/record/warn/list?${queryString}`).then(res => { + if (res.code == 200) { + this.total = res.total + if (res.total < 1) { + this.wuflag = false + } else { + this.pageNum++ + this.wuflag = true + if (this.type == null) { + this.rzlist = [...this.rzlist, ...res.rows.map(row => ({ + ...row, + }))] + } else { + let existingBeehiveIds = new Set(this.rzlist.filter(row => row.type == this + .type).map(row => row.id)); + let filteredAndDeduplicatedNewRows = res.rows.filter(row => row.type == this + .type).filter(row => !existingBeehiveIds.has(row.id)).map(row => ({ + ...row, + })); + this.rzlist = [...this.rzlist.filter(row => row.type == this.type), ... + filteredAndDeduplicatedNewRows + ] + } + } + } + }) + } else { + let queryParams = { + pageNum: this.pageNum, + pageSize: this.pageSize, + apiaryId: this.apiaryId, + type: this.type + }; + if (this.type == null) { + delete queryParams.type; + } + let queryString = Object.keys(queryParams).filter(key => queryParams[key] != null).map(key => + `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`).join('&') + this.$u.get(`/farm/record/warn/list?${queryString}`).then(res => { + if (res.code == 200) { + this.total = res.total + if (res.total < 1) { + this.wuflag = false + } else { + this.pageNum++ + this.wuflag = true + if (this.type == null) { + this.rzlist = [...this.rzlist, ...res.rows.map(row => ({ + ...row, + }))] + } else { + let existingBeehiveIds = new Set(this.rzlist.filter(row => row.type == this + .type).map(row => row.id)); + let filteredAndDeduplicatedNewRows = res.rows.filter(row => row.type == this + .type).filter(row => !existingBeehiveIds.has(row.id)).map(row => ({ + ...row, + })); + this.rzlist = [...this.rzlist.filter(row => row.type == this.type), ... + filteredAndDeduplicatedNewRows + ] + } + } + } + }) + } + + }, + + changeTag(idx, type) { + if (idx == 0) { + this.rzlist = [] + } + this.pageNum = 1 + this.type = type + this.currentIndex = idx + this.getyuj() + }, + + + } } @@ -172,10 +370,207 @@ background-color: #F4FAF8; } + .addtj { + width: 100%; + height: 200rpx; + // background-color: #FFCC25; + // background-color: #fff; + text-align: center; + line-height: 90rpx; + position: fixed; + left: 220rpx; + bottom: 0; + font-size: 36rpx; + padding-left: 80rpx; + padding-top: 30rpx; + box-sizing: border-box; + + view { + width: 336rpx; + height: 88rpx; + background-color: #FFCC25; + text-align: center; + line-height: 88rpx; + color: #fff; + border-radius: 10rpx; + } + } + .page { // position: relative; width: 750rpx; - .top{ + + .no_cont { + margin: 152rpx auto 0; + width: 432rpx; + + .img { + image { + width: 432rpx; + height: 432rpx; + } + } + + .txt { + margin-top: 50rpx; + width: 100%; + text-align: center; + font-weight: 500; + font-size: 32rpx; + color: #808080; + } + } + + .set_log_box { + padding: 50rpx 56rpx; + + .btn { + display: flex; + align-items: center; + justify-content: center; + position: fixed; + left: 58rpx; + bottom: 68rpx; + width: 638rpx; + height: 88rpx; + background: #FFCC25; + border-radius: 20rpx 20rpx 20rpx 20rpx; + font-weight: 500; + font-size: 32rpx; + color: #FFFFFF; + } + + .xy { + margin-top: 46rpx; + width: 100%; + display: flex; + flex-wrap: nowrap; + align-items: center; + justify-content: center; + + .yuans { + margin-top: 2rpx; + display: flex; + align-items: center; + justify-content: center; + width: 34rpx; + height: 34rpx; + border-radius: 50%; + border: #808080 solid 2rpx; + + image { + width: 100%; + height: 100%; + border-radius: 50%; + } + } + + .txt { + margin-left: 10rpx; + font-weight: 400; + font-size: 28rpx; + color: #808080; + + span { + color: #3D3D3D; + } + } + + } + + .input-container { + position: relative; + width: 612rpx; + height: 172rpx; + background: #FFFFFF; + box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1); + border-radius: 20rpx; + margin-top: 40rpx; + overflow: hidden; + padding-right: 38rpx; + box-sizing: border-box; + border: 2rpx solid #C7C7C7; + } + + .placeholder { + position: absolute; + top: 18rpx; + left: 38rpx; + color: #999; + /* placeholder颜色 */ + pointer-events: none; + /* 确保点击事件可以穿透到textarea上 */ + } + + .custom-textarea { + width: 100%; + height: 100%; + /* 设置一个合适高度 */ + padding-top: 18rpx; + /* 为placeholder留出空间 */ + padding-left: 38rpx; + box-sizing: border-box; + border: 1px solid #ccc; + } + + .word-count { + position: absolute; + right: 10px; + bottom: 10px; + font-size: 12px; + color: #999; + } + + .icon { + display: flex; + flex-wrap: wrap; + align-items: center; + margin-top: 40rpx; + + .imgbox { + width: 33%; + + image { + width: 222rpx; + height: 222rpx; + } + } + + } + + .tit { + font-weight: 600; + font-size: 36rpx; + color: #3D3D3D; + } + + .set_type_box { + display: flex; + flex-wrap: wrap; + + // margin-top: 26rpx; + .type_li { + margin-top: 26rpx; + margin-right: 18rpx; + padding: 12rpx 50rpx; + background: #FFF5D6; + border-radius: 12rpx 12rpx 12rpx 12rpx; + border: 2rpx solid #FFC107; + font-weight: 500; + font-size: 32rpx; + color: #3D3D3D; + } + + .act1 { + background: #FFC107; + border-radius: 12rpx 12rpx 12rpx 12rpx; + border: 2rpx solid #FFC107; + color: #FFFFFF; + } + } + } + + .top { display: flex; align-items: center; justify-content: space-between; @@ -184,14 +579,16 @@ width: 658rpx; height: 106rpx; background: #FFFFFF; - box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.15); + box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); border-radius: 20rpx 20rpx 20rpx 20rpx; - .top_left{ + + .top_left { font-weight: 600; font-size: 36rpx; color: #3D3D3D; } - .top_right{ + + .top_right { display: flex; align-items: center; flex-wrap: nowrap; @@ -200,6 +597,7 @@ color: #808080; } } + .cont_box { margin-top: 26rpx; display: flex; @@ -207,18 +605,19 @@ .left { margin-left: 48rpx; - width: 216rpx; + width: 200rpx; .left_cont_box { - width: 216rpx; + width: 200rpx; height: 100rpx; background: #fff; .left_cont { display: flex; align-items: center; - justify-content: center; - width: 216rpx; + // justify-content: center; + padding-left: 30rpx; + width: 200rpx; height: 100rpx; font-weight: 600; font-size: 36rpx; @@ -227,7 +626,7 @@ // border-radius: 0rpx 40rpx 40rpx 0rpx; // border: 1rpx solid #fff; - + } .act1 { @@ -251,70 +650,86 @@ } } - .right{ + + .right { padding: 16rpx; margin-left: -10rpx; width: 100%; - height: 100vn; + height: 92vh; background: #fff; - .right_cont{ + overflow: scroll; + padding-bottom: 200rpx; + box-sizing: border-box; + + .right_cont { + margin-top: 20rpx; padding: 20rpx 26rpx; width: 462rpx; - height: 242rpx; + height: 260rpx; background: #F6F6F6; border-radius: 20rpx 20rpx 20rpx 20rpx; - .cont{ + + .cont { margin-top: 10rpx; display: flex; flex-wrap: nowrap; align-items: center; width: 100%; padding-left: 80rpx; - image{ - width: 18rpx; + + image { + width: 22rpx; height: 22rpx; } - .txt1{ + + .txt1 { margin-left: 8rpx; font-weight: 400; font-size: 26rpx; color: #4D4D4D; } - .txt2{ + + .txt2 { font-weight: 600; font-size: 28rpx; color: #3D3D3D; } - .txt3{ + + .txt3 { margin-left: auto; font-weight: 400; font-size: 24rpx; color: #808080; } } - .right_cont_top{ + + .right_cont_top { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; - .cont_left{ + + .cont_left { display: flex; flex-wrap: nowrap; align-items: center; - image{ + + image { width: 50rpx; height: 50rpx; } - .txt{ + + .txt { margin-left: 34rpx; font-weight: 600; font-size: 36rpx; color: #3D3D3D; - + } } - .cont_right{ - .btn1{ + + .cont_right { + .btn1 { display: flex; align-items: center; justify-content: center; @@ -326,7 +741,8 @@ font-size: 28rpx; color: #FFFFFF; } - .btn2{ + + .btn2 { display: flex; align-items: center; justify-content: center; @@ -341,6 +757,7 @@ } } } + // border-radius: 40rpx 0 0 40rpx; // box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); } diff --git a/pages/Apiary/Apiary_detail.vue b/pages/Apiary/Apiary_detail.vue index 6386f13..0a507b6 100644 --- a/pages/Apiary/Apiary_detail.vue +++ b/pages/Apiary/Apiary_detail.vue @@ -39,10 +39,10 @@ - + - 1 + {{apiaryobj.unReadWarnCount == undefined ? 0 : apiaryobj.unReadWarnCount}} @@ -87,7 +87,7 @@ - + 预警设置 @@ -218,13 +218,26 @@ }, methods: { + // 跳转预警设置 + btnpageyj(){ + uni.navigateTo({ + url:'/pages/Apiary/early_Set ?apiaryId=' + this.apiaryId + }) + }, + // 跳转预警记录 + btnyj(){ + uni.navigateTo({ + url:'/page_Beehive/Beehive_woring?apiaryId=' + this.apiaryId + '&tit=' + '蜂场预警记录' + }) + }, + // 请求指定蜂场蜂箱 getMyLocation() { uni.getLocation({ type: 'wgs84', success: (res) => { - this.latitude = Number(res.latitude.toFixed(5)) - 0.004 - this.longitude = Number(res.longitude.toFixed(5)) + 0.004 + // this.latitude = Number(res.latitude.toFixed(5)) - 0.004 + // this.longitude = Number(res.longitude.toFixed(5)) + 0.004 this.$u.get(`/farm/beehive/listByApiary/${this.apiaryId}`).then( res => { if (res.code == 200) { @@ -322,6 +335,7 @@ height: 30, iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uYrX2QTRLdVVDTB3E5cp', }) + this.polygons[0].points = [] let centerLat = res.data.lat let centerLon = res.data.lng let radius = res.data.radius diff --git a/pages/Apiary/early_Set .vue b/pages/Apiary/early_Set .vue index 81d7b08..ddb82a6 100644 --- a/pages/Apiary/early_Set .vue +++ b/pages/Apiary/early_Set .vue @@ -7,67 +7,87 @@ 蜂箱温度预警 - + - - + 蜂箱湿度预警 - + - - + 蜂箱重量预警 - + - - + 蜂箱进出量预警 - + - - + 蜂箱电量预警 - + - - + 蜂箱频率预警 - + - - + 电子围栏范围预警 - + - - + + + + + + + 蜂箱{{fxtxt}}预警范围 + + + 低于 {{danwei}}或高于 {{danwei}}时 + + + + 取消 + + + 确定 + + + + @@ -79,19 +99,79 @@ bgc: { backgroundColor: " #F4FAF8", }, - title: "添加视频监控", - checked:false - + title: "预警设置", + apiaryId:'', + fxtxt:'', + danwei:'', + di:'', + gao:'', + form:{ + enableTemperature:false, + enableHumidity:false, + enableWeight:false, + enableIo:false, + enablePower:false, + enableHz:false, + enableFence:false, + minTemperature:'', + maxTemperature:'', + minHumidity:'', + maxHumidity:'', + minWeight:'', + maxWeight:'', + minIo:'', + maxIo:'', + minPower:'', + minHz:'', + maxHz:'', + minFence:'', + }, + maskflag:false } }, - onLoad() { - + onLoad(option) { + this.apiaryId = option.apiaryId + this.getlist() }, onShow() { - + }, methods: { - + btnqx(){ + this.maskflag = false + }, + btnfx(num){ + this.maskflag = true + if(num == 1){ + this.danwei = '℃' + this.fxtxt = '温度' + }else if(num == 2){ + this.danwei = '℃' + this.fxtxt = '湿度' + }else if(num == 5){ + this.danwei = '℃' + this.fxtxt = '电量' + } else if(num == 3){ + this.danwei = 'g' + this.fxtxt = '重量' + }else if(num == 4){ + this.danwei = '只' + this.fxtxt = '进出量' + }else if(num == 6){ + this.danwei = '' + this.fxtxt = '频率' + }else if(num == 7){ + this.danwei = 'Km' + this.fxtxt = '范围' + } + }, + getlist(){ + this.$u.get(`/farm/warnSetting/apiary/${this.apiaryId}`).then(res => { + if(res.code == 200){ + this.form = res.data + } + }) + } } } @@ -105,6 +185,87 @@ // position: relative; padding-bottom: 200rpx; width: 750rpx; + .mask{ + position: fixed; + top: 0; + left: 0; + z-index: 97; + width: 100%; + height: 100vh; + background: rgba(61,61,61,0.2); + } + .tanc{ + width: 594rpx; + height: 420rpx; + background: #FFFFFF; + border-radius: 30rpx 30rpx 30rpx 30rpx; + position: fixed; + left: 50%; + transform: translateX(-50%); + top: 506rpx; + z-index: 98; + .anniu{ + display: flex; + justify-content: space-between; + padding: 0 44rpx; + box-sizing: border-box; + margin-top: 64rpx; + width: 100%; + .qux{ + width: 234rpx; + height: 80rpx; + border-radius: 40rpx 40rpx 40rpx 40rpx; + border: 2rpx solid #FFC107; + font-size: 36rpx; + color: #FFC107; + text-align: center; + line-height: 80rpx; + } + .qd{ + width: 234rpx; + height: 80rpx; + background: #FFC107; + border-radius: 40rpx 40rpx 40rpx 40rpx; + font-size: 36rpx; + color: #FFFFFF; + text-align: center; + line-height: 80rpx; + } + } + .shuzhi{ + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 60rpx; + margin-top: 50rpx; + box-sizing: border-box; + input{ + width: 96rpx; + height: 76rpx; + border-radius: 10rpx 10rpx 10rpx 10rpx; + border: 2rpx solid #808080; + padding-left: 30rpx; + box-sizing: border-box; + } + } + .top{ + font-weight: 600; + font-size: 36rpx; + color: #3D3D3D; + width: 100%; + text-align: center; + padding-top: 40rpx; + box-sizing: border-box; + } + image{ + width: 198rpx; + height: 172rpx; + position: absolute; + top: 12rpx; + right: 20rpx; + opacity: .5; + } + } .tit { margin-right: 49rpx; display: flex; diff --git a/pages/map.vue b/pages/map.vue index dda2b67..d6ff781 100644 --- a/pages/map.vue +++ b/pages/map.vue @@ -4,7 +4,7 @@ title-size='36' :title-bold='true' height='45' id="navbar"> + :show-location='true' :markers="covers"> @@ -63,10 +63,6 @@ } }, methods: { - // 点击地图图标 - handleMarkerClick(e) { - console.log(e.markerId); - }, getMyLocations() { uni.getLocation({ @@ -82,7 +78,7 @@ this.listmaps = res.data res.data.forEach(item => { this.covers.push({ - id: parseFloat(item.beehiveId), + markerId:parseFloat(item.beehiveId), latitude: item.lat, longitude: item.lng, width: 25, @@ -141,7 +137,7 @@ this.listmap = res.data res.data.forEach(item => { this.covers.push({ - id: parseFloat(item.apiaryId), + markerId:parseFloat(item.apiaryId), latitude: item.lat, longitude: item.lng, width: 25,