Files
apt15e/src/pages/shells/config-modal.vue

361 lines
11 KiB
Vue
Raw Normal View History

2025-06-26 17:47:20 +08:00
<template>
<el-dialog
2025-08-14 20:05:52 +08:00
class="config_dialog"
2025-08-27 11:16:49 +08:00
:class="{'enClass': $i18n.locale === 'en-us'}"
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">
2025-08-27 11:16:49 +08:00
<el-tab-pane :label="$t('Basicconfiguration')" 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>
2025-08-27 11:16:49 +08:00
<el-form-item :label="$t('ServiceIP')" prop="serverIp">
<el-input :placeholder="$t('PleaseServiceIP')" v-model="dataForm.serverIp" id="ip"></el-input>
2025-08-14 20:05:52 +08:00
</el-form-item>
<el-form-item :label="$t('SchedulingIP')" prop="ip">
2025-08-27 11:16:49 +08:00
<el-input :placeholder="$t('PleaseIP')" v-model="dataForm.ip" id="ip"></el-input>
2025-08-14 20:05:52 +08:00
</el-form-item>
2025-08-27 18:15:06 +08:00
<!-- <el-form-item label="WIFI" prop="wifi">
2025-08-27 11:16:49 +08:00
<el-input :placeholder="$t('PleaseWIFI')" v-model="dataForm.wifi" id="wifi"></el-input>
2025-08-27 18:15:06 +08:00
</el-form-item> -->
2025-08-14 20:05:52 +08:00
</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>
2025-08-29 21:06:21 +08:00
<el-tab-pane :label="$t('Systemsettings')" name="second">
<div class="tab_wraper">
<div class="contorl_title">AGV</div>
<el-row type="flex" class="contorl_box">
<button class="agv_button" @click="toReboot">
<img src="../../images/new/RF5.png" alt="">
<p>{{ $t('Shutdownrestart') }}</p>
</button>
<button class="agv_button" @click="synchronizedMapConfirm">
<img src="../../images/new/RF6.png" alt="">
<p>{{ $t('Synchronizemap') }}</p>
</button>
</el-row>
<div class="contorl_title">{{$t('Control')}}</div>
<el-row type="flex" class="contorl_box">
2025-09-01 15:59:37 +08:00
<p class="contorl_title_2">{{$t('Obstacleforklifts')}}</p>
<div class="switch_button" :class="{'switch_button_on': backIoStatus === '1'}">
2025-08-29 21:06:21 +08:00
<div class="switch_on_off"></div>
<input type="checkbox" @click="_backIoStatus">
</div>
</el-row>
2025-09-17 17:52:04 +08:00
<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>
2025-08-29 21:06:21 +08:00
</div>
2025-08-20 17:45:56 +08:00
</el-tab-pane>
2025-08-14 20:05:52 +08:00
</el-tabs>
2025-06-26 17:47:20 +08:00
</el-dialog>
</template>
<script>
2025-09-17 17:52:04 +08:00
import { rebootVehicle, synchronizedMap, backIoStatus, updateReturnStation, queryStation, getReturnStation } 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: [
2025-08-27 11:16:49 +08:00
{ required: true, message: this.$t('ServiceIPnotempty'), trigger: 'blur' }
2025-08-08 17:44:36 +08:00
],
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
]
},
languages: [
2025-06-27 17:07:21 +08:00
{label: '中文', value: 'zh-cn'},
{label: 'English', value: 'en-us'}
// {label: 'Español', value: 'es'}
2025-09-17 17:52:04 +08:00
],
returnPoint: '',
options: []
2025-06-26 17:47:20 +08:00
}
},
2025-08-08 17:44:36 +08:00
computed: {
2025-08-29 21:06:21 +08:00
...mapGetters(['serverUrl', 'backIoStatus']),
2025-08-08 17:44:36 +08:00
},
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-08-29 21:06:21 +08:00
this.activeName = 'first'
2025-06-26 17:47:20 +08:00
this.dialogVisible = true
2025-09-17 17:52:04 +08:00
this._queryStation()
2025-06-26 17:47:20 +08:00
},
exitUser () {
this.dialogVisible = false
},
dataFormSubmit () {
this.dialogVisible = false
2025-06-27 17:07:21 +08:00
this.$i18n.locale = this.dataForm.selectedLanguage
window.localStorage.setItem('locale', this.dataForm.selectedLanguage)
2025-11-21 13:36:14 +08:00
if (window.JsToAndroid) {
if (this.dataForm.selectedLanguage === 'en-us') {
window.JsToAndroid.switchLanguage('ENGLISH')
} else {
window.JsToAndroid.switchLanguage('CHINESE')
}
2025-11-18 14:01:22 +08:00
}
2025-08-08 17:44:36 +08:00
this.setServerUrl(this.dataForm.serverIp)
2025-08-27 11:16:49 +08:00
this.$emit('refreshWebsocket')
2025-06-26 17:47:20 +08:00
},
handleClose (done) {
done()
},
2025-08-14 20:05:52 +08:00
toReboot () {
2025-08-27 18:30:43 +08:00
this.$confirm(this.$t('Aresureshutrestart'), this.$t('Prompt'), {
2025-08-27 11:16:49 +08:00
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'),
2025-08-14 20:05:52 +08:00
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',
2025-08-27 18:30:43 +08:00
message: this.$t('shutrestartcancel')
2025-08-14 20:05:52 +08:00
})
})
},
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 () {
2025-11-21 13:36:14 +08:00
if (window.JsToAndroid) {
window.JsToAndroid.reboot()
}
2025-08-14 20:05:52 +08:00
},
2025-08-20 17:45:56 +08:00
synchronizedMapConfirm () {
2025-08-27 18:30:43 +08:00
this.$confirm(this.$t('Aresuremap'), this.$t('Prompt'), {
2025-08-27 11:16:49 +08:00
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'),
2025-08-20 17:45:56 +08:00
type: 'warning'
}).then(() => {
this._synchronizedMap()
}).catch(() => {
this.$message({
type: 'info',
2025-08-27 18:30:43 +08:00
message: this.$t('Mapbeencancel')
2025-08-20 17:45:56 +08:00
})
})
},
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) {
2025-08-29 21:06:21 +08:00
this.$message(this.$t('Syncsuccessfully'))
2025-08-20 17:45:56 +08:00
}
this.loading.close()
} catch (e) {
this.$message.error(e)
this.loading.close()
}
2025-08-29 21:06:21 +08:00
},
async _backIoStatus () {
try {
this.loading = this.$loading({
lock: true,
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.6)'
})
2025-09-01 17:31:44 +08:00
const type = this.backIoStatus === '1' ? '0' : '1'
let res = await backIoStatus(type)
2025-08-29 21:06:21 +08:00
if (res) {
this.$message(res.message)
}
this.loading.close()
} catch (e) {
this.$message.error(e)
this.loading.close()
}
},
2025-09-17 17:52:04 +08:00
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)'
})
2025-09-18 13:16:35 +08:00
const returnPoint = this.returnPoint ? this.returnPoint : '-1'
let res = await updateReturnStation(returnPoint)
2025-09-17 17:52:04 +08:00
if (res) {
this.$message(res.message)
}
this.loading.close()
} catch (e) {
this.$message.error(e)
this.loading.close()
}
}
2025-06-26 17:47:20 +08:00
}
}
</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-08-29 21:06:21 +08:00
.contorl_title
width 2rem
height .4rem
padding-left .4rem
font-size .24rem
color #fff
line-height .4rem
margin-bottom .2rem
2025-09-18 13:16:35 +08:00
white-space: nowrap;
2025-08-29 21:06:21 +08:00
background center / 100% 100% url(../../images/new/state_title_bg.png) no-repeat
.agv_button
min-width .9rem
height .9rem
padding: 0.05rem;
font-size: .16rem;
color: #fff;
border 1px solid #3D93F0
background linear-gradient(0deg, #3483DA, #1E59CD)
img
width .5rem
height .5rem
+.agv_button
margin-left .2rem
.contorl_box
padding 0 .4rem
margin-bottom .2rem
.contorl_title_2
font-size: .2rem;
line-height: .4rem;
color: #fff;
padding-right: 0.1rem;
.switch_button
position relative
width .9rem
height .4rem
border 1px solid #357ED1
background linear-gradient(0deg, #286495, #0F294D)
box-sizing border-box
input[type="checkbox"]
position absolute
width 100%
height 100%
opacity: 0;
margin: 0;
.switch_on_off
position absolute
width .4rem
height 100%
left 0
background #4380AF
.switch_button_on
border-color #3D93F0
background linear-gradient(0deg, #3483DA, #1E59CD)
.switch_on_off
background #A2FAFE
2025-09-01 16:48:08 +08:00
left auto
right 0
2025-08-27 11:16:49 +08:00
.enClass
.el-tabs__item
font-size .2rem
2025-06-26 17:47:20 +08:00
</style>