diff --git a/src/components/Linechart.vue b/src/components/Linechart.vue index 6f91310..2223474 100644 --- a/src/components/Linechart.vue +++ b/src/components/Linechart.vue @@ -1,6 +1,6 @@ @@ -25,63 +25,80 @@ use([ CanvasRenderer ]) - - -const option = ref({ - xAxis: { - type: 'category', - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - axisLabel: { - color: '#fff' - } - }, - yAxis: { - type: 'value', - axisLabel: { - color: '#fff' - } - }, - grid: { - left: '5%', - top: 60, - right: '5%', - bottom: '10%', +const props = defineProps({ + height: { + type: String, + default: '400px' }, - title: { - text: '有功功率kW', - textStyle: { - color: '#fff' - } - }, - legend: { - data: ['有功功率'], - right: '5%', - textStyle: { - color: '#fff' + lineData: { + type: Array, + default: [] + } +}) + +const option = computed(() => { + return { + xAxis: { + type: 'category', + data: props.lineData.map(item => item.name), + axisLabel: { + color: '#fff' + } }, - }, - tooltip: { - trigger: 'axis', // 触发类型,默认数据项触发,可选为:'item' | 'axis' | 'none' - axisPointer: { - type: 'cross' // 默认为直线,可选为:'line' | 'shadow' - } - }, - series: [ - { - data: [150, 230, 224, 218, 135, 147, 260], - type: 'line', - name: '有功功率', - color: '#00E0F4', - smooth: true, - symbolSize: 10 - } - ] + yAxis: { + type: 'value', + max: 100, + min: 0, + axisLabel: { + color: '#fff', + formatter: '{value}%' + } + }, + grid: { + left: '5%', + top: 60, + right: '5%', + bottom: '10%', + }, + title: { + text: '有功功率kW', + textStyle: { + color: '#fff' + } + }, + legend: { + data: ['有功功率'], + right: '5%', + textStyle: { + color: '#fff' + }, + }, + tooltip: { + trigger: 'axis', // 触发类型,默认数据项触发,可选为:'item' | 'axis' | 'none' + axisPointer: { + type: 'cross', // 默认为直线,可选为:'line' | 'shadow' + label: { + formatter: '{value} 时' + } + }, + valueFormatter: (value) => value + '%' + }, + series: [ + { + data: props.lineData.map(item => item.value), + type: 'line', + name: '有功功率', + color: '#00E0F4', + smooth: true, + symbolSize: 10 + } + ] + } }) \ No newline at end of file diff --git a/src/views/AlarmInformation/index.vue b/src/views/AlarmInformation/index.vue index 166a513..d8d25fa 100644 --- a/src/views/AlarmInformation/index.vue +++ b/src/views/AlarmInformation/index.vue @@ -18,6 +18,12 @@
+ + + + + 批量处理 + @@ -31,11 +37,21 @@ + + + + + +
@@ -108,6 +124,43 @@ const handleDel = () => { if (multipleSelection.value.length === 0) { return ElMessage.warning('请至少选择一项!') } + ElMessageBox.confirm( + `此操作将删除报警信息,是否继续?`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + RPC.post('/m9z/fault/batchExec', { ids: multipleSelection.value.map(item => item.id), operate: 1 }).then(res => { + ElMessage.success('处理成功') + multipleTableRef.value.clearSelection() + currentPage.value = 1 + getData() + }) + }) +} +const handleDeal = () => { + console.log(multipleSelection.value) + if (multipleSelection.value.length === 0) { + return ElMessage.warning('请至少选择一项!') + } + ElMessageBox.confirm( + `此操作将处理报警信息,是否继续?`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + RPC.post('/m9z/fault/batchExec', { ids: multipleSelection.value.map(item => item.id), operate: 0 }).then(res => { + ElMessage.success('处理成功') + multipleTableRef.value.clearSelection() + getData() + }) + }) } const getData = () => { diff --git a/src/views/Monitoring/index.vue b/src/views/Monitoring/index.vue index 2d3be98..1ec4430 100644 --- a/src/views/Monitoring/index.vue +++ b/src/views/Monitoring/index.vue @@ -140,9 +140,13 @@
- +
+ + +
@@ -198,7 +202,7 @@ import { ref, onMounted, onUnmounted, watch } from 'vue' import { useRouter } from 'vue-router' import RPC from '@/utils/rpc' import dayjs from 'dayjs' -// import Linechart from '@/components/Linechart.vue'; +import Linechart from '@/components/Linechart.vue'; const commit_uid = localStorage.getItem('central_control_comm_uid') @@ -212,6 +216,32 @@ const selectedChannelName = ref(null) const week = ref('') const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; +function transformHourlyData(data) { + if (!data) return [] + return Object.keys(data) + .filter(key => key.startsWith('hour')) + .map(key => { + const hourNum = parseInt(key.replace('hour', ''), 10); + return { + name: hourNum.toString().padStart(2, '0'), + value: data[key] + }; + }) + .sort((a, b) => a.name.localeCompare(b.name)); +} +const lineData = ref([]) +const recdDate = ref(dayjs().add(-1, 'day').format('YYYY-MM-DD')) +const lineDataLoading = ref(false) +const getLineData = () => { + lineDataLoading.value = true + RPC.post('/lightm/rtu/his', { commUid: commit_uid, recdDate: recdDate.value }).then(res => { + lineData.value = transformHourlyData(res) + }).finally(() => { + lineDataLoading.value = false + }) +} +getLineData() + // 电力参数数据 const powerPhases = ref([ { @@ -379,7 +409,6 @@ const getInfo = () => { getInfo() const timer = setInterval(() => { - console.log('setInterval') getInfo() }, 30000) @@ -947,8 +976,19 @@ onUnmounted(() => { padding-top: 20px; } -.chart { +.chartBox { width: 100%; - height: 400px; + + .search { + display: flex; + align-items: center; + margin-bottom: 15px; + + .el-button { + background-color: #006eff; + border-color: #006eff; + margin-left: 20px; + } + } } diff --git a/src/views/ParamsConfig/TableDialog.vue b/src/views/ParamsConfig/TableDialog.vue new file mode 100644 index 0000000..55e97b2 --- /dev/null +++ b/src/views/ParamsConfig/TableDialog.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/src/views/ParamsConfig/index.vue b/src/views/ParamsConfig/index.vue index 68ed4b6..c893452 100644 --- a/src/views/ParamsConfig/index.vue +++ b/src/views/ParamsConfig/index.vue @@ -25,7 +25,7 @@
设备时间
- +
@@ -62,7 +62,7 @@
控制回路数
-
+
{{ subLoopParameter.subLoopData?.length || 0 }}
@@ -83,8 +83,24 @@
稳压分控器
-
- +
+
+
+
回路地址
+
{{ item.LoopAddress }}
+
+
+
子模块数量
+
{{ item.Modules?.length || 0 }}
+
+
+
调光幅度
+
{{ item.DimmingValue ? item.DimmingValue + '%' : item.DimmingValue }}
+
+
+
查看子模块
+
+
@@ -101,7 +117,7 @@
电能表型号
-
+
ADL400
@@ -144,6 +160,7 @@
+ @@ -151,11 +168,14 @@ import { ref, onMounted, onUnmounted } from 'vue' import { useRouter } from 'vue-router' import RPC from '@/utils/rpc'; +import TableDialog from './TableDialog.vue'; const router = useRouter() const currentTime = ref('') const systemRuntime = ref('38分钟') const formField = ref({}) +const deviceTime = ref('') +const subLoopParameter = ref([]) const commit_uid = localStorage.getItem('central_control_comm_uid') const RiseSetOption = [ @@ -183,6 +203,303 @@ 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 => { @@ -240,14 +557,19 @@ const save = () => { "rise": Number(formField.value.rise), "set": Number(formField.value.set) } - console.log(params, formField.value) - // RPC.post('/m9z/setDeviceLgnLatAndSunRsTime', params).then(res => { - // ElMessage.success('操作成功') - // }) + Promise.all(RPC.post('/m9z/setDeviceLgnLatAndSunRsTime', params), RPC.post('/m9z/setDeviceTime', { "comm_uid": commit_uid, device_time: deviceTime.value })).then(res => { + ElMessage.success('操作成功') + }) }) } - - +const currentTableData = ref([]) +const currentTitle = ref('') +const isShowDialog = ref(false) +const openDialog = item => { + isShowDialog.value = true + currentTableData.value = item.Modules + currentTitle.value = item.LoopAddress +} // 返回主界面 const goBack = () => { @@ -327,6 +649,7 @@ onUnmounted(() => { border: .5px solid #ddd; display: flex; flex-direction: column; + height: 450px; .main_title { display: flex; @@ -351,6 +674,10 @@ onUnmounted(() => { } } + &.subLoopParame { + overflow-y: auto; + } + .key { color: #fff; margin-right: 10px; @@ -368,6 +695,22 @@ onUnmounted(() => { // border: 1px solid #ccc; } + .subLoopParameter_item { + border-radius: 10px; + border: 1px solid #fff; + padding: 15px; + margin-bottom: 20px; + + .item { + display: flex; + justify-content: space-between; + + &:not(:last-child) { + margin-bottom: 10px; + } + } + } + .line { display: flex; align-items: center; @@ -403,7 +746,7 @@ onUnmounted(() => { margin: 0 10px; &.save { - background-color: #7fe669; + background-color: #61c24b; } &.restart { diff --git a/vite.config.js b/vite.config.js index bf15781..b1b59c2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -61,6 +61,7 @@ export default defineConfig({ '/jsonrpc': { target: 'https://lamp-dev.ruixininfo.com', changeOrigin: true, + secure: false, }, }, },