网络设置
This commit is contained in:
parent
d5e138f901
commit
e1db651893
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 系统运维->时间设置->查询时间设置
|
||||
export function getTimeSettingAPI(params) {
|
||||
return request({
|
||||
url: '/smartCar/data/device/getTimeSetting',
|
||||
url: '/smartCar/data/setting/getSettingDetail',
|
||||
method: 'GET',
|
||||
params
|
||||
})
|
||||
|
|
@ -12,7 +12,7 @@ export function getTimeSettingAPI(params) {
|
|||
// 系统运维->时间设置->更新时间设置
|
||||
export function updateTimeSettingAPI(data) {
|
||||
return request({
|
||||
url: '/smartCar/data/device/updateTimeSetting',
|
||||
url: '/smartCar/data/setting/settingNTP',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
{{ deviceInfo.batteryCapacity }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="TF存储">
|
||||
{{ deviceInfo.tfStorage }}
|
||||
{{ deviceInfo.tfStorage + 'GB'}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="序列号">
|
||||
{{ deviceInfo.serialNumber }}
|
||||
|
|
|
|||
|
|
@ -12,32 +12,32 @@
|
|||
</div>
|
||||
|
||||
<el-form :model="form" :rules="rules" ref="timeSettingForm" label-width="120px">
|
||||
<el-form-item label="校时模式" prop="calibrationMode">
|
||||
<el-radio-group v-model="form.calibrationMode" @change="handleModeChange">
|
||||
<el-radio label="ntp">NTP校时</el-radio>
|
||||
<el-radio label="manual">手动校时</el-radio>
|
||||
<el-form-item label="校时模式" prop="syncMode">
|
||||
<el-radio-group v-model="form.syncMode" @change="handleModeChange">
|
||||
<el-radio label="1">NTP校时</el-radio>
|
||||
<el-radio label="2">手动校时</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<!-- NTP校时模式 -->
|
||||
<template v-if="form.calibrationMode === 'ntp'">
|
||||
<template v-if="form.syncMode === '1'">
|
||||
<el-form-item label="服务器地址" prop="serverAddress" required>
|
||||
<el-input v-model="form.serverAddress" placeholder="请输入服务器地址" style="width: 400px" maxlength="32" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="NTP端口" prop="ntpPort" required>
|
||||
<el-input v-model="form.ntpPort" placeholder="请输入NTP端口" style="width: 400px" maxlength="5" show-word-limit></el-input>
|
||||
<el-input v-model="form.ntpPort" placeholder="请输入NTP端口" style="width: 400px" maxlength="32" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="校时时间间隔" prop="calibrationInterval" required>
|
||||
<el-input-number v-model="form.calibrationInterval" :min="1" :max="9999" style="width: 200px" maxlength="5"></el-input-number>
|
||||
<el-form-item label="校时时间间隔" prop="syncIntervalTime" required>
|
||||
<el-input-number v-model="form.syncIntervalTime" :min="1" :max="9999" style="width: 200px"></el-input-number>
|
||||
<span style="margin-left: 10px; color: #606266;">分钟</span>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<!-- 手动校时模式 -->
|
||||
<template v-if="form.calibrationMode === 'manual'">
|
||||
<el-form-item label="设置时间" prop="setTime" required>
|
||||
<template v-if="form.syncMode === '2'">
|
||||
<el-form-item label="设置时间" prop="settingTime" required>
|
||||
<el-date-picker
|
||||
v-model="form.setTime"
|
||||
v-model="form.settingTime"
|
||||
type="datetime"
|
||||
placeholder="请选择时间"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
|
|
@ -66,11 +66,13 @@ export default {
|
|||
currentTime: '',
|
||||
timeTimer: null,
|
||||
form: {
|
||||
calibrationMode: 'ntp', // ntp: NTP校时, manual: 手动校时
|
||||
systemSettingId: 1,
|
||||
systemId: 1,
|
||||
syncMode: '1', // 1: NTP校时, 2: 手动校时
|
||||
serverAddress: '',
|
||||
ntpPort: '',
|
||||
calibrationInterval: null,
|
||||
setTime: ''
|
||||
syncIntervalTime: null,
|
||||
settingTime: ''
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
|
|
@ -103,15 +105,17 @@ export default {
|
|||
async getTimeSetting() {
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await getTimeSettingAPI()
|
||||
const res = await getTimeSettingAPI({systemSettingId:1})
|
||||
if (res.code === 200 && res.data) {
|
||||
const data = res.data
|
||||
this.form = {
|
||||
calibrationMode: data.calibrationMode || 'ntp',
|
||||
systemSettingId: data.systemSettingId || null,
|
||||
systemId: data.systemId || 1,
|
||||
syncMode: data.syncMode || '1',
|
||||
serverAddress: data.serverAddress || '',
|
||||
ntpPort: data.ntpPort || '',
|
||||
calibrationInterval: data.calibrationInterval || null,
|
||||
setTime: data.setTime || ''
|
||||
syncIntervalTime: data.syncIntervalTime || null,
|
||||
settingTime: data.settingTime || ''
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -133,17 +137,21 @@ export default {
|
|||
async handleSave() {
|
||||
try {
|
||||
// 根据模式验证必填字段
|
||||
if (this.form.calibrationMode === 'ntp') {
|
||||
if (this.form.syncMode === '1') {
|
||||
if (!this.form.serverAddress) {
|
||||
this.$message.error('服务器地址不能为空')
|
||||
return
|
||||
}
|
||||
if (!this.form.calibrationInterval) {
|
||||
if (!this.form.ntpPort) {
|
||||
this.$message.error('NTP端口不能为空')
|
||||
return
|
||||
}
|
||||
if (!this.form.syncIntervalTime) {
|
||||
this.$message.error('校时时间间隔不能为空')
|
||||
return
|
||||
}
|
||||
} else if (this.form.calibrationMode === 'manual') {
|
||||
if (!this.form.setTime) {
|
||||
} else if (this.form.syncMode === '2') {
|
||||
if (!this.form.settingTime) {
|
||||
this.$message.error('设置时间不能为空')
|
||||
return
|
||||
}
|
||||
|
|
@ -151,11 +159,13 @@ export default {
|
|||
|
||||
this.loading = true
|
||||
const params = {
|
||||
calibrationMode: this.form.calibrationMode,
|
||||
systemSettingId: this.form.systemSettingId,
|
||||
systemId: this.form.systemId,
|
||||
syncMode: this.form.syncMode,
|
||||
serverAddress: this.form.serverAddress,
|
||||
ntpPort: this.form.ntpPort,
|
||||
calibrationInterval: this.form.calibrationInterval,
|
||||
setTime: this.form.setTime
|
||||
syncIntervalTime: this.form.syncIntervalTime,
|
||||
settingTime: this.form.settingTime
|
||||
}
|
||||
const res = await updateTimeSettingAPI(params)
|
||||
if (res.code === 200) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue