设备保护
This commit is contained in:
@ -76,3 +76,12 @@ export function getDevicePointList({siteId,deviceId,deviceCategory,parentId,page
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//获取设备类型下面的所有设备列表
|
||||
export function getDeviceListBySiteAndCategory({siteId, deviceCategory}) {
|
||||
return request({
|
||||
url: `/ems/siteConfig/getDeviceListBySiteAndCategory?siteId=${siteId}&deviceCategory=${deviceCategory}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@ -40,6 +40,17 @@
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<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>
|
||||
<el-form-item label="是否告警" prop="isAlert">
|
||||
<el-checkbox
|
||||
v-model="formData.isAlert"
|
||||
@ -96,17 +107,12 @@
|
||||
:key="'protectionSettings' + index"
|
||||
>
|
||||
<div>
|
||||
<el-select
|
||||
v-model="item.deviceCategory"
|
||||
placeholder="请选择设备类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="(value, key) in deviceCategoryList"
|
||||
:key="key + 'deviceCategoryList'"
|
||||
:label="value.name"
|
||||
:value="value.code"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-cascader
|
||||
v-model="item.deviceId"
|
||||
:show-all-levels="false"
|
||||
:options="childOptions"
|
||||
@change="(v)=>handleChange(v,'protectionSettings',index)"
|
||||
></el-cascader>
|
||||
</div>
|
||||
<div>
|
||||
<el-autocomplete
|
||||
@ -214,17 +220,12 @@
|
||||
:key="'protectionPlan' + index"
|
||||
>
|
||||
<div>
|
||||
<el-select
|
||||
v-model="item.deviceCategory"
|
||||
placeholder="请选择设备类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="(value, key) in deviceCategoryList"
|
||||
:key="key + 'deviceCategoryList'"
|
||||
:label="value.name"
|
||||
:value="value.code"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-cascader
|
||||
v-model="item.deviceId"
|
||||
:show-all-levels="false"
|
||||
:options="childOptions"
|
||||
@change="(v)=>handleChange(v,'protectionPlan',index)"
|
||||
></el-cascader>
|
||||
</div>
|
||||
<div>
|
||||
<el-autocomplete
|
||||
@ -272,6 +273,7 @@ import {
|
||||
updateDevice,
|
||||
addDevice,
|
||||
getParentDeviceId,
|
||||
getDeviceListBySiteAndCategory
|
||||
} from "@/api/ems/site";
|
||||
import { getAllDeviceCategory, pointFuzzyQuery } from "@/api/ems/search";
|
||||
export default {
|
||||
@ -302,6 +304,7 @@ export default {
|
||||
};
|
||||
return {
|
||||
loading: 0,
|
||||
childOptions:[],
|
||||
protectionSettings: [],
|
||||
protectionPlan: [],
|
||||
dialogTableVisible: false,
|
||||
@ -314,6 +317,7 @@ export default {
|
||||
faultLevel: 1, //告警等级
|
||||
faultDelaySeconds: "", //故障延时
|
||||
releaseDelaySeconds: "", //释放延时
|
||||
description:'',//方案描述
|
||||
},
|
||||
rules: {
|
||||
siteId: [
|
||||
@ -351,8 +355,8 @@ export default {
|
||||
handler(newVal) {
|
||||
//打开弹窗
|
||||
if (newVal) {
|
||||
this.getZdList();
|
||||
this.getDeviceCategoryList();
|
||||
this.getZdList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
@ -385,19 +389,25 @@ export default {
|
||||
addRow(type) {
|
||||
if (type === "protectionSettings") {
|
||||
this.protectionSettings.push({
|
||||
deviceCategory: "",
|
||||
point: "",
|
||||
faultValue: "",
|
||||
releaseValue: "",
|
||||
faultOperator: "",
|
||||
releaseOperator: "",
|
||||
relation: "",
|
||||
deviceId:'',//设备ID
|
||||
deviceCategory: "",//设备类型 英文
|
||||
categoryName:'',//设备类型名称 中文
|
||||
point: "",//点位 英文
|
||||
pointName:"",//点位 中文
|
||||
faultValue: "",//故障值
|
||||
releaseValue: "",//释放值
|
||||
faultOperator: "",//故障值比较关系
|
||||
releaseOperator: "",//释放值比较关系
|
||||
relationNext: "",//与下一个点位的关系
|
||||
});
|
||||
} else {
|
||||
this.protectionPlan.push({
|
||||
deviceCategory: "",
|
||||
deviceId:"",
|
||||
deviceCategory: "",//设备类型 英文
|
||||
categoryName:'',//设备类型名称 中文
|
||||
point: "",
|
||||
value: "",
|
||||
pointName:"",
|
||||
value: "",//设置值
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -406,6 +416,7 @@ export default {
|
||||
this[type].splice(index, 1);
|
||||
},
|
||||
|
||||
|
||||
// 设备保护前提、设备保护方案点位选择
|
||||
querySearchAsync(query, cb, index, type) {
|
||||
console.log("查询数据", query, index);
|
||||
@ -429,17 +440,63 @@ export default {
|
||||
);
|
||||
});
|
||||
},
|
||||
// 点位选择
|
||||
handleSelect(data, index, type) {
|
||||
console.log("点位选择", data, "index=", index);
|
||||
this[type][index].point = data.value;
|
||||
this[type][index].pointName = data.value;
|
||||
},
|
||||
|
||||
// 切换站点
|
||||
changeType() {
|
||||
console.log("切换站点");
|
||||
this.protectionSettings.forEach((item) => (item.point = ""));
|
||||
this.protectionPlan.forEach((item) => (item.point = ""));
|
||||
// 获取设备类别-不区分站点
|
||||
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])
|
||||
},
|
||||
|
||||
//获取站点列表
|
||||
getZdList() {
|
||||
this.loading += 1;
|
||||
@ -451,17 +508,29 @@ export default {
|
||||
this.loading -= 1;
|
||||
});
|
||||
},
|
||||
// 获取设备类别
|
||||
getDeviceCategoryList() {
|
||||
this.loading += 1;
|
||||
getAllDeviceCategory()
|
||||
.then((response) => {
|
||||
this.deviceCategoryList = response?.data || [];
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading -= 1;
|
||||
});
|
||||
// 切换站点
|
||||
// 重新获取设备列表
|
||||
// 清空选中的设备、点位信息
|
||||
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=''
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
saveDialog() {
|
||||
this.$refs.addTempForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
@ -535,6 +604,9 @@ export default {
|
||||
faultDelaySeconds: "", //故障延时
|
||||
releaseDelaySeconds: "", //释放延时
|
||||
};
|
||||
for(let key in this.formData) {
|
||||
this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
|
||||
}
|
||||
this.$refs.addTempForm.resetFields();
|
||||
this.dialogTableVisible = false;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user