You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
298 lines
7.2 KiB
298 lines
7.2 KiB
<template> |
|
<view class="container"> |
|
<uni-forms ref="form" :modelValue="form" :rules="rules" class="padding-wrap" label-position="top"> |
|
<uni-forms-item label="楼号" name="buildId" label-width="200upx"> |
|
<uni-easyinput trim="all" v-model="form.buildId" placeholder="请输入楼号"></uni-easyinput> |
|
</uni-forms-item> |
|
<uni-forms-item label="楼层" name="floorNo" label-width="200upx"> |
|
<uni-easyinput trim="all" v-model="form.floorNo" placeholder="请输入楼层"></uni-easyinput> |
|
</uni-forms-item> |
|
<uni-forms-item label="经纬度" label-width="200upx"> |
|
<view class="choose-map" @click="goMap" :style="{color:form.xy? '#000' : '#C4C7CB'}">{{form.xy ? form.xy : '请选择地图定位'}}</view> |
|
</uni-forms-item> |
|
<uni-forms-item label="应急预案报警类型" name="planTypeId" label-width="300upx"> |
|
<uni-data-select v-model="form.planTypeId" :localdata="planTypeList" placeholder="请选择常应急预案报警类型"></uni-data-select> |
|
</uni-forms-item> |
|
<view class="btn-box"> |
|
<view class="submit-btn" @click="submit">保 存</view> |
|
</view> |
|
</uni-forms> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
data() { |
|
return { |
|
form: { |
|
employeeId: '', |
|
buildId: '1', |
|
floorNo: '', |
|
longidute: '', |
|
latidute: '', |
|
planTypeId: '', |
|
planTypeName: '', |
|
xy: '' |
|
}, |
|
rules: { |
|
buildId: { |
|
rules: [{ |
|
required: true, |
|
errorMessage: '请输入楼号' |
|
}] |
|
}, |
|
floorNo: { |
|
rules: [{ |
|
required: true, |
|
errorMessage: '请输入楼层' |
|
}] |
|
}, |
|
}, |
|
planTypeList: [],//应急预案类型 |
|
userInfo: {} |
|
} |
|
}, |
|
onShow() { |
|
uni.$on('mapData',(data) => { |
|
let obj = JSON.parse(data.data[0].detail); |
|
console.log('监听到事件来自返回的参数:', JSON.stringify(obj)); |
|
this.form.xy = obj.x + ',' + obj.y; |
|
this.form.buildId = obj.buildId; |
|
if(obj.floorNo) { |
|
this.form.floorNo = obj.floorNo > 3 ? obj.floorNo - 3 : obj.floorNo > 0 && obj.floorNo <= 3 ? obj.floorNo - 4 : obj.floorNo; |
|
} |
|
this.form.latidute = obj.y; |
|
this.form.longidute = obj.x; |
|
console.log(JSON.stringify(this.form)) |
|
}) |
|
}, |
|
onUnload() { |
|
console.log('释放监听') |
|
uni.$off('mapData'); |
|
}, |
|
onLoad() { |
|
this.queryPlanTypeList(); |
|
let userInfo = uni.getStorageSync('mobileInfo'); |
|
let locationInfo = uni.getStorageSync('locationInfo'); |
|
if(userInfo){ |
|
this.userInfo = JSON.parse(userInfo); |
|
this.form.employeeId = this.userInfo.employeeId; |
|
} |
|
if (locationInfo) { |
|
console.log(JSON.stringify(locationInfo)) |
|
this.locationInfo = JSON.parse(locationInfo); |
|
this.form.planTypeId = this.locationInfo.planTypeId; |
|
this.form.planTypeName = this.locationInfo.planTypeName; |
|
this.form.buildId = this.locationInfo.buildId; |
|
this.form.floorNo = this.locationInfo.floorNo; |
|
this.form.latidute = this.locationInfo.latidute; |
|
this.form.longidute = this.locationInfo.longidute; |
|
this.form.xy = this.locationInfo.longidute + ',' + this.locationInfo.latidute; |
|
console.log(JSON.stringify(this.form)) |
|
} |
|
}, |
|
methods: { |
|
//跳到地图页面获取定位 |
|
goMap() { |
|
console.log('页面跳转') |
|
uni.navigateTo({ |
|
url: '/pages/map/map' |
|
}) |
|
}, |
|
//预案类型 |
|
queryPlanTypeList() { |
|
uni.request({ |
|
// url: "http://172.19.2.177:8081/GetAllPlanInfo", |
|
url: getApp().globalData.mobileUrl + "/GetAllPlanInfo", |
|
success: (res) => { |
|
if(res.data.code == 200) { |
|
res.data.data.forEach(item => { |
|
item.value = item.planId; |
|
item.text = item.planName; |
|
}) |
|
this.planTypeList = res.data.data; |
|
} |
|
} |
|
}) |
|
}, |
|
submit() { |
|
this.$refs.form.validate().then(res => { |
|
if(this.form.xy == ''){ |
|
uni.showToast({ |
|
title: '请选择地图定位', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
uni.setStorageSync("locationInfo",JSON.stringify(this.form));//测试使用 |
|
uni.navigateBack(); |
|
console.log('form ====>',this.form) |
|
// uni.request({ |
|
// url: 'http://172.19.0.11:8081/employee/modify', |
|
// data: this.form, |
|
// method: "POST", |
|
// success: (res) => { |
|
// console.log(res.data); |
|
// uni.showToast({ |
|
// title: '设置成功' |
|
// }); |
|
// uni.setStorageSync("mobileInfo",JSON.stringify(this.form)); |
|
// } |
|
// }); |
|
}).catch(err => { |
|
console.log('表单错误信息:', err); |
|
uni.showToast({ |
|
title: err |
|
}); |
|
}) |
|
} |
|
}, |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
page, |
|
.container { |
|
min-height: 100vh; |
|
background-color: #FFFFFF; |
|
/deep/.uni-forms-item__label{ |
|
color: #031945; |
|
font-size: 28upx; |
|
font-family: PingFang SC-Bold, PingFang SC; |
|
font-weight: bold; |
|
} |
|
/deep/.uni-easyinput__content{ |
|
height: 88upx; |
|
border: 0; |
|
border-bottom: 1px solid #D6D8DF; |
|
border-radius: 0; |
|
} |
|
/deep/.uni-easyinput__content-input{ |
|
font-size: 28upx; |
|
height: 88upx; |
|
} |
|
/deep/.uni-input-placeholder{ |
|
color: #90959D; |
|
font-size: 28upx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
} |
|
/deep/.uni-select{ |
|
height: 88upx; |
|
background: #F6F8FA; |
|
border-radius: 30upx; |
|
padding: 0 15upx 0 30upx; |
|
border: 0; |
|
} |
|
/deep/.uni-select__input-box{ |
|
height: 88upx; |
|
} |
|
/deep/.uni-select__input-placeholder{ |
|
color: #C4C7CB; |
|
font-size: 28upx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
} |
|
/deep/.uni-icons{ |
|
color: #C4C7CB; |
|
font-size: 28upx; |
|
} |
|
} |
|
|
|
.padding-wrap { |
|
padding: 30upx; |
|
} |
|
|
|
.choose-map{ |
|
line-height: 44upx; |
|
color: #C4C7CB; |
|
font-size: 28upx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
text-align: left; |
|
background: #F6F8FA; |
|
border-radius: 30upx; |
|
word-break: break-all; |
|
padding: 22upx 15upx 22upx 33upx; |
|
} |
|
|
|
.voice-rocord-box{ |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-between; |
|
margin-bottom: 40upx; |
|
.voice-box{ |
|
display: flex; |
|
align-items: center; |
|
justify-content: flex-end; |
|
min-width: 300px; |
|
height: 90upx; |
|
background: #338AF8 url(@/static/voive_bg.png) 40upx 28upx no-repeat; |
|
background-size: 226upx 34upx; |
|
border-radius: 100upx; |
|
.voice-mins{ |
|
color: #FFFFFF; |
|
font-size: 28upx; |
|
font-family: Arial-Regular, Arial; |
|
font-weight: 400; |
|
margin-right: 40upx; |
|
} |
|
} |
|
.voice-del{ |
|
color: #B6B8BB; |
|
font-size: 28upx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
margin-left: 20upx; |
|
} |
|
} |
|
|
|
.tab-switch { |
|
display: flex; |
|
justify-content: flex-end; |
|
align-items: center; |
|
|
|
.tab-btn { |
|
display: flex; |
|
width: 80upx; |
|
height: 40upx; |
|
border-radius: 20upx; |
|
background-color: #eee; |
|
margin-right: 10upx; |
|
|
|
.tab-btn-item { |
|
float: right; |
|
width: 36upx; |
|
height: 36upx; |
|
border-radius: 18upx; |
|
background-color: #FFFFFF; |
|
margin: 2upx; |
|
} |
|
|
|
&.active { |
|
background-color: #338AF8; |
|
|
|
.tab-btn-item { |
|
float: left; |
|
} |
|
} |
|
} |
|
} |
|
|
|
.btn-box{ |
|
position: fixed; |
|
left: 30upx; |
|
right: 30upx; |
|
bottom: 100upx; |
|
.submit-btn{ |
|
color: #FFFFFF; |
|
font-size: 22px; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
line-height: 90upx; |
|
text-align: center; |
|
background: #338AF8; |
|
border-radius: 100upx; |
|
} |
|
} |
|
</style> |