|
@@ -1,41 +1,60 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view>
|
|
|
|
|
- <view class="status_bar"></view>
|
|
|
|
|
- <view class="" style="position: relative;top: 40px;">
|
|
|
|
|
- <view style="position: fixed;z-index: 100;">
|
|
|
|
|
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="修改名称"></uni-nav-bar>
|
|
|
|
|
|
|
+ <view class="modification">
|
|
|
|
|
+ <view class="modification__header">
|
|
|
|
|
+ <u-icon
|
|
|
|
|
+ size="36"
|
|
|
|
|
+ class="arrow-left"
|
|
|
|
|
+ name="arrow-left"
|
|
|
|
|
+ @click="handleBack"
|
|
|
|
|
+ ></u-icon>
|
|
|
|
|
+ 信息修改
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content">
|
|
|
|
|
+ <view class="modification__content__item">
|
|
|
|
|
+ <view class="modification__content__item__title">
|
|
|
|
|
+ 设备名称
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content__item__input">
|
|
|
|
|
+ <u-input v-model="moddata.device_name" placeholder="请输入设备名称" clearable class="input" :custom-style="{ 'text-align': 'right' }"></u-input>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="mod">
|
|
|
|
|
- <view class="mod_name">
|
|
|
|
|
- <p>
|
|
|
|
|
- <text style="color: #ff0000;">*</text>设备名称</p>
|
|
|
|
|
- <input type="text" v-model="moddata.device_name" :class="quanxian.namealter?'namebg':''" />
|
|
|
|
|
|
|
+ <view class="modification__content__item">
|
|
|
|
|
+ <view class="modification__content__item__title">
|
|
|
|
|
+ 设备ID
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="mod_id">
|
|
|
|
|
- <p>设备ID</p>
|
|
|
|
|
- <input type="text" :value="moddata.imei || moddata.device_id || moddata.id" disabled />
|
|
|
|
|
|
|
+ <view class="modification__content__item__input">
|
|
|
|
|
+ <u-input disabled :value="moddata.imei || moddata.device_id || moddata.id" placeholder="请输入设备ID" clearable class="input" :custom-style="{ 'text-align': 'right' }"></u-input>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="mod_user">
|
|
|
|
|
- <p>适配用户</p>
|
|
|
|
|
- <input type="text" :value="moddata.real_name==''?'无':moddata.real_name" disabled />
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content__item">
|
|
|
|
|
+ <view class="modification__content__item__title">
|
|
|
|
|
+ 适配用户
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="mod_city">
|
|
|
|
|
- <view style="width: 90%;">
|
|
|
|
|
- <p><span style="color: #ff0000;" v-if="quanxian.cityalter">*</span>设备位置</p>
|
|
|
|
|
- <input type="text" :value="city" disabled />
|
|
|
|
|
- </view>
|
|
|
|
|
- <!-- <u-icon name="arrow-right"></u-icon> -->
|
|
|
|
|
|
|
+ <view class="modification__content__item__input">
|
|
|
|
|
+ <u-input disabled :value="moddata.real_name || '无'" placeholder="请输入用户名" clearable class="input" :custom-style="{ 'text-align': 'right' }"></u-input>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="mod_time">
|
|
|
|
|
- <p>设备添加时间</p>
|
|
|
|
|
- <input type="text" :value="moddata.addtime|timeFormat()" disabled />
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content__item">
|
|
|
|
|
+ <view class="modification__content__item__title">
|
|
|
|
|
+ 设备位置
|
|
|
</view>
|
|
</view>
|
|
|
- <p style="width: 90%;margin: 0 auto;text-align: right;color: #06B535;"><span style="color: #ff0000;">*</span>为可修改</p>
|
|
|
|
|
- <view class="sub" @click="btn">
|
|
|
|
|
- 提 交
|
|
|
|
|
|
|
+ <view class="modification__content__item__input" @click.native="amendcity">
|
|
|
|
|
+ <view class="location-city">{{ city }}</view>
|
|
|
|
|
+ <u-icon name="arrow-right"></u-icon>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content__item">
|
|
|
|
|
+ <view class="modification__content__item__title">
|
|
|
|
|
+ 设备添加时间
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="modification__content__item__input">
|
|
|
|
|
+ <u-input disabled :value="moddata.addtime | timeFormat()" placeholder="请输入设备添加时间" clearable class="input" :custom-style="{ 'text-align': 'right' }"></u-input>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="sub" @click="btn">
|
|
|
|
|
+ 提 交
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -46,6 +65,8 @@
|
|
|
moddata: [],
|
|
moddata: [],
|
|
|
city: "",
|
|
city: "",
|
|
|
selectcityTF: false,
|
|
selectcityTF: false,
|
|
|
|
|
+ locationCity: "",
|
|
|
|
|
+ locationName: "",
|
|
|
quanxian:{
|
|
quanxian:{
|
|
|
namealter:false,
|
|
namealter:false,
|
|
|
cityalter:false,
|
|
cityalter:false,
|
|
@@ -54,7 +75,12 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- async eqlistcity(lat, lng) { //修改设备定位
|
|
|
|
|
|
|
+ handleBack() {
|
|
|
|
|
+ uni.navigateBack({
|
|
|
|
|
+ delta: 1
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ async eqlistcity(lat, lng) {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.revise_device',
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.revise_device',
|
|
|
data: {
|
|
data: {
|
|
@@ -63,8 +89,7 @@
|
|
|
lng: lng
|
|
lng: lng
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- console.log(res)
|
|
|
|
|
- if (res==false) {
|
|
|
|
|
|
|
+ if (!res) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '修改地址失败!',
|
|
title: '修改地址失败!',
|
|
|
icon: "none"
|
|
icon: "none"
|
|
@@ -76,7 +101,7 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- async eqlistname(lat, lng) { //修改设备名称
|
|
|
|
|
|
|
+ async eqlistname(lat, lng) {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.revise_device',
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.revise_device',
|
|
|
data: {
|
|
data: {
|
|
@@ -86,8 +111,7 @@
|
|
|
lng: lng,
|
|
lng: lng,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- console.log(res)
|
|
|
|
|
- if (res==false) {
|
|
|
|
|
|
|
+ if (!res) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '修改名称失败!',
|
|
title: '修改名称失败!',
|
|
|
icon: "none"
|
|
icon: "none"
|
|
@@ -103,7 +127,7 @@
|
|
|
this.clickLeft()
|
|
this.clickLeft()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- async eqlistuser(id, imei,device_model) { //获取设备信息
|
|
|
|
|
|
|
+ async eqlistuser(id, imei,device_model) {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
|
|
|
data: {
|
|
data: {
|
|
@@ -113,39 +137,66 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
this.moddata = res.data[0]
|
|
this.moddata = res.data[0]
|
|
|
- console.log(res)
|
|
|
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
|
},
|
|
},
|
|
|
- async xyeqlistuser(imei) { //获取设备信息
|
|
|
|
|
|
|
+ async xyeqlistuser(imei) {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_list',
|
|
url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_list',
|
|
|
data: {
|
|
data: {
|
|
|
device_id: imei,
|
|
device_id: imei,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- console.log(res)
|
|
|
|
|
this.moddata = res.data[0]
|
|
this.moddata = res.data[0]
|
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
|
},
|
|
},
|
|
|
btn() {
|
|
btn() {
|
|
|
- // this.eqlistcity(this.moddata.lat, this.moddata.lng)
|
|
|
|
|
this.eqlistname(this.moddata.lat, this.moddata.lng)
|
|
this.eqlistname(this.moddata.lat, this.moddata.lng)
|
|
|
},
|
|
},
|
|
|
clickLeft() {
|
|
clickLeft() {
|
|
|
uni.navigateBack({
|
|
uni.navigateBack({
|
|
|
delta:1,
|
|
delta:1,
|
|
|
success:()=>{
|
|
success:()=>{
|
|
|
- //告知上一页刷新数据
|
|
|
|
|
uni.$emit('refreshData')
|
|
uni.$emit('refreshData')
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- amendcity() { //修改设备地址
|
|
|
|
|
- this.selectcityTF = true
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: "/pages/fourBase/city"
|
|
|
|
|
|
|
+ getCity({city}){
|
|
|
|
|
+ if(city.city == undefined){
|
|
|
|
|
+ var add = city
|
|
|
|
|
+ }else if(city.city != undefined){
|
|
|
|
|
+ var add = city.city
|
|
|
|
|
+ }
|
|
|
|
|
+ let pages = getCurrentPages()
|
|
|
|
|
+ let prevpage = pages[pages.length - 2]
|
|
|
|
|
+ prevpage.$vm.city = add
|
|
|
|
|
+ uni.navigateBack({
|
|
|
|
|
+ delta: 1
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ selectedCity(city){
|
|
|
|
|
+ this.getCity && this.getCity({city});
|
|
|
|
|
+ },
|
|
|
|
|
+ location(){
|
|
|
|
|
+ let That = this;
|
|
|
|
|
+ uni.chooseLocation({
|
|
|
|
|
+ success(res){
|
|
|
|
|
+ uni.setStorage({
|
|
|
|
|
+ key:"location",
|
|
|
|
|
+ data:[res.longitude,res.latitude]
|
|
|
|
|
+ })
|
|
|
|
|
+ That.city = res && res.address;
|
|
|
|
|
+ That.locationName = res && res.name;
|
|
|
|
|
+ That.selectedCity({city:That.city,name:That.locationName});
|
|
|
|
|
+ },
|
|
|
|
|
+ fail(){
|
|
|
|
|
+ That.locationCity = "定位失败,请点击重试";
|
|
|
|
|
+ That.locationName = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ amendcity() {
|
|
|
|
|
+ this.location()
|
|
|
|
|
+ },
|
|
|
selectaddress(lng, lat) { //获取分布位置
|
|
selectaddress(lng, lat) { //获取分布位置
|
|
|
uni.request({
|
|
uni.request({
|
|
|
type: "GET",
|
|
type: "GET",
|
|
@@ -153,7 +204,6 @@
|
|
|
"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
|
|
"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
|
|
|
dataType: "json",
|
|
dataType: "json",
|
|
|
complete: ress => {
|
|
complete: ress => {
|
|
|
- // console.log(ress)
|
|
|
|
|
if (ress.data.regeocode.formatted_address.length == 0) {
|
|
if (ress.data.regeocode.formatted_address.length == 0) {
|
|
|
this.city = "--"
|
|
this.city = "--"
|
|
|
} else {
|
|
} else {
|
|
@@ -164,8 +214,7 @@
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
|
- console.log(option)
|
|
|
|
|
- if(option.id==10){
|
|
|
|
|
|
|
+ if(option.id == 10){
|
|
|
const data = JSON.parse(option.data)
|
|
const data = JSON.parse(option.data)
|
|
|
this.xyeqlistuser(data.device_id || data.id)
|
|
this.xyeqlistuser(data.device_id || data.id)
|
|
|
}else{
|
|
}else{
|
|
@@ -175,23 +224,22 @@
|
|
|
uni.getStorage({
|
|
uni.getStorage({
|
|
|
key:"jurisdiction",
|
|
key:"jurisdiction",
|
|
|
success:(res)=>{
|
|
success:(res)=>{
|
|
|
- console.log(JSON.parse(res.data))
|
|
|
|
|
if(!res?.data){
|
|
if(!res?.data){
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
let items = JSON.parse(res.data).filter((item)=>{
|
|
let items = JSON.parse(res.data).filter((item)=>{
|
|
|
return item.purview_name == "设备管理"
|
|
return item.purview_name == "设备管理"
|
|
|
})
|
|
})
|
|
|
- let items2 = items[0].children.filter((item)=>{
|
|
|
|
|
|
|
+ let items2 = items[0]?.children?.filter((item)=>{
|
|
|
return item.purview_name == "设备列表"
|
|
return item.purview_name == "设备列表"
|
|
|
})
|
|
})
|
|
|
- this.quanxian.namealter = items2[0].children.some((item)=>{
|
|
|
|
|
|
|
+ this.quanxian.namealter = items2[0]?.children?.some((item)=>{
|
|
|
return item.purview_name == "修改名称"
|
|
return item.purview_name == "修改名称"
|
|
|
})
|
|
})
|
|
|
- this.quanxian.cityalter = items2[0].children.some((item)=>{
|
|
|
|
|
|
|
+ this.quanxian.cityalter = items2[0]?.children?.some((item)=>{
|
|
|
return item.purview_name == "添加位置"
|
|
return item.purview_name == "添加位置"
|
|
|
})
|
|
})
|
|
|
- this.quanxian.infoalter = items2[0].children.some((item)=>{
|
|
|
|
|
|
|
+ this.quanxian.infoalter = items2[0]?.children?.some((item)=>{
|
|
|
return item.purview_name == "修改名称" || item.purview_name == "添加位置"
|
|
return item.purview_name == "修改名称" || item.purview_name == "添加位置"
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -201,66 +249,84 @@
|
|
|
uni.getStorage({
|
|
uni.getStorage({
|
|
|
key: "location",
|
|
key: "location",
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
|
- // console.log(res);
|
|
|
|
|
this.moddata.lat = res.data[1]
|
|
this.moddata.lat = res.data[1]
|
|
|
this.moddata.lng = res.data[0]
|
|
this.moddata.lng = res.data[0]
|
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
this.selectaddress(this.moddata.lng, this.moddata.lat)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
|
page{
|
|
page{
|
|
|
- background-color: #FAFAFA;
|
|
|
|
|
|
|
+ background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
|
|
|
}
|
|
}
|
|
|
- .mod {
|
|
|
|
|
|
|
+ .modification{
|
|
|
|
|
+ display: flex;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- position: absolute;
|
|
|
|
|
- top: 44px;
|
|
|
|
|
- .mod_name,
|
|
|
|
|
- .mod_id,
|
|
|
|
|
- .mod_user,
|
|
|
|
|
- .mod_time {
|
|
|
|
|
- width: 90%;
|
|
|
|
|
- margin: 30rpx auto;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- background-color: #FFFFFF;
|
|
|
|
|
- padding: 20rpx 10rpx;
|
|
|
|
|
- color: #57C77A;
|
|
|
|
|
- line-height: 50rpx;
|
|
|
|
|
- .namebg{
|
|
|
|
|
- background-color: #FAFAFA;
|
|
|
|
|
- }
|
|
|
|
|
- input {
|
|
|
|
|
- text-align: right;
|
|
|
|
|
- font-size: 28rpx;
|
|
|
|
|
- padding: 10rpx;
|
|
|
|
|
|
|
+ height: calc(100vh - 112rpx);
|
|
|
|
|
+ padding-top: 112rpx;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ overflow-y: scroll;
|
|
|
|
|
+ &__header{
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #042118;
|
|
|
|
|
+ font-family: 'Source Han Sans CN VF';
|
|
|
|
|
+ font-weight: 700;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ .arrow-left {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 32rpx;
|
|
|
|
|
+ margin-right: 12rpx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .mod_city{
|
|
|
|
|
- width: 90%;
|
|
|
|
|
- margin: 30rpx auto;
|
|
|
|
|
- background-color: #FFFFFF;
|
|
|
|
|
- padding: 20rpx 10rpx;
|
|
|
|
|
- color: #57C77A;
|
|
|
|
|
- line-height: 50rpx;
|
|
|
|
|
|
|
+ &__content{
|
|
|
|
|
+ width: calc(100% - 64rpx);
|
|
|
|
|
+ margin-top: 32rpx;
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ border-radius: 16rpx;
|
|
|
|
|
+ padding: 32rpx;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ }
|
|
|
|
|
+ &__content__item{
|
|
|
display: flex;
|
|
display: flex;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ margin-bottom: 32rpx;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
- .namebg{
|
|
|
|
|
- background-color: #FAFAFA;
|
|
|
|
|
- }
|
|
|
|
|
- input {
|
|
|
|
|
- width: 90%;
|
|
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ &__content__item__title{
|
|
|
|
|
+ width: 180rpx;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #333333;
|
|
|
|
|
+ font-family: 'Source Han Sans CN VF';
|
|
|
|
|
+ }
|
|
|
|
|
+ &__content__item__input{
|
|
|
|
|
+ font-size: 26rpx;
|
|
|
|
|
+ color: #042118;
|
|
|
|
|
+ font-family: 'Source Han Sans CN VF';
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ display:flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ .location-city{
|
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
|
- padding: 10rpx;
|
|
|
|
|
|
|
+ color:#333333;
|
|
|
|
|
+ }
|
|
|
|
|
+ .u-icon--right{
|
|
|
|
|
+ color:#999999;
|
|
|
|
|
+ margin-left: 12rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .input{
|
|
|
|
|
+ font-size: 26rpx;
|
|
|
|
|
+ text-align: right;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ color: #333333;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
.sub {
|
|
.sub {
|
|
|
width: 90%;
|
|
width: 90%;
|
|
|
margin: 30rpx auto;
|
|
margin: 30rpx auto;
|
|
@@ -268,7 +334,8 @@
|
|
|
height: 70rpx;
|
|
height: 70rpx;
|
|
|
line-height: 70rpx;
|
|
line-height: 70rpx;
|
|
|
background-color: #57C77A;
|
|
background-color: #57C77A;
|
|
|
- border-radius: 35rpx;
|
|
|
|
|
|
|
+ border-radius: 16rpx;
|
|
|
color: #FFFFFF;
|
|
color: #FFFFFF;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|