Browse Source

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

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

67
pages/patrolGarden/detail.vue

@ -2,7 +2,7 @@
.container{ .container{
min-height: 100%; min-height: 100%;
background:#f6f6f6; background:#f6f6f6;
padding-top:30rpx; padding:30rpx 0 1rpx 0;
.card{ .card{
margin-top:0; margin-top:0;
position:relative; position:relative;
@ -110,29 +110,18 @@
<text class="label">位置</text> <text class="label">位置</text>
<text class="val">{{record.position}}</text> <text class="val">{{record.position}}</text>
</view> </view>
<view class="item block">
<text class="label">凭证</text> <u-form v-if="record" class="inline" :model="record" :rules="rules" ref="form" labelWidth="auto" errorType="toast">
<view class="imgs"> <d-form label="凭证" required field="pic" :num="3" type="upImg" :value="record.imgs" @imgs="record.pic=$event"/>
<image v-for="(v,k) in ((record.pic||'').split(',').filter(v=>v)||[])" :key="k" :src="`${host}/${v}`"/> <d-form label="描述" type="textarea" v-model="record.remark"/>
</view> <d-form label="是否处理" type="radio" :columns="[{label:'是',value:'1'},{label:'否',value:'0'}]" v-model="record.flagDeal"/>
</view> </u-form>
<view class="item block"> <button class="cu-btn round bg-green shadow submit" @click="submit">保存修改</button>
<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>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {host} from '@/common/request' import request,{host} from '@/common/request'
export default { export default {
data(){ data(){
return{ return{
@ -141,6 +130,9 @@ export default {
host:host('imgUrl'), host:host('imgUrl'),
detail:{}, detail:{},
record:null, record:null,
rules:{
pic:{requried:true,message:"请上传凭证!",trigger:'blur'},
},
eventChannel:null, eventChannel:null,
} }
}, },
@ -156,8 +148,14 @@ export default {
marker.setIcon(`/static/patrolGarden/${({0:'unhandle',1:'handle'})[this.detail.detailVos[i].flagDeal]}.png?i=${i}`) marker.setIcon(`/static/patrolGarden/${({0:'unhandle',1:'handle'})[this.detail.detailVos[i].flagDeal]}.png?i=${i}`)
marker.setLabel(this.detail.detailVos[i].position) marker.setLabel(this.detail.detailVos[i].position)
marker.onclick=e=>{ 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.addOverlay(marker)
} }
this.maps.setCenter(new plus.maps.Point(this.detail.detailVos[0].lng, this.detail.detailVos[0].lat)) this.maps.setCenter(new plus.maps.Point(this.detail.detailVos[0].lng, this.detail.detailVos[0].lat))
@ -169,7 +167,32 @@ export default {
/* #endif */ /* #endif */
}, },
methods:{ 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> </script>
Loading…
Cancel
Save