2025-10-26 22:44:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
width="90%"
|
|
|
|
|
|
:visible.sync="dialogTableVisible"
|
|
|
|
|
|
class="ems-dialog"
|
|
|
|
|
|
title="保护方案"
|
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
|
:show-close="false"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-form
|
|
|
|
|
|
v-loading="loading > 0"
|
|
|
|
|
|
ref="addTempForm"
|
|
|
|
|
|
:model="formData"
|
|
|
|
|
|
:rules="rules"
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
label-width="140px"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-form-item label="站点" prop="siteId">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="formData.siteId"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
:style="{ width: '50%' }"
|
|
|
|
|
|
@change="changeType"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
:label="item.siteName"
|
|
|
|
|
|
:value="item.siteId"
|
|
|
|
|
|
v-for="(item, index) in siteList"
|
|
|
|
|
|
:key="index + 'siteOptions'"
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="设备保护名称" prop="faultName">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="formData.faultName"
|
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:style="{ width: '50%' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</el-form-item>
|
2025-10-28 18:15:10 +08:00
|
|
|
|
<el-form-item label="处理方案描述" prop="description">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="formData.description"
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
:rows="2"
|
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:style="{ width: '50%' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</el-form-item>
|
2025-10-26 22:44:04 +08:00
|
|
|
|
<el-form-item label="是否告警" prop="isAlert">
|
|
|
|
|
|
<el-checkbox
|
|
|
|
|
|
v-model="formData.isAlert"
|
|
|
|
|
|
:true-label="1"
|
|
|
|
|
|
:false-label="0"
|
|
|
|
|
|
></el-checkbox>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="告警等级" prop="faultLevel">
|
|
|
|
|
|
<el-radio-group v-model="formData.faultLevel" :style="{ width: '50%' }">
|
|
|
|
|
|
<el-radio :label="1">等级1</el-radio>
|
|
|
|
|
|
<el-radio :label="2">等级2</el-radio>
|
|
|
|
|
|
<el-radio :label="3">等级3</el-radio>
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<div class="items-container">
|
|
|
|
|
|
<div class="item-title">
|
|
|
|
|
|
保护前提:
|
|
|
|
|
|
<div style="display: inline-block; margin-left: 20px">
|
|
|
|
|
|
延时:<el-input
|
|
|
|
|
|
v-model="formData.faultDelaySeconds"
|
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:style="{ width: '200px', display: 'inline-block' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
@click.native.prevent="addRow('protectionSettings')"
|
|
|
|
|
|
block
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
style="margin-bottom: 20px"
|
|
|
|
|
|
>
|
|
|
|
|
|
新增保护前提
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item-content">
|
|
|
|
|
|
<div class="time-lists-container">
|
|
|
|
|
|
<div class="time-lists time-lists-title">
|
|
|
|
|
|
<div>设备类型</div>
|
|
|
|
|
|
<div>点位</div>
|
|
|
|
|
|
<div>故障值比较符号</div>
|
|
|
|
|
|
<div>故障值</div>
|
|
|
|
|
|
<div>释放值比较符号</div>
|
|
|
|
|
|
<div>释放值</div>
|
|
|
|
|
|
<div>关系</div>
|
|
|
|
|
|
<div>操作</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="time-lists"
|
|
|
|
|
|
v-for="(item, index) in protectionSettings"
|
|
|
|
|
|
:key="'protectionSettings' + index"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div>
|
2025-10-28 18:15:10 +08:00
|
|
|
|
<el-cascader
|
|
|
|
|
|
v-model="item.deviceId"
|
|
|
|
|
|
:show-all-levels="false"
|
|
|
|
|
|
:options="childOptions"
|
|
|
|
|
|
@change="(v)=>handleChange(v,'protectionSettings',index)"
|
|
|
|
|
|
></el-cascader>
|
2025-10-26 22:44:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-autocomplete
|
|
|
|
|
|
v-model="item.point"
|
|
|
|
|
|
placeholder="请输入点位"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:fetch-suggestions="
|
|
|
|
|
|
(q, c) =>
|
|
|
|
|
|
querySearchAsync(q, c, index, 'protectionSettings')
|
|
|
|
|
|
"
|
|
|
|
|
|
@select="(v) => handleSelect(v, index, 'protectionSettings')"
|
|
|
|
|
|
></el-autocomplete>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-select v-model="item.faultOperator" placeholder="请选择">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="(value, key) in comparisonOperatorOptions"
|
|
|
|
|
|
:key="key + 'faultOperator'"
|
|
|
|
|
|
:label="key"
|
|
|
|
|
|
:value="value"
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-input placeholder="请输入故障值" v-model="item.faultValue">
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-select v-model="item.releaseOperator" placeholder="请选择">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="(value, key) in comparisonOperatorOptions"
|
|
|
|
|
|
:key="key + 'releaseOperator'"
|
|
|
|
|
|
:label="key"
|
|
|
|
|
|
:value="value"
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
placeholder="请输入释放值"
|
|
|
|
|
|
v-model="item.releaseValue"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-select v-model="item.relation" placeholder="请选择">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="(value, key) in relationWithPoint"
|
|
|
|
|
|
:key="key + 'relation'"
|
|
|
|
|
|
:label="key"
|
|
|
|
|
|
:value="value"
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
@click.native.prevent="deleteRow(index)"
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="items-container">
|
|
|
|
|
|
<div class="item-title">
|
|
|
|
|
|
保护方案:
|
|
|
|
|
|
<div style="display: inline-block; margin-left: 20px">
|
|
|
|
|
|
延时:<el-input
|
|
|
|
|
|
v-model="formData.faultDelaySeconds"
|
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:style="{ width: '200px', display: 'inline-block' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
@click.native.prevent="addRow('protectionPlan')"
|
|
|
|
|
|
block
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
style="margin-bottom: 20px"
|
|
|
|
|
|
>
|
|
|
|
|
|
新增保护方案
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item-content">
|
|
|
|
|
|
<div class="time-lists-container">
|
|
|
|
|
|
<div class="time-lists time-lists-title">
|
|
|
|
|
|
<div>设备类型</div>
|
|
|
|
|
|
<div>点位</div>
|
|
|
|
|
|
<div>故障值比较符号</div>
|
|
|
|
|
|
<div>故障值</div>
|
|
|
|
|
|
<div>操作</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="time-lists"
|
|
|
|
|
|
v-for="(item, index) in protectionPlan"
|
|
|
|
|
|
:key="'protectionPlan' + index"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div>
|
2025-10-28 18:15:10 +08:00
|
|
|
|
<el-cascader
|
|
|
|
|
|
v-model="item.deviceId"
|
|
|
|
|
|
:show-all-levels="false"
|
|
|
|
|
|
:options="childOptions"
|
|
|
|
|
|
@change="(v)=>handleChange(v,'protectionPlan',index)"
|
|
|
|
|
|
></el-cascader>
|
2025-10-26 22:44:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-autocomplete
|
|
|
|
|
|
v-model="item.point"
|
|
|
|
|
|
placeholder="请输入点位"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
:fetch-suggestions="
|
|
|
|
|
|
(q, c) => querySearchAsync(q, c, index, 'protectionPlan')
|
|
|
|
|
|
"
|
|
|
|
|
|
@select="(v) => handleSelect(v, index, 'protectionPlan')"
|
|
|
|
|
|
></el-autocomplete>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>=</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-input placeholder="请输入故障值" v-model="item.value">
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
@click.native.prevent="deleteRow(index)"
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer">
|
|
|
|
|
|
<el-button @click="closeDialog">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="saveDialog">确定</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { mapState } from "vuex";
|
|
|
|
|
|
import { getAllSites } from "@/api/ems/zddt";
|
|
|
|
|
|
import { validText } from "@/utils/validate";
|
|
|
|
|
|
import {
|
|
|
|
|
|
getDeviceDetailInfo,
|
|
|
|
|
|
updateDevice,
|
|
|
|
|
|
addDevice,
|
|
|
|
|
|
getParentDeviceId,
|
2025-10-28 18:15:10 +08:00
|
|
|
|
getDeviceListBySiteAndCategory
|
2025-10-26 22:44:04 +08:00
|
|
|
|
} 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)) {
|
|
|
|
|
|
callback(new Error("只能输入中文、英文、数字和特殊字符!"));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const validateDeviceId = (rule, value, callback) => {
|
|
|
|
|
|
if (value !== "" && !/^[a-zA-Z0-9]+$/.test(value)) {
|
|
|
|
|
|
callback(new Error("只能输入英文和数字!"));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
|
|
|
loading: 0,
|
2025-10-28 18:15:10 +08:00
|
|
|
|
childOptions:[],
|
2025-10-26 22:44:04 +08:00
|
|
|
|
protectionSettings: [],
|
|
|
|
|
|
protectionPlan: [],
|
|
|
|
|
|
dialogTableVisible: false,
|
|
|
|
|
|
siteList: [], //站点列表 从接口获取数据
|
|
|
|
|
|
formData: {
|
|
|
|
|
|
id: "", //设备唯一标识
|
|
|
|
|
|
siteId: "", //站点ID
|
|
|
|
|
|
faultName: "", //设备保护名称
|
|
|
|
|
|
isAlert: 0, //是否告警
|
|
|
|
|
|
faultLevel: 1, //告警等级
|
|
|
|
|
|
faultDelaySeconds: "", //故障延时
|
|
|
|
|
|
releaseDelaySeconds: "", //释放延时
|
2025-10-28 18:15:10 +08:00
|
|
|
|
description:'',//方案描述
|
2025-10-26 22:44:04 +08:00
|
|
|
|
},
|
|
|
|
|
|
rules: {
|
|
|
|
|
|
siteId: [
|
|
|
|
|
|
{
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请选择站点",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
faultName: [
|
|
|
|
|
|
{ required: true, message: "请输入设备保护名称", trigger: "blur" },
|
|
|
|
|
|
],
|
|
|
|
|
|
isAlert: [
|
|
|
|
|
|
{ required: true, message: "请选择是否告警", trigger: "blur" },
|
|
|
|
|
|
],
|
|
|
|
|
|
description: [
|
|
|
|
|
|
{ required: true, message: "请输入设备描述", trigger: "blur" },
|
|
|
|
|
|
{ validator: validateText, trigger: "blur" },
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
...mapState({
|
|
|
|
|
|
communicationStatusOptions: (state) =>
|
|
|
|
|
|
state?.ems?.communicationStatusOptions || {},
|
|
|
|
|
|
deviceTypeOptions: (state) => state?.ems?.deviceTypeOptions || {},
|
|
|
|
|
|
comparisonOperatorOptions: (state) =>
|
|
|
|
|
|
state?.ems?.comparisonOperatorOptions || {},
|
|
|
|
|
|
relationWithPoint: (state) => state?.ems?.relationWithPoint || {},
|
|
|
|
|
|
}),
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
dialogTableVisible: {
|
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
|
//打开弹窗
|
|
|
|
|
|
if (newVal) {
|
|
|
|
|
|
this.getDeviceCategoryList();
|
2025-10-28 18:15:10 +08:00
|
|
|
|
this.getZdList();
|
2025-10-26 22:44:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
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: {
|
|
|
|
|
|
// 新增设备保护前提、设备保护方案
|
|
|
|
|
|
addRow(type) {
|
|
|
|
|
|
if (type === "protectionSettings") {
|
|
|
|
|
|
this.protectionSettings.push({
|
2025-10-28 18:15:10 +08:00
|
|
|
|
deviceId:'',//设备ID
|
|
|
|
|
|
deviceCategory: "",//设备类型 英文
|
|
|
|
|
|
categoryName:'',//设备类型名称 中文
|
|
|
|
|
|
point: "",//点位 英文
|
|
|
|
|
|
pointName:"",//点位 中文
|
|
|
|
|
|
faultValue: "",//故障值
|
|
|
|
|
|
releaseValue: "",//释放值
|
|
|
|
|
|
faultOperator: "",//故障值比较关系
|
|
|
|
|
|
releaseOperator: "",//释放值比较关系
|
|
|
|
|
|
relationNext: "",//与下一个点位的关系
|
2025-10-26 22:44:04 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.protectionPlan.push({
|
2025-10-28 18:15:10 +08:00
|
|
|
|
deviceId:"",
|
|
|
|
|
|
deviceCategory: "",//设备类型 英文
|
|
|
|
|
|
categoryName:'',//设备类型名称 中文
|
2025-10-26 22:44:04 +08:00
|
|
|
|
point: "",
|
2025-10-28 18:15:10 +08:00
|
|
|
|
pointName:"",
|
|
|
|
|
|
value: "",//设置值
|
2025-10-26 22:44:04 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 删除设备保护前提、设备保护方案
|
|
|
|
|
|
deleteRow(index, type) {
|
|
|
|
|
|
this[type].splice(index, 1);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2025-10-28 18:15:10 +08:00
|
|
|
|
|
2025-10-26 22:44:04 +08:00
|
|
|
|
// 设备保护前提、设备保护方案点位选择
|
|
|
|
|
|
querySearchAsync(query, cb, index, type) {
|
|
|
|
|
|
console.log("查询数据", query, index);
|
|
|
|
|
|
if (!this.formData.siteId || !this[type][index].deviceCategory) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
message: "请先选择站点和设备",
|
|
|
|
|
|
});
|
|
|
|
|
|
return cb([]);
|
|
|
|
|
|
}
|
|
|
|
|
|
pointFuzzyQuery({
|
|
|
|
|
|
siteIds: [this.formData.siteId],
|
|
|
|
|
|
deviceCategory: this[type][index].deviceCategory,
|
|
|
|
|
|
pointName: query,
|
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
|
const data = response?.data || [];
|
|
|
|
|
|
cb(
|
|
|
|
|
|
data.map((item) => {
|
|
|
|
|
|
return { name: item, value: item };
|
|
|
|
|
|
})
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2025-10-28 18:15:10 +08:00
|
|
|
|
// 点位选择
|
2025-10-26 22:44:04 +08:00
|
|
|
|
handleSelect(data, index, type) {
|
|
|
|
|
|
this[type][index].point = data.value;
|
2025-10-28 18:15:10 +08:00
|
|
|
|
this[type][index].pointName = data.value;
|
2025-10-26 22:44:04 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-10-28 18:15:10 +08:00
|
|
|
|
// 获取设备类别-不区分站点
|
|
|
|
|
|
getDeviceCategoryList() {
|
|
|
|
|
|
this.loading += 1;
|
|
|
|
|
|
getAllDeviceCategory()
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
const data = (response?.data || []).filter(item => ['PCS','STACK'].includes(item.code));
|
|
|
|
|
|
this.childOptions=[]
|
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
|
this.childOptions.push({
|
|
|
|
|
|
value: item.code,
|
|
|
|
|
|
label: item.name,
|
|
|
|
|
|
children:[]
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('获取设备类型',data,this.childOptions)
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
this.loading -= 1;
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
//获取设备列表-区分站点
|
|
|
|
|
|
getDeviceList(deviceCategory){
|
|
|
|
|
|
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 => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
label: item.deviceName,
|
|
|
|
|
|
value: item.id,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
//更新站点下面的设备列表
|
|
|
|
|
|
updateSiteDeviceList(){
|
|
|
|
|
|
this.childOptions.forEach(item => {
|
|
|
|
|
|
item.children = []
|
|
|
|
|
|
})
|
|
|
|
|
|
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])
|
2025-10-26 22:44:04 +08:00
|
|
|
|
},
|
2025-10-28 18:15:10 +08:00
|
|
|
|
|
2025-10-26 22:44:04 +08:00
|
|
|
|
//获取站点列表
|
|
|
|
|
|
getZdList() {
|
|
|
|
|
|
this.loading += 1;
|
|
|
|
|
|
getAllSites()
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.siteList = response?.data || [];
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
this.loading -= 1;
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2025-10-28 18:15:10 +08:00
|
|
|
|
// 切换站点
|
|
|
|
|
|
// 重新获取设备列表
|
|
|
|
|
|
// 清空选中的设备、点位信息
|
|
|
|
|
|
changeType() {
|
|
|
|
|
|
//获取当前站点下的pcs和bms
|
|
|
|
|
|
this.updateSiteDeviceList()
|
|
|
|
|
|
this.protectionSettings.forEach((item) => {
|
|
|
|
|
|
item.point = ""
|
|
|
|
|
|
item.pointName = ""
|
|
|
|
|
|
item.deviceId=''
|
|
|
|
|
|
item.categoryName=''
|
|
|
|
|
|
item.deviceCategory=''
|
|
|
|
|
|
});
|
|
|
|
|
|
this.protectionPlan.forEach((item) => {
|
|
|
|
|
|
item.point = ""
|
|
|
|
|
|
item.pointName = ""
|
|
|
|
|
|
item.deviceId=''
|
|
|
|
|
|
item.categoryName=''
|
|
|
|
|
|
item.deviceCategory=''
|
|
|
|
|
|
});
|
2025-10-26 22:44:04 +08:00
|
|
|
|
},
|
2025-10-28 18:15:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-10-26 22:44:04 +08:00
|
|
|
|
saveDialog() {
|
|
|
|
|
|
this.$refs.addTempForm.validate((valid) => {
|
|
|
|
|
|
if (!valid) return;
|
|
|
|
|
|
this.loading += 1;
|
|
|
|
|
|
const {
|
|
|
|
|
|
id = "", //设备唯一标识
|
|
|
|
|
|
siteId = "", //站点ID
|
|
|
|
|
|
faultName = "", //设备保护名称
|
|
|
|
|
|
isAlert = 0, //是否告警
|
|
|
|
|
|
faultLevel = 1, //告警等级
|
|
|
|
|
|
faultDelaySeconds = "", //故障延时
|
|
|
|
|
|
releaseDelaySeconds = "", //释放延时
|
|
|
|
|
|
} = this.formData;
|
|
|
|
|
|
if (this.mode === "add") {
|
|
|
|
|
|
addDevice({
|
|
|
|
|
|
siteId,
|
|
|
|
|
|
faultName,
|
|
|
|
|
|
isAlert,
|
|
|
|
|
|
faultLevel,
|
|
|
|
|
|
faultDelaySeconds,
|
|
|
|
|
|
releaseDelaySeconds,
|
|
|
|
|
|
protectionSettings,
|
|
|
|
|
|
protectionPlan,
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
//新增成功
|
|
|
|
|
|
// 关闭弹窗 更新表格
|
|
|
|
|
|
this.$emit("update");
|
|
|
|
|
|
this.closeDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
this.loading -= 1;
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
updateDevice({
|
|
|
|
|
|
id,
|
|
|
|
|
|
siteId,
|
|
|
|
|
|
faultName,
|
|
|
|
|
|
isAlert,
|
|
|
|
|
|
faultLevel,
|
|
|
|
|
|
faultDelaySeconds,
|
|
|
|
|
|
releaseDelaySeconds,
|
|
|
|
|
|
protectionSettings,
|
|
|
|
|
|
protectionPlan,
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
//新增成功
|
|
|
|
|
|
// 关闭弹窗 更新表格
|
|
|
|
|
|
this.$emit("update");
|
|
|
|
|
|
this.closeDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
this.loading -= 1;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
closeDialog() {
|
|
|
|
|
|
this.$emit("clear");
|
|
|
|
|
|
// 清空所有数据
|
|
|
|
|
|
this.formData = {
|
|
|
|
|
|
id: "", //设备唯一标识
|
|
|
|
|
|
siteId: "", //站点ID
|
|
|
|
|
|
faultName: "", //设备保护名称
|
|
|
|
|
|
isAlert: 0, //是否告警
|
|
|
|
|
|
faultLevel: 1, //告警等级
|
|
|
|
|
|
faultDelaySeconds: "", //故障延时
|
|
|
|
|
|
releaseDelaySeconds: "", //释放延时
|
|
|
|
|
|
};
|
2025-10-28 18:15:10 +08:00
|
|
|
|
for(let key in this.formData) {
|
|
|
|
|
|
this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
|
|
|
|
|
|
}
|
2025-10-26 22:44:04 +08:00
|
|
|
|
this.$refs.addTempForm.resetFields();
|
|
|
|
|
|
this.dialogTableVisible = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.items-container {
|
|
|
|
|
|
margin-top: 40px;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
.item-title {
|
|
|
|
|
|
line-height: 16px;
|
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
|
color: #000;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.time-lists-container {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
border: 1px solid #eee;
|
|
|
|
|
|
.time-lists {
|
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
& > div {
|
|
|
|
|
|
width: 16%;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
padding: 10px 15px;
|
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
|
|
width: 28%;
|
|
|
|
|
|
border-right: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-date-editor.el-input,
|
|
|
|
|
|
.el-date-editor.el-input__inner {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.time-lists-title {
|
|
|
|
|
|
color: #000;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
line-height: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|