设置返回点

This commit is contained in:
2025-09-17 17:52:04 +08:00
parent 1a1ddd256f
commit b2e1b317cc
6 changed files with 90 additions and 19 deletions

View File

@@ -57,6 +57,22 @@
<input type="checkbox" @click="_backIoStatus">
</div>
</el-row>
<div class="contorl_title">{{$t('Vehiclereturnpoint')}}</div>
<el-row type="flex" align="middle" class="contorl_box">
<el-col :span="14">
<el-select v-model="returnPoint" :placeholder="$t('Pleaseselect')" clearable style="width: 100%;">
<el-option
v-for="item in options"
:key="item.station_id"
:label="item.station_name"
:value="item.station_id">
</el-option>
</el-select>
</el-col>
<el-col :span="6">
<el-button type="primary" size="mini" style="height: .4rem; margin-left: 0.2rem" @click="_updateReturnStation">{{$t('Save')}}</el-button>
</el-col>
</el-row>
</div>
</el-tab-pane>
</el-tabs>
@@ -64,7 +80,7 @@
</template>
<script>
import { rebootVehicle, synchronizedMap, backIoStatus } from '../../config/getData.js'
import { rebootVehicle, synchronizedMap, backIoStatus, updateReturnStation, queryStation, getReturnStation } from '../../config/getData.js'
import { mapGetters, mapActions } from 'vuex'
export default {
data () {
@@ -89,7 +105,9 @@ export default {
{label: '中文', value: 'zh-cn'},
{label: 'English', value: 'en-us'}
// {label: 'Español', value: 'es'}
]
],
returnPoint: '',
options: []
}
},
computed: {
@@ -113,6 +131,7 @@ export default {
this.dataForm.serverIp = this.serverUrl
this.activeName = 'first'
this.dialogVisible = true
this._queryStation()
},
exitUser () {
this.dialogVisible = false
@@ -214,6 +233,44 @@ export default {
this.loading.close()
}
},
async _queryStation () {
try {
let res = await queryStation()
if (res && res.data) {
this.options = [...res.data]
this._getReturnStation()
}
} catch (e) {
this.options = []
}
},
async _getReturnStation () {
try {
let res = await getReturnStation()
if (res) {
this.returnPoint = res.station_id
}
} catch (e) {
this.returnPoint = ''
}
},
async _updateReturnStation () {
try {
this.loading = this.$loading({
lock: true,
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.6)'
})
let res = await updateReturnStation(this.returnPoint)
if (res) {
this.$message(res.message)
}
this.loading.close()
} catch (e) {
this.$message.error(e)
this.loading.close()
}
}
}
}
</script>