修改情景模式
This commit is contained in:
parent
06e42c2e4a
commit
fe23b7a17f
@ -50,7 +50,7 @@ export function deleteBatchCriticalData (queryParams:any){
|
|||||||
}
|
}
|
||||||
// 导出临界数据
|
// 导出临界数据
|
||||||
export function exportAllExports(deviceType:any){
|
export function exportAllExports(deviceType:any){
|
||||||
let url = '/critical-data/v2/export/?deviceType='+deviceType
|
let url = '/critical-data/v2/export?deviceType='+deviceType
|
||||||
|
|
||||||
return request({
|
return request({
|
||||||
url: url ,
|
url: url ,
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export function sizeSchemaAll(queryParams:any){
|
|||||||
|
|
||||||
// 导出全部结果
|
// 导出全部结果
|
||||||
export function exportAllExports(deviceType:any){
|
export function exportAllExports(deviceType:any){
|
||||||
let url = '/devices/v2/export/?deviceType='+deviceType
|
let url = '/devices/v2/export?deviceType='+deviceType
|
||||||
|
|
||||||
return request({
|
return request({
|
||||||
url: url ,
|
url: url ,
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { getDictItemById } from '@/api/dict';
|
|||||||
import { topologyDevicesLsit } from '@/api/business/project';
|
import { topologyDevicesLsit } from '@/api/business/project';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { searchEventsByScenarioId } from '@/api/business/event';
|
import { searchEventsByScenarioId } from '@/api/business/event';
|
||||||
|
import { sizeSchemaAll } from "@/api/business/database/device";
|
||||||
const url = import.meta.env.VITE_APP_BASE_API;
|
const url = import.meta.env.VITE_APP_BASE_API;
|
||||||
const conditionData:any = ref([{ // 套件数据
|
const conditionData:any = ref([{ // 套件数据
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ function initConditionData(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(res.length > 0){
|
if(res.length > 0){
|
||||||
getDeviceInfo(menuList.value[0].device)
|
getInitDeviceInfo(menuList.value[0].device)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -78,13 +79,25 @@ onMounted(() => {
|
|||||||
DicInit()
|
DicInit()
|
||||||
initDeviceData()
|
initDeviceData()
|
||||||
initConditionData()
|
initConditionData()
|
||||||
|
getSizeSchemaList()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//获取所有项目列表
|
||||||
|
const sizeSchemaInfo:any = ref({});
|
||||||
|
|
||||||
|
async function getSizeSchemaList(){ // 获取所有项目列表
|
||||||
|
let result = await sizeSchemaAll({})
|
||||||
|
sizeSchemaInfo.value = result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const deviceData:any = ref([]) // 始发设备数据
|
const deviceData:any = ref([]) // 始发设备数据
|
||||||
const attributeData:any = ref([]) // 设备属性数据
|
const attributeData:any = ref([]) // 设备属性数据
|
||||||
const materialData:any = ref([]) // 变化物料数据
|
const materialData:any = ref([]) // 变化物料数据
|
||||||
const menuList:any = ref([
|
const menuList:any = ref([
|
||||||
{
|
{
|
||||||
label: '条件1',
|
label: '条件1',
|
||||||
|
deviceType: '',
|
||||||
target:{
|
target:{
|
||||||
entityType: '',
|
entityType: '',
|
||||||
entityId: '',
|
entityId: '',
|
||||||
@ -136,6 +149,7 @@ function addMenu(){ //添加导菜单
|
|||||||
|
|
||||||
menuList.value.push({
|
menuList.value.push({
|
||||||
label: '条件' + (menuList.value.length + 1),
|
label: '条件' + (menuList.value.length + 1),
|
||||||
|
deviceType: '',
|
||||||
target:{
|
target:{
|
||||||
entityType: '',
|
entityType: '',
|
||||||
entityId: '',
|
entityId: '',
|
||||||
@ -159,18 +173,6 @@ function delMenu(){ // 删除导菜单
|
|||||||
|
|
||||||
// 查询字典项
|
// 查询字典项
|
||||||
function DicInit() {
|
function DicInit() {
|
||||||
let params = {
|
|
||||||
dictId: 'dc7419e5f8a655966e6bb90b0cb5c0c2',
|
|
||||||
size:99,
|
|
||||||
current:1
|
|
||||||
}
|
|
||||||
getDictItemById(params).then((result: any) => {
|
|
||||||
attributeData.value = result.data.records;
|
|
||||||
}).catch((err: any) => {
|
|
||||||
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
|
||||||
getDeviceInfo(menuList.value[menuIndex.value].device)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let paramss = {
|
let paramss = {
|
||||||
dictId: '9d87f873bc80e79c6d399131cbe01016',
|
dictId: '9d87f873bc80e79c6d399131cbe01016',
|
||||||
size:99,
|
size:99,
|
||||||
@ -179,7 +181,7 @@ function DicInit() {
|
|||||||
getDictItemById(paramss).then((result: any) => {
|
getDictItemById(paramss).then((result: any) => {
|
||||||
materialData.value = result.data.records;
|
materialData.value = result.data.records;
|
||||||
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
||||||
getDeviceInfo(menuList.value[menuIndex.value].device)
|
getInitDeviceInfo(menuList.value[menuIndex.value].device)
|
||||||
}
|
}
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
});
|
});
|
||||||
@ -195,15 +197,13 @@ function changeAttribute(e:any){ // 设备属性改变时,清空变化物料
|
|||||||
menuList.value[menuIndex.value].target.entityType = 'device'
|
menuList.value[menuIndex.value].target.entityType = 'device'
|
||||||
menuList.value[menuIndex.value].target.property = e
|
menuList.value[menuIndex.value].target.property = e
|
||||||
deviceData.value.forEach((item:any) => {
|
deviceData.value.forEach((item:any) => {
|
||||||
if(item.deviceName == menuList.value[menuIndex.value].device){
|
if(item.deviceId == menuList.value[menuIndex.value].device){
|
||||||
menuList.value[menuIndex.value].target.entityId = item.deviceId
|
menuList.value[menuIndex.value].target.entityId = item.deviceId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
getAttributeMaterial(e)
|
||||||
|
|
||||||
getDeviceInfo(e)
|
|
||||||
}
|
}
|
||||||
function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
|
function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
|
||||||
menuList.value[menuIndex.value].target.entityType = ''
|
menuList.value[menuIndex.value].target.entityType = ''
|
||||||
@ -213,14 +213,13 @@ function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
|
|||||||
menuList.value[menuIndex.value].target.entityId = ''
|
menuList.value[menuIndex.value].target.entityId = ''
|
||||||
|
|
||||||
deviceData.value.forEach((item:any) => {
|
deviceData.value.forEach((item:any) => {
|
||||||
if(item.deviceName == menuList.value[menuIndex.value].device){
|
if(item.deviceId == menuList.value[menuIndex.value].device){
|
||||||
menuList.value[menuIndex.value].target.entityId = item.materialId
|
menuList.value[menuIndex.value].target.entityId = item.materialId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
menuList.value[menuIndex.value].target.property = e
|
menuList.value[menuIndex.value].target.property = e
|
||||||
}
|
}
|
||||||
|
getAttributeMaterial(e)
|
||||||
getDeviceInfo(e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const devicename = ref('') // 选中始发设备
|
const devicename = ref('') // 选中始发设备
|
||||||
@ -237,21 +236,61 @@ function getTimelineList(){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function getDeviceInfo(e:any){ // 获取设备信息
|
|
||||||
|
function getDeviceInfo(e:any){ //始发设备(物料) 下来选项
|
||||||
|
devicename.value = ""
|
||||||
|
deviceMaterial.value = ""
|
||||||
|
menuList.value[menuIndex.value].attribute = ""
|
||||||
|
menuList.value[menuIndex.value].material = ""
|
||||||
|
deviceData.value.forEach((item:any) => {
|
||||||
|
if(item.deviceId == menuList.value[menuIndex.value].device){
|
||||||
|
devicename.value = item.deviceName
|
||||||
|
menuList.value[menuIndex.value].deviceType = item.deviceType
|
||||||
|
for(let key in sizeSchemaInfo.value){
|
||||||
|
if(item.deviceType == key){
|
||||||
|
attributeData.value = sizeSchemaInfo.value[key].fields
|
||||||
|
attributeData.value.forEach((item:any) => {
|
||||||
|
item.dictName = item.label,
|
||||||
|
item.itemCode = item.key
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getInitDeviceInfo(e:any){ // 初始化信息
|
||||||
|
|
||||||
devicename.value = ""
|
devicename.value = ""
|
||||||
deviceMaterial.value = ""
|
deviceMaterial.value = ""
|
||||||
deviceData.value.forEach((item:any) => {
|
deviceData.value.forEach((item:any) => {
|
||||||
if(item.deviceName == menuList.value[menuIndex.value].device){
|
if(item.deviceId == menuList.value[menuIndex.value].device){
|
||||||
devicename.value = item.deviceName
|
devicename.value = item.deviceName
|
||||||
|
menuList.value[menuIndex.value].deviceType = item.deviceType
|
||||||
|
for(let key in sizeSchemaInfo.value){
|
||||||
|
if(item.deviceType == key){
|
||||||
|
attributeData.value = sizeSchemaInfo.value[key].fields
|
||||||
|
attributeData.value.forEach((item:any) => {
|
||||||
|
item.dictName = item.label,
|
||||||
|
item.itemCode = item.key
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
||||||
attributeData.value.forEach((item:any) => {
|
attributeData.value.forEach((item:any) => {
|
||||||
if(item.itemCode == menuList.value[menuIndex.value].attribute){
|
if(item.itemCode == menuList.value[menuIndex.value].attribute){
|
||||||
deviceMaterial.value = item.dictName
|
deviceMaterial.value = item.dictName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取所有项目列表
|
||||||
|
// getSizeSchemaList()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuList.value[menuIndex.value].target.entityType == 'material'){
|
if(menuList.value[menuIndex.value].target.entityType == 'material'){
|
||||||
@ -265,7 +304,26 @@ function getDeviceInfo(e:any){ // 获取设备信息
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function getAttributeMaterial(e:any){ // 获取设备属性或变化物料
|
||||||
|
if(menuList.value[menuIndex.value].target.entityType == 'device'){
|
||||||
|
attributeData.value.forEach((item:any) => {
|
||||||
|
if(item.itemCode == menuList.value[menuIndex.value].attribute){
|
||||||
|
deviceMaterial.value = item.dictName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取所有项目列表
|
||||||
|
// getSizeSchemaList()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(menuList.value[menuIndex.value].target.entityType == 'material'){
|
||||||
|
materialData.value.forEach((item:any) => {
|
||||||
|
if(item.itemCode == menuList.value[menuIndex.value].material){
|
||||||
|
deviceMaterial.value = item.dictName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
const upload:any = ref(null)
|
const upload:any = ref(null)
|
||||||
function handleSuccess(file: any) {
|
function handleSuccess(file: any) {
|
||||||
if(file.code =="0"){
|
if(file.code =="0"){
|
||||||
@ -299,19 +357,24 @@ function handleSuccess(file: any) {
|
|||||||
<el-form-item label="始发设备(物料)" prop="code">
|
<el-form-item label="始发设备(物料)" prop="code">
|
||||||
<el-select v-model="menuList[menuIndex].device" placeholder="请选择" style="width:100%;" clearable @change="getDeviceInfo"
|
<el-select v-model="menuList[menuIndex].device" placeholder="请选择" style="width:100%;" clearable @change="getDeviceInfo"
|
||||||
:disabled="isEdit == false">
|
:disabled="isEdit == false">
|
||||||
<el-option v-for="item in deviceData" :key="item.deviceName" :label="item.deviceName +'('+item.materialName+')'" :value="item.deviceName" />
|
<el-option v-for="item in deviceData" :key="item.deviceName" :label="item.deviceName +'('+item.materialName+')'"
|
||||||
|
:value="item.deviceId" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div style="display: flex; width: 100%;justify-content: space-between;">
|
<div style="display: flex; width: 100%;justify-content: space-between;">
|
||||||
<el-form-item label="设备属性" prop="name" style="width: 49%;">
|
<el-form-item label="设备属性" prop="name" style="width: 49%;">
|
||||||
<el-select v-model="menuList[menuIndex].attribute" placeholder="请选择" style="width:100%;" clearable
|
<el-select v-model="menuList[menuIndex].attribute"
|
||||||
:disabled="(menuList[menuIndex].material!='' && menuList[menuIndex].material!=null) || isEdit == false" @change="changeAttribute">
|
placeholder="请选择" style="width:100%;" clearable
|
||||||
|
:disabled="(menuList[menuIndex].material!='' && menuList[menuIndex].material!=null && menuList[menuIndex].device!='' &&
|
||||||
|
menuList[menuIndex].device!=null) || isEdit == false
|
||||||
|
|| menuList[menuIndex].device == '' || menuList[menuIndex].device == null" @change="changeAttribute">
|
||||||
<el-option v-for="item in attributeData" :key="item.itemCode" :label="item.dictName" :value="item.itemCode" />
|
<el-option v-for="item in attributeData" :key="item.itemCode" :label="item.dictName" :value="item.itemCode" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="变化物料" style="width: 49%;">
|
<el-form-item label="变化物料" style="width: 49%;">
|
||||||
<el-select v-model="menuList[menuIndex].material" placeholder="请选择" style="width:100%;" clearable
|
<el-select v-model="menuList[menuIndex].material" placeholder="请选择" style="width:100%;" clearable
|
||||||
:disabled="(menuList[menuIndex].attribute!='' && menuList[menuIndex].attribute!=null)|| isEdit == false" @change="changeMaterial">
|
:disabled="(menuList[menuIndex].attribute!='' && menuList[menuIndex].attribute!=null)|| isEdit == false
|
||||||
|
|| menuList[menuIndex].device == '' || menuList[menuIndex].device == null" @change="changeMaterial">
|
||||||
<el-option v-for="item in materialData" :key="item.itemCode" :label="item.dictName" :value="item.itemCode" />
|
<el-option v-for="item in materialData" :key="item.itemCode" :label="item.dictName" :value="item.itemCode" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -492,6 +555,7 @@ function handleSuccess(file: any) {
|
|||||||
.segmentation-content{
|
.segmentation-content{
|
||||||
width: 590px;
|
width: 590px;
|
||||||
height: calc(100vh - 530px);
|
height: calc(100vh - 530px);
|
||||||
|
/* height: calc(100vh - 400px); */
|
||||||
background: rgba(250, 250, 250, 1);
|
background: rgba(250, 250, 250, 1);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid rgba(242, 242, 242, 1);
|
border: 1px solid rgba(242, 242, 242, 1);
|
||||||
@ -691,6 +755,8 @@ function handleSuccess(file: any) {
|
|||||||
.condition-right-content{
|
.condition-right-content{
|
||||||
border-left: 1px solid #f0f1f2;
|
border-left: 1px solid #f0f1f2;
|
||||||
border-top: 1px solid #f0f1f2;
|
border-top: 1px solid #f0f1f2;
|
||||||
|
overflow: auto;
|
||||||
|
max-height: calc(100vh - 400px);
|
||||||
}
|
}
|
||||||
.condition-right-tableheader{
|
.condition-right-tableheader{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ 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';
|
import { topologyDevicesLsit } from '@/api/business/project';
|
||||||
|
import { searchAlgorithmsModelPage } from '@/api/business/algorithmModel';
|
||||||
const emit = defineEmits([ 'closeCreatescenario']);
|
const emit = defineEmits([ 'closeCreatescenario']);
|
||||||
const props = defineProps({ // 接收父组件传递的项目信息
|
const props = defineProps({ // 接收父组件传递的项目信息
|
||||||
projectInfo: {
|
projectInfo: {
|
||||||
@ -49,28 +50,26 @@ const getAlgorithmType = async () => {
|
|||||||
}
|
}
|
||||||
//新建事故情景-确认按钮/修改按钮
|
//新建事故情景-确认按钮/修改按钮
|
||||||
function confirmClick(formEl: any) {
|
function confirmClick(formEl: any) {
|
||||||
console.log(info.value)
|
|
||||||
formEl.validate((valid: any) => {
|
formEl.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let isAlgorithmType = false
|
let isAlgorithmModelId = false
|
||||||
let isSonAlgorithmType = 0
|
let isSonAlgorithmModelId = 0
|
||||||
for(let i = 0;i<deviceData.value.length;i++){
|
for(let i = 0;i<deviceData.value.length;i++){
|
||||||
if(deviceData.value[i].algorithmType != null && deviceData.value[i].algorithmType != ''){
|
if(deviceData.value[i].algorithmModelId != null && deviceData.value[i].algorithmModelId != ''){
|
||||||
isSonAlgorithmType = isSonAlgorithmType + 1
|
isSonAlgorithmModelId = isSonAlgorithmModelId + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(info.value.algorithmType == null || info.value.algorithmType == ''){
|
if(info.value.algorithmType == null || info.value.algorithmType == ''){
|
||||||
isAlgorithmType = true
|
isAlgorithmModelId = true
|
||||||
}
|
}
|
||||||
|
if( isAlgorithmModelId == true && isSonAlgorithmModelId == 0){
|
||||||
if( isAlgorithmType == true && isSonAlgorithmType == 0){
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "请选择算法类型",
|
message: "请选择算法类型",
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if( isSonAlgorithmType != deviceData.value.length && isAlgorithmType == true){
|
if( isSonAlgorithmModelId != deviceData.value.length && isAlgorithmModelId == true){
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "设备算法配置映射没有填写完全",
|
message: "设备算法配置映射没有填写完全",
|
||||||
@ -85,11 +84,16 @@ function confirmClick(formEl: any) {
|
|||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
keffThreshold: info.value.keffThreshold,
|
keffThreshold: info.value.keffThreshold,
|
||||||
};
|
};
|
||||||
let device_algo_config:any = {}
|
let device_algo_config:any = []
|
||||||
let isTrue:any = false
|
let isTrue:any = false
|
||||||
deviceData.value.forEach((item: any) => {
|
deviceData.value.forEach((item: any) => {
|
||||||
if(item.algorithmType !=null && item.algorithmType != ''){
|
if(item.algorithmType !=null && item.algorithmType != ''){
|
||||||
device_algo_config[item.deviceId] = item.algorithmType
|
device_algo_config.push({
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
algorithmType: item.algorithmType,
|
||||||
|
algorithmModelId: item.algorithmModelId,
|
||||||
|
})
|
||||||
|
// device_algo_config[item.deviceId] = item.algorithmType
|
||||||
isTrue = true
|
isTrue = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -185,7 +189,10 @@ function initDeviceData(){
|
|||||||
deviceData.value.push({
|
deviceData.value.push({
|
||||||
deviceId: item.deviceId,
|
deviceId: item.deviceId,
|
||||||
deviceName: item.deviceName,
|
deviceName: item.deviceName,
|
||||||
algorithmType: ''
|
deviceType: item.deviceType,
|
||||||
|
algorithmType: '',
|
||||||
|
algorithmModelId: '',
|
||||||
|
algorithmModelsData: []
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -201,8 +208,27 @@ function changeAlgorithmType(){
|
|||||||
item.algorithmType = ""
|
item.algorithmType = ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function changeSonAlgorithmType(){
|
function changeSonAlgorithmType(e:any,deviceType:any,index:any){
|
||||||
info.value.algorithmType = ""
|
info.value.algorithmType = ""
|
||||||
|
deviceData.value[index].algorithmModelId = ""
|
||||||
|
deviceData.value[index].algorithmModelsData =[]
|
||||||
|
if(e == null || e == ''){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getAlgorithmModels(e,deviceType,index)
|
||||||
|
}
|
||||||
|
function getAlgorithmModels(algorithmType:any,deviceType:any,index:any){
|
||||||
|
searchAlgorithmsModelPage({
|
||||||
|
algorithmType: algorithmType,
|
||||||
|
deviceType: deviceType,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000
|
||||||
|
}).then((res:any) => {
|
||||||
|
deviceData.value[index].algorithmModelsData = res.records
|
||||||
|
if(res.records.length > 0 && res.records[0].isCurrent == 1){
|
||||||
|
deviceData.value[index].algorithmModelId = res.records[0].algorithmModelId
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
@ -217,7 +243,7 @@ function changeAlgorithmType(){
|
|||||||
</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="160px" style="width:600px;height: calc(100vh - 300px);overflow: auto;padding-top: 10px;"
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="160px" style="width:820px;height: calc(100vh - 300px);overflow: auto;padding-top: 10px;"
|
||||||
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>
|
||||||
@ -230,15 +256,17 @@ function changeAlgorithmType(){
|
|||||||
|
|
||||||
<el-form-item label="设备算法配置映射:">
|
<el-form-item label="设备算法配置映射:">
|
||||||
<div style="width: 100%;padding-top: 40px;">
|
<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 v-for="(item,index) 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>
|
<div style="width: 150px;text-align: right;padding-right: 10px;">{{item.deviceName}}</div>
|
||||||
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:100%;" clearable @change="changeSonAlgorithmType">
|
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:300px;margin-right: 10px;" clearable
|
||||||
|
@change="changeSonAlgorithmType(item.algorithmType,item.deviceType,index)">
|
||||||
<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-select v-model="item.algorithmModelId" placeholder="请选择" style="width:180px;" >
|
||||||
|
<el-option v-for="items in item.algorithmModelsData" :key="items.algorithmModelId" :label="items.versionTag" :value="items.algorithmModelId" />
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="Keff预警阈值:" prop="keffThreshold">
|
<el-form-item label="Keff预警阈值:" prop="keffThreshold">
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import { topologyDevicesLsit } from '@/api/business/project';
|
|||||||
import TableModels from '@/components/antvx6/tableModel.vue';
|
import TableModels from '@/components/antvx6/tableModel.vue';
|
||||||
import EchartsModels from '@/components/antvx6/echartsModel.vue';
|
import EchartsModels from '@/components/antvx6/echartsModel.vue';
|
||||||
import Viewx6 from '@/components/antvx6/viewx6.vue';
|
import Viewx6 from '@/components/antvx6/viewx6.vue';
|
||||||
|
import { searchAlgorithmsModelPage } from '@/api/business/algorithmModel';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const username = ref(userStore.username)
|
const username = ref(userStore.username)
|
||||||
@ -121,10 +121,17 @@ function editClick(row: any,type: string) {
|
|||||||
}
|
}
|
||||||
if(info.value.deviceAlgoConfig !=null && info.value.deviceAlgoConfig != ''){
|
if(info.value.deviceAlgoConfig !=null && info.value.deviceAlgoConfig != ''){
|
||||||
let device_algo_config = JSON.parse(info.value.deviceAlgoConfig)
|
let device_algo_config = JSON.parse(info.value.deviceAlgoConfig)
|
||||||
for(let key in device_algo_config){
|
for(let j = 0;j<device_algo_config.length;j++ ){
|
||||||
for(let i = 0;i<deviceData.value.length;i++){
|
for(let i = 0;i<deviceData.value.length;i++){
|
||||||
if(deviceData.value[i].deviceId == key){
|
if(deviceData.value[i].deviceId == device_algo_config[j].deviceId){
|
||||||
deviceData.value[i].algorithmType = device_algo_config[key]
|
deviceData.value[i].deviceId = device_algo_config[j].algorithmType
|
||||||
|
deviceData.value[i].algorithmType = device_algo_config[j].algorithmType
|
||||||
|
deviceData.value[i].algorithmModelId = device_algo_config[j].algorithmModelId
|
||||||
|
for(let k = 0;k<algorithmModelsData.value.length;k++){
|
||||||
|
if(algorithmModelsData.value[k].algorithmModelId == device_algo_config[j].algorithmModelId){
|
||||||
|
deviceData.value[i].algorithmModelsData.push(algorithmModelsData.value[k])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,25 +220,24 @@ const getAlgorithmType = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function submitClick(){
|
function submitClick(){
|
||||||
let isAlgorithmType = false
|
let isAlgorithmModelId = false
|
||||||
let isSonAlgorithmType = 0
|
let isSonAlgorithmModelId = 0
|
||||||
for(let i = 0;i<deviceData.value.length;i++){
|
for(let i = 0;i<deviceData.value.length;i++){
|
||||||
if(deviceData.value[i].algorithmType != null && deviceData.value[i].algorithmType != ''){
|
if(deviceData.value[i].algorithmModelId != null && deviceData.value[i].algorithmModelId != ''){
|
||||||
isSonAlgorithmType = isSonAlgorithmType + 1
|
isSonAlgorithmModelId = isSonAlgorithmModelId + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(info.value.algorithmType == null || info.value.algorithmType == ''){
|
if(info.value.algorithmType == null || info.value.algorithmType == ''){
|
||||||
isAlgorithmType = true
|
isAlgorithmModelId = true
|
||||||
}
|
}
|
||||||
|
if( isAlgorithmModelId == true && isSonAlgorithmModelId == 0){
|
||||||
if( isAlgorithmType == true && isSonAlgorithmType == 0){
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "请选择算法类型",
|
message: "请选择算法类型",
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if( isSonAlgorithmType != deviceData.value.length){
|
if( isSonAlgorithmModelId != deviceData.value.length && isAlgorithmModelId == true){
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "设备算法配置映射没有填写完全",
|
message: "设备算法配置映射没有填写完全",
|
||||||
@ -239,23 +245,27 @@ function submitClick(){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let data:any = {
|
const data:any = {
|
||||||
scenarioId: info.value.scenarioId,
|
projectId: props.projectInfo.projectId,
|
||||||
algorithmType: info.value.algorithmType,
|
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
|
algorithmType: info.value.algorithmType,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
keffThreshold: info.value.keffThreshold,
|
keffThreshold: info.value.keffThreshold,
|
||||||
}
|
};
|
||||||
let device_algo_config:any = {}
|
let device_algo_config:any = []
|
||||||
let isTrue:any = false
|
let isTrue:any = false
|
||||||
deviceData.value.forEach((item: any) => {
|
deviceData.value.forEach((item: any) => {
|
||||||
if(item.algorithmType !=null && item.algorithmType != ''){
|
if(item.algorithmType !=null && item.algorithmType != ''){
|
||||||
device_algo_config[item.deviceId] = item.algorithmType
|
device_algo_config.push({
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
algorithmType: item.algorithmType,
|
||||||
|
algorithmModelId: item.algorithmModelId,
|
||||||
|
})
|
||||||
isTrue = true
|
isTrue = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(isTrue == true){
|
if(isTrue == true){
|
||||||
data.deviceAlgoConfig = JSON.stringify(device_algo_config)
|
data.deviceAlgoConfig = JSON.stringify(device_algo_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,13 +280,19 @@ function submitClick(){
|
|||||||
gettableData();
|
gettableData();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const algorithmModelsData = ref<any>([])
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getAlgorithmType()
|
getAlgorithmType()
|
||||||
gettableData();
|
gettableData();
|
||||||
initDeviceData()
|
initDeviceData()
|
||||||
|
|
||||||
|
searchAlgorithmsModelPage({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 9999
|
||||||
|
}).then((res:any) => {
|
||||||
|
algorithmModelsData.value = res.records
|
||||||
|
})
|
||||||
});
|
});
|
||||||
function closeCreatescenario(){
|
function closeCreatescenario(){
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
@ -412,7 +428,10 @@ function initDeviceData(){
|
|||||||
deviceData.value.push({
|
deviceData.value.push({
|
||||||
deviceId: item.deviceId,
|
deviceId: item.deviceId,
|
||||||
deviceName: item.deviceName,
|
deviceName: item.deviceName,
|
||||||
algorithmType: ''
|
deviceType: item.deviceType,
|
||||||
|
algorithmType: '',
|
||||||
|
algorithmModelId: '',
|
||||||
|
algorithmModelsData: []
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -424,10 +443,28 @@ function initDeviceData(){
|
|||||||
item.algorithmType = ""
|
item.algorithmType = ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function changeSonAlgorithmType(){
|
function changeSonAlgorithmType(e:any,deviceType:any,index:any){
|
||||||
info.value.algorithmType = ""
|
info.value.algorithmType = ""
|
||||||
|
deviceData.value[index].algorithmModelId = ""
|
||||||
|
deviceData.value[index].algorithmModelsData = []
|
||||||
|
if(e == null || e == ''){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getAlgorithmModels(e,deviceType,index)
|
||||||
|
}
|
||||||
|
function getAlgorithmModels(algorithmType:any,deviceType:any,index:any){
|
||||||
|
searchAlgorithmsModelPage({
|
||||||
|
algorithmType: algorithmType,
|
||||||
|
deviceType: deviceType,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000
|
||||||
|
}).then((res:any) => {
|
||||||
|
deviceData.value[index].algorithmModelsData = res.records
|
||||||
|
if(res.records.length > 0 && res.records[0].isCurrent == 1){
|
||||||
|
deviceData.value[index].algorithmModelId = res.records[0].algorithmModelId
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFile(obj :any, name :any, suffix :any) {
|
function downloadFile(obj :any, name :any, suffix :any) {
|
||||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
@ -500,7 +537,6 @@ function handlefailDetail(row:any){
|
|||||||
<el-table-column type="selection" width="50" align="center"></el-table-column>
|
<el-table-column type="selection" width="50" align="center"></el-table-column>
|
||||||
<el-table-column prop="name" label="事故情景名称" min-width="180"></el-table-column>
|
<el-table-column prop="name" label="事故情景名称" min-width="180"></el-table-column>
|
||||||
<el-table-column prop="algorithmType" label="算法模型" min-width="180"></el-table-column>
|
<el-table-column prop="algorithmType" label="算法模型" min-width="180"></el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="createdAt" label="模拟时间" width="200">
|
<el-table-column prop="createdAt" label="模拟时间" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.createdAt != null">{{ dateFormat(scope.row.createdAt) }}</span>
|
<span v-if="scope.row.createdAt != null">{{ dateFormat(scope.row.createdAt) }}</span>
|
||||||
@ -557,8 +593,8 @@ function handlefailDetail(row:any){
|
|||||||
<Createscenario v-if="dialogVisible" :projectInfo="projectInfo" @closeCreatescenario ="closeCreatescenario"/>
|
<Createscenario v-if="dialogVisible" :projectInfo="projectInfo" @closeCreatescenario ="closeCreatescenario"/>
|
||||||
<el-dialog v-model="dialogEditVisible" :close-on-click-modal="false"
|
<el-dialog v-model="dialogEditVisible" :close-on-click-modal="false"
|
||||||
:modal="false" draggable :before-close="handleClose" :title="title"
|
:modal="false" draggable :before-close="handleClose" :title="title"
|
||||||
append-to-body width="590px">
|
append-to-body width="800px">
|
||||||
<el-form ref="infoForm" :model="info" :rules="rules" label-width="140px" style="width:500px;height: calc(100vh - 300px);overflow: auto;padding-top: 10px;">
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="140px" style="width:750px;height: calc(100vh - 300px);overflow: auto;padding-top: 10px;">
|
||||||
<el-form-item label="事故情景名称:" prop="name">
|
<el-form-item label="事故情景名称:" prop="name">
|
||||||
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" :disabled="title == '查看事故情景'"></el-input>
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" :disabled="title == '查看事故情景'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -570,12 +606,15 @@ function handlefailDetail(row:any){
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备算法配置映射:">
|
<el-form-item label="设备算法配置映射:">
|
||||||
<div style="width: 100%;padding-top: 40px;">
|
<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 v-for="(item,index) 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>
|
<div style="width: 150px;text-align: right;padding-right: 10px;">{{item.deviceName}}</div>
|
||||||
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:100%;"
|
<el-select v-model="item.algorithmType" placeholder="请选择" style="width:300px;margin-right: 10px;" clearable
|
||||||
clearable :disabled="title == '查看事故情景'" @change="changeSonAlgorithmType">
|
@change="changeSonAlgorithmType(item.algorithmType,item.deviceType,index)">
|
||||||
<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-select v-model="item.algorithmModelId" placeholder="请选择" style="width:180px;" >
|
||||||
|
<el-option v-for="items in item.algorithmModelsData" :key="items.algorithmModelId" :label="items.versionTag" :value="items.algorithmModelId" />
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user