修改模拟分析添加Keff预警阈值,设备算法配置映射
This commit is contained in:
parent
9ed22058b6
commit
099486cfc1
@ -11,7 +11,7 @@ import { getDictItemById } from '@/api/dict';
|
|||||||
import { eventsBatchSave } from '@/api/business/event';
|
import { eventsBatchSave } from '@/api/business/event';
|
||||||
import ConditionModels from '@/views/component/scenario/condition.vue'
|
import ConditionModels from '@/views/component/scenario/condition.vue'
|
||||||
import { addScenarios,updateScenarios,getActiveAlgorithms } from "@/api/business/scenario";
|
import { addScenarios,updateScenarios,getActiveAlgorithms } from "@/api/business/scenario";
|
||||||
|
import { topologyDevicesLsit } from '@/api/business/project';
|
||||||
const emit = defineEmits([ 'closeCreatescenario']);
|
const emit = defineEmits([ 'closeCreatescenario']);
|
||||||
const props = defineProps({ // 接收父组件传递的项目信息
|
const props = defineProps({ // 接收父组件传递的项目信息
|
||||||
projectInfo: {
|
projectInfo: {
|
||||||
@ -53,12 +53,25 @@ function confirmClick(formEl: any) {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
||||||
if (!info.value.scenarioId) {
|
if (!info.value.scenarioId) {
|
||||||
const params = {
|
const params:any = {
|
||||||
projectId: props.projectInfo.projectId,
|
projectId: props.projectInfo.projectId,
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
algorithmType: info.value.algorithmType,
|
algorithmType: info.value.algorithmType,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
|
keffThreshold: info.value.keffThreshold,
|
||||||
};
|
};
|
||||||
|
let device_algo_config:any = {}
|
||||||
|
let isTrue:any = false
|
||||||
|
deviceData.value.forEach((item: any) => {
|
||||||
|
if(item.algorithmType !=null && item.algorithmType != ''){
|
||||||
|
device_algo_config[item.deviceId] = item.algorithmType
|
||||||
|
isTrue = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(isTrue == true){
|
||||||
|
params.deviceAlgoConfig = JSON.stringify(device_algo_config)
|
||||||
|
}
|
||||||
|
|
||||||
if(isSwitch.value == true){
|
if(isSwitch.value == true){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -82,13 +95,26 @@ function confirmClick(formEl: any) {
|
|||||||
isSwitch.value = false;
|
isSwitch.value = false;
|
||||||
})
|
})
|
||||||
} else if (info.value.scenarioId) {
|
} else if (info.value.scenarioId) {
|
||||||
const params = {
|
const params:any = {
|
||||||
scenarioId: info.value.scenarioId,
|
scenarioId: info.value.scenarioId,
|
||||||
projectId: info.value.projectId,
|
projectId: info.value.projectId,
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
algorithmType: info.value.algorithmType,
|
algorithmType: info.value.algorithmType,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
|
keffThreshold: info.value.keffThreshold,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let device_algo_config:any = {}
|
||||||
|
let isTrue:any = false
|
||||||
|
deviceData.value.forEach((item: any) => {
|
||||||
|
if(item.algorithmType !=null && item.algorithmType != ''){
|
||||||
|
device_algo_config[item.deviceId] = item.algorithmType
|
||||||
|
isTrue = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(isTrue == true){
|
||||||
|
params.deviceAlgoConfig = JSON.stringify(device_algo_config)
|
||||||
|
}
|
||||||
updateScenarios(params).then((res) => {
|
updateScenarios(params).then((res) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -121,8 +147,26 @@ function submitClick(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
const deviceData: any = ref([]); // 设备数据
|
||||||
|
function initDeviceData(){
|
||||||
|
deviceData.value = []
|
||||||
|
topologyDevicesLsit({
|
||||||
|
id: props.projectInfo.projectId
|
||||||
|
}).then((res:any) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
deviceData.value.push({
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
deviceName: item.deviceName,
|
||||||
|
algorithmType: ''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
initDeviceData()
|
||||||
getAlgorithmType()
|
getAlgorithmType()
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -138,7 +182,7 @@ onMounted(() => {
|
|||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="scenario-setting-bottombox">
|
<div class="scenario-setting-bottombox">
|
||||||
<el-form ref="infoForm" :model="info" :rules="rules" label-width="140px" style="width:600px"
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="160px" style="width:600px"
|
||||||
v-if="stepsActive == 0">
|
v-if="stepsActive == 0">
|
||||||
<el-form-item label="事故情景名称:" prop="name">
|
<el-form-item label="事故情景名称:" prop="name">
|
||||||
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" ></el-input>
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" ></el-input>
|
||||||
@ -148,6 +192,26 @@ onMounted(() => {
|
|||||||
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="设备算法配置映射:">
|
||||||
|
<div style="width: 100%;padding-top: 40px;">
|
||||||
|
<div v-for="item in deviceData" :key="item.deviceId" style="display: flex;align-items: center;margin-bottom: 10px;">
|
||||||
|
<div style="width: 150px;text-align: right;padding-right: 10px;">{{item.deviceName}}</div>
|
||||||
|
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:100%;" clearable>
|
||||||
|
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="Keff预警阈值:" prop="keffThreshold">
|
||||||
|
<el-input v-model="info.keffThreshold" style="width: 100%" placeholder="输入Keff预警阈值" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<el-form-item label="事故情景描述:">
|
<el-form-item label="事故情景描述:">
|
||||||
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述"></el-input>
|
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@ -86,7 +86,12 @@ function addClick() {
|
|||||||
description: "",
|
description: "",
|
||||||
};
|
};
|
||||||
stepsActive.value = 0;
|
stepsActive.value = 0;
|
||||||
|
deviceData.value.forEach((item: any) => {
|
||||||
|
item.algorithmType = ''
|
||||||
|
})
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSwitch = ref(false); // 事故情景id
|
const isSwitch = ref(false); // 事故情景id
|
||||||
@ -105,6 +110,23 @@ const rules = ref({
|
|||||||
function editClick(row: any,type: string) {
|
function editClick(row: any,type: string) {
|
||||||
title.value =type + "事故情景";
|
title.value =type + "事故情景";
|
||||||
info.value = JSON.parse(JSON.stringify(row));
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
|
if(info.value.deviceAlgoConfig !=null && info.value.deviceAlgoConfig != ''){
|
||||||
|
let device_algo_config = JSON.parse(info.value.deviceAlgoConfig)
|
||||||
|
for(let key in device_algo_config){
|
||||||
|
for(let i = 0;i<deviceData.value.length;i++){
|
||||||
|
if(deviceData.value[i].deviceId == key){
|
||||||
|
deviceData.value[i].algorithmType = device_algo_config[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dialogEditVisible.value = true;
|
dialogEditVisible.value = true;
|
||||||
}
|
}
|
||||||
@ -191,12 +213,27 @@ const getAlgorithmType = async () => {
|
|||||||
}
|
}
|
||||||
function submitClick(){
|
function submitClick(){
|
||||||
|
|
||||||
let data = {
|
let data:any = {
|
||||||
scenarioId: info.value.scenarioId,
|
scenarioId: info.value.scenarioId,
|
||||||
algorithm_type: info.value.algorithmType,
|
algorithm_type: info.value.algorithmType,
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
|
keffThreshold: info.value.keffThreshold,
|
||||||
}
|
}
|
||||||
|
let device_algo_config:any = {}
|
||||||
|
let isTrue:any = false
|
||||||
|
deviceData.value.forEach((item: any) => {
|
||||||
|
if(item.algorithmType !=null && item.algorithmType != ''){
|
||||||
|
device_algo_config[item.deviceId] = item.algorithmType
|
||||||
|
isTrue = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(isTrue == true){
|
||||||
|
data.deviceAlgoConfig = JSON.stringify(device_algo_config)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateScenarios(data).then((res:any) => {
|
updateScenarios(data).then((res:any) => {
|
||||||
if (res == true) {
|
if (res == true) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -213,6 +250,7 @@ function submitClick(){
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getAlgorithmType()
|
getAlgorithmType()
|
||||||
gettableData();
|
gettableData();
|
||||||
|
initDeviceData()
|
||||||
});
|
});
|
||||||
function closeCreatescenario(){
|
function closeCreatescenario(){
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
@ -347,6 +385,24 @@ function changeShowResult(isShow:any){ // 切换显示结果模型
|
|||||||
},
|
},
|
||||||
200);
|
200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deviceData: any = ref([]); // 设备数据
|
||||||
|
function initDeviceData(){
|
||||||
|
deviceData.value = []
|
||||||
|
topologyDevicesLsit({
|
||||||
|
id: props.projectInfo.projectId
|
||||||
|
}).then((res:any) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
deviceData.value.push({
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
deviceName: item.deviceName,
|
||||||
|
algorithmType: ''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -436,6 +492,20 @@ function changeShowResult(isShow:any){ // 切换显示结果模型
|
|||||||
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="Keff预警阈值:" prop="keffThreshold">
|
||||||
|
<el-input v-model="info.keffThreshold" style="width: 100%" placeholder="输入Keff预警阈值" :disabled="title == '查看事故情景'"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="设备算法配置映射:">
|
||||||
|
<div style="width: 100%;padding-top: 40px;">
|
||||||
|
<div v-for="item in deviceData" :key="item.deviceType" style="display: flex;align-items: center;margin-bottom: 10px;">
|
||||||
|
<div style="width: 150px;text-align: right;padding-right: 10px;">{{item.deviceName}}</div>
|
||||||
|
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:100%;" clearable :disabled="title == '查看事故情景'">
|
||||||
|
<el-option v-for="item in algorithmTypeData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="事故情景描述:" :disabled="title == '查看事故情景'">
|
<el-form-item label="事故情景描述:" :disabled="title == '查看事故情景'">
|
||||||
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述" :disabled="title == '查看事故情景'"></el-input>
|
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述" :disabled="title == '查看事故情景'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user