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