优化暂存

main
Lufaneng 1 year ago
parent 42916f45ec
commit 3178ec0946

@ -1,6 +1,6 @@
<template>
<div class="chart">
<v-chart class="chart" :option="option" />
<v-chart :style="{ height: height }" class="chart" :option="option" />
</div>
</template>
@ -25,20 +25,33 @@ use([
CanvasRenderer
])
const props = defineProps({
height: {
type: String,
default: '400px'
},
lineData: {
type: Array,
default: []
}
})
const option = ref({
const option = computed(() => {
return {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
data: props.lineData.map(item => item.name),
axisLabel: {
color: '#fff'
}
},
yAxis: {
type: 'value',
max: 100,
min: 0,
axisLabel: {
color: '#fff'
color: '#fff',
formatter: '{value}%'
}
},
grid: {
@ -63,12 +76,16 @@ const option = ref({
tooltip: {
trigger: 'axis', // 'item' | 'axis' | 'none'
axisPointer: {
type: 'cross' // 线'line' | 'shadow'
type: 'cross', // 线'line' | 'shadow'
label: {
formatter: '{value} 时'
}
},
valueFormatter: (value) => value + '%'
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
data: props.lineData.map(item => item.value),
type: 'line',
name: '有功功率',
color: '#00E0F4',
@ -76,12 +93,12 @@ const option = ref({
symbolSize: 10
}
]
}
})
</script>
<style lang="scss" scoped>
.chart {
width: 100%;
height: 100%;
}
</style>

@ -18,6 +18,12 @@
<!-- 主体区域 -->
<div class="control-content">
<div style="width: 100%;">
<el-button @click="handleDeal" class="handleBtn" type="success">
<el-icon>
<Delete />
</el-icon>
批量处理
</el-button>
<el-button @click="handleDel" class="delBtn" type="danger">
<el-icon>
<Delete />
@ -31,11 +37,21 @@
<el-table-column align="center" prop="loop_idx" label="回路地址" />
<el-table-column align="center" prop="fault_msg" label="故障信息" />
<el-table-column align="center" prop="fault_code" label="故障码" />
<el-table-column align="center" prop="voltage" label="电压">
<template #default="{ row }">
{{ row.voltage && row.voltage + 'V' }}
</template>
</el-table-column>
<el-table-column align="center" prop="fault_time" label="故障时间" min-width="150">
<template #default="{ row }">
{{ row.fault_time ? dayjs(row.fault_time).format('YYYY-MM-DD HH:mm:ss') : '' }}
</template>
</el-table-column>
<el-table-column align="center" prop="voltage" label="处理状态">
<template #default="{ row }">
{{ row.operate_status == 0 ? '未处理' : '已处理' }}
</template>
</el-table-column>
</el-table>
<el-pagination v-if="total > 0" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[10, 30, 50, 100]" :total="total" :pager-count="5" v-model:page-size="pageSize" v-model:current-page="currentPage" background layout="prev, pager, next,jumper" />
</div>
@ -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 = () => {

@ -140,9 +140,13 @@
</div>
</div>
</div>
<!-- <div class="chart">
<Linechart></Linechart>
</div> -->
<div class="chartBox">
<div class="search">
<el-date-picker value-format="YYYY-MM-DD" v-model="recdDate" type="date" placeholder="请选择时间" />
<el-button type="primary" :loading="lineDataLoading" @click="getLineData"></el-button>
</div>
<Linechart :lineData="lineData"></Linechart>
</div>
</div>
</div>
</div>
@ -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;
}
}
}
</style>

@ -0,0 +1,62 @@
<script setup>
const props = defineProps({
title: [String],
tableData: [Object],
})
const emit = defineEmits(['closed'])
const dialogVisible = ref(false)
onMounted(() => {
dialogVisible.value = true
})
function closed() {
emit('closed')
}
</script>
<template>
<el-dialog align-center :title="title + '-子模块信息'" width="800px" v-model="dialogVisible" @closed="closed">
<el-table :data="tableData" style="width: 100%" height="366" stripe>
<el-table-column align="center" prop="ModuleLoopAddress" label="回路地址" />
<el-table-column align="center" prop="DeviceAddress" label="设备地址" />
<el-table-column align="center" prop="CurrentPWMDuty" label="电流PWM">
<template #default="{ row }">
{{ row.CurrentPWMDuty && row.CurrentPWMDuty + '%' }}
</template>
</el-table-column>
<el-table-column align="center" prop="VoltagePWMDuty" label="电压PWM">
<template #default="{ row }">
{{ row.VoltagePWMDuty && row.VoltagePWMDuty + '%' }}
</template>
</el-table-column>
<el-table-column align="center" prop="CurrentLimitPct" label="限流百分比">
<template #default="{ row }">
{{ row.CurrentLimitPct && row.CurrentLimitPct + '%' }}
</template>
</el-table-column>
<el-table-column align="center" prop="ModuleVersion" label="版本" />
</el-table>
<template #footer>
<div class="dialog-footer">
<el-button icon="Remove" @click="dialogVisible = false">
关闭
</el-button>
<!-- <el-button
v-if="!isOnlyView"
icon="CircleCheck"
:loading="loading"
type="primary"
@click="submitForm"
>
</el-button> -->
</div>
</template>
</el-dialog>
</template>
<style lang="scss" scoped></style>

@ -25,7 +25,7 @@
<div class="line">
<div class="item">
<div class="key">设备时间</div>
<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" style="flex: 1;" v-model="formField.deviceTime" type="datetime" placeholder="请选择时间" />
<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" style="flex: 1;" v-model="deviceTime" type="datetime" placeholder="请选择时间" />
</div>
</div>
<div class="line">
@ -62,7 +62,7 @@
<div class="line">
<div class="item">
<div class="key">控制回路数</div>
<div class="value" style="min-width: 100px;"></div>
<div class="value" style="min-width: 100px;">{{ subLoopParameter.subLoopData?.length || 0 }}</div>
</div>
<div class="item"></div>
</div>
@ -83,8 +83,24 @@
<div class="main_title">
稳压分控器
</div>
<div class="main_content energy_meter" style="width:235px">
<div class="main_content energy_meter subLoopParame" style="width:235px">
<div class="subLoopParameter_item" v-for="item in subLoopParameter.subLoopData">
<div class="item">
<div class="key">回路地址</div>
<div class="value">{{ item.LoopAddress }}</div>
</div>
<div class="item">
<div class="key">子模块数量</div>
<div class="value">{{ item.Modules?.length || 0 }}</div>
</div>
<div class="item">
<div class="key">调光幅度</div>
<div class="value">{{ item.DimmingValue ? item.DimmingValue + '%' : item.DimmingValue }}</div>
</div>
<div class="buttonBox" v-if="item.Modules?.length">
<div class="button save" style="width: 100px;" @click="openDialog(item)"></div>
</div>
</div>
</div>
</div>
<div class="main_item">
@ -101,7 +117,7 @@
<div class="line">
<div class="item">
<div class="key">电能表型号</div>
<div class="value"> </div>
<div class="value">ADL400</div>
<!-- <el-input v-model="formField.g" style="width: 100px" placeholder="请输入" /> -->
</div>
</div>
@ -144,6 +160,7 @@
</el-button>
</div>
</div>
<TableDialog v-if="isShowDialog" @closed="isShowDialog = false" :tableData="currentTableData" :title="currentTitle"></TableDialog>
</div>
</template>
@ -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 {

@ -61,6 +61,7 @@ export default defineConfig({
'/jsonrpc': {
target: 'https://lamp-dev.ruixininfo.com',
changeOrigin: true,
secure: false,
},
},
},

Loading…
Cancel
Save