Browse Source

巡园详情 添加异常修改功能

master
邓宏 11 months ago
parent
commit
2c6d8e2ccf
  1. 69
      pages/patrolGarden/detail.vue

69
pages/patrolGarden/detail.vue

@ -2,7 +2,7 @@
.container{
min-height: 100%;
background:#f6f6f6;
padding-top:30rpx;
padding:30rpx 0 1rpx 0;
.card{
margin-top:0;
position:relative;
@ -110,29 +110,18 @@
<text class="label">位置</text>
<text class="val">{{record.position}}</text>
</view>
<view class="item block">
<text class="label">凭证</text>
<view class="imgs">
<image v-for="(v,k) in ((record.pic||'').split(',').filter(v=>v)||[])" :key="k" :src="`${host}/${v}`"/>
</view>
</view>
<view class="item block">
<text class="label">描述</text>
<text class="dec">{{record.remark}}</text>
</view>
<view class="item block">
<text class="label">是否处理</text>
<u-radio-group :value="record.flagDeal" activeColor="#10C176">
<u-radio label="是" name="1" :customStyle="{marginRight: '8px'}"/>
<u-radio label="否" name="0"/>
</u-radio-group>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存修改</button>
</view>
<u-form v-if="record" class="inline" :model="record" :rules="rules" ref="form" labelWidth="auto" errorType="toast">
<d-form label="凭证" required field="pic" :num="3" type="upImg" :value="record.imgs" @imgs="record.pic=$event"/>
<d-form label="描述" type="textarea" v-model="record.remark"/>
<d-form label="是否处理" type="radio" :columns="[{label:'是',value:'1'},{label:'否',value:'0'}]" v-model="record.flagDeal"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存修改</button>
</view>
</view>
</template>
<script>
import {host} from '@/common/request'
import request,{host} from '@/common/request'
export default {
data(){
return{
@ -141,6 +130,9 @@ export default {
host:host('imgUrl'),
detail:{},
record:null,
rules:{
pic:{requried:true,message:"请上传凭证!",trigger:'blur'},
},
eventChannel:null,
}
},
@ -148,7 +140,7 @@ export default {
this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail",e=>{
this.detail=e
/* #ifdef APP-PLUS */
if(this.detail.detailVos){
for(var i in this.detail.detailVos){
@ -156,8 +148,14 @@ export default {
marker.setIcon(`/static/patrolGarden/${({0:'unhandle',1:'handle'})[this.detail.detailVos[i].flagDeal]}.png?i=${i}`)
marker.setLabel(this.detail.detailVos[i].position)
marker.onclick=e=>{
this.record=this.detail.detailVos[e.icon.match(/i=(\d+)/)[1]]
var val=this.detail.detailVos[e.icon.match(/i=(\d+)/)[1]]
this.record={
...val,
imgs:(val.pic||'').split(',').filter(v=>v),
index:e.icon.match(/i=(\d+)/)[1],
}
}
this.detail.detailVos[i].marker=marker
this.maps.addOverlay(marker)
}
this.maps.setCenter(new plus.maps.Point(this.detail.detailVos[0].lng, this.detail.detailVos[0].lat))
@ -169,7 +167,32 @@ export default {
/* #endif */
},
methods:{
submit(){},
async submit(){
this.$refs.form.validate().then(async valid=>{
if(valid){
var res=await request("/api/basetour/updateTourDetailInfo",{
method:"post",
body: {
id:this.record.id,
pic:this.record.pic,
remark:this.record.remark,
flagDeal:this.record.flagDeal,
}
})
if(res.statu){
uni.showToast({title:"修改成功",icon:"success"})
this.detail.detailVos[this.record.index]=this.record
this.detail.detailVos[this.record.index].marker.setIcon(`/static/patrolGarden/${({0:'unhandle',1:'handle'})[this.record.flagDeal]}.png?i=${this.record.index}`)
}else{
uni.showModal({
title:"提示",
content:res.msg||"修改失败!",
showCancel:false,
})
}
}
})
},
}
}
</script>
Loading…
Cancel
Save