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.
 
 
 
 
 

76 lines
2.2 KiB

<style scoped>
.container{
min-height: 100%;
background:#f6f6f6;
padding:30rpx;
}
</style>
<template>
<view class="container">
<u-form class="card inline" errorType="toast" :model="formData" ref="form" :rules="rules" labelWidth="auto">
<d-form label="当前位置" type="map" @position="formData.lat=$event.latitude;formData.lng=$event.longitude"/>
<d-form label="位置详情" required field="position" v-model="formData.position"/>
<d-form label="地块" type="navigate" required field="plotId" :value="formData.plotName" :btnFun="selectPlot"/>
<d-form label="凭证" required field="pic" :num="3" :value="imgs" type="upImg" @imgs="formData.pic=$event"/>
<d-form label="描述" type="textarea" v-model="formData.remark"/>
<d-form label="是否处理" type="radio" :columns="[{label:'是',value:1},{label:'否',value:0}]" v-model="formData.flagDeal"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存</button>
</view>
</template>
<script>
export default {
data(){
return{
formData:{
lng:"",
lat:"",
position:"",
remark:"",
pic:'',
flagDeal:0,
plotId:"",
plotName:"",
},
imgs:[],
rules:{
pic:{required:true,message:"请上传凭证!",trigger:'blur'},
position:{required:true,message:"请输入位置详情!",trigger:"blur"},
plotId:{required:true,message:"请选择地块!"},
},
eventChannel:null,
}
},
onLoad(){
this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail",e=>{
this.formData=e
this.imgs=(e.pic||"").split(',').filter(v=>v)
})
},
methods:{
submit(){
this.$refs.form.validate().then(async valid=>{
if(valid){
this.eventChannel.emit('update',this.formData)
uni.navigateBack()
}
})
},
selectPlot(){
uni.navigateTo({
url:"/pages/patrolGarden/searchPlot",
events:{update:e=>{
this.formData.plotId=e.map(v=>v.id).join(',')
this.formData.plotName=e.map(v=>v.plotName).join(',')
}},
success: e=>{
var id=this.formData.plotId?.split?.(',')?.filter(v=>v)||[]
var name=this.formData.plotName?.split?.(',')?.filter(v=>v)||[]
e.eventChannel.emit("list", id.map((v,k)=>({id:v, plotName:name[k]})))
}
})
},
}
}
</script>