优化暂存

main
Lufaneng 1 year ago
parent 42916f45ec
commit 3178ec0946

@ -1,6 +1,6 @@
<template> <template>
<div class="chart"> <div class="chart">
<v-chart class="chart" :option="option" /> <v-chart :style="{ height: height }" class="chart" :option="option" />
</div> </div>
</template> </template>
@ -25,63 +25,80 @@ use([
CanvasRenderer CanvasRenderer
]) ])
const props = defineProps({
height: {
const option = ref({ type: String,
xAxis: { default: '400px'
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%',
}, },
title: { lineData: {
text: '有功功率kW', type: Array,
textStyle: { default: []
color: '#fff' }
} })
},
legend: { const option = computed(() => {
data: ['有功功率'], return {
right: '5%', xAxis: {
textStyle: { type: 'category',
color: '#fff' data: props.lineData.map(item => item.name),
axisLabel: {
color: '#fff'
}
}, },
}, yAxis: {
tooltip: { type: 'value',
trigger: 'axis', // 'item' | 'axis' | 'none' max: 100,
axisPointer: { min: 0,
type: 'cross' // 线'line' | 'shadow' axisLabel: {
} color: '#fff',
}, formatter: '{value}%'
series: [ }
{ },
data: [150, 230, 224, 218, 135, 147, 260], grid: {
type: 'line', left: '5%',
name: '有功功率', top: 60,
color: '#00E0F4', right: '5%',
smooth: true, bottom: '10%',
symbolSize: 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
}
]
}
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chart { .chart {
width: 100%; width: 100%;
height: 100%;
} }
</style> </style>

@ -18,6 +18,12 @@
<!-- 主体区域 --> <!-- 主体区域 -->
<div class="control-content"> <div class="control-content">
<div style="width: 100%;"> <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-button @click="handleDel" class="delBtn" type="danger">
<el-icon> <el-icon>
<Delete /> <Delete />
@ -31,11 +37,21 @@
<el-table-column align="center" prop="loop_idx" label="回路地址" /> <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_msg" label="故障信息" />
<el-table-column align="center" prop="fault_code" 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"> <el-table-column align="center" prop="fault_time" label="故障时间" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
{{ row.fault_time ? dayjs(row.fault_time).format('YYYY-MM-DD HH:mm:ss') : '' }} {{ row.fault_time ? dayjs(row.fault_time).format('YYYY-MM-DD HH:mm:ss') : '' }}
</template> </template>
</el-table-column> </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-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" /> <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> </div>
@ -108,6 +124,43 @@ const handleDel = () => {
if (multipleSelection.value.length === 0) { if (multipleSelection.value.length === 0) {
return ElMessage.warning('请至少选择一项!') 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 = () => { const getData = () => {

@ -140,9 +140,13 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="chart"> <div class="chartBox">
<Linechart></Linechart> <div class="search">
</div> --> <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> </div>
</div> </div>
@ -198,7 +202,7 @@ import { ref, onMounted, onUnmounted, watch } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import RPC from '@/utils/rpc' import RPC from '@/utils/rpc'
import dayjs from 'dayjs' 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') const commit_uid = localStorage.getItem('central_control_comm_uid')
@ -212,6 +216,32 @@ const selectedChannelName = ref(null)
const week = ref('') const week = ref('')
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; 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([ const powerPhases = ref([
{ {
@ -379,7 +409,6 @@ const getInfo = () => {
getInfo() getInfo()
const timer = setInterval(() => { const timer = setInterval(() => {
console.log('setInterval')
getInfo() getInfo()
}, 30000) }, 30000)
@ -947,8 +976,19 @@ onUnmounted(() => {
padding-top: 20px; padding-top: 20px;
} }
.chart { .chartBox {
width: 100%; 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> </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="line">
<div class="item"> <div class="item">
<div class="key">设备时间</div> <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> </div>
<div class="line"> <div class="line">
@ -62,7 +62,7 @@
<div class="line"> <div class="line">
<div class="item"> <div class="item">
<div class="key">控制回路数</div> <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>
<div class="item"></div> <div class="item"></div>
</div> </div>
@ -83,8 +83,24 @@
<div class="main_title"> <div class="main_title">
稳压分控器 稳压分控器
</div> </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> </div>
<div class="main_item"> <div class="main_item">
@ -101,7 +117,7 @@
<div class="line"> <div class="line">
<div class="item"> <div class="item">
<div class="key">电能表型号</div> <div class="key">电能表型号</div>
<div class="value"> </div> <div class="value">ADL400</div>
<!-- <el-input v-model="formField.g" style="width: 100px" placeholder="请输入" /> --> <!-- <el-input v-model="formField.g" style="width: 100px" placeholder="请输入" /> -->
</div> </div>
</div> </div>
@ -144,6 +160,7 @@
</el-button> </el-button>
</div> </div>
</div> </div>
<TableDialog v-if="isShowDialog" @closed="isShowDialog = false" :tableData="currentTableData" :title="currentTitle"></TableDialog>
</div> </div>
</template> </template>
@ -151,11 +168,14 @@
import { ref, onMounted, onUnmounted } from 'vue' import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import RPC from '@/utils/rpc'; import RPC from '@/utils/rpc';
import TableDialog from './TableDialog.vue';
const router = useRouter() const router = useRouter()
const currentTime = ref('') const currentTime = ref('')
const systemRuntime = ref('38分钟') const systemRuntime = ref('38分钟')
const formField = ref({}) const formField = ref({})
const deviceTime = ref('')
const subLoopParameter = ref([])
const commit_uid = localStorage.getItem('central_control_comm_uid') const commit_uid = localStorage.getItem('central_control_comm_uid')
const RiseSetOption = [ const RiseSetOption = [
@ -183,6 +203,303 @@ RPC.post('/m9z/getSunRiseSet', { comm_uid: commit_uid }).then(res => {
formField.value.rise = res.rise formField.value.rise = res.rise
formField.value.set = res.set 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('') const address = ref('')
RPC.post('/adl400/getMsgAddress', { comm_uid: commit_uid }).then(res => { RPC.post('/adl400/getMsgAddress', { comm_uid: commit_uid }).then(res => {
@ -240,14 +557,19 @@ const save = () => {
"rise": Number(formField.value.rise), "rise": Number(formField.value.rise),
"set": Number(formField.value.set) "set": Number(formField.value.set)
} }
console.log(params, formField.value) Promise.all(RPC.post('/m9z/setDeviceLgnLatAndSunRsTime', params), RPC.post('/m9z/setDeviceTime', { "comm_uid": commit_uid, device_time: deviceTime.value })).then(res => {
// RPC.post('/m9z/setDeviceLgnLatAndSunRsTime', params).then(res => { ElMessage.success('操作成功')
// 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 = () => { const goBack = () => {
@ -327,6 +649,7 @@ onUnmounted(() => {
border: .5px solid #ddd; border: .5px solid #ddd;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 450px;
.main_title { .main_title {
display: flex; display: flex;
@ -351,6 +674,10 @@ onUnmounted(() => {
} }
} }
&.subLoopParame {
overflow-y: auto;
}
.key { .key {
color: #fff; color: #fff;
margin-right: 10px; margin-right: 10px;
@ -368,6 +695,22 @@ onUnmounted(() => {
// border: 1px solid #ccc; // 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 { .line {
display: flex; display: flex;
align-items: center; align-items: center;
@ -403,7 +746,7 @@ onUnmounted(() => {
margin: 0 10px; margin: 0 10px;
&.save { &.save {
background-color: #7fe669; background-color: #61c24b;
} }
&.restart { &.restart {

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

Loading…
Cancel
Save