Merge branch 'main' of http://121.37.111.42:3000/zhengsl/emcp
This commit is contained in:
commit
bfc4a68988
@ -130,3 +130,11 @@ export async function saveDevicePassword(payload: { password: string }): Promise
|
|||||||
const response = await http.post<ApiResponse<{ send_status: string }>>('/config/device/password', payload)
|
const response = await http.post<ApiResponse<{ send_status: string }>>('/config/device/password', payload)
|
||||||
return response.data
|
return response.data
|
||||||
}
|
}
|
||||||
|
export async function saveDeviceNet(payload: any[]): Promise<any> {
|
||||||
|
const response = await http.post<ApiResponse<any>>('/config/device/net', payload)
|
||||||
|
return response.data.data
|
||||||
|
}
|
||||||
|
export async function saveDeviceUart(payload: any[]): Promise<any> {
|
||||||
|
const response = await http.post<ApiResponse<any>>('/config/device/uart', payload)
|
||||||
|
return response.data.data
|
||||||
|
}
|
||||||
|
|||||||
@ -87,9 +87,9 @@ onMounted(() => {
|
|||||||
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
||||||
const dayOfMonth = now.getDate().toString().padStart(2, '0')
|
const dayOfMonth = now.getDate().toString().padStart(2, '0')
|
||||||
|
|
||||||
time.value = `${hours}:${minutes}:${seconds}`
|
// time.value = `${hours}:${minutes}:${seconds}`
|
||||||
date.value = `${year}-${month}-${dayOfMonth}`
|
// date.value = `${year}-${month}-${dayOfMonth}`
|
||||||
day.value = weekDays[now.getDay()]
|
// day.value = weekDays[now.getDay()]
|
||||||
|
|
||||||
// 连接时间同步 WebSocket
|
// 连接时间同步 WebSocket
|
||||||
ws = connectTimeSync((event) => {
|
ws = connectTimeSync((event) => {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { fetchDeviceNet, fetchDevicePort, getDeviceNetConfig, saveDevicePortConfig, fetchChannelConfig } from '@/api/platform'
|
import { fetchDeviceNet, fetchDevicePort, getDeviceNetConfig, saveDeviceNet, saveDeviceUart } from '@/api/platform'
|
||||||
import NumericKeyboard from '@/components/NumericKeyboard.vue'
|
import NumericKeyboard from '@/components/NumericKeyboard.vue'
|
||||||
import PasswordDialog from '@/components/passwordValie.vue'
|
import PasswordDialog from '@/components/passwordValie.vue'
|
||||||
|
|
||||||
@ -109,9 +109,10 @@ const handleKeyboardConfirm = (value: string) => {
|
|||||||
}
|
}
|
||||||
keyboardVisible.value = false
|
keyboardVisible.value = false
|
||||||
}
|
}
|
||||||
|
const currentType = ref('')
|
||||||
// 保存按钮打开密码弹窗
|
// 保存按钮打开密码弹窗
|
||||||
const handleSave = () => {
|
const handleSave = (type: string) => {
|
||||||
|
currentType.value = type
|
||||||
passwordDialogVisible.value = true
|
passwordDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,25 +121,33 @@ const handlePasswordConfirm = async () => {
|
|||||||
if (isswitch.value) return
|
if (isswitch.value) return
|
||||||
isswitch.value = true
|
isswitch.value = true
|
||||||
try {
|
try {
|
||||||
const submitData: any = {
|
if (currentType.value === 'net') {
|
||||||
hardware_version: netConfig.value.hardware_version,
|
const res = await saveDeviceNet([formData.value, formDataRight.value])
|
||||||
software_version: netConfig.value.software_version,
|
if (res.send_status === '成功') {
|
||||||
password: netConfig.value.password,
|
|
||||||
net: [formData.value, formDataRight.value],
|
|
||||||
uart: [formData2.value, formData2Right.value]
|
|
||||||
}
|
|
||||||
const res = await saveDevicePortConfig(submitData)
|
|
||||||
if (res.code === 200) {
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '全部配置保存成功',
|
message: '网卡配置保存成功',
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '全部配置保存失败',
|
message: '网卡配置保存失败',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const res = await saveDeviceUart([formData2.value, formData2Right.value])
|
||||||
|
if (res.send_status === '成功') {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '串口配置保存成功',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ElMessage({
|
||||||
|
type: 'error',
|
||||||
|
message: '串口配置保存失败',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@ -181,12 +190,15 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="communication-container">
|
<div class="communication-container">
|
||||||
<el-form label-width="100px" class="form-wrapper">
|
<el-form label-width="100px" class="form-wrapper">
|
||||||
<!-- 常规配置:左右两栏 网卡一 / 网卡二 -->
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
<div class="section-title">
|
<div class="section-title">
|
||||||
<div class="icon"></div>
|
<div class="icon"></div>
|
||||||
<div>常规配置</div>
|
<div>常规配置</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-button type="primary" @click="handleSave('net')">保存</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-row :gutter="40">
|
<el-row :gutter="40">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="网卡号">
|
<el-form-item label="网卡号">
|
||||||
@ -241,10 +253,13 @@ onMounted(() => {
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
<div class="section-title">
|
<div class="section-title">
|
||||||
<div class="icon"></div>
|
<div class="icon"></div>
|
||||||
<div>串口设置</div>
|
<div>串口设置</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-button type="primary" @click="handleSave('port')">保存</el-button>
|
||||||
|
</div>
|
||||||
<el-row :gutter="40">
|
<el-row :gutter="40">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="串口号">
|
<el-form-item label="串口号">
|
||||||
@ -323,12 +338,6 @@ onMounted(() => {
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div class="btn-wrapper">
|
|
||||||
<el-button type="primary" style="background-color: #0099ff;width: 150px;height: 40px;"
|
|
||||||
@click="handleSave">保存</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-dialog v-model="dialogVisible" :close-on-click-modal="false" :show-close="false" title="错误提示" width="300">
|
<el-dialog v-model="dialogVisible" :close-on-click-modal="false" :show-close="false" title="错误提示" width="300">
|
||||||
<div style="color: #FF4D4F;font-size: 16px;text-align: center;">原密码验证错误!</div>
|
<div style="color: #FF4D4F;font-size: 16px;text-align: center;">原密码验证错误!</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user