保护方案
This commit is contained in:
@ -1,42 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
width="90%"
|
width="90%"
|
||||||
:visible.sync="dialogTableVisible"
|
:visible.sync="dialogTableVisible"
|
||||||
class="ems-dialog"
|
class="ems-dialog"
|
||||||
title="保护方案"
|
title="保护方案"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
v-loading="loading > 0"
|
v-loading="loading > 0"
|
||||||
ref="addTempForm"
|
ref="addTempForm"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
size="medium"
|
size="medium"
|
||||||
label-width="140px"
|
label-width="140px"
|
||||||
>
|
>
|
||||||
<el-form-item label="站点" prop="siteId">
|
<el-form-item label="站点" prop="siteId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.siteId"
|
v-model="formData.siteId"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
:style="{ width: '50%' }"
|
:style="{ width: '50%' }"
|
||||||
@change="changeType"
|
@change="changeType"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
:label="item.siteName"
|
:label="item.siteName"
|
||||||
:value="item.siteId"
|
:value="item.siteId"
|
||||||
v-for="(item, index) in siteList"
|
v-for="(item, index) in siteList"
|
||||||
:key="index + 'siteOptions'"
|
:key="index + 'siteOptions'"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备保护名称" prop="faultName">
|
<el-form-item label="设备保护名称" prop="faultName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.faultName"
|
v-model="formData.faultName"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
:style="{ width: '50%' }"
|
:style="{ width: '50%' }"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -53,9 +53,9 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否告警" prop="isAlert">
|
<el-form-item label="是否告警" prop="isAlert">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="formData.isAlert"
|
v-model="formData.isAlert"
|
||||||
:true-label="1"
|
:true-label="1"
|
||||||
:false-label="0"
|
:false-label="0"
|
||||||
></el-checkbox>
|
></el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="告警等级" prop="faultLevel">
|
<el-form-item label="告警等级" prop="faultLevel">
|
||||||
@ -81,11 +81,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
@click.native.prevent="addRow('protectionSettings')"
|
@click.native.prevent="addRow('protectionSettings')"
|
||||||
block
|
block
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
style="margin-bottom: 20px"
|
style="margin-bottom: 20px"
|
||||||
>
|
>
|
||||||
新增保护前提
|
新增保护前提
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -103,38 +103,40 @@
|
|||||||
<div>操作</div>
|
<div>操作</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="time-lists"
|
class="time-lists"
|
||||||
v-for="(item, index) in protectionSettings"
|
v-for="(item, index) in protectionSettings"
|
||||||
:key="'protectionSettings' + index"
|
:key="'protectionSettings' + index"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="item.deviceId"
|
v-model="item.deviceId"
|
||||||
:options="childOptions"
|
:options="childOptions"
|
||||||
|
:props="props"
|
||||||
:show-all-levels="false"
|
:show-all-levels="false"
|
||||||
|
:ref="'protectionSettings'+index"
|
||||||
@change="(v)=>handleChange(v,'protectionSettings',index)"
|
@change="(v)=>handleChange(v,'protectionSettings',index)"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
v-model="item.point"
|
v-model="item.point"
|
||||||
placeholder="请输入点位"
|
placeholder="请输入点位"
|
||||||
clearable
|
clearable
|
||||||
:fetch-suggestions="
|
:fetch-suggestions="
|
||||||
(q, c) =>
|
(q, c) =>
|
||||||
querySearchAsync(q, c, index, 'protectionSettings')
|
querySearchAsync(q, c, index, 'protectionSettings')
|
||||||
"
|
"
|
||||||
@select="(v) => handleSelect(v, index, 'protectionSettings')"
|
@select="(v) => handleSelect(v, index, 'protectionSettings')"
|
||||||
></el-autocomplete>
|
></el-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<el-select v-model="item.faultOperator" placeholder="请选择">
|
<el-select v-model="item.faultOperator" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(value, key) in comparisonOperatorOptions"
|
v-for="(value, key) in comparisonOperatorOptions"
|
||||||
:key="key + 'faultOperator'"
|
:key="key + 'faultOperator'"
|
||||||
:label="key"
|
:label="key"
|
||||||
:value="value"
|
:value="value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
@ -145,35 +147,35 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-select v-model="item.releaseOperator" placeholder="请选择">
|
<el-select v-model="item.releaseOperator" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(value, key) in comparisonOperatorOptions"
|
v-for="(value, key) in comparisonOperatorOptions"
|
||||||
:key="key + 'releaseOperator'"
|
:key="key + 'releaseOperator'"
|
||||||
:label="key"
|
:label="key"
|
||||||
:value="value"
|
:value="value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="请输入释放值"
|
placeholder="请输入释放值"
|
||||||
v-model="item.releaseValue"
|
v-model="item.releaseValue"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-select v-model="item.relationNext" placeholder="请选择">
|
<el-select v-model="item.relationNext" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(value, key) in relationWithPoint"
|
v-for="(value, key) in relationWithPoint"
|
||||||
:key="key + 'relation'"
|
:key="key + 'relation'"
|
||||||
:label="key"
|
:label="key"
|
||||||
:value="value"
|
:value="value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
@click.native.prevent="deleteRow(index,'protectionSettings')"
|
@click.native.prevent="deleteRow(index,'protectionSettings')"
|
||||||
type="warning"
|
type="warning"
|
||||||
size="mini"
|
size="mini"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -198,11 +200,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
@click.native.prevent="addRow('protectionPlan')"
|
@click.native.prevent="addRow('protectionPlan')"
|
||||||
block
|
block
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
style="margin-bottom: 20px"
|
style="margin-bottom: 20px"
|
||||||
>
|
>
|
||||||
新增保护方案
|
新增保护方案
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -217,27 +219,29 @@
|
|||||||
<div>操作</div>
|
<div>操作</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="time-lists"
|
class="time-lists"
|
||||||
v-for="(item, index) in protectionPlan"
|
v-for="(item, index) in protectionPlan"
|
||||||
:key="'protectionPlan' + index"
|
:key="'protectionPlan' + index"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="item.deviceId"
|
v-model="item.deviceId"
|
||||||
:show-all-levels="false"
|
:show-all-levels="false"
|
||||||
:options="childOptions"
|
:options="childOptions"
|
||||||
|
:props="props"
|
||||||
|
:ref="'protectionPlan'+index"
|
||||||
@change="(v)=>handleChange(v,'protectionPlan',index)"
|
@change="(v)=>handleChange(v,'protectionPlan',index)"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
v-model="item.point"
|
v-model="item.point"
|
||||||
placeholder="请输入点位"
|
placeholder="请输入点位"
|
||||||
clearable
|
clearable
|
||||||
:fetch-suggestions="
|
:fetch-suggestions="
|
||||||
(q, c) => querySearchAsync(q, c, index, 'protectionPlan')
|
(q, c) => querySearchAsync(q, c, index, 'protectionPlan')
|
||||||
"
|
"
|
||||||
@select="(v) => handleSelect(v, index, 'protectionPlan')"
|
@select="(v) => handleSelect(v, index, 'protectionPlan')"
|
||||||
></el-autocomplete>
|
></el-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -248,9 +252,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
@click.native.prevent="deleteRow(index,'protectionPlan')"
|
@click.native.prevent="deleteRow(index,'protectionPlan')"
|
||||||
type="warning"
|
type="warning"
|
||||||
size="mini"
|
size="mini"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -267,16 +271,12 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from "vuex";
|
import {mapState} from "vuex";
|
||||||
import { getAllSites } from "@/api/ems/zddt";
|
import {getAllSites} from "@/api/ems/zddt";
|
||||||
import { validText } from "@/utils/validate";
|
import {validText} from "@/utils/validate";
|
||||||
import {
|
import {addProtectPlan, getDeviceListBySiteAndCategory, getProtectPlan, updateProtectPlan} from "@/api/ems/site";
|
||||||
updateProtectPlan,
|
import {getAllDeviceCategory, pointFuzzyQuery} from "@/api/ems/search";
|
||||||
addProtectPlan,
|
|
||||||
getProtectPlan,
|
|
||||||
getDeviceListBySiteAndCategory
|
|
||||||
} from "@/api/ems/site";
|
|
||||||
import { getAllDeviceCategory, pointFuzzyQuery } from "@/api/ems/search";
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
const validateText = (rule, value, callback) => {
|
const validateText = (rule, value, callback) => {
|
||||||
@ -287,9 +287,17 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
mode:'',
|
props: {
|
||||||
|
// emitPath: false,//在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false,则只返回该节点的值
|
||||||
|
lazy: true,
|
||||||
|
lazyLoad: (node, resolve) => {
|
||||||
|
console.log('---------node', node)
|
||||||
|
this.getDeviceList(node, resolve)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mode: '',
|
||||||
loading: 0,
|
loading: 0,
|
||||||
childOptions:[],
|
childOptions: [],
|
||||||
protectionSettings: [],
|
protectionSettings: [],
|
||||||
protectionPlan: [],
|
protectionPlan: [],
|
||||||
dialogTableVisible: false,
|
dialogTableVisible: false,
|
||||||
@ -302,7 +310,7 @@ export default {
|
|||||||
faultLevel: 1, //告警等级
|
faultLevel: 1, //告警等级
|
||||||
faultDelaySeconds: "", //故障延时
|
faultDelaySeconds: "", //故障延时
|
||||||
releaseDelaySeconds: "", //释放延时
|
releaseDelaySeconds: "", //释放延时
|
||||||
description:'',//方案描述
|
description: '',//方案描述
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
siteId: [
|
siteId: [
|
||||||
@ -313,22 +321,22 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
faultName: [
|
faultName: [
|
||||||
{ required: true, message: "请输入设备保护名称", trigger: "blur" },
|
{required: true, message: "请输入设备保护名称", trigger: "blur"},
|
||||||
],
|
],
|
||||||
isAlert: [
|
isAlert: [
|
||||||
{ required: true, message: "请选择是否告警", trigger: "blur" },
|
{required: true, message: "请选择是否告警", trigger: "blur"},
|
||||||
],
|
],
|
||||||
description: [
|
description: [
|
||||||
{ required: true, message: "请输入设备描述", trigger: "blur" },
|
{required: true, message: "请输入设备描述", trigger: "blur"},
|
||||||
{ validator: validateText, trigger: "blur" },
|
{validator: validateText, trigger: "blur"},
|
||||||
],
|
],
|
||||||
faultDelaySeconds: [
|
faultDelaySeconds: [
|
||||||
{ required: true, message: "请输入保护前提延时", trigger: "blur" },
|
{required: true, message: "请输入保护前提延时", trigger: "blur"},
|
||||||
{ validator: validateText, trigger: "blur" },
|
{validator: validateText, trigger: "blur"},
|
||||||
],
|
],
|
||||||
releaseDelaySeconds: [
|
releaseDelaySeconds: [
|
||||||
{ required: true, message: "请输入保护方案延时", trigger: "blur" },
|
{required: true, message: "请输入保护方案延时", trigger: "blur"},
|
||||||
{ validator: validateText, trigger: "blur" },
|
{validator: validateText, trigger: "blur"},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -336,24 +344,24 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
communicationStatusOptions: (state) =>
|
communicationStatusOptions: (state) =>
|
||||||
state?.ems?.communicationStatusOptions || {},
|
state?.ems?.communicationStatusOptions || {},
|
||||||
deviceTypeOptions: (state) => state?.ems?.deviceTypeOptions || {},
|
deviceTypeOptions: (state) => state?.ems?.deviceTypeOptions || {},
|
||||||
comparisonOperatorOptions: (state) =>
|
comparisonOperatorOptions: (state) =>
|
||||||
state?.ems?.comparisonOperatorOptions || {},
|
state?.ems?.comparisonOperatorOptions || {},
|
||||||
relationWithPoint: (state) => state?.ems?.relationWithPoint || {},
|
relationWithPoint: (state) => state?.ems?.relationWithPoint || {},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open(id,siteId){
|
open(id, siteId) {
|
||||||
this.dialogTableVisible=true
|
this.dialogTableVisible = true
|
||||||
this.getZdList();
|
this.getZdList();
|
||||||
this.getDeviceCategoryList().then(()=>{
|
this.getDeviceCategoryList().then(() => {
|
||||||
if(id && siteId) {
|
if (id && siteId) {
|
||||||
this.getDeviceList('PCS',siteId)
|
// this.getDeviceList('PCS', siteId)
|
||||||
this.getDeviceList('STACK',siteId)
|
// this.getDeviceList('STACK', siteId)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(id){
|
if (id) {
|
||||||
this.formData.id = id
|
this.formData.id = id
|
||||||
this.mode = 'edit'
|
this.mode = 'edit'
|
||||||
getProtectPlan(id).then(response => {
|
getProtectPlan(id).then(response => {
|
||||||
@ -365,53 +373,74 @@ export default {
|
|||||||
isAlert: data?.isAlert || 0, //是否告警
|
isAlert: data?.isAlert || 0, //是否告警
|
||||||
faultLevel: data?.faultLevel || 1, //告警等级
|
faultLevel: data?.faultLevel || 1, //告警等级
|
||||||
faultDelaySeconds: data?.faultDelaySeconds || "", //故障延时
|
faultDelaySeconds: data?.faultDelaySeconds || "", //故障延时
|
||||||
releaseDelaySeconds: data?.releaseDelaySeconds ||"", //释放延时
|
releaseDelaySeconds: data?.releaseDelaySeconds || "", //释放延时
|
||||||
description: data?.description ||'',//方案描述
|
description: data?.description || '',//方案描述
|
||||||
}
|
}
|
||||||
const plan =(JSON.parse(data?.protectionPlan || [])).map(item=>{
|
const plan = (JSON.parse(data?.protectionPlan || [])).map(item => {
|
||||||
return Object.assign({},item,{
|
const index = this.childOptions.findIndex(i => i.value === item.deviceCategory)
|
||||||
deviceId:[item.deviceCategory || '',item.deviceId || ''],
|
if (index > -1) {
|
||||||
|
!this.childOptions[index].children.find(i => i.value === item.deviceId) && this.childOptions[index].children.push({
|
||||||
|
value: item.deviceId,
|
||||||
|
label: item.deviceName,
|
||||||
|
leaf: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return Object.assign({}, item, {
|
||||||
|
deviceId: [item.deviceCategory || '', item.deviceId || ''],
|
||||||
|
deviceName: [item.categoryName || '', item.deviceName || ''],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const settings =(JSON.parse(data?.protectionSettings || [])).map(item=>{
|
const settings = (JSON.parse(data?.protectionSettings || [])).map(item => {
|
||||||
return Object.assign({},item,{
|
const index = this.childOptions.findIndex(i => i.value === item.deviceCategory)
|
||||||
deviceId:[item.deviceCategory || '',item.deviceId || ''],
|
if (index > -1) {
|
||||||
|
!this.childOptions[index].children.find(i => i.value === item.deviceId) && this.childOptions[index].children.push({
|
||||||
|
value: item.deviceId,
|
||||||
|
label: item.deviceName,
|
||||||
|
leaf: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return Object.assign({}, item, {
|
||||||
|
deviceId: [item.deviceCategory || '', item.deviceId || ''],
|
||||||
|
deviceName: [item.categoryName || '', item.deviceName || ''],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
this.protectionPlan.splice(0,0,...plan)
|
this.protectionPlan.splice(0, 0, ...plan)
|
||||||
this.protectionSettings.splice(0,0,...settings)
|
this.protectionSettings.splice(0, 0, ...settings)
|
||||||
})
|
})
|
||||||
console.log('获取设备保护详情并初始化',this.formData,this.protectionPlan,this.protectionSettings)
|
console.log('获取设备保护详情并初始化', this.formData, this.protectionPlan, this.protectionSettings, this.childOptions)
|
||||||
|
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
this.mode = 'add'
|
this.mode = 'add'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 新增设备保护前提、设备保护方案
|
// 新增设备保护前提、设备保护方案
|
||||||
addRow(type) {
|
addRow(type) {
|
||||||
const item = type === 'protectionSettings' ? {
|
const item = type === 'protectionSettings' ? {
|
||||||
deviceId:[],//设备ID
|
deviceId: [],//设备ID
|
||||||
|
deviceName: [],
|
||||||
deviceCategory: "",//设备类型 英文
|
deviceCategory: "",//设备类型 英文
|
||||||
categoryName:'',//设备类型名称 中文
|
categoryName: '',//设备类型名称 中文
|
||||||
point: "",//点位 英文
|
point: "",//点位 英文
|
||||||
pointName:"",//点位 中文
|
pointName: "",//点位 中文
|
||||||
faultValue: "",//故障值
|
faultValue: "",//故障值
|
||||||
releaseValue: "",//释放值
|
releaseValue: "",//释放值
|
||||||
faultOperator: "",//故障值比较关系
|
faultOperator: "",//故障值比较关系
|
||||||
releaseOperator: "",//释放值比较关系
|
releaseOperator: "",//释放值比较关系
|
||||||
relationNext: "",//与下一个点位的关系
|
relationNext: "",//与下一个点位的关系
|
||||||
} : {
|
} : {
|
||||||
deviceId:[],
|
deviceId: [],
|
||||||
|
deviceName: [],
|
||||||
deviceCategory: "",//设备类型 英文
|
deviceCategory: "",//设备类型 英文
|
||||||
categoryName:'',//设备类型名称 中文
|
categoryName: '',//设备类型名称 中文
|
||||||
point: "",
|
point: "",
|
||||||
pointName:"",
|
pointName: "",
|
||||||
value: "",//设置值
|
value: "",//设置值
|
||||||
}
|
}
|
||||||
// this.$set(this[type], this[type].length, item);
|
// this.$set(this[type], this[type].length, item);
|
||||||
this[type].splice(this[type].length,0,item)
|
this[type].splice(this[type].length, 0, item)
|
||||||
console.log('新增设备保护前提、方案',type,this[type])
|
console.log('新增设备保护前提、方案', type, this[type])
|
||||||
},
|
},
|
||||||
// 删除设备保护前提、设备保护方案
|
// 删除设备保护前提、设备保护方案
|
||||||
deleteRow(index, type) {
|
deleteRow(index, type) {
|
||||||
@ -435,25 +464,25 @@ export default {
|
|||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
const data = response?.data || [];
|
const data = response?.data || [];
|
||||||
cb(
|
cb(
|
||||||
data.map((item) => {
|
data.map((item) => {
|
||||||
return { name: item, value: item };
|
return {name: item, value: item};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 点位选择
|
// 点位选择
|
||||||
handleSelect(data, index, type) {
|
handleSelect(data, index, type) {
|
||||||
console.log('选择点位',data,index,type)
|
console.log('选择点位', data, index, type)
|
||||||
// this.$set(this[type], index, Object.assign({},this[type][index],{
|
// this.$set(this[type], index, Object.assign({},this[type][index],{
|
||||||
// point:data.value,
|
// point:data.value,
|
||||||
// pointName:data.value,
|
// pointName:data.value,
|
||||||
// }));
|
// }));
|
||||||
let line = Object.assign({},this[type][index],{
|
let line = Object.assign({}, this[type][index], {
|
||||||
point:data.value,
|
point: data.value,
|
||||||
pointName:data.value,
|
pointName: data.value,
|
||||||
})
|
})
|
||||||
this[type].splice(index,1,line);
|
this[type].splice(index, 1, line);
|
||||||
console.log('选择点位配置完成',this[type][index])
|
console.log('选择点位配置完成', this[type][index])
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取设备类别-不区分站点
|
// 获取设备类别-不区分站点
|
||||||
@ -461,79 +490,86 @@ export default {
|
|||||||
this.loading += 1;
|
this.loading += 1;
|
||||||
return getAllDeviceCategory()
|
return getAllDeviceCategory()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const data = (response?.data || []).filter(item => ['PCS','STACK'].includes(item.code));
|
const data = (response?.data || []);
|
||||||
// this.childOptions=[]
|
this.$set(this, 'childOptions', [])
|
||||||
this.$set(this,'childOptions',[])
|
let arr = []
|
||||||
let arr =[]
|
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
arr.push({
|
arr.push({
|
||||||
value: item.code,
|
value: item.code,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
children:[]
|
leaf: false,
|
||||||
|
children: []
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.childOptions.splice(0,0,...arr)
|
this.childOptions.splice(0, 0, ...arr)
|
||||||
console.log('获取设备类型',data,this.childOptions)
|
console.log('获取设备类型', data, this.childOptions)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading -= 1;
|
this.loading -= 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//获取设备列表-区分站点
|
//获取设备列表-区分站点
|
||||||
getDeviceList(deviceCategory,siteId){
|
getDeviceList(node, resolve) {
|
||||||
this.$nextTick(()=>{
|
if (!this.formData.siteId) {
|
||||||
getDeviceListBySiteAndCategory({siteId:siteId || this.formData.siteId,deviceCategory}).then((response) => {
|
this.$message({
|
||||||
const data = (response?.data || []).map(item => {
|
type: "warning",
|
||||||
return {
|
message: "请先选择站点",
|
||||||
label: item.deviceName,
|
});
|
||||||
value: item.id,
|
return resolve([])
|
||||||
}
|
}
|
||||||
})
|
getDeviceListBySiteAndCategory({
|
||||||
const index = this.childOptions.findIndex(item=>item.value === deviceCategory)
|
siteId: this.formData.siteId,
|
||||||
if(index>-1){
|
deviceCategory: node.value
|
||||||
const length = this.childOptions[index].children.length
|
}).then((response) => {
|
||||||
this.childOptions[index].children.splice(0,length,...data)
|
const data = (response?.data || []).map(item => {
|
||||||
|
return {
|
||||||
|
label: item.deviceName,
|
||||||
|
value: item.id,
|
||||||
|
leaf: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
resolve(data)
|
||||||
|
}).catch(() => {
|
||||||
|
resolve([])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//更新站点下面的设备列表
|
//更新站点下面的设备列表
|
||||||
updateSiteDeviceList(){
|
updateSiteDeviceList() {
|
||||||
this.childOptions.forEach(item => {
|
this.childOptions.forEach(item => {
|
||||||
const length = item.children.length
|
const length = item.children.length
|
||||||
item.children.splice(0,length)
|
item.children.splice(0, length)
|
||||||
})
|
})
|
||||||
this.getDeviceList('PCS')
|
|
||||||
this.getDeviceList('STACK')
|
|
||||||
},
|
},
|
||||||
//选中设备类型、设备
|
//选中设备类型、设备
|
||||||
handleChange(data,type,index){
|
handleChange(data, type, index) {
|
||||||
const deviceCategory = data[0],deviceId=data[1]
|
console.log('设置选中设备类型、设备', data, type, index)
|
||||||
console.log('设置选中设备类型、设备',deviceCategory,deviceId,type,index)
|
const {label = '', parent = {}} = this.$refs[type + index][0].getCheckedNodes()[0]
|
||||||
const item = Object.assign({},this[type][index],{
|
console.log('选中设备的名称', parent.label, label)
|
||||||
deviceId:data,
|
const item = Object.assign({}, this[type][index], {
|
||||||
deviceCategory,
|
deviceId: data,
|
||||||
categoryName : this.childOptions.find(i=>i.value === deviceCategory).label,
|
deviceName: [parent.label, label],
|
||||||
pointName:'',
|
deviceCategory: data[0],
|
||||||
point:''
|
categoryName: parent.label,
|
||||||
|
pointName: '',
|
||||||
|
point: ''
|
||||||
})
|
})
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
// this.$set(this[type], index, item);
|
// this.$set(this[type], index, item);
|
||||||
this[type].splice(index,1,item);
|
this[type].splice(index, 1, item);
|
||||||
})
|
})
|
||||||
console.log('设置选中设备类型、设备配置完成',this[type][index])
|
console.log('设置选中设备类型、设备配置完成', this[type][index])
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取站点列表
|
//获取站点列表
|
||||||
getZdList() {
|
getZdList() {
|
||||||
this.loading += 1;
|
this.loading += 1;
|
||||||
getAllSites()
|
getAllSites()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.siteList = response?.data || [];
|
this.siteList = response?.data || [];
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading -= 1;
|
this.loading -= 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 切换站点
|
// 切换站点
|
||||||
// 重新获取设备列表
|
// 重新获取设备列表
|
||||||
@ -541,62 +577,65 @@ export default {
|
|||||||
changeType() {
|
changeType() {
|
||||||
//获取当前站点下的pcs和bms
|
//获取当前站点下的pcs和bms
|
||||||
this.updateSiteDeviceList()
|
this.updateSiteDeviceList()
|
||||||
if(this.protectionSettings.length>0){
|
if (this.protectionSettings.length > 0) {
|
||||||
const list =this.protectionSettings
|
const list = this.protectionSettings
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
item.point = ""
|
item.point = ""
|
||||||
item.pointName = ""
|
item.pointName = ""
|
||||||
item.deviceId=[]
|
item.deviceId = []
|
||||||
item.categoryName=''
|
item.deviceName = []
|
||||||
item.deviceCategory=''
|
item.categoryName = ''
|
||||||
|
item.deviceCategory = ''
|
||||||
});
|
});
|
||||||
// this.$set(this,'protectionSettings',list)
|
// this.$set(this,'protectionSettings',list)
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
this.protectionSettings.splice(0,this.protectionSettings.length,...list)
|
this.protectionSettings.splice(0, this.protectionSettings.length, ...list)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(this.protectionPlan.length>0){
|
if (this.protectionPlan.length > 0) {
|
||||||
const list =this.protectionPlan
|
const list = this.protectionPlan
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
item.point = ""
|
item.point = ""
|
||||||
item.pointName = ""
|
item.pointName = ""
|
||||||
item.deviceId=[]
|
item.deviceId = []
|
||||||
item.categoryName=''
|
item.deviceName = []
|
||||||
item.deviceCategory=''
|
item.categoryName = ''
|
||||||
|
item.deviceCategory = ''
|
||||||
});
|
});
|
||||||
// this.$set(this,'protectionPlan',list)
|
// this.$set(this,'protectionPlan',list)
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
this.protectionPlan.splice(0,this.protectionPlan.length,...list)
|
this.protectionPlan.splice(0, this.protectionPlan.length, ...list)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
saveDialog() {
|
saveDialog() {
|
||||||
function getToastMsg(name,type,index){
|
function getToastMsg(name, type, index) {
|
||||||
return {
|
return {
|
||||||
protectionSettings:{
|
protectionSettings: {
|
||||||
deviceId:`请选择保护前提第${index}行的设备`,//设备ID
|
deviceId: `请选择保护前提第${index}行的设备`,//设备ID
|
||||||
deviceCategory: `请选择保护前提第${index}行的设备类型`,//设备类型 英文
|
deviceCategory: `请选择保护前提第${index}行的设备类型`,//设备类型 英文
|
||||||
categoryName:`请选择保护前提第${index}行的设备类型`,//设备类型名称 中文
|
categoryName: `请选择保护前提第${index}行的设备类型`,//设备类型名称 中文
|
||||||
point: `请选择保护前提第${index}行的点位`,//点位 英文
|
point: `请选择保护前提第${index}行的点位`,//点位 英文
|
||||||
pointName:`请选择保护前提第${index}行的点位`,//点位 中文
|
pointName: `请选择保护前提第${index}行的点位`,//点位 中文
|
||||||
faultValue: `请输入保护前提第${index}行的故障值`,//故障值
|
faultValue: `请输入保护前提第${index}行的故障值`,//故障值
|
||||||
releaseValue: `请输入保护前提第${index}行的释放值`,//释放值
|
releaseValue: `请输入保护前提第${index}行的释放值`,//释放值
|
||||||
faultOperator: `请选择保护前提第${index}行的故障值比较关系`,//故障值比较关系
|
faultOperator: `请选择保护前提第${index}行的故障值比较关系`,//故障值比较关系
|
||||||
releaseOperator: `请选择保护前提第${index}行的释放值比较关系`,//释放值比较关系
|
releaseOperator: `请选择保护前提第${index}行的释放值比较关系`,//释放值比较关系
|
||||||
relationNext: `请选择保护前提第${index}行与下一个点位的关系`,//与下一个点位的关系
|
relationNext: `请选择保护前提第${index}行与下一个点位的关系`,//与下一个点位的关系
|
||||||
},
|
},
|
||||||
protectionPlan :{
|
protectionPlan: {
|
||||||
deviceId:`请选择保护方案第${index}行的设备`,
|
deviceId: `请选择保护方案第${index}行的设备`,
|
||||||
deviceCategory: `请选择保护方案第${index}行的设备类型`,//设备类型 英文
|
deviceCategory: `请选择保护方案第${index}行的设备类型`,//设备类型 英文
|
||||||
categoryName:`请选择保护方案第${index}行的设备类型`,//设备类型名称 中文
|
categoryName: `请选择保护方案第${index}行的设备类型`,//设备类型名称 中文
|
||||||
point: `请选择保护方案第${index}行的点位`,
|
point: `请选择保护方案第${index}行的点位`,
|
||||||
pointName:`请选择保护方案第${index}行的点位`,
|
pointName: `请选择保护方案第${index}行的点位`,
|
||||||
value: `请输入保护方案第${index}行的故障值`,//设置值
|
value: `请输入保护方案第${index}行的故障值`,//设置值
|
||||||
}
|
}
|
||||||
}[type][name]
|
}[type][name]
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$refs.addTempForm.validate((valid) => {
|
this.$refs.addTempForm.validate((valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
const {
|
const {
|
||||||
@ -607,67 +646,69 @@ export default {
|
|||||||
faultLevel = 1, //告警等级
|
faultLevel = 1, //告警等级
|
||||||
faultDelaySeconds = "", //故障延时
|
faultDelaySeconds = "", //故障延时
|
||||||
releaseDelaySeconds = "", //释放延时
|
releaseDelaySeconds = "", //释放延时
|
||||||
description="",//方案描述
|
description = "",//方案描述
|
||||||
} = this.formData;
|
} = this.formData;
|
||||||
const {protectionSettings,protectionPlan} = this
|
const {protectionSettings, protectionPlan} = this
|
||||||
let protectionSettingsValidateStatus= true , protectionPlanValidateStatus= true
|
let protectionSettingsValidateStatus = true, protectionPlanValidateStatus = true
|
||||||
for(let i = 0;i<protectionSettings.length;i++){
|
for (let i = 0; i < protectionSettings.length; i++) {
|
||||||
let valueMap = Object.entries(protectionSettings[i]);
|
let valueMap = Object.entries(protectionSettings[i]);
|
||||||
for(let inner = 0;inner < valueMap.length;inner++){
|
for (let inner = 0; inner < valueMap.length; inner++) {
|
||||||
const key =valueMap[inner][0],value =valueMap[inner][1]
|
const key = valueMap[inner][0], value = valueMap[inner][1]
|
||||||
if(key === 'relationNext'){
|
if (key === 'relationNext') {
|
||||||
if(protectionSettings[i+1] && !value){//有下一个点位
|
if (protectionSettings[i + 1] && !value) {//有下一个点位
|
||||||
this.$message.error(getToastMsg(key,'protectionSettings',i+1))
|
this.$message.error(getToastMsg(key, 'protectionSettings', i + 1))
|
||||||
protectionSettingsValidateStatus=false
|
protectionSettingsValidateStatus = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(![0,'0'].includes(value) && !value){
|
if (![0, '0'].includes(value) && !value) {
|
||||||
this.$message.error(getToastMsg(key,'protectionSettings',i+1))
|
this.$message.error(getToastMsg(key, 'protectionSettings', i + 1))
|
||||||
protectionSettingsValidateStatus=false
|
protectionSettingsValidateStatus = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!protectionSettingsValidateStatus) break
|
if (!protectionSettingsValidateStatus) break
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 0;i<protectionPlan.length;i++){
|
for (let i = 0; i < protectionPlan.length; i++) {
|
||||||
let valueMap = Object.entries(protectionPlan[i]);
|
let valueMap = Object.entries(protectionPlan[i]);
|
||||||
for(let inner = 0;inner < valueMap.length;inner++){
|
for (let inner = 0; inner < valueMap.length; inner++) {
|
||||||
const key =valueMap[inner][0],value =valueMap[inner][1]
|
const key = valueMap[inner][0], value = valueMap[inner][1]
|
||||||
if(key === 'relationNext'){
|
if (key === 'relationNext') {
|
||||||
if(protectionPlan[i+1] && !value){//有下一个点位
|
if (protectionPlan[i + 1] && !value) {//有下一个点位
|
||||||
this.$message.error(getToastMsg(key,'protectionPlan',i+1))
|
this.$message.error(getToastMsg(key, 'protectionPlan', i + 1))
|
||||||
protectionPlanValidateStatus=false
|
protectionPlanValidateStatus = false
|
||||||
break
|
break
|
||||||
}else{
|
} else {
|
||||||
// protectionPlan[i][key] = ''//清空选择的关系
|
// protectionPlan[i][key] = ''//清空选择的关系
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(![0,'0'].includes(value) && !value){
|
if (![0, '0'].includes(value) && !value) {
|
||||||
this.$message.error(getToastMsg(key,'protectionPlan',i+1))
|
this.$message.error(getToastMsg(key, 'protectionPlan', i + 1))
|
||||||
protectionPlanValidateStatus=false
|
protectionPlanValidateStatus = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!protectionPlanValidateStatus) break
|
if (!protectionPlanValidateStatus) break
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!protectionSettingsValidateStatus || !protectionPlanValidateStatus) return
|
if (!protectionSettingsValidateStatus || !protectionPlanValidateStatus) return
|
||||||
const settings = protectionSettings.map(item=>{
|
const settings = protectionSettings.map(item => {
|
||||||
return Object.assign({},item,{
|
return Object.assign({}, item, {
|
||||||
deviceId:item.deviceId[1],
|
deviceId: item.deviceId[1],
|
||||||
|
deviceName: item.deviceName[1],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const plan = protectionPlan.map(item=>{
|
const plan = protectionPlan.map(item => {
|
||||||
return Object.assign({},item,{
|
return Object.assign({}, item, {
|
||||||
deviceId:item.deviceId[1],
|
deviceId: item.deviceId[1],
|
||||||
|
deviceName: item.deviceName[1],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.loading += 1;
|
this.loading += 1;
|
||||||
const params= {
|
const params = {
|
||||||
siteId,
|
siteId,
|
||||||
faultName,
|
faultName,
|
||||||
isAlert,
|
isAlert,
|
||||||
@ -675,49 +716,49 @@ export default {
|
|||||||
faultDelaySeconds,
|
faultDelaySeconds,
|
||||||
releaseDelaySeconds,
|
releaseDelaySeconds,
|
||||||
description,
|
description,
|
||||||
protectionSettings:JSON.stringify(settings),
|
protectionSettings: JSON.stringify(settings),
|
||||||
protectionPlan:JSON.stringify(plan),
|
protectionPlan: JSON.stringify(plan),
|
||||||
}
|
}
|
||||||
if (this.mode === "add") {
|
if (this.mode === "add") {
|
||||||
addProtectPlan(params)
|
addProtectPlan(params)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
//新增成功
|
//新增成功
|
||||||
// 关闭弹窗 更新表格
|
// 关闭弹窗 更新表格
|
||||||
this.$emit("update");
|
this.$emit("update");
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading -= 1;
|
this.loading -= 1;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
params.id = id
|
params.id = id
|
||||||
updateProtectPlan(params)
|
updateProtectPlan(params)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
//新增成功
|
//新增成功
|
||||||
// 关闭弹窗 更新表格
|
// 关闭弹窗 更新表格
|
||||||
this.$emit("update");
|
this.$emit("update");
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading -= 1;
|
this.loading -= 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.$emit("clear");
|
this.$emit("clear");
|
||||||
// 清空所有数据
|
// 清空所有数据
|
||||||
for(let key in this.formData) {
|
for (let key in this.formData) {
|
||||||
this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
|
this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
|
||||||
}
|
}
|
||||||
this.$refs.addTempForm.resetFields();
|
this.$refs.addTempForm.resetFields();
|
||||||
this.$set(this,'protectionSettings',[])
|
this.$set(this, 'protectionSettings', [])
|
||||||
this.$set(this,'protectionPlan',[])
|
this.$set(this, 'protectionPlan', [])
|
||||||
this.$set(this,'childOptions',[])
|
this.$set(this, 'childOptions', [])
|
||||||
this.dialogTableVisible = false;
|
this.dialogTableVisible = false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -727,35 +768,43 @@ export default {
|
|||||||
.items-container {
|
.items-container {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-lists-container {
|
.time-lists-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
|
|
||||||
.time-lists {
|
.time-lists {
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
width: 16%;
|
width: 16%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
|
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
width: 28%;
|
width: 28%;
|
||||||
border-right: 1px solid #eee;
|
border-right: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-date-editor.el-input,
|
.el-date-editor.el-input,
|
||||||
.el-date-editor.el-input__inner {
|
.el-date-editor.el-input__inner {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-lists-title {
|
.time-lists-title {
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user