完善
This commit is contained in:
parent
f042c7bf6b
commit
d42101a209
|
@ -61,13 +61,15 @@
|
|||
longitude: item.lng,
|
||||
width: 25,
|
||||
height: 25,
|
||||
id: item.id,
|
||||
id: parseFloat(item.id),
|
||||
iconPath: '../../static/蜂场.png',
|
||||
label: {
|
||||
content: item.name,
|
||||
fontSize:14,
|
||||
fontSize:15,
|
||||
anchorX: (() => {
|
||||
if (item.name.length <= 2) {
|
||||
if (item.name.length < 2) {
|
||||
return -6
|
||||
}else if(item.name.length <= 2){
|
||||
return -13
|
||||
} else if (item.name.length <= 3) {
|
||||
return -20
|
||||
|
@ -106,12 +108,14 @@
|
|||
longitude: item.lng,
|
||||
width: 15,
|
||||
height: 15,
|
||||
id: item.id,
|
||||
id: parseFloat(item.id),
|
||||
iconPath: '../../static/a11.png',
|
||||
label: {
|
||||
content: item.name,
|
||||
anchorX: (() => {
|
||||
if (item.name.length <= 2) {
|
||||
if (item.name.length < 2) {
|
||||
return -6
|
||||
}else if(item.name.length <= 2){
|
||||
return -12
|
||||
} else if (item.name.length <= 3) {
|
||||
return -20
|
||||
|
@ -138,14 +142,16 @@
|
|||
longitude: item.lng,
|
||||
width: 15,
|
||||
height: 15,
|
||||
id: item.id,
|
||||
id: parseFloat(item.id),
|
||||
iconPath: '../../static/a22.png',
|
||||
label: {
|
||||
content: item.name,
|
||||
anchorX: (() => {
|
||||
if (item.name.length <= 2) {
|
||||
return -12
|
||||
} else if (item.name.length <= 3) {
|
||||
if (item.name.length < 2) {
|
||||
return -6
|
||||
}else if(item.name.length <= 2){
|
||||
return -12
|
||||
} else if (item.name.length <= 3) {
|
||||
return -20
|
||||
} else if (item.name.length <= 4) {
|
||||
return -25
|
||||
|
@ -184,30 +190,11 @@
|
|||
longitude,
|
||||
width: 1,
|
||||
height: 1,
|
||||
id: 0,
|
||||
id: parseFloat(0),
|
||||
iconPath:'',
|
||||
customCallout: {
|
||||
// anchorY: -5,
|
||||
anchorX: (() => {
|
||||
if (item.name.length <= 2) {
|
||||
return -12
|
||||
} else if (item.name.length <= 3) {
|
||||
return -20
|
||||
} else if (item.name.length <= 4) {
|
||||
return -25
|
||||
} else if (item.name.length <= 5) {
|
||||
return -30
|
||||
} else if (item.name.length <= 6) {
|
||||
return -35
|
||||
} else if (item.name.length <= 8) {
|
||||
return -40
|
||||
} else if (item.name.length <=
|
||||
10) {
|
||||
return -45
|
||||
} else {
|
||||
return -item.name.length * 5
|
||||
}
|
||||
})(),
|
||||
anchorX:-5,
|
||||
display: 'BYCLICK'
|
||||
}
|
||||
})
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<u-tabs :list="tabitems" @click="clicktabs($event)" :current='currentindex'></u-tabs>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view v-if="masks" class="konghezi">
|
||||
<u-empty mode="list" text="暂无蜂箱">
|
||||
|
@ -41,7 +41,7 @@
|
|||
</view>
|
||||
</u-empty>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- listData.length > 0 -->
|
||||
<view v-else style="margin-top: 130rpx;">
|
||||
|
||||
|
@ -265,7 +265,7 @@
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
listid: '',
|
||||
maskgun: false,
|
||||
curren: '',
|
||||
qrcodevalue: '', // 搜索框
|
||||
|
@ -303,7 +303,7 @@
|
|||
total: 0,
|
||||
showflag: false,
|
||||
masks: false,
|
||||
quchongid:''
|
||||
quchongid: ''
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
|
@ -319,7 +319,7 @@
|
|||
this.loadData()
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
}, 5000)
|
||||
}, 3000)
|
||||
// this.cheshi()
|
||||
this.tabitems = [{
|
||||
name: '全部'
|
||||
|
@ -351,7 +351,7 @@
|
|||
},
|
||||
async loadData() {
|
||||
// 先执行获取数据的方法
|
||||
// await this.getfengchangList();
|
||||
await this.getfengchangList();
|
||||
|
||||
// 获取targetId
|
||||
|
||||
|
@ -360,6 +360,7 @@
|
|||
if (targetId) {
|
||||
// 如果存在,赋值给this.checkid
|
||||
this.checkid = targetId;
|
||||
this.quchongid = targetId
|
||||
const index = this.tabitems.findIndex(item => item.id === this.checkid);
|
||||
// 将索引赋值给this.currentindex
|
||||
this.currentindex = index;
|
||||
|
@ -579,12 +580,14 @@
|
|||
title: res.data.msg,
|
||||
})
|
||||
this.showfengzhong = false
|
||||
this.listData = this.listData.filter(items => items.id !== this.listid)
|
||||
this.refresh()
|
||||
})
|
||||
})
|
||||
},
|
||||
// 迁移蜂箱
|
||||
migrtionHive(item) {
|
||||
console.log(item);
|
||||
this.HiddenClick(item)
|
||||
this.curren = item.id
|
||||
// 发请求获取所有蜂场名称
|
||||
|
@ -597,8 +600,9 @@
|
|||
id: e.id
|
||||
})
|
||||
})
|
||||
console.log(this.fengzhongcolumns);
|
||||
this.listid = item.id
|
||||
this.showfengzhong = true
|
||||
this.quchongid = item.apiary_id
|
||||
},
|
||||
// 蜂箱去皮
|
||||
hiveTare(item) {
|
||||
|
@ -656,6 +660,7 @@
|
|||
})
|
||||
},
|
||||
fenx(item) {
|
||||
console.log(item);
|
||||
this.HiddenClick(item)
|
||||
if (item.detail_qrcode) {
|
||||
this.ewmflag = true
|
||||
|
@ -682,9 +687,8 @@
|
|||
title: res.data.msg
|
||||
})
|
||||
})
|
||||
lithis.loadData();
|
||||
// lithis.getfengchangList()
|
||||
lithis.refresh()
|
||||
lithis.listData = lithis.listData.filter(items => items.id !== item.id)
|
||||
// lithis.refresh()
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
})
|
||||
|
@ -695,9 +699,11 @@
|
|||
},
|
||||
// 重命名 用户点击确定
|
||||
confirmname() {
|
||||
request.put('/api/beehive/update/' + this.updataname.id, {
|
||||
name: this.form.inputvalue
|
||||
}).then(res => {
|
||||
let itemToChange = this.listData.find(item => item.id === this.listid)
|
||||
if (itemToChange) {
|
||||
itemToChange.name = this.form.inputvalue
|
||||
}
|
||||
request.put('/api/beehive/update/' + this.updataname.id, {name: this.form.inputvalue}).then(res => {
|
||||
// this.getfengchangList()
|
||||
this.refresh()
|
||||
this.$nextTick(() => {
|
||||
|
@ -706,13 +712,13 @@
|
|||
title: res.data.msg,
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
this.form.inputvalue = ''
|
||||
this.flageupdate()
|
||||
},
|
||||
// 重命名
|
||||
anewname(item) {
|
||||
this.listid = item.id
|
||||
this.backToTop()
|
||||
this.HiddenClick(item)
|
||||
this.updataname.name = item.name
|
||||
|
@ -788,83 +794,73 @@
|
|||
qrcode
|
||||
}
|
||||
}).then(res => {
|
||||
if(res.statusCode == 200){
|
||||
wx.setStorageSync('user_id', res.data.data[0].user_id);
|
||||
this.total = res.data.total
|
||||
if(this.total > 0){
|
||||
if (res.statusCode == 200) {
|
||||
wx.setStorageSync('user_id', res.data.data[0].user_id);
|
||||
this.total = res.data.total
|
||||
if (this.total > 0) {
|
||||
this.masks = false
|
||||
}else{
|
||||
this.masks = true
|
||||
}
|
||||
if (res.data.data.length > 0) {
|
||||
// 有数据,追加到列表
|
||||
// this.listData = this.listData.concat(res.data.data)
|
||||
} else {
|
||||
this.masks = true
|
||||
}
|
||||
if (res.data.data.length > 0) {
|
||||
// 有数据,追加到列表
|
||||
this.listData.push(...res.data.data)
|
||||
if (this.quchongid === '') {
|
||||
if (this.quchongid == '') {
|
||||
let filteredData = this.listData
|
||||
let uniqueIds = new Set()
|
||||
let uniqueData = filteredData.filter(item => {
|
||||
if (!uniqueIds.has(item.id)) {
|
||||
uniqueIds.add(item.id);
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
})
|
||||
uniqueData.sort((a, b) => {
|
||||
// 首先根据 status_text 排序
|
||||
if (a.status_text !== b.status_text) {
|
||||
// 假设 "在线" 应该排在 "离线" 前面
|
||||
return a.status_text === '在线' ? -1 : 1;
|
||||
}
|
||||
|
||||
// status_text 相同,则根据 name 排序
|
||||
// 尝试将 name 转换为数字,如果失败则保留为字符串
|
||||
const numA = Number(a.name);
|
||||
const numB = Number(b.name);
|
||||
|
||||
// 检查 name 是否可以转换为数字
|
||||
if (!isNaN(numA) && !isNaN(numB)) {
|
||||
// 两者都是数字,按数字大小排序
|
||||
return numA - numB;
|
||||
} else if (!isNaN(numA)) {
|
||||
// a 是数字,b 不是数字,数字排前面
|
||||
return -1;
|
||||
} else if (!isNaN(numB)) {
|
||||
// b 是数字,a 不是数字,b 排后面
|
||||
return 1;
|
||||
} else {
|
||||
// 两者都不是数字,按字符串排序
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
});
|
||||
// this.listData = filteredData;
|
||||
this.listData = uniqueData;
|
||||
} else {
|
||||
let filteredData = this.listData.filter(item => item.apiary_id === this.quchongid)
|
||||
let uniqueIds = new Set()
|
||||
let uniqueData = filteredData.filter(item => {
|
||||
if (!uniqueIds.has(item.id)) {
|
||||
uniqueIds.add(item.id);
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
let uniqueIds = new Set()
|
||||
let uniqueData = filteredData.filter(item => {
|
||||
if (!uniqueIds.has(item.id)) {
|
||||
uniqueIds.add(item.id);
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
})
|
||||
this.listData = uniqueData;
|
||||
}
|
||||
|
||||
this.page++
|
||||
}
|
||||
uni.hideLoading()
|
||||
// 停止下拉刷新状态
|
||||
wx.stopPullDownRefresh();
|
||||
// this.$forceUpdate()
|
||||
}else{
|
||||
this.masks = true
|
||||
}
|
||||
uniqueData.sort((a, b) => {
|
||||
if (a.status_text !== b.status_text) {
|
||||
return a.status_text === '在线' ? -1 : 1;
|
||||
}
|
||||
const numA = Number(a.name);
|
||||
const numB = Number(b.name);
|
||||
if (!isNaN(numA) && !isNaN(numB)) {
|
||||
return numA - numB;
|
||||
} else if (!isNaN(numA)) {
|
||||
return -1;
|
||||
} else if (!isNaN(numB)) {
|
||||
return 1;
|
||||
} else {
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
});
|
||||
this.listData = uniqueData
|
||||
} else {
|
||||
let filteredData = this.listData.filter(item => item.apiary_id === this.quchongid)
|
||||
let uniqueIds = new Set()
|
||||
let uniqueData = filteredData.filter(item => {
|
||||
if (!uniqueIds.has(item.id)) {
|
||||
uniqueIds.add(item.id);
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
})
|
||||
if (uniqueData.length > 0) {
|
||||
this.listData = uniqueData
|
||||
} else {
|
||||
this.listData = []
|
||||
}
|
||||
}
|
||||
this.page++
|
||||
}
|
||||
uni.hideLoading()
|
||||
// 停止下拉刷新状态
|
||||
wx.stopPullDownRefresh();
|
||||
// this.$forceUpdate()
|
||||
} else {
|
||||
this.masks = true
|
||||
}
|
||||
}).catch(e => {})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
// 跳转添加蜂箱页面
|
||||
xinzeng() {
|
||||
if (this.tokenflag == true) {
|
||||
|
@ -906,12 +902,16 @@
|
|||
})
|
||||
},
|
||||
clicktabs(event) {
|
||||
console.log(event);
|
||||
if(event.id){
|
||||
if (event.id) {
|
||||
this.quchongid = event.id
|
||||
}else{
|
||||
} else {
|
||||
this.quchongid = ''
|
||||
}
|
||||
if(event.weight == '0KG'){
|
||||
this.listData = []
|
||||
// this.masks = true
|
||||
console.log(this.listData);
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
|
@ -921,12 +921,12 @@
|
|||
if (event.index = 0) {
|
||||
this.checkid = ''
|
||||
this.currentindex = 0
|
||||
|
||||
|
||||
} else {
|
||||
this.checkid = event.id
|
||||
const index = this.tabitems.findIndex(item => item.id === this.checkid);
|
||||
this.currentindex = index
|
||||
|
||||
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.refresh()
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
src="../../static/wode-youjianto.png"
|
||||
/>
|
||||
</view>
|
||||
<view @click="shouhuo" class="button-box flex-row justify-between items-center group_7">
|
||||
<!-- <view @click="shouhuo" class="button-box flex-row justify-between items-center group_7">
|
||||
<text class="font">收货地址</text>
|
||||
<image
|
||||
class="image_6"
|
||||
src="../../static/wode-youjianto.png"
|
||||
/>
|
||||
</view>
|
||||
</view> -->
|
||||
<view @click="shezhi" class="button-box flex-row justify-between items-center group_8">
|
||||
<text class="font text_6">设置</text>
|
||||
<image
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<view class="text-box">蜂场地区</view>
|
||||
<view>
|
||||
<u-button @click="show = true" class="input-b" shape="circle"
|
||||
placeholder="请选择蜂场地区">{{form.address}}</u-button>
|
||||
placeholder="请选择蜂场地区">{{form.area}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 具体位置 -->
|
||||
|
@ -24,7 +24,7 @@
|
|||
<view class="text-box">具体位置</view>
|
||||
<view @click="gotomap">
|
||||
<u--input class="input-b" shape="circle" placeholder="请选择具体位置" border="surround"
|
||||
v-model="form.addresss">{{form.addresss}}</u--input>
|
||||
v-model="form.address">{{form.address}}</u--input>
|
||||
<!-- <view class="input-b">{{form.lng}},{{form.lat}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
@ -91,7 +91,6 @@
|
|||
lng: '',
|
||||
lat: '',
|
||||
address: '',
|
||||
addresss:'',
|
||||
bee_type: '',
|
||||
honey_source: '',
|
||||
remark: '',
|
||||
|
@ -167,9 +166,9 @@
|
|||
uni.chooseLocation({
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.form.lng = res.latitude
|
||||
this.form.lat = res.longitude
|
||||
this.form.addresss = res.address
|
||||
this.form.lng = res.longitude
|
||||
this.form.lat = res.latitude
|
||||
this.form.address = res.address
|
||||
},
|
||||
fail: function(err) {
|
||||
// 检查错误消息,看是否是用户取消了位置选择
|
||||
|
@ -359,7 +358,7 @@
|
|||
confirm(e) {
|
||||
console.log('confirm', e)
|
||||
this.form.area_id = e.areaId[2]
|
||||
this.form.address = e.value.toString()
|
||||
// this.form.address = e.value.toString()
|
||||
this.form.area = e.value.toString()
|
||||
console.log(this.form.area_id, this.form.address)
|
||||
this.show = false
|
||||
|
|
Loading…
Reference in New Issue
Block a user