This commit is contained in:
高云鹏 2024-12-17 16:34:31 +08:00
commit 7cc5f90068
6 changed files with 246 additions and 119 deletions

View File

@ -51,7 +51,7 @@ public class FaultRecorderController {
String code = jsonObject.getString("deviceCode"); String code = jsonObject.getString("deviceCode");
String startTime = jsonObject.getString("startTime"); String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime"); String endTime = jsonObject.getString("endTime");
List<FileNode> result = faultRecorderService.getDirOrFileList("Statuscode",code,startTime,endTime); List<FileNode> result = faultRecorderService.getDirOrFileList("Tracelog",code,startTime,endTime);
return R.success(result); return R.success(result);
} }

View File

@ -191,8 +191,8 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine()); resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("文件解析异常:{}",e);
throw new ServiceException("配置解析异常"); throw new ServiceException("文件解析异常,请检查配置");
} }
return resultMap; return resultMap;
} }
@ -231,6 +231,7 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
stringListMap = parseDataCurve(result, timeFormat); stringListMap = parseDataCurve(result, timeFormat);
} catch (Exception e) { } catch (Exception e) {
log.error("文件解析失败{}", e); log.error("文件解析失败{}", e);
throw new ServiceException("文件解析失败");
} }
return stringListMap; return stringListMap;
} }

View File

@ -44,7 +44,7 @@ public class PlcLogsController {
String code = jsonObject.getString("deviceCode"); String code = jsonObject.getString("deviceCode");
String startTime = jsonObject.getString("startTime"); String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime"); String endTime = jsonObject.getString("endTime");
List<FileNode> result = plcLogService.getDirOrFileList("Tracelog",code,startTime,endTime); List<FileNode> result = plcLogService.getDirOrFileList("Statuscode",code,startTime,endTime);
return R.success(result); return R.success(result);
} }

View File

@ -86,8 +86,8 @@ public class PlcLogsServiceImpl implements PlcLogService {
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine()); resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("文件解析异常:{}",e);
throw new ServiceException("配置解析异常"); throw new ServiceException("文件解析异常,请检查配置");
} }
return resultMap; return resultMap;
} }
@ -163,6 +163,7 @@ public class PlcLogsServiceImpl implements PlcLogService {
stringListMap = parseDataCurve(result, timeFormat); stringListMap = parseDataCurve(result, timeFormat);
} catch (Exception e) { } catch (Exception e) {
log.error("文件解析失败{}", e); log.error("文件解析失败{}", e);
throw new ServiceException("文件解析失败");
} }
return stringListMap; return stringListMap;
} }

View File

@ -0,0 +1,18 @@
import createAxios from '/@/utils/axios'
export function getParamList(params: object = {}) {
return createAxios({
url: '/api/page/home/set/getList',
method: 'POST',
data: params,
})
}
export function Paramupdate(params: object = {}) {
return createAxios({
url: '/api/page/home/set/update',
method: 'POST',
data: params,
})
}

View File

@ -9,13 +9,13 @@
<el-col :span="24"> <el-col :span="24">
<div class="tablePart"> <div class="tablePart">
<el-table :data="paramData" style="width: 100%"> <el-table :data="paramData" style="width: 100%">
<el-table-column prop="paramNmae" label="参数名称" /> <el-table-column prop="paramName" label="参数名称" />
<el-table-column prop="namedes" label="中文" /> <el-table-column prop="paramDesc" label="中文" />
<!-- <el-table-column prop="paramValue" label="参数值" />--> <!-- <el-table-column prop="paramValue" label="参数值" />-->
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template #default="scope"> <template #default="scope">
<span style="color: #0064aa; cursor: pointer" <span style="color: #0064aa; cursor: pointer"
v-if="scope.row.paramNmae=='ParamColor'" v-if="scope.row.paramName=='paramColor'"
@click="Editcolor(scope)" @click="Editcolor(scope)"
>编辑</span> >编辑</span>
<span style="color: #0064aa; cursor: pointer" <span style="color: #0064aa; cursor: pointer"
@ -33,10 +33,26 @@
<el-dialog v-model="visibleColor" title="状态颜色" width="1000" :before-close="handleClose" class="ColorPart"> <el-dialog v-model="visibleColor" title="状态颜色" width="1000" :before-close="handleClose" class="ColorPart">
<div class="tablePart"> <div class="tablePart">
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="porder" label="状态" /> <el-table-column prop="state" label="状态">
<el-table-column prop="attributeCode" label="颜色">
<template #default="scope"> <template #default="scope">
<div class="color-box" :style="{ backgroundColor: scope.row.attributeCode }"></div> <div v-if="scope.row.state == 20">并网</div>
<div v-if="scope.row.state == 10">维护</div>
<div v-if="scope.row.state == 8">限功率运行</div>
<div v-if="scope.row.state == 0">离线</div>
<div v-if="scope.row.state == 16">启动</div>
<div v-if="scope.row.state == 6">正常停机</div>
<div v-if="scope.row.state == 1">外部因素导致停机</div>
<div v-if="scope.row.state == 2">停机</div>
<div v-if="scope.row.state == 11">待机</div>
<div v-if="scope.row.state == 1110">解缆状态</div>
<div v-if="scope.row.state == 1111">电网故障停机</div>
<div v-if="scope.row.state == 1112">安全链停机</div>
<div v-if="scope.row.state == 33">通讯中断</div>
</template>
</el-table-column>
<el-table-column prop="color" label="颜色">
<template #default="scope">
<div class="color-box" :style="{ backgroundColor: scope.row.color }"></div>
<!-- <el-color-picker v-model="scope.row.attributeCode" show-alpha></el-color-picker>--> <!-- <el-color-picker v-model="scope.row.attributeCode" show-alpha></el-color-picker>-->
</template> </template>
</el-table-column> </el-table-column>
@ -49,7 +65,7 @@
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="onSubmitType">保存</el-button> <el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="visibleColor = false">取消</el-button> <el-button @click="visibleColor = false">取消</el-button>
</div> </div>
</template> </template>
@ -58,55 +74,100 @@
<div class="layoutmain"> <div class="layoutmain">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="4"> <el-col :span="4">
<div class="demo-color-box" style="background: rgb(2, 119, 179);"> <div class="demo-color-box"
style="background: #9C27B0 ;"
@click="onSubmitColor('#9C27B0')">
<div class="value" text="xs">#9C27B0</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #673AB7 ;"
@click="onSubmitColor('#673AB7')">
<div class="value" text="xs">#673AB7</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #3F51B5;"
@click="onSubmitColor('#3F51B5')">
<div class="value" text="xs">#3F51B5</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #3059EC;"
@click="onSubmitColor('#3059EC')">
<div class="value" text="xs">#3059EC</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #0277B3;"
@click="onSubmitColor('#0277B3')">
<div class="value" text="xs">#0277B3</div> <div class="value" text="xs">#0277B3</div>
</div> </div>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<div class="demo-color-box" style="background: rgb(255, 126, 0)"> <div class="demo-color-box"
<div class="value" text="xs">#FF7E00</div> style="background: #00A096;"
</div> @click="onSubmitColor('#00A096')">
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(6, 180, 41)">
<div class="value" text="xs">#FE3731</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(0, 160, 150);">
<div class="value" text="xs">#00A096</div> <div class="value" text="xs">#00A096</div>
</div> </div>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<div class="demo-color-box" style="background: rgb(153, 153, 153);"> <div class="demo-color-box"
style="background: #06B429;"
@click="onSubmitColor('#06B429')">
<div class="value" text="xs">#06B429</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #64DD17;"
@click="onSubmitColor('#64DD17')">
<div class="value" text="xs">#64DD17</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #EEFF41;"
@click="onSubmitColor('#EEFF41')">
<div class="value" text="xs">#EEFF41</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #FFB600;"
@click="onSubmitColor('#FFB600')">
<div class="value" text="xs">#FFB600</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: #FF7E00;"
@click="onSubmitColor('#FF7E00')">
<div class="value" text="xs">#FF7E00</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: #FE3731;"
@click="onSubmitColor('#FE3731')">
<div class="value" text="xs">#FE3731</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box"
style="background: rgb(153, 153, 153);"
@click="onSubmitColor('#999999')">
<div class="value" text="xs">#999999</div> <div class="value" text="xs">#999999</div>
</div> </div>
</el-col> </el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
<div class="value" text="xs">#67C23A</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(254, 55, 49);">
<div class="value" text="xs">#67C23A</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
<div class="value" text="xs">#67C23A</div>
</div>
</el-col>
<el-col :span="4">
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
<div class="value" text="xs">#67C23A</div>
</div>
</el-col>
</el-row> </el-row>
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="onSubmitType">确定</el-button> <!-- <el-button type="primary" @click="onSubmitColor">确定</el-button>-->
<el-button @click="visibleselectColor = false">取消</el-button> <el-button @click="visibleselectColor = false">取消</el-button>
</div> </div>
</template> </template>
@ -115,19 +176,19 @@
<div class="layoutmain"> <div class="layoutmain">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="demo-color-box"> <div class="demo-color-box" @click="onSubmitLayout('风格1', $event.currentTarget)">
<div class="style01 selected"><img src="~assets/SystemParam/style01.png" alt="" /></div> <div class="style01"><img src="~assets/SystemParam/style01.png" alt="" /></div>
<div>风格1</div> <div>风格1</div>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="demo-color-box"> <div class="demo-color-box" @click="onSubmitLayout('风格2', $event.currentTarget)">
<div class="style01"><img src="~assets/SystemParam/style02.png" alt="" /></div> <div class="style01"><img src="~assets/SystemParam/style02.png" alt="" /></div>
<div>风格2</div> <div>风格2</div>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="demo-color-box"> <div class="demo-color-box" @click="onSubmitLayout('风格3', $event.currentTarget)">
<div class="style01"><img src="~assets/SystemParam/style03.png" alt="" /></div> <div class="style01"><img src="~assets/SystemParam/style03.png" alt="" /></div>
<div>风格3</div> <div>风格3</div>
</div> </div>
@ -136,7 +197,7 @@
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="onSubmitType">保存</el-button> <!-- <el-button type="primary" @click="SaveLayout">保存</el-button>-->
<el-button @click="visibleLayout = false">取消</el-button> <el-button @click="visibleLayout = false">取消</el-button>
</div> </div>
</template> </template>
@ -145,53 +206,126 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref} from 'vue' import {onMounted, ref,nextTick} from 'vue'
const paramData=ref([ import { getParamList,Paramupdate } from '/@/api/backend/SystemParam/request'
{paramNmae:'ParamColor',namedes:'颜色',paramValue:'0.5'}, import { ElMessage} from 'element-plus'
{paramNmae:'ParamLayout',namedes:'布局',paramValue:'0.5'} const paramData=ref([])
]) const tableData = ref([])
const tableData = ref([ const PARAM_COLOR = 'paramColor';
{ porder: '并网', attributeCode: 'rgb(2, 119, 179)' }, const PARAM_LAYOUT = 'paramLayout';
{ porder: '待机', attributeCode: 'rgb(255, 126, 0)' }, const getList=()=>{
{ porder: '启动', attributeCode: 'rgb(6, 180, 41)' }, getParamList().then((res:any)=>{
{ porder: '维护', attributeCode: 'rgb(0, 160, 150)' }, paramData.value=res.data
{ porder: '离线', attributeCode: 'rgb(153, 153, 153)' }, paramData.value.forEach((item, index) => {
{ porder: '限功率运行', attributeCode: 'rgb(48, 89, 236)' }, if (item.paramName === PARAM_COLOR && res.data && res.data[index]) {
{ porder: '正常停机', attributeCode: 'rgb(254, 55, 49)' }, tableData.value = res.data[index].paramValueJson;
{ porder: '通讯中断', attributeCode: 'rgb(153, 153, 153)' }, }
{ porder: '停机', attributeCode: 'rgb(153, 153, 153)' }, });
{ porder: '解缆状态', attributeCode: 'rgb(48, 89, 236)' },
{ porder: '电网故障停机', attributeCode: 'rgb(254, 55, 49)' }, })
{ porder: '安全链停机', attributeCode: 'rgb(254, 55, 49)' }, }
]) const setDefaultLayout = (defaultLayout: string) => {
const layoutElements = document.querySelectorAll('.LayoutPart .demo-color-box');
if (selectedLayout.value) {
selectedLayout.value.classList.remove('selected');
}
layoutElements.forEach((element: HTMLElement) => {
if (element.textContent?.trim() === defaultLayout) {
element.classList.add('selected');
selectedLayout.value = element;
}
});
};
const selectLayout=ref([
{value:'0',label:'风格1'},
{value:'1',label:'风格2'},
{value:'2',label:'风格3'},
])
const visibleColor=ref(false) const visibleColor=ref(false)
const Editcolor = (data: any) => { const Editcolor = (data: any) => {
debugger
visibleColor.value=true visibleColor.value=true
paramColorData.value.id=data.row.id
paramColorData.value.paramName=data.row.paramName
paramColorData.value.paramDesc=data.row.paramDesc
} }
const handleClose = () => { const handleClose = () => {
debugger
visibleColor.value=false visibleColor.value=false
} }
const visibleLayout=ref(false) const visibleLayout=ref(false)
const EditLayout = (data: any) => { const EditLayout = (data: any) => {
debugger paramColorData.value.id=data.row.id
paramColorData.value.paramName=data.row.paramName
paramColorData.value.paramDesc=data.row.paramDesc
visibleLayout.value=true visibleLayout.value=true
const defaultLayout = data.row.paramValueJson[0];
nextTick(() => {
setDefaultLayout(defaultLayout);
});
} }
const handleCloselayout = () => { const handleCloselayout = () => {
debugger
visibleLayout.value=false visibleLayout.value=false
} }
const currentparemColor=ref({
state:'',
color:''
})
const visibleselectColor=ref(false) const visibleselectColor=ref(false)
const selectColor = () => { const selectColor = (data:any) => {
visibleselectColor.value=true visibleselectColor.value=true
currentparemColor.value.state=data.row.state
currentparemColor.value.color=data.row.color
} }
//
const onSubmitColor=(data:any)=>{
currentparemColor.value.color=data
tableData.value.forEach((item:any)=>{
if(item.state==currentparemColor.value.state){
item.color=currentparemColor.value.color
}
})
visibleselectColor.value=false
}
//
const selectedLayout = ref(null);
const onSubmitLayout=(data:any,layoutElement: HTMLElement)=>{
if (selectedLayout.value) {
selectedLayout.value.classList.remove('selected');
}
layoutElement.classList.add('selected');
selectedLayout.value = layoutElement
paramColorData.value.paramValue=JSON.stringify([data])
Paramupdate(paramColorData.value).then((res:any)=>{
if(res.code==200){
ElMessage.success(res.msg ?? '保存成功')
visibleLayout.value=false
getList()
}else {
ElMessage.error(res.msg ?? '保存失败')
}
}).catch((err) => {
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
})
}
const paramColorData=ref({
id:'',
paramName:'',
paramDesc:'',
paramValue:[]
})
//
const onSubmit=()=>{
paramColorData.value.paramValue=JSON.stringify(tableData.value)
Paramupdate(paramColorData.value).then((res:any)=>{
if(res.code==200){
ElMessage.success(res.msg ?? '保存成功')
visibleColor.value=false
getList()
}else {
ElMessage.error(res.msg ?? '保存失败')
}
}).catch((err) => {
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
})
}
onMounted(() =>{
getList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -248,45 +382,18 @@ $headerHeight: 60px;
.LayoutPart{ .LayoutPart{
.demo-color-box{ .demo-color-box{
text-align: center; text-align: center;
.style01.selected:before {
opacity: 1;
}
.style01.selected img {
box-shadow: 0 0 0 4px #00c09e;
animation: selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-o-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-ms-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-moz-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-webkit-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
}
.style01.selected:before {
content: "2714";
display: block;
position: absolute;
margin: auto;
top: 0; left: 0; bottom: 0; right: 0;
width: 40px;
height: 40px;
line-height: 40px;
background: #00c09e;
border-radius: 50px;
color: #fff;
text-align: center;
font-size: 16px;
z-index: 10;
opacity: 0;
transition: 0.3s linear;
-o-transition: 0.3s linear;
-ms-transition: 0.3s linear;
-moz-transition: 0.3s linear;
-webkit-transition: 0.3s linear;
-o-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
cursor: pointer;
}
} }
.demo-color-box.selected:before {
opacity: 1;
}
.demo-color-box.selected img {
box-shadow: 0 0 0 4px #00c09e;
animation: selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-o-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-ms-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-moz-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
-webkit-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
}
} }
} }