From d73f6a1189b547d4ca89d12c5704b09fcf5a5a10 Mon Sep 17 00:00:00 2001 From: Lufaneng Date: Tue, 3 Mar 2026 09:38:02 +0800 Subject: [PATCH] 1 --- src/views/AutomaticMode/index.vue | 29 +- src/views/HandleControl/index.vue | 74 ++-- src/views/Monitoring/index.vue | 19 +- src/views/ParamsConfig/index.vue | 628 +++++++++++++++--------------- vite.config.js | 3 +- 5 files changed, 402 insertions(+), 351 deletions(-) diff --git a/src/views/AutomaticMode/index.vue b/src/views/AutomaticMode/index.vue index c5e7c26..c9f11fa 100644 --- a/src/views/AutomaticMode/index.vue +++ b/src/views/AutomaticMode/index.vue @@ -343,9 +343,7 @@ const tasks = computed(() => [startTask.value, stopTask.value, middleTask.value] const deviceMode = ref(0) const currentMode = ref(0) -RPC.post('/m9z/getDeviceMode', { comm_uid: commit_uid }).then(res => { - currentMode.value = res -}) + const changeMode = () => { modeActive.value = currentMode.value @@ -385,7 +383,7 @@ const getTask = () => { middleTaskLoading.value = false }) } -getTask() + const addTask = () => { middleTask.value.push({ @@ -473,11 +471,6 @@ const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四 const sunriseTime = ref('') const sunsetTime = ref('') -RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => { - sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : '' - sunsetTime.value = res.Sunset ? dayjs(res.Sunset).format('HH:mm:ss') : '' -}) - // 更新时间 const updateTime = () => { const now = new Date() @@ -549,8 +542,24 @@ const restartSystem = () => { } let timeInterval = null - +const isOnline = ref(false) onMounted(() => { + RPC.post('/lightm/rtu/isOnline', { commUid: commit_uid }).then(res => { + console.log('/lightm/rtu/isOnlin', res) + isOnline.value = res + if (isOnline.value) { + RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => { + sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : '' + sunsetTime.value = res.Sunset ? dayjs(res.Sunset).format('HH:mm:ss') : '' + }) + RPC.post('/m9z/getDeviceMode', { comm_uid: commit_uid }).then(res => { + currentMode.value = res + }) + getTask() + } else { + ElMessage.error('设备不在线') + } + }) updateTime() timeInterval = setInterval(updateTime, 1000) }) diff --git a/src/views/HandleControl/index.vue b/src/views/HandleControl/index.vue index 03ad771..ed796af 100644 --- a/src/views/HandleControl/index.vue +++ b/src/views/HandleControl/index.vue @@ -237,7 +237,8 @@ const getDeviceTime = () => { isUpDateTimeing.value = false }) } -getDeviceTime() + +const isOnline = ref(false) const setDeviceTime = () => { timeLoading.value = true @@ -251,29 +252,8 @@ const setDeviceTime = () => { const week = ref('') const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; -const phaseLoading = ref(true) -RPC.post('/adl400/readPhaseData', { comm_uid: commit_uid }).then(res => { - powerPhases.value[0].voltage = res.aVoltage ? res.aVoltage + 'V' : '0V' - powerPhases.value[0].current = res.aElectricCurrent ? res.aElectricCurrent + 'A' : '0A' - powerPhases.value[0].power = res.aPower ? res.aPower + 'kW' : '0kW' - powerPhases.value[0].factor = res.aPowerFactor ? res.aPowerFactor : 0 - - powerPhases.value[1].voltage = res.bVoltage ? res.bVoltage + 'V' : '0V' - powerPhases.value[1].current = res.bElectricCurrent ? res.bElectricCurrent + 'A' : '0A' - powerPhases.value[1].power = res.bPower ? res.bPower + 'kW' : '0kW' - powerPhases.value[1].factor = res.bPowerFactor ? res.bPowerFactor : 0 - - powerPhases.value[2].voltage = res.cVoltage ? res.cVoltage + 'V' : '0V' - powerPhases.value[2].current = res.cElectricCurrent ? res.cElectricCurrent + 'A' : '0A' - powerPhases.value[2].power = res.cPower ? res.cPower + 'kW' : '0kW' - powerPhases.value[2].factor = res.cPowerFactor ? res.cPowerFactor : 0 - - energyParams.value.activeEnergy = res.activeEnergy ? res.activeEnergy + 'kW·h' : '0kW·h' - energyParams.value.activePower = res.activePower ? res.activePower + 'kW' : '0kW' - energyParams.value.powerFactor = res.powerFactor ? res.powerFactor : 0 -}).finally(() => { - phaseLoading.value = false -}) +const phaseLoading = ref(false) + // 电力参数数据 const powerPhases = ref([ @@ -420,7 +400,7 @@ const getInfo = () => { infoLoading.value = false }) } -getInfo() + const refresh = () => { getInfo() @@ -469,10 +449,6 @@ watch(info, () => { const sunriseTime = ref('') const sunsetTime = ref('') -RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => { - sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : '' - sunsetTime.value = res.Sunset ? dayjs(res.Sunset).format('HH:mm:ss') : '' -}) // 更新时间 const updateTime = () => { @@ -611,6 +587,9 @@ const restartSystem = () => { } const changeMode = () => { + if (!isOnline.value) { + return ElMessage.error('设备不在线') + } ElMessageBox.confirm( `此操作将切换到${info.value.disable ? '自动' : '手动'}模式,是否继续?`, '提示', @@ -633,6 +612,43 @@ let timeInterval = null onMounted(() => { updateTime() timeInterval = setInterval(updateTime, 1000) + RPC.post('/lightm/rtu/isOnline', { commUid: commit_uid }).then(res => { + console.log('/lightm/rtu/isOnlin', res) + isOnline.value = res + if (isOnline.value) { + getInfo() + RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => { + sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : '' + sunsetTime.value = res.Sunset ? dayjs(res.Sunset).format('HH:mm:ss') : '' + }) + phaseLoading.value = true + RPC.post('/adl400/readPhaseData', { comm_uid: commit_uid }).then(res => { + powerPhases.value[0].voltage = res.aVoltage ? res.aVoltage + 'V' : '0V' + powerPhases.value[0].current = res.aElectricCurrent ? res.aElectricCurrent + 'A' : '0A' + powerPhases.value[0].power = res.aPower ? res.aPower + 'kW' : '0kW' + powerPhases.value[0].factor = res.aPowerFactor ? res.aPowerFactor : 0 + + powerPhases.value[1].voltage = res.bVoltage ? res.bVoltage + 'V' : '0V' + powerPhases.value[1].current = res.bElectricCurrent ? res.bElectricCurrent + 'A' : '0A' + powerPhases.value[1].power = res.bPower ? res.bPower + 'kW' : '0kW' + powerPhases.value[1].factor = res.bPowerFactor ? res.bPowerFactor : 0 + + powerPhases.value[2].voltage = res.cVoltage ? res.cVoltage + 'V' : '0V' + powerPhases.value[2].current = res.cElectricCurrent ? res.cElectricCurrent + 'A' : '0A' + powerPhases.value[2].power = res.cPower ? res.cPower + 'kW' : '0kW' + powerPhases.value[2].factor = res.cPowerFactor ? res.cPowerFactor : 0 + + energyParams.value.activeEnergy = res.activeEnergy ? res.activeEnergy + 'kW·h' : '0kW·h' + energyParams.value.activePower = res.activePower ? res.activePower + 'kW' : '0kW' + energyParams.value.powerFactor = res.powerFactor ? res.powerFactor : 0 + }).finally(() => { + phaseLoading.value = false + }) + getDeviceTime() + } else { + ElMessage.error('设备不在线') + } + }) }) onUnmounted(() => { diff --git a/src/views/Monitoring/index.vue b/src/views/Monitoring/index.vue index 7cf259b..7741704 100644 --- a/src/views/Monitoring/index.vue +++ b/src/views/Monitoring/index.vue @@ -474,10 +474,15 @@ const getInfo = () => { // sunsetTime.value = res.Sunset ? dayjs(res.Sunset).format('HH:mm:ss') : '' // }) } -getInfo() const timer = setInterval(() => { - getInfo() + RPC.post('/lightm/rtu/isOnline', { commUid: commit_uid }).then(res => { + console.log('/lightm/rtu/isOnlin', res) + isOnline.value = res + if (isOnline.value) { + getInfo() + } + }) }, 30000) onUnmounted(() => { @@ -594,7 +599,17 @@ const restartSystem = () => { let timeInterval = null +const isOnline = ref(false) onMounted(() => { + RPC.post('/lightm/rtu/isOnline', { commUid: commit_uid }).then(res => { + console.log('/lightm/rtu/isOnlin', res) + isOnline.value = res + if (isOnline.value) { + getInfo() + } else { + ElMessage.error('设备不在线') + } + }) updateTime() timeInterval = setInterval(updateTime, 1000) }) diff --git a/src/views/ParamsConfig/index.vue b/src/views/ParamsConfig/index.vue index cc68393..499c83c 100644 --- a/src/views/ParamsConfig/index.vue +++ b/src/views/ParamsConfig/index.vue @@ -200,317 +200,9 @@ const RiseSetOption = [ { label: '延后60分钟', value: -60 }, ] -RPC.post('/m9z/getLgnLatData', { comm_uid: commit_uid }).then((res) => { - formField.value.lat = res.lat - formField.value.lgn = res.lgn - formField.value.loc = res.loc -}) -RPC.post('/m9z/getSunRiseSet', { comm_uid: commit_uid }).then((res) => { - formField.value.rise = res.rise - formField.value.set = res.set -}) -RPC.post('/m9z/getDeviceTime', { comm_uid: commit_uid }).then((res) => { - deviceTime.value = res.deviceTime -}) -RPC.post('/m9z/getAllSubLoopParameter', { comm_uid: commit_uid }).then((res) => { - subLoopParameter.value = res - // subLoopParameter.value = { - // "subLoopData": [ - // { - // "DCVoltage": 0.5, - // "DCCurrent": 0, - // "DimmingValue": 70, - // "AlarmStatus": 9, - // "AlarmCode": "09 01", - // "RelayStatus": 1, - // "LoopAddress": "0x1", - // "SubModuleCount": 1, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [ - // { - // "OutputVoltage": 0, - // "OutputCurrent": 0, - // "CurrentPWMDuty": 0, - // "VoltagePWMDuty": 0, - // "DeviceAddress": "0x0", - // "ModuleLoopAddress": "0x0", - // "CurrentLimitPct": 0, - // "OperatingMode": 0, - // "ModuleVersion": 0, - // "RatedVoltageDuty": 0, - // "RatedCurrentDuty": 0, - // "RatedOutputVoltage": 0, - // "RatedOutputCurrent": 0 - // } - // ] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "", - // "RelayStatus": 0, - // "LoopAddress": "0x1", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": null - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "", - // "RelayStatus": 0, - // "LoopAddress": "0x2", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": null - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "", - // "RelayStatus": 0, - // "LoopAddress": "0x4", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": null - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // }, - // { - // "DCVoltage": 0, - // "DCCurrent": 0, - // "DimmingValue": 0, - // "AlarmStatus": 0, - // "AlarmCode": "00 00", - // "RelayStatus": 0, - // "LoopAddress": "0x0", - // "SubModuleCount": 0, - // "Reserved": [ - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0, - // 0 - // ], - // "Modules": [] - // } - // ], - // "totalP": 0 - // } -}) const address = ref('') -RPC.post('/adl400/getMsgAddress', { comm_uid: commit_uid }).then((res) => { - address.value = res -}) + const week = ref('') const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] @@ -579,7 +271,325 @@ const goBack = () => { let timeInterval = null +const isOnline = ref(false) onMounted(() => { + RPC.post('/lightm/rtu/isOnline', { commUid: commit_uid }).then(res => { + console.log('/lightm/rtu/isOnlin', res) + isOnline.value = res + if (isOnline.value) { + RPC.post('/adl400/getMsgAddress', { comm_uid: commit_uid }).then((res) => { + address.value = res + }) + RPC.post('/m9z/getLgnLatData', { comm_uid: commit_uid }).then((res) => { + formField.value.lat = res.lat + formField.value.lgn = res.lgn + formField.value.loc = res.loc + }) + RPC.post('/m9z/getSunRiseSet', { comm_uid: commit_uid }).then((res) => { + formField.value.rise = res.rise + formField.value.set = res.set + }) + RPC.post('/m9z/getDeviceTime', { comm_uid: commit_uid }).then((res) => { + deviceTime.value = res.deviceTime + }) + RPC.post('/m9z/getAllSubLoopParameter', { comm_uid: commit_uid }).then((res) => { + subLoopParameter.value = res + // subLoopParameter.value = { + // "subLoopData": [ + // { + // "DCVoltage": 0.5, + // "DCCurrent": 0, + // "DimmingValue": 70, + // "AlarmStatus": 9, + // "AlarmCode": "09 01", + // "RelayStatus": 1, + // "LoopAddress": "0x1", + // "SubModuleCount": 1, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [ + // { + // "OutputVoltage": 0, + // "OutputCurrent": 0, + // "CurrentPWMDuty": 0, + // "VoltagePWMDuty": 0, + // "DeviceAddress": "0x0", + // "ModuleLoopAddress": "0x0", + // "CurrentLimitPct": 0, + // "OperatingMode": 0, + // "ModuleVersion": 0, + // "RatedVoltageDuty": 0, + // "RatedCurrentDuty": 0, + // "RatedOutputVoltage": 0, + // "RatedOutputCurrent": 0 + // } + // ] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "", + // "RelayStatus": 0, + // "LoopAddress": "0x1", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": null + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "", + // "RelayStatus": 0, + // "LoopAddress": "0x2", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": null + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "", + // "RelayStatus": 0, + // "LoopAddress": "0x4", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": null + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // }, + // { + // "DCVoltage": 0, + // "DCCurrent": 0, + // "DimmingValue": 0, + // "AlarmStatus": 0, + // "AlarmCode": "00 00", + // "RelayStatus": 0, + // "LoopAddress": "0x0", + // "SubModuleCount": 0, + // "Reserved": [ + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0, + // 0 + // ], + // "Modules": [] + // } + // ], + // "totalP": 0 + // } + }) + } else { + ElMessage.error('设备不在线') + } + }) updateTime() timeInterval = setInterval(updateTime, 1000) }) diff --git a/vite.config.js b/vite.config.js index 5b92e98..ad0d1ac 100644 --- a/vite.config.js +++ b/vite.config.js @@ -59,7 +59,8 @@ export default defineConfig({ open: true, proxy: { '/jsonrpc': { - target: 'https://lamp.ruixininfo.com', + // target: 'https://lamp.ruixininfo.com', + target: 'https://smart-light.ruixininfo.com', // target: 'http://171.208.94.46:7070', changeOrigin: true, secure: false,