修改路段回显

This commit is contained in:
xiao-fajia 2024-10-04 23:11:37 +08:00
parent 7960eb6a90
commit 7e5a0ded48

View File

@ -89,7 +89,7 @@
<view class="dix"> <view class="dix">
<text class="huiy">路段:</text> <text class="huiy">路段:</text>
<text>{{detailsData.sectionRoad || ''}}</text> <text @click="getRoadList()" <text>{{detailsData.sectionRoad ? getSectionRoadLabel(detailsData.sectionRoad) : ''}}</text> <text @click="getRoadList()"
style="margin-left: 20px;color:blue;font-size: 12px;"> style="margin-left: 20px;color:blue;font-size: 12px;">
点击选择</text> 点击选择</text>
</view> </view>
@ -284,12 +284,20 @@
this.id = option.id this.id = option.id
this.getrescueDetail(option.id) this.getrescueDetail(option.id)
this.newtwo() this.newtwo()
this.getRoadList(false);
}, },
onShow() { onShow() {
}, },
methods: { methods: {
//
getSectionRoadLabel(id){
if(typeof id === 'string'){
id = parseInt(id)
}
return this.roadList.find(item => item.id === id)?.label
},
chooseRoad(data) { chooseRoad(data) {
console.log(data); console.log(data);
this.detailsData.sectionRoad = data.value[0].id this.detailsData.sectionRoad = data.value[0].id
@ -299,12 +307,12 @@
this.carNumShow = false this.carNumShow = false
this.detailsData.driverCarNum = data.value[0].rescueCarNum this.detailsData.driverCarNum = data.value[0].rescueCarNum
}, },
getRoadList() { getRoadList(flag = true) {
request({ request({
url: '/system/rescueInfo/getRescueRoad', url: '/system/rescueInfo/getRescueRoad',
method: 'get' method: 'get'
}).then((res) => { }).then((res) => {
this.roadShow = true this.roadShow = flag
this.roadList = res.data this.roadList = res.data
}) })
}, },