设备保护
This commit is contained in:
@ -85,3 +85,46 @@ export function getDeviceListBySiteAndCategory({siteId, deviceCategory}) {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//新增设备保护
|
||||
export function addProtectPlan(data) {
|
||||
return request({
|
||||
url: `/ems/protectPlan`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//修改设备保护
|
||||
export function updateProtectPlan(data) {
|
||||
return request({
|
||||
url: `/ems/protectPlan`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//删除设备保护
|
||||
export function deleteProtectPlan(id) {
|
||||
return request({
|
||||
url: `/ems/protectPlan/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
//设备保护详情
|
||||
export function getProtectPlan(id) {
|
||||
return request({
|
||||
url: `/ems/protectPlan/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//设备保护详情列表
|
||||
//http://localhost:8089/ems/protectPlan/list?pageSize=10&pageNum=1&faultName=总压&siteId=021_DDS_01
|
||||
export function protectPlanList({siteId, faultName,pageSize,pageNum}) {
|
||||
return request({
|
||||
url: `/ems/protectPlan/list?siteId=${siteId}&faultName=${faultName}&pageSize=${pageSize}&pageNum=${pageNum}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@ -59,7 +59,7 @@
|
||||
></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警等级" prop="faultLevel">
|
||||
<el-radio-group v-model="formData.faultLevel" :style="{ width: '50%' }">
|
||||
<el-radio-group v-model="formData.faultLevel" :style="{ width: '50%' }" :disabled="mode === 'edit'">
|
||||
<el-radio :label="1">等级1</el-radio>
|
||||
<el-radio :label="2">等级2</el-radio>
|
||||
<el-radio :label="3">等级3</el-radio>
|
||||
@ -69,13 +69,14 @@
|
||||
<div class="item-title">
|
||||
保护前提:
|
||||
<div style="display: inline-block; margin-left: 20px">
|
||||
延时:<el-input
|
||||
<el-form-item label="延时" prop="faultDelaySeconds">
|
||||
<el-input
|
||||
v-model="formData.faultDelaySeconds"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
:style="{ width: '200px', display: 'inline-block' }"
|
||||
>
|
||||
</el-input>
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@ -109,8 +110,8 @@
|
||||
<div>
|
||||
<el-cascader
|
||||
v-model="item.deviceId"
|
||||
:show-all-levels="false"
|
||||
:options="childOptions"
|
||||
:show-all-levels="false"
|
||||
@change="(v)=>handleChange(v,'protectionSettings',index)"
|
||||
></el-cascader>
|
||||
</div>
|
||||
@ -159,7 +160,7 @@
|
||||
</el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="item.relation" placeholder="请选择">
|
||||
<el-select v-model="item.relationNext" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(value, key) in relationWithPoint"
|
||||
:key="key + 'relation'"
|
||||
@ -170,7 +171,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
@click.native.prevent="deleteRow(index)"
|
||||
@click.native.prevent="deleteRow(index,'protectionSettings')"
|
||||
type="warning"
|
||||
size="mini"
|
||||
>
|
||||
@ -185,13 +186,14 @@
|
||||
<div class="item-title">
|
||||
保护方案:
|
||||
<div style="display: inline-block; margin-left: 20px">
|
||||
延时:<el-input
|
||||
v-model="formData.faultDelaySeconds"
|
||||
<el-form-item label="延时" prop="releaseDelaySeconds">
|
||||
<el-input
|
||||
v-model="formData.releaseDelaySeconds"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
:style="{ width: '200px', display: 'inline-block' }"
|
||||
>
|
||||
</el-input>
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@ -246,7 +248,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
@click.native.prevent="deleteRow(index)"
|
||||
@click.native.prevent="deleteRow(index,'protectionPlan')"
|
||||
type="warning"
|
||||
size="mini"
|
||||
>
|
||||
@ -269,24 +271,13 @@ import { mapState } from "vuex";
|
||||
import { getAllSites } from "@/api/ems/zddt";
|
||||
import { validText } from "@/utils/validate";
|
||||
import {
|
||||
getDeviceDetailInfo,
|
||||
updateDevice,
|
||||
addDevice,
|
||||
getParentDeviceId,
|
||||
updateProtectPlan,
|
||||
addProtectPlan,
|
||||
getProtectPlan,
|
||||
getDeviceListBySiteAndCategory
|
||||
} from "@/api/ems/site";
|
||||
import { getAllDeviceCategory, pointFuzzyQuery } from "@/api/ems/search";
|
||||
export default {
|
||||
props: {
|
||||
mode: {
|
||||
type: String,
|
||||
default: "add",
|
||||
},
|
||||
id: {
|
||||
type: String | Number,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const validateText = (rule, value, callback) => {
|
||||
if (value !== "" && !validText(value)) {
|
||||
@ -295,14 +286,8 @@ export default {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const validateDeviceId = (rule, value, callback) => {
|
||||
if (value !== "" && !/^[a-zA-Z0-9]+$/.test(value)) {
|
||||
callback(new Error("只能输入英文和数字!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
mode:'',
|
||||
loading: 0,
|
||||
childOptions:[],
|
||||
protectionSettings: [],
|
||||
@ -337,6 +322,14 @@ export default {
|
||||
{ required: true, message: "请输入设备描述", trigger: "blur" },
|
||||
{ validator: validateText, trigger: "blur" },
|
||||
],
|
||||
faultDelaySeconds: [
|
||||
{ required: true, message: "请输入保护前提延时", trigger: "blur" },
|
||||
{ validator: validateText, trigger: "blur" },
|
||||
],
|
||||
releaseDelaySeconds: [
|
||||
{ required: true, message: "请输入保护方案延时", trigger: "blur" },
|
||||
{ validator: validateText, trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -350,46 +343,55 @@ export default {
|
||||
relationWithPoint: (state) => state?.ems?.relationWithPoint || {},
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
dialogTableVisible: {
|
||||
handler(newVal) {
|
||||
//打开弹窗
|
||||
if (newVal) {
|
||||
this.getDeviceCategoryList();
|
||||
this.getZdList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
id: {
|
||||
handler(newVal) {
|
||||
if ((newVal || newVal === 0) && this.mode !== "add") {
|
||||
this.loading += 1;
|
||||
// getDeviceDetailInfo(newVal)
|
||||
// .then((response) => {
|
||||
// this.formData = JSON.parse(JSON.stringify(response?.data || {}));
|
||||
// if (
|
||||
// this.dccDeviceCategoryList.includes(
|
||||
// this.formData.deviceCategory
|
||||
// )
|
||||
// ) {
|
||||
// this.getParentDeviceList(true);
|
||||
// }
|
||||
// })
|
||||
// .finally(() => {
|
||||
// this.loading -= 1;
|
||||
// });
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(id,siteId){
|
||||
this.dialogTableVisible=true
|
||||
this.getZdList();
|
||||
this.getDeviceCategoryList().then(()=>{
|
||||
if(id && siteId) {
|
||||
this.getDeviceList('PCS',siteId)
|
||||
this.getDeviceList('STACK',siteId)
|
||||
}
|
||||
});
|
||||
if(id){
|
||||
this.formData.id = id
|
||||
this.mode = 'edit'
|
||||
getProtectPlan(id).then(response => {
|
||||
const data = response?.data || {}
|
||||
this.formData = {
|
||||
id,
|
||||
siteId: data?.siteId || '', //站点ID
|
||||
faultName: data?.faultName || '', //设备保护名称
|
||||
isAlert: data?.isAlert || 0, //是否告警
|
||||
faultLevel: data?.faultLevel || 1, //告警等级
|
||||
faultDelaySeconds: data?.faultDelaySeconds || "", //故障延时
|
||||
releaseDelaySeconds: data?.releaseDelaySeconds ||"", //释放延时
|
||||
description: data?.description ||'',//方案描述
|
||||
}
|
||||
const plan =(JSON.parse(data?.protectionPlan || [])).map(item=>{
|
||||
return Object.assign({},item,{
|
||||
deviceId:[item.deviceCategory || '',item.deviceId || ''],
|
||||
})
|
||||
})
|
||||
const settings =(JSON.parse(data?.protectionSettings || [])).map(item=>{
|
||||
return Object.assign({},item,{
|
||||
deviceId:[item.deviceCategory || '',item.deviceId || ''],
|
||||
})
|
||||
})
|
||||
this.$nextTick(()=>{
|
||||
this.protectionPlan.splice(0,0,...plan)
|
||||
this.protectionSettings.splice(0,0,...settings)
|
||||
})
|
||||
console.log('获取设备保护详情并初始化',this.formData,this.protectionPlan,this.protectionSettings)
|
||||
})
|
||||
}else{
|
||||
this.mode = 'add'
|
||||
}
|
||||
},
|
||||
// 新增设备保护前提、设备保护方案
|
||||
addRow(type) {
|
||||
if (type === "protectionSettings") {
|
||||
this.protectionSettings.push({
|
||||
deviceId:'',//设备ID
|
||||
const item = type === 'protectionSettings' ? {
|
||||
deviceId:[],//设备ID
|
||||
deviceCategory: "",//设备类型 英文
|
||||
categoryName:'',//设备类型名称 中文
|
||||
point: "",//点位 英文
|
||||
@ -399,24 +401,23 @@ export default {
|
||||
faultOperator: "",//故障值比较关系
|
||||
releaseOperator: "",//释放值比较关系
|
||||
relationNext: "",//与下一个点位的关系
|
||||
});
|
||||
} else {
|
||||
this.protectionPlan.push({
|
||||
deviceId:"",
|
||||
} : {
|
||||
deviceId:[],
|
||||
deviceCategory: "",//设备类型 英文
|
||||
categoryName:'',//设备类型名称 中文
|
||||
point: "",
|
||||
pointName:"",
|
||||
value: "",//设置值
|
||||
});
|
||||
}
|
||||
// this.$set(this[type], this[type].length, item);
|
||||
this[type].splice(this[type].length,0,item)
|
||||
console.log('新增设备保护前提、方案',type,this[type])
|
||||
},
|
||||
// 删除设备保护前提、设备保护方案
|
||||
deleteRow(index, type) {
|
||||
this[type].splice(index, 1);
|
||||
},
|
||||
|
||||
|
||||
// 设备保护前提、设备保护方案点位选择
|
||||
querySearchAsync(query, cb, index, type) {
|
||||
console.log("查询数据", query, index);
|
||||
@ -442,24 +443,36 @@ export default {
|
||||
},
|
||||
// 点位选择
|
||||
handleSelect(data, index, type) {
|
||||
this[type][index].point = data.value;
|
||||
this[type][index].pointName = data.value;
|
||||
console.log('选择点位',data,index,type)
|
||||
// this.$set(this[type], index, Object.assign({},this[type][index],{
|
||||
// point:data.value,
|
||||
// pointName:data.value,
|
||||
// }));
|
||||
let line = Object.assign({},this[type][index],{
|
||||
point:data.value,
|
||||
pointName:data.value,
|
||||
})
|
||||
this[type].splice(index,1,line);
|
||||
console.log('选择点位配置完成',this[type][index])
|
||||
},
|
||||
|
||||
// 获取设备类别-不区分站点
|
||||
getDeviceCategoryList() {
|
||||
this.loading += 1;
|
||||
getAllDeviceCategory()
|
||||
return getAllDeviceCategory()
|
||||
.then((response) => {
|
||||
const data = (response?.data || []).filter(item => ['PCS','STACK'].includes(item.code));
|
||||
this.childOptions=[]
|
||||
// this.childOptions=[]
|
||||
this.$set(this,'childOptions',[])
|
||||
let arr =[]
|
||||
data.forEach((item) => {
|
||||
this.childOptions.push({
|
||||
arr.push({
|
||||
value: item.code,
|
||||
label: item.name,
|
||||
children:[]
|
||||
})
|
||||
})
|
||||
this.childOptions.splice(0,0,...arr)
|
||||
console.log('获取设备类型',data,this.childOptions)
|
||||
})
|
||||
.finally(() => {
|
||||
@ -467,34 +480,48 @@ export default {
|
||||
});
|
||||
},
|
||||
//获取设备列表-区分站点
|
||||
getDeviceList(deviceCategory){
|
||||
getDeviceList(deviceCategory,siteId){
|
||||
this.$nextTick(()=>{
|
||||
getDeviceListBySiteAndCategory({siteId:this.formData.siteId,deviceCategory}).then((response) => {
|
||||
const data = response?.data || []
|
||||
console.log('设置设备列表',this.childOptions)
|
||||
this.childOptions.find(item=>item.value === deviceCategory).children=data.map(item => {
|
||||
getDeviceListBySiteAndCategory({siteId:siteId || this.formData.siteId,deviceCategory}).then((response) => {
|
||||
const data = (response?.data || []).map(item => {
|
||||
return {
|
||||
label: item.deviceName,
|
||||
value: item.id,
|
||||
}
|
||||
})
|
||||
const index = this.childOptions.findIndex(item=>item.value === deviceCategory)
|
||||
if(index>-1){
|
||||
const length = this.childOptions[index].children.length
|
||||
this.childOptions[index].children.splice(0,length,...data)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
//更新站点下面的设备列表
|
||||
updateSiteDeviceList(){
|
||||
this.childOptions.forEach(item => {
|
||||
item.children = []
|
||||
const length = item.children.length
|
||||
item.children.splice(0,length)
|
||||
})
|
||||
this.getDeviceList('PCS')
|
||||
this.getDeviceList('STACK')
|
||||
},
|
||||
//选中设备类型、设备
|
||||
handleChange([deviceCategory,deviceId],type,index){
|
||||
this[type][index].deviceId = deviceId;
|
||||
this[type][index].deviceCategory = deviceCategory;
|
||||
this[type][index].categoryName = this.childOptions.find(i=>i.value === deviceCategory).label;
|
||||
console.log('设置选中设备类型、设备',this[type][index])
|
||||
handleChange(data,type,index){
|
||||
const deviceCategory = data[0],deviceId=data[1]
|
||||
console.log('设置选中设备类型、设备',deviceCategory,deviceId,type,index)
|
||||
const item = Object.assign({},this[type][index],{
|
||||
deviceId:data,
|
||||
deviceCategory,
|
||||
categoryName : this.childOptions.find(i=>i.value === deviceCategory).label,
|
||||
pointName:'',
|
||||
point:''
|
||||
})
|
||||
this.$nextTick(()=>{
|
||||
// this.$set(this[type], index, item);
|
||||
this[type].splice(index,1,item);
|
||||
})
|
||||
console.log('设置选中设备类型、设备配置完成',this[type][index])
|
||||
},
|
||||
|
||||
//获取站点列表
|
||||
@ -514,27 +541,64 @@ export default {
|
||||
changeType() {
|
||||
//获取当前站点下的pcs和bms
|
||||
this.updateSiteDeviceList()
|
||||
this.protectionSettings.forEach((item) => {
|
||||
if(this.protectionSettings.length>0){
|
||||
const list =this.protectionSettings
|
||||
list.forEach((item) => {
|
||||
item.point = ""
|
||||
item.pointName = ""
|
||||
item.deviceId=''
|
||||
item.deviceId=[]
|
||||
item.categoryName=''
|
||||
item.deviceCategory=''
|
||||
});
|
||||
this.protectionPlan.forEach((item) => {
|
||||
// this.$set(this,'protectionSettings',list)
|
||||
this.$nextTick(()=>{
|
||||
this.protectionSettings.splice(0,this.protectionSettings.length,...list)
|
||||
})
|
||||
}
|
||||
if(this.protectionPlan.length>0){
|
||||
const list =this.protectionPlan
|
||||
list.forEach((item) => {
|
||||
item.point = ""
|
||||
item.pointName = ""
|
||||
item.deviceId=''
|
||||
item.deviceId=[]
|
||||
item.categoryName=''
|
||||
item.deviceCategory=''
|
||||
});
|
||||
// this.$set(this,'protectionPlan',list)
|
||||
this.$nextTick(()=>{
|
||||
this.protectionPlan.splice(0,this.protectionPlan.length,...list)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
saveDialog() {
|
||||
function getToastMsg(name,type,index){
|
||||
return {
|
||||
protectionSettings:{
|
||||
deviceId:`请选择保护前提第${index}行的设备`,//设备ID
|
||||
deviceCategory: `请选择保护前提第${index}行的设备类型`,//设备类型 英文
|
||||
categoryName:`请选择保护前提第${index}行的设备类型`,//设备类型名称 中文
|
||||
point: `请选择保护前提第${index}行的点位`,//点位 英文
|
||||
pointName:`请选择保护前提第${index}行的点位`,//点位 中文
|
||||
faultValue: `请输入保护前提第${index}行的故障值`,//故障值
|
||||
releaseValue: `请输入保护前提第${index}行的释放值`,//释放值
|
||||
faultOperator: `请选择保护前提第${index}行的故障值比较关系`,//故障值比较关系
|
||||
releaseOperator: `请选择保护前提第${index}行的释放值比较关系`,//释放值比较关系
|
||||
relationNext: `请选择保护前提第${index}行与下一个点位的关系`,//与下一个点位的关系
|
||||
},
|
||||
protectionPlan :{
|
||||
deviceId:`请选择保护方案第${index}行的设备`,
|
||||
deviceCategory: `请选择保护方案第${index}行的设备类型`,//设备类型 英文
|
||||
categoryName:`请选择保护方案第${index}行的设备类型`,//设备类型名称 中文
|
||||
point: `请选择保护方案第${index}行的点位`,
|
||||
pointName:`请选择保护方案第${index}行的点位`,
|
||||
value: `请输入保护方案第${index}行的故障值`,//设置值
|
||||
}
|
||||
}[type][name]
|
||||
}
|
||||
this.$refs.addTempForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
this.loading += 1;
|
||||
const {
|
||||
id = "", //设备唯一标识
|
||||
siteId = "", //站点ID
|
||||
@ -543,18 +607,79 @@ export default {
|
||||
faultLevel = 1, //告警等级
|
||||
faultDelaySeconds = "", //故障延时
|
||||
releaseDelaySeconds = "", //释放延时
|
||||
description="",//方案描述
|
||||
} = this.formData;
|
||||
if (this.mode === "add") {
|
||||
addDevice({
|
||||
const {protectionSettings,protectionPlan} = this
|
||||
let protectionSettingsValidateStatus= true , protectionPlanValidateStatus= true
|
||||
for(let i = 0;i<protectionSettings.length;i++){
|
||||
let valueMap = Object.entries(protectionSettings[i]);
|
||||
for(let inner = 0;inner < valueMap.length;inner++){
|
||||
const key =valueMap[inner][0],value =valueMap[inner][1]
|
||||
if(key === 'relationNext'){
|
||||
if(protectionSettings[i+1] && !value){//有下一个点位
|
||||
this.$message.error(getToastMsg(key,'protectionSettings',i+1))
|
||||
protectionSettingsValidateStatus=false
|
||||
break
|
||||
}
|
||||
}else{
|
||||
if(![0,'0'].includes(value) && !value){
|
||||
this.$message.error(getToastMsg(key,'protectionSettings',i+1))
|
||||
protectionSettingsValidateStatus=false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!protectionSettingsValidateStatus) break
|
||||
}
|
||||
|
||||
for(let i = 0;i<protectionPlan.length;i++){
|
||||
let valueMap = Object.entries(protectionPlan[i]);
|
||||
for(let inner = 0;inner < valueMap.length;inner++){
|
||||
const key =valueMap[inner][0],value =valueMap[inner][1]
|
||||
if(key === 'relationNext'){
|
||||
if(protectionPlan[i+1] && !value){//有下一个点位
|
||||
this.$message.error(getToastMsg(key,'protectionPlan',i+1))
|
||||
protectionPlanValidateStatus=false
|
||||
break
|
||||
}else{
|
||||
// protectionPlan[i][key] = ''//清空选择的关系
|
||||
}
|
||||
}else{
|
||||
if(![0,'0'].includes(value) && !value){
|
||||
this.$message.error(getToastMsg(key,'protectionPlan',i+1))
|
||||
protectionPlanValidateStatus=false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!protectionPlanValidateStatus) break
|
||||
}
|
||||
|
||||
if(!protectionSettingsValidateStatus || !protectionPlanValidateStatus) return
|
||||
const settings = protectionSettings.map(item=>{
|
||||
return Object.assign({},item,{
|
||||
deviceId:item.deviceId[1],
|
||||
})
|
||||
})
|
||||
const plan = protectionPlan.map(item=>{
|
||||
return Object.assign({},item,{
|
||||
deviceId:item.deviceId[1],
|
||||
})
|
||||
})
|
||||
this.loading += 1;
|
||||
const params= {
|
||||
siteId,
|
||||
faultName,
|
||||
isAlert,
|
||||
faultLevel,
|
||||
faultDelaySeconds,
|
||||
releaseDelaySeconds,
|
||||
protectionSettings,
|
||||
protectionPlan,
|
||||
})
|
||||
description,
|
||||
protectionSettings:JSON.stringify(settings),
|
||||
protectionPlan:JSON.stringify(plan),
|
||||
}
|
||||
if (this.mode === "add") {
|
||||
addProtectPlan(params)
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
//新增成功
|
||||
@ -567,17 +692,8 @@ export default {
|
||||
this.loading -= 1;
|
||||
});
|
||||
} else {
|
||||
updateDevice({
|
||||
id,
|
||||
siteId,
|
||||
faultName,
|
||||
isAlert,
|
||||
faultLevel,
|
||||
faultDelaySeconds,
|
||||
releaseDelaySeconds,
|
||||
protectionSettings,
|
||||
protectionPlan,
|
||||
})
|
||||
params.id = id
|
||||
updateProtectPlan(params)
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
//新增成功
|
||||
@ -595,19 +711,13 @@ export default {
|
||||
closeDialog() {
|
||||
this.$emit("clear");
|
||||
// 清空所有数据
|
||||
this.formData = {
|
||||
id: "", //设备唯一标识
|
||||
siteId: "", //站点ID
|
||||
faultName: "", //设备保护名称
|
||||
isAlert: 0, //是否告警
|
||||
faultLevel: 1, //告警等级
|
||||
faultDelaySeconds: "", //故障延时
|
||||
releaseDelaySeconds: "", //释放延时
|
||||
};
|
||||
for(let key in this.formData) {
|
||||
this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
|
||||
}
|
||||
this.$refs.addTempForm.resetFields();
|
||||
this.$set(this,'protectionSettings',[])
|
||||
this.$set(this,'protectionPlan',[])
|
||||
this.$set(this,'childOptions',[])
|
||||
this.dialogTableVisible = false;
|
||||
},
|
||||
},
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user