2025-06-26 17:47:20 +08:00
|
|
|
<template>
|
|
|
|
|
<el-dialog
|
2025-08-14 20:05:52 +08:00
|
|
|
class="config_dialog"
|
2025-06-27 18:16:47 +08:00
|
|
|
:title="$t('Configuration')"
|
2025-06-26 17:47:20 +08:00
|
|
|
:visible.sync="dialogVisible"
|
2025-08-15 14:55:07 +08:00
|
|
|
width="55%"
|
2025-06-26 17:47:20 +08:00
|
|
|
:before-close="handleClose">
|
2025-08-14 20:05:52 +08:00
|
|
|
<el-tabs v-model="activeName">
|
|
|
|
|
<el-tab-pane label="基础配置" name="first">
|
2025-08-15 14:55:07 +08:00
|
|
|
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '1.4rem' : '1.1rem'" size="mini">
|
2025-08-14 20:05:52 +08:00
|
|
|
<p class="tip">{{$t('Languageselection')}}</p>
|
|
|
|
|
<el-form-item :label="$t('Language')" prop="selectedLanguage">
|
|
|
|
|
<el-select v-model="dataForm.selectedLanguage" :placeholder="$t('Pleaseselect')" id="selectedLanguage" style="width: 100%;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in languages"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value">
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<p class="tip">{{$t('Parameterconfiguration')}}</p>
|
|
|
|
|
<el-form-item label="服务IP" prop="serverIp">
|
|
|
|
|
<el-input placeholder="请输入服务IP" v-model="dataForm.serverIp" id="ip" @focus="show" data-layout="normal"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="$t('SchedulingIP')" prop="ip">
|
|
|
|
|
<el-input :placeholder="$t('PleaseIP')" v-model="dataForm.ip" id="ip" @focus="show" data-layout="normal"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="WIFI" prop="wifi">
|
|
|
|
|
<el-input :placeholder="$t('PleaseWIFI')" v-model="dataForm.wifi" id="wifi" @focus="show" data-layout="normal"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
|
|
|
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
|
|
|
|
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="关机重启" name="second">
|
|
|
|
|
<el-row type="flex" justify="center" align="middle" class="tab_wraper">
|
|
|
|
|
<div class="reset" @click="toReboot"></div>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-tab-pane>
|
2025-08-20 17:45:56 +08:00
|
|
|
<el-tab-pane label="同步地图" name="third">
|
|
|
|
|
<el-row type="flex" justify="center" align="middle" class="tab_wraper">
|
|
|
|
|
<button class="button_control" @click="synchronizedMapConfirm"><p>同步地图</p></button>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-tab-pane>
|
2025-08-14 20:05:52 +08:00
|
|
|
</el-tabs>
|
2025-08-11 14:42:41 +08:00
|
|
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
2025-06-26 17:47:20 +08:00
|
|
|
</el-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-20 17:45:56 +08:00
|
|
|
import { rebootVehicle, synchronizedMap } from '../../config/getData.js'
|
2025-08-08 17:44:36 +08:00
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
2025-06-26 17:47:20 +08:00
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2025-08-14 20:05:52 +08:00
|
|
|
activeName: 'first',
|
2025-06-26 17:47:20 +08:00
|
|
|
dialogVisible: false,
|
|
|
|
|
dataForm: {
|
|
|
|
|
selectedLanguage: '',
|
2025-08-08 17:44:36 +08:00
|
|
|
serverIp: '',
|
2025-06-26 17:47:20 +08:00
|
|
|
ip: '',
|
|
|
|
|
wifi: ''
|
|
|
|
|
},
|
|
|
|
|
dataRule: {
|
2025-08-08 17:44:36 +08:00
|
|
|
serverIp: [
|
|
|
|
|
{ required: true, message: '服务IP不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
2025-06-26 17:47:20 +08:00
|
|
|
ip: [
|
2025-06-27 18:16:47 +08:00
|
|
|
{ required: true, message: this.$t('Schedulingnotempty'), trigger: 'blur' }
|
2025-06-26 17:47:20 +08:00
|
|
|
],
|
|
|
|
|
wifi: [
|
2025-06-27 18:16:47 +08:00
|
|
|
{ required: true, message: this.$t('WIFInotempty'), trigger: 'blur' }
|
2025-06-26 17:47:20 +08:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
languages: [
|
2025-06-27 17:07:21 +08:00
|
|
|
{label: '中文', value: 'zh-cn'},
|
|
|
|
|
{label: 'English', value: 'en-us'}
|
|
|
|
|
// {label: 'Español', value: 'es'}
|
2025-06-26 17:47:20 +08:00
|
|
|
],
|
|
|
|
|
visible: false,
|
|
|
|
|
layout: 'normal',
|
|
|
|
|
input: null,
|
|
|
|
|
options: {
|
|
|
|
|
useKbEvents: false,
|
|
|
|
|
preventClickEvent: false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-08-08 17:44:36 +08:00
|
|
|
computed: {
|
|
|
|
|
...mapGetters(['serverUrl']),
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
serverUrl (newVal) {
|
|
|
|
|
if (newVal) {
|
|
|
|
|
this.dataForm.serverIp = newVal
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-06-26 17:47:20 +08:00
|
|
|
methods: {
|
2025-08-08 17:44:36 +08:00
|
|
|
...mapActions(['setServerUrl']),
|
2025-06-26 17:47:20 +08:00
|
|
|
init () {
|
2025-06-27 17:07:21 +08:00
|
|
|
if (this.$i18n.locale === 'zh-cn') {
|
|
|
|
|
this.dataForm.selectedLanguage = 'zh-cn'
|
|
|
|
|
} else if (this.$i18n.locale === 'en-us') {
|
|
|
|
|
this.dataForm.selectedLanguage = 'en-us'
|
|
|
|
|
}
|
2025-08-08 17:44:36 +08:00
|
|
|
this.dataForm.serverIp = this.serverUrl
|
2025-06-26 17:47:20 +08:00
|
|
|
this.dialogVisible = true
|
|
|
|
|
},
|
|
|
|
|
exitUser () {
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.visible = false
|
|
|
|
|
},
|
|
|
|
|
dataFormSubmit () {
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.visible = false
|
2025-06-27 17:07:21 +08:00
|
|
|
this.$i18n.locale = this.dataForm.selectedLanguage
|
|
|
|
|
window.localStorage.setItem('locale', this.dataForm.selectedLanguage)
|
2025-08-08 17:44:36 +08:00
|
|
|
this.setServerUrl(this.dataForm.serverIp)
|
2025-06-26 17:47:20 +08:00
|
|
|
},
|
|
|
|
|
handleClose (done) {
|
|
|
|
|
this.visible = false
|
|
|
|
|
done()
|
|
|
|
|
},
|
2025-08-14 20:05:52 +08:00
|
|
|
toReboot () {
|
|
|
|
|
this.$confirm('是否确定关机重启?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
2025-08-18 13:51:04 +08:00
|
|
|
this._rebootVehicle()
|
2025-08-14 20:05:52 +08:00
|
|
|
}).catch(() => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'info',
|
|
|
|
|
message: '已取消关机重启'
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
2025-08-18 13:51:04 +08:00
|
|
|
async _rebootVehicle () {
|
|
|
|
|
try {
|
|
|
|
|
this.loading = this.$loading({
|
|
|
|
|
lock: true,
|
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.6)'
|
|
|
|
|
})
|
|
|
|
|
let res = await rebootVehicle()
|
|
|
|
|
if (res) {
|
|
|
|
|
this.initLink()
|
|
|
|
|
}
|
|
|
|
|
this.loading.close()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error(e)
|
|
|
|
|
this.loading.close()
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-08-14 20:05:52 +08:00
|
|
|
initLink () {
|
|
|
|
|
let link = 'stservice://systech.com:8088/router?data=reboot'
|
|
|
|
|
const a = document.createElement('a')
|
|
|
|
|
a.href = link
|
|
|
|
|
document.body.appendChild(a)
|
|
|
|
|
a.click()
|
|
|
|
|
},
|
2025-08-20 17:45:56 +08:00
|
|
|
synchronizedMapConfirm () {
|
|
|
|
|
this.$confirm('是否确定同步地图?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this._synchronizedMap()
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'info',
|
|
|
|
|
message: '已取消同步地图'
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async _synchronizedMap () {
|
|
|
|
|
try {
|
|
|
|
|
this.loading = this.$loading({
|
|
|
|
|
lock: true,
|
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
|
background: 'rgba(0, 0, 0, 0.6)'
|
|
|
|
|
})
|
|
|
|
|
let res = await synchronizedMap()
|
|
|
|
|
if (res) {
|
|
|
|
|
this.$message('同步成功')
|
|
|
|
|
}
|
|
|
|
|
this.loading.close()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error(e)
|
|
|
|
|
this.loading.close()
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-06-26 17:47:20 +08:00
|
|
|
show (e) {
|
|
|
|
|
// 关闭中文keyboard
|
|
|
|
|
let arr = document.querySelectorAll('.hg-theme-default')
|
|
|
|
|
arr.forEach((ele) => {
|
|
|
|
|
ele.style.visibility = 'hidden'
|
|
|
|
|
})
|
|
|
|
|
this.input = e.target
|
|
|
|
|
this.layout = e.target.dataset.layout
|
|
|
|
|
if (!this.visible) {
|
|
|
|
|
this.visible = true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
hide () {
|
|
|
|
|
this.visible = false
|
|
|
|
|
},
|
|
|
|
|
accept () {
|
|
|
|
|
this.hide()
|
|
|
|
|
},
|
|
|
|
|
next () {
|
|
|
|
|
let inputs = document.querySelectorAll('input')
|
|
|
|
|
let found = false;
|
|
|
|
|
[].forEach.call(inputs, (item, i) => {
|
|
|
|
|
if (!found && item === this.input && i < inputs.length - 1 && this.input.dataset.next === '1') {
|
|
|
|
|
found = true
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
inputs[i + 1].focus()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (!found) {
|
|
|
|
|
this.input.blur()
|
|
|
|
|
this.hide()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
|
.tip
|
|
|
|
|
font-size .2rem
|
|
|
|
|
font-weight 700
|
|
|
|
|
font-family 'SourceHanSansCN-Bold'
|
|
|
|
|
line-height .2rem
|
|
|
|
|
color #E54F29
|
|
|
|
|
margin-bottom .1rem
|
2025-08-14 20:05:52 +08:00
|
|
|
.tab_wraper
|
|
|
|
|
width 100%
|
|
|
|
|
height calc(2.2rem + 72px)
|
|
|
|
|
.reset
|
|
|
|
|
cursor pointer
|
|
|
|
|
width .72rem
|
|
|
|
|
height .71rem
|
|
|
|
|
background center / 100% auto url(../../images/new/reset.png) no-repeat
|
2025-06-26 17:47:20 +08:00
|
|
|
</style>
|