设备保护

This commit is contained in:
白菜
2025-10-31 21:34:52 +08:00
parent 567ddf85a5
commit 1280b7196c
3 changed files with 385 additions and 198 deletions

View File

@ -7,11 +7,10 @@
<el-form :inline="true" class="select-container">
<el-form-item label="站点选择">
<el-select
v-model="siteId"
v-model="form.siteId"
placeholder="请选择换电站名称"
:loading="searchLoading"
loading-text="正在加载数据"
@change="onSearch"
clearable
>
<el-option
@ -22,9 +21,17 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="故障名称">
<el-input
v-model="form.faultName"
clearable
placeholder="请输入故障名称"
style="width: 150px"
></el-input>
</el-form-item>
<el-form-item>
<!-- <el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>-->
<!-- <el-button @click="onReset" native-type="button">重置</el-button>-->
<el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>
<el-button @click="onReset" native-type="button">重置</el-button>
</el-form-item>
</el-form>
<el-button type="primary" @click="addDevice" native-type="button"
@ -37,14 +44,31 @@
max-height="600px"
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="siteId" label="站点ID"> </el-table-column>
<el-table-column prop="siteName" label="站点名称"> </el-table-column>
<!-- <el-table-column
prop=""
label=""
>
</el-table-column>-->
<el-table-column fixed="right" label="操作" width="260">
<el-table-column prop="siteId" label="站点" width="100"> </el-table-column>
<el-table-column prop="faultName" label="设备保护名称" width="100"> </el-table-column>
<el-table-column prop="faultLevel" label="故障等级" width="100">
<template slot-scope="scope">等级{{scope.row.faultLevel}}</template>
</el-table-column>
<el-table-column prop="isAlert" label="是否告警" width="100">
<template slot-scope="scope">{{scope.row.isAlert === 1 ? '是' : '否'}}</template>
</el-table-column>
<el-table-column prop="description" label="处理方案描述" width="200" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="protectionSettings" label="保护前提" show-overflow-tooltip width="400">
<template slot-scope="scope">
<div v-html="handleProtectionSettings(scope.row.protectionSettings)"></div>
</template>
</el-table-column>
<el-table-column prop="faultDelaySeconds" label="保护前提延时(s)" width="120">
</el-table-column>
<el-table-column prop="protectionPlan" label="保护方案" show-overflow-tooltip width="200">
<template slot-scope="scope">
<div v-html="handleProtectionPlan(scope.row.protectionPlan)"></div>
</template>
</el-table-column>
<el-table-column prop="releaseDelaySeconds" label="保护方案延时(s)" width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" width="150">
<template slot-scope="scope">
<el-button @click="editDevice(scope.row)" type="warning" size="mini">
编辑
@ -70,33 +94,29 @@
</el-pagination>
<add-device
ref="addDevice"
:mode="mode"
:id="editDeviceId"
@update="getData"
@clear="clearEditDeviceData"
/>
</div>
</template>
<script>
import {
getDeviceInfoList,
getDeviceDetailInfo,
deleteService,
protectPlanList,
deleteProtectPlan,
} from "@/api/ems/site";
import { getAllSites } from "@/api/ems/zddt";
import { formatNumber } from "@/filters/ems";
import AddDevice from "./AddDevice.vue";
export default {
name: "SBBH",
components: { AddDevice },
data() {
return {
form:{
siteId:'',
faultName:''
},
loading: false,
searchLoading: false,
mode: "", //新增、编辑设备
editDeviceId: "", //编辑设备id
siteId: "",
siteList: [],
tableData: [],
pageSize: 10, //分页栏当前每个数据总数
@ -106,28 +126,36 @@ export default {
};
},
methods: {
// 查看设备电位表格
pointDetail(row) {
this.$refs.pointTable.showTable(row);
handleProtectionSettings(data){
if(!data || !JSON.parse(data)) return
const arr = JSON.parse(data),
str= arr.map((item,index)=>{
const {categoryName='',deviceId='',point='',faultOperator='',faultValue='',releaseOperator='',releaseValue='',relationNext=''} = item
return `<div>${index+1}、 <span>${categoryName ? categoryName + '-' : ''}${deviceId ? deviceId + '-' : ''}${ point || ''}</span> <span>故障:${faultOperator || ''}${ faultValue || ''}</span> <span>释放:${releaseOperator || ''}${releaseValue || ''}</span> ${arr[index+1] ? '<span>关系:'+(relationNext || '')+'</span>' : ''}</div>`
})
return str.join('')
},
clearEditDeviceData() {
this.mode = "";
this.editDeviceId = "";
handleProtectionPlan(data){
if(!data || !JSON.parse(data)) return
const arr = JSON.parse(data),
str= arr.map((item,index)=>{
const {categoryName='',deviceId='',point='',value=''} = item
return `<div>${index+1}、 <span>${categoryName ? categoryName + '-' : ''}${deviceId ? deviceId + '-' : ''}${ point || ''}</span> <span>故障:=${ value || ''}</span> </div>`
})
return str.join('')
},
// 新增设备 展示弹窗
addDevice() {
this.mode = "add";
this.$refs.addDevice.dialogTableVisible = true;
this.$refs.addDevice.open()
},
// 编辑设备
editDevice(row) {
this.mode = "edit";
this.editDeviceId = row.id;
this.$refs.addDevice.dialogTableVisible = true;
this.$refs.addDevice.open(row.id,row.siteId)
},
//删除设备
deleteDevice(row) {
this.$confirm(`确认要设备保护${row.deviceName}吗?`, {
console.log('删除')
this.$confirm(`确认要设备保护${row.faultName}吗?`, {
confirmButtonText: "确定",
cancelButtonText: "取消",
showClose: false,
@ -136,7 +164,7 @@ export default {
beforeClose: (action, instance, done) => {
if (action === "confirm") {
instance.confirmButtonLoading = true;
deleteService(row.id)
deleteProtectPlan(row.id)
.then((response) => {
response.code === 200 && done();
})
@ -181,15 +209,18 @@ export default {
},
// 重置
onReset() {
this.siteId = "";
this.form={
siteId: "",
faultName: "",
}
this.pageNum = 1; //每次搜索从1开始搜索
this.getData();
},
// 获取数据
getData() {
this.loading = true;
const { siteId, pageNum, pageSize } = this;
getDeviceInfoList({ siteId, pageNum, pageSize })
const { pageNum, pageSize } = this,{siteId,faultName=''}=this.form;
protectPlanList({ siteId, faultName,pageNum, pageSize })
.then((response) => {
this.tableData = response?.rows || [];
this.totalSize = response?.total || 0;
@ -204,7 +235,7 @@ export default {
return getAllSites()
.then((response) => {
this.siteList = response?.data || [];
if (this.siteList.length > 0) this.siteId = this.siteList[0].siteId;
if (this.siteList.length > 0) this.form.siteId = this.siteList[0].siteId;
})
.finally(() => {
this.searchLoading = false;
@ -213,7 +244,10 @@ export default {
},
mounted() {
this.loading = true;
this.siteId = "";
this.form = {
siteId: "",
faultName: "",
};
this.pageNum = 1; //每次搜索从1开始搜索
this.getZdList().then(() => {
this.getData();