diff --git a/frontend/src/api/platform.ts b/frontend/src/api/platform.ts index 0b40ef0..ac3d2de 100644 --- a/frontend/src/api/platform.ts +++ b/frontend/src/api/platform.ts @@ -20,19 +20,25 @@ export async function fetchDeviceStatus(): Promise { const response = await http.get>('/device-status') return response.data.data } - export async function fetchDeviceConfig(): Promise { const response = await http.get>('/config/device') return response.data.data } - +export async function fetchDeviceNet(nic: string): Promise { + const response = await http.get>(`/config/device/net?nic=${nic}`) + return response.data.data +} +export async function fetchDevicePort(uart: string): Promise { + const response = await http.get>(`/config/device/uart?port=${uart}`) + return response.data.data +} export async function fetchChannelConfig(): Promise { const response = await http.get>('/config/channel') return response.data.data } -export async function fetchLineAlarmSetting(): Promise { - const response = await http.get>('/config/line_alarm_setting') +export async function fetchLineAlarmSetting(lineNo: number): Promise { + const response = await http.get>(`/config/line_alarm_setting?line_no=${lineNo}`) return response.data.data } @@ -46,14 +52,14 @@ export async function fetchSystemConfig(): Promise { return response.data.data } -export async function fetchAlarmHistory(page = 1, size = 20): Promise { - const response = await http.get>(`/alarm/list?page=${page}&size=${size}`) +export async function fetchAlarmHistory(params: any): Promise { + const response = await http.get>('/alarm/list', { params }) return response.data.data } -export async function verifyAccessPassword(password: string): Promise { +export async function verifyAccessPassword(password: string): Promise> { const response = await http.post>('/auth/verify-password', { password }) - return response.data.data + return response.data } export async function saveDeviceConfig(payload: DeviceConfigPayload): Promise> { @@ -61,6 +67,14 @@ export async function saveDeviceConfig(payload: DeviceConfigPayload): Promise> { + const response = await http.post>('/config/device/net', payload) + return response.data +} +export async function saveDevicePortConfig(payload: { port: string; ip: string; mask: string; gateway: string; protocol: string }): Promise> { + const response = await http.post>('/config/device/uart', payload) + return response.data +} export async function saveChannelConfig( payload: ChannelConfigPayload, ): Promise> { diff --git a/frontend/src/stores/platform.ts b/frontend/src/stores/platform.ts index 61e41e7..a024e94 100644 --- a/frontend/src/stores/platform.ts +++ b/frontend/src/stores/platform.ts @@ -72,7 +72,7 @@ function scheduleRealtimeReconnect() { } function startRealtimeSocket() { - if (realtimeSocket && [WebSocket.CONNECTING, WebSocket.OPEN].includes(realtimeSocket.readyState)) { + if (realtimeSocket && [WebSocket.CONNECTING, WebSocket.OPEN].includes(realtimeSocket.readyState as 0 | 1)) { return } diff --git a/frontend/src/types/platform.ts b/frontend/src/types/platform.ts index 4602320..2f9897a 100644 --- a/frontend/src/types/platform.ts +++ b/frontend/src/types/platform.ts @@ -5,8 +5,26 @@ export interface ValueGroup { Ia: number Ib: number Ic: number + Pa: number + Pb: number + Pc: number Pt: number frq: number + Qa: number + Qb: number + Qc: number + Qt: number + Sa: number + Sb: number + Sc: number + St: number + PFa: number + PFb: number + PFc: number + Uab: number + Ubc: number + Uca: number + PFt: number } export interface LineData { diff --git a/frontend/src/views/aiAlarmSetting/index.vue b/frontend/src/views/aiAlarmSetting/index.vue index 9d66167..af18179 100644 --- a/frontend/src/views/aiAlarmSetting/index.vue +++ b/frontend/src/views/aiAlarmSetting/index.vue @@ -29,7 +29,7 @@ const handleSave = () => { }) .then(({ value }) => { verifyAccessPassword(value).then((res: any) => { - if (res.code === 200) { + if (res.data) { if (isswitch.value) { return } @@ -42,7 +42,7 @@ const handleSave = () => { } }) }else{ - ElMessage.error('密码错误') + ElMessage.error('密码错误,不能修改!') } }) }) diff --git a/frontend/src/views/aiChannelSetting/index.vue b/frontend/src/views/aiChannelSetting/index.vue index 7ef720e..cbcb76a 100644 --- a/frontend/src/views/aiChannelSetting/index.vue +++ b/frontend/src/views/aiChannelSetting/index.vue @@ -1,32 +1,75 @@ @@ -43,23 +86,24 @@ onMounted(() => {
高端值
-
{{ item.no }}
-
{{ item.type }}
+
{{ item.ch }}
+
{{ item.singal_type }}
- - + +
- +
- +
- +
@@ -116,10 +160,12 @@ onMounted(() => { box-sizing: border-box; background-color: #f9fafe; color: #787878; - & + .cell { + + &+.cell { margin-left: 8px; } } + .cell-no { width: 100px; background: #f9fafe; @@ -173,22 +219,25 @@ onMounted(() => { cursor: pointer; } } - // 去掉所有边框 + 阴影 - :deep(.el-select__wrapper), - :deep(.el-input__wrapper) { - border: none !important; - box-shadow: none !important; - background: transparent !important; - text-align: center !important; - } - :deep(.el-select__wrapper.is-hover), - :deep(.el-input__wrapper.is-hover), - :deep(.el-select__wrapper.is-focused), - :deep(.el-input__wrapper.is-focused) { - box-shadow: none !important; - border: none !important; - } - :deep(.el-input__inner){ - text-align: center !important; - } + +// 去掉所有边框 + 阴影 +:deep(.el-select__wrapper), +:deep(.el-input__wrapper) { + border: none !important; + box-shadow: none !important; + background: transparent !important; + text-align: center !important; +} + +:deep(.el-select__wrapper.is-hover), +:deep(.el-input__wrapper.is-hover), +:deep(.el-select__wrapper.is-focused), +:deep(.el-input__wrapper.is-focused) { + box-shadow: none !important; + border: none !important; +} + +:deep(.el-input__inner) { + text-align: center !important; +} \ No newline at end of file diff --git a/frontend/src/views/aiQuantity/index.vue b/frontend/src/views/aiQuantity/index.vue index c4d6cea..99a1bcf 100644 --- a/frontend/src/views/aiQuantity/index.vue +++ b/frontend/src/views/aiQuantity/index.vue @@ -1,63 +1,70 @@ @@ -74,17 +81,18 @@ onMounted(() => {
所属路线
类别
低值
-
低值
+
高值
-
{{ item.channel }}
+
{{ item.ch }} +
{{ item.rawValue }}
-
{{ item.line }}
-
{{ item.category }}
-
{{ item.lowValue1 }}
-
{{ item.lowValue2 }}
+
线路{{ item.line_no }}
+
{{ item.type }}
+
{{ item.limit_low }}
+
{{ item.limit_high }}
@@ -97,9 +105,9 @@ onMounted(() => {
{{ index + 1 }}
{{ item.name }}
{{ item.typeName }}
+
{{ item.level }}
{{ item.content }}
{{ item.time }}
-
{{ item.ts }}ms
@@ -157,6 +165,7 @@ onMounted(() => { display: flex; flex-direction: column; gap: 5px; + .table-row { display: flex; width: 100%; diff --git a/frontend/src/views/analogQuantity/index.vue b/frontend/src/views/analogQuantity/index.vue index 8212e44..3e6e8e0 100644 --- a/frontend/src/views/analogQuantity/index.vue +++ b/frontend/src/views/analogQuantity/index.vue @@ -18,7 +18,6 @@ const valList = ref([ const checkedVal = ref('一次值') const currentLineData = computed(() => { - console.log(state) if (!state.realtime) return null const line = lineList.value.find(l => l.name === checkedLine.value) if (!line) return null @@ -32,12 +31,10 @@ const currentValues = computed(() => { }) const frequency = computed(() => { - if (!currentValues.value) return '50.000' - return currentValues.value.frq.toFixed(4) + if (!currentValues.value) return '50' + return currentValues.value.frq }) -const sqrt3 = Math.sqrt(3) - const infoList = computed(() => { const values = currentValues.value if (!values) { @@ -53,45 +50,45 @@ const infoList = computed(() => { return [ { name: '单项电压(V)', - a: values.Ua.toFixed(3), - b: values.Ub.toFixed(3), - c: values.Uc.toFixed(3), - total: ((values.Ua + values.Ub + values.Uc) / 3).toFixed(3), + a: values.Ua, + b: values.Ub, + c: values.Uc, + total: '', }, { name: '单相电流(A)', - a: values.Ia.toFixed(3), - b: values.Ib.toFixed(3), - c: values.Ic.toFixed(3), - total: ((values.Ia + values.Ib + values.Ic) / 3).toFixed(3), + a: values.Ia, + b: values.Ib, + c: values.Ic, + total: '', }, { name: '有功功率(kw)', - a: ((values.Ua * values.Ia * 0.9) / 1000).toFixed(3), - b: ((values.Ub * values.Ib * 0.9) / 1000).toFixed(3), - c: ((values.Uc * values.Ic * 0.9) / 1000).toFixed(3), - total: (values.Pt / 1000).toFixed(3), + a: values.Pa, + b: values.Pb, + c: values.Pc, + total: values.Pt }, { name: '无功功率(kvar)', - a: ((values.Ua * values.Ia * Math.sin(Math.acos(0.9))) / 1000).toFixed(3), - b: ((values.Ub * values.Ib * Math.sin(Math.acos(0.9))) / 1000).toFixed(3), - c: ((values.Uc * values.Ic * Math.sin(Math.acos(0.9))) / 1000).toFixed(3), - total: ((sqrt3 * values.Ua * values.Ia * Math.sin(Math.acos(0.9))) / 1000).toFixed(3), + a: values.Qa, + b: values.Qb, + c: values.Qc, + total: values.Qt }, { name: '视在功率(kVA)', - a: ((values.Ua * values.Ia) / 1000).toFixed(3), - b: ((values.Ub * values.Ib) / 1000).toFixed(3), - c: ((values.Uc * values.Ic) / 1000).toFixed(3), - total: ((sqrt3 * values.Ua * values.Ia) / 1000).toFixed(3), + a: values.Sa, + b: values.Sb, + c: values.Sc, + total: values.St }, { name: '功率因数(cos)', - a: '0.900', - b: '0.900', - c: '0.900', - total: '0.900', + a: values.PFa, + b: values.PFb, + c: values.PFc, + total: values.PFt }, ] }) @@ -103,20 +100,46 @@ const infoData = computed(() => { } return { name: '线电压(V)', - a: (values.Ua * sqrt3).toFixed(3), - b: (values.Ub * sqrt3).toFixed(3), - c: (values.Uc * sqrt3).toFixed(3), + a: values?.Uab, + b: values?.Ubc, + c: values?.Uca, } }) +function formatTime(dateStr: string): string { + const date = new Date(dateStr) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + const seconds = String(date.getSeconds()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` +} + const tableData = computed(() => { - return state.alarms.slice(0, 10).map((alarm, index) => ({ - name: `线路${currentLineData.value?.line_no || 1}`, - typeName: alarm.type, - content: alarm.content, - time: alarm.time, - ts: '0', - })) + const list = state.alarms[state.alarms.length - 1] || {} + const arr = [] + let reslist:any = {} + if(list.alarm_type == 'line_alarm'){ + reslist.name = `线路${list?.no || 1}` + }else if(list.alarm_type == 'ai_alarm'){ + reslist.name = `通道${list?.no || 1}` + } else if(list.alarm_type == 'operate_alarm'){ + reslist.name = '' + } + reslist.typeName = list.type + reslist.content = list.content + reslist.time = list.time ? formatTime(list.time) : '' + reslist.level = list.level || '' + return [reslist] + // return state.alarms.slice(0, 10).map((alarm, index) => ({ + // name: `线路${currentLineData.value?.line_no || 1}`, + // typeName: alarm.type, + // content: alarm.content, + // time: alarm.time, + // ts: '0', + // })) }) function handleClick(name: string) { @@ -197,11 +220,11 @@ onMounted(() => {
{{ index + 1 }}
-
{{ item.name }}
-
{{ item.typeName }}
-
{{ item.content }}
+
{{ item.name }}
+
{{ item.typeName }}
+
{{ item.level }}
+
{{ item.content }}
{{ item.time }}
-
{{ item.ts }}ms
diff --git a/frontend/src/views/aoChannelSetting/index.vue b/frontend/src/views/aoChannelSetting/index.vue index 6cb215e..d995b61 100644 --- a/frontend/src/views/aoChannelSetting/index.vue +++ b/frontend/src/views/aoChannelSetting/index.vue @@ -1,32 +1,76 @@ @@ -43,23 +87,24 @@ onMounted(() => {
高端值
-
{{ item.no }}
-
{{ item.type }}
+
{{ item.ch }}
+
{{ item.singal_type }}
- - + +
- +
- +
- +
@@ -116,10 +161,12 @@ onMounted(() => { box-sizing: border-box; background-color: #f9fafe; color: #787878; - & + .cell { + + &+.cell { margin-left: 8px; } } + .cell-no { width: 100px; background: #f9fafe; @@ -173,22 +220,25 @@ onMounted(() => { cursor: pointer; } } - // 去掉所有边框 + 阴影 - :deep(.el-select__wrapper), - :deep(.el-input__wrapper) { - border: none !important; - box-shadow: none !important; - background: transparent !important; - text-align: center !important; - } - :deep(.el-select__wrapper.is-hover), - :deep(.el-input__wrapper.is-hover), - :deep(.el-select__wrapper.is-focused), - :deep(.el-input__wrapper.is-focused) { - box-shadow: none !important; - border: none !important; - } - :deep(.el-input__inner){ - text-align: center !important; - } + +// 去掉所有边框 + 阴影 +:deep(.el-select__wrapper), +:deep(.el-input__wrapper) { + border: none !important; + box-shadow: none !important; + background: transparent !important; + text-align: center !important; +} + +:deep(.el-select__wrapper.is-hover), +:deep(.el-input__wrapper.is-hover), +:deep(.el-select__wrapper.is-focused), +:deep(.el-input__wrapper.is-focused) { + box-shadow: none !important; + border: none !important; +} + +:deep(.el-input__inner) { + text-align: center !important; +} \ No newline at end of file diff --git a/frontend/src/views/communicationSetting/index.vue b/frontend/src/views/communicationSetting/index.vue index f29c248..6ac83cc 100644 --- a/frontend/src/views/communicationSetting/index.vue +++ b/frontend/src/views/communicationSetting/index.vue @@ -1,7 +1,7 @@