This commit is contained in:
Sliverber 2024-07-05 14:08:02 +08:00
commit 099e437e42
3 changed files with 70 additions and 71 deletions

View File

@ -84,7 +84,7 @@
</u-checkbox-group> </u-checkbox-group>
</view> </view>
<view class="btn_box"> <view class="btn_box">
<view class="btns"> <view class="btns" @click="btncz">
重置 重置
</view> </view>
<view class="btn1" @click="btnbc"> <view class="btn1" @click="btnbc">
@ -159,6 +159,25 @@
}, },
methods: { methods: {
btncz(){
this.miteInterval = ''
this.minPower = ''
this.minHeat = ''
this.maxHeat = ''
this.maxFan = ''
this.minCo2 = ''
this.maxCo2 = ''
this.list.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
this.lists.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
},
checkboxChange(e) { checkboxChange(e) {
let index = this.value.indexOf(e) let index = this.value.indexOf(e)
if (index > -1) { if (index > -1) {

View File

@ -151,10 +151,10 @@
电子围栏Km 电子围栏Km
</view> </view>
<view class="cont"> <view class="cont">
最大距离 <view class="ipt"><input type="text" class="ips" v-model="code" placeholder=" " 最大距离 <view class="ipt"><input type="text" class="ips" v-model="dzcode" placeholder=" "
placeholder-class="my-placeholder" /></view> placeholder-class="my-placeholder" /></view>
</view> </view>
<view class="btn"> <view class="btn" @click="btnqued">
确定 确定
</view> </view>
</view> </view>
@ -181,18 +181,8 @@
latitude: '', latitude: '',
longitude: '', longitude: '',
isMap: false, isMap: false,
zoomSize: 15, zoomSize: 13,
markers: [{ markers: [],
id: 1,
latitude: 39.90469,
longitude: 116.40717,
title: 'Marker1'
}, {
id: 2,
latitude: 39.90969,
longitude: 116.41217,
title: 'Marker2'
}],
showtq: false, showtq: false,
showwl: false, showwl: false,
apiaryId: '', apiaryId: '',
@ -204,6 +194,7 @@
chartData8: [], chartData8: [],
daytime: '', daytime: '',
covers: [], covers: [],
dzcode:'',
polygons: [{ polygons: [{
// //
points: [], points: [],
@ -242,8 +233,8 @@
id: Number(item.storeId), id: Number(item.storeId),
latitude: item.lat, latitude: item.lat,
longitude: item.lng, longitude: item.lng,
width: 25, width: 20,
height: 30, height: 20,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/ukbyhyrDcp3VzgyeJo2G', iconPath: 'https://api.ccttiot.com/smartmeter/img/static/ukbyhyrDcp3VzgyeJo2G',
}) })
}) })
@ -255,7 +246,31 @@
} }
}); });
}, },
//
btnqued(){
let data = {
apiaryId:this.apiaryId,
radius:this.dzcode
}
this.$u.put(`farm/apiary`,data).then(res =>{
if(res.code == 200){
uni.showToast({
title: '修改成功',
icon: 'none',
duration: 2000
})
this.showwl = false
this.getfcxq()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
btnedfc() { btnedfc() {
uni.navigateTo({ uni.navigateTo({
@ -273,7 +288,6 @@
}) })
}, },
gettq() { gettq() {
console.log(this.latitude, this.longitude);
this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => { this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.daily = res.data.daily this.daily = res.data.daily
@ -314,8 +328,6 @@
let circlePoints = this.calculateCirclePoints(centerLat, centerLon, radius) let circlePoints = this.calculateCirclePoints(centerLat, centerLon, radius)
this.polygons[0].points = circlePoints this.polygons[0].points = circlePoints
console.log(this.polygons[0].points, '圆形电子围栏点')
this.gettq() this.gettq()
this.getmy() this.getmy()
this.getfz() this.getfz()
@ -330,28 +342,28 @@
}, },
// //
calculateCirclePoints(lat, lon, radiusInKm, numPoints = 36) { calculateCirclePoints(lat, lon, radiusInKm, numPoints = 36) {
let earthRadiusKm = 6371; // let earthRadiusKm = 6371
let radius = radiusInKm / earthRadiusKm; // let radius = radiusInKm / earthRadiusKm
let points = []; let points = [];
for (let i = 0; i < numPoints; i++) { for (let i = 0; i < numPoints; i++) {
let angle = (i / (numPoints - 1)) * 2 * Math.PI; // 02π let angle = (i / (numPoints - 1)) * 2 * Math.PI
let latRad = lat * Math.PI / 180; // let latRad = lat * Math.PI / 180
let lonRad = lon * Math.PI / 180; // let lonRad = lon * Math.PI / 180
let newLatRad = Math.asin(Math.sin(latRad) * Math.cos(radius) + let newLatRad = Math.asin(Math.sin(latRad) * Math.cos(radius) +
Math.cos(latRad) * Math.sin(radius) * Math.cos(angle)); Math.cos(latRad) * Math.sin(radius) * Math.cos(angle))
let newLonRad = lonRad + Math.atan2( let newLonRad = lonRad + Math.atan2(
Math.sin(angle) * Math.sin(radius) * Math.cos(latRad), Math.sin(angle) * Math.sin(radius) * Math.cos(latRad),
Math.cos(radius) - Math.sin(latRad) * Math.sin(newLatRad) Math.cos(radius) - Math.sin(latRad) * Math.sin(newLatRad)
); );
let newLat = newLatRad * 180 / Math.PI; let newLat = newLatRad * 180 / Math.PI;
let newLon = (newLonRad + 3 * Math.PI) % (2 * Math.PI) - Math.PI; // -180180 let newLon = (newLonRad + 3 * Math.PI) % (2 * Math.PI) - Math.PI
newLon = newLon * 180 / Math.PI; newLon = newLon * 180 / Math.PI;
points.push({ points.push({
latitude: newLat, latitude: newLat,
longitude: newLon longitude: newLon
}); });
} }
return points; return points
}, },
getmy() { getmy() {
this.$u.get(`/common/getDictByType?dictType=apiary_honey_type`).then(res => { this.$u.get(`/common/getDictByType?dictType=apiary_honey_type`).then(res => {

View File

@ -4,7 +4,7 @@
title-size='36' :title-bold='true' height='45' id="navbar"> title-size='36' :title-bold='true' height='45' id="navbar">
</u-navbar> </u-navbar>
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude" <map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
:show-location='true' :markers="covers"></map> :show-location='true' :markers="covers" @markertap="handleMarkerClick"></map>
<view class="fxtongji"> <view class="fxtongji">
<view class="one"> <view class="one">
@ -36,42 +36,7 @@
longitude: '', longitude: '',
isMap: false, isMap: false,
zoomSize: 15, zoomSize: 15,
markers: [{ markers: [],
id: 1,
latitude: 39.90469,
longitude: 116.40717,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uYrX2QTRLdVVDTB3E5cp',
width: 39,
height: 46,
callout: {
content: '福鼎蜂场福建省宁德市福鼎市太姥山镇秦屿大道二号\n', //
color: '#000', //
fontSize: 14, //
borderRadius: 10, //
bgColor: '#FFFFFF', //
padding: 10, //
display: 'ALWAYS', //
textAlign: 'center', //
}
}, {
id: 2,
latitude: 39.90969,
longitude: 116.41217,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uYrX2QTRLdVVDTB3E5cp',
width: 39,
height: 46,
callout: {
content: '未上架', //
color: '#ffffff', //
fontSize: 14, //
borderRadius: 10, //
bgColor: '#000000', //
padding: 6, //
display: 'ALWAYS', //
}
}],
jinweidu:'', jinweidu:'',
covers: [], covers: [],
mapContext: null, mapContext: null,
@ -98,6 +63,11 @@
} }
}, },
methods: { methods: {
//
handleMarkerClick(e) {
console.log(e.markerId);
},
getMyLocations() { getMyLocations() {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
@ -106,14 +76,13 @@
this.latitude = Number(res.latitude.toFixed(5)) - 0.004 this.latitude = Number(res.latitude.toFixed(5)) - 0.004
this.longitude = Number(res.longitude.toFixed(5)) + 0.004 this.longitude = Number(res.longitude.toFixed(5)) + 0.004
// this.setMapScale() // this.setMapScale()
//
this.$u.get("/farm/beehive/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then( this.$u.get("/farm/beehive/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(
res => { res => {
if (res.code == 200) { if (res.code == 200) {
this.listmaps = res.data this.listmaps = res.data
res.data.forEach(item => { res.data.forEach(item => {
this.covers.push({ this.covers.push({
id: parseFloat(item.storeId), id: parseFloat(item.beehiveId),
latitude: item.lat, latitude: item.lat,
longitude: item.lng, longitude: item.lng,
width: 25, width: 25,
@ -146,7 +115,6 @@
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white', textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
borderColor:'#fff', borderColor:'#fff',
borderRadius:5, borderRadius:5,
// bgColor: 'rgba(255, 255, 255, 0.7)'
} }
}) })
// this.covers.push(shopCover) // this.covers.push(shopCover)
@ -173,7 +141,7 @@
this.listmap = res.data this.listmap = res.data
res.data.forEach(item => { res.data.forEach(item => {
this.covers.push({ this.covers.push({
id: parseFloat(item.storeId), id: parseFloat(item.apiaryId),
latitude: item.lat, latitude: item.lat,
longitude: item.lng, longitude: item.lng,
width: 25, width: 25,