From fe23b7a17f865622032950b739ffcad62d0fd973 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Mon, 18 May 2026 16:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=83=85=E6=99=AF=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/database/criticalData/index.ts | 2 +- .../src/api/business/database/device/index.ts | 2 +- .../api/business/database/material/index.ts | 2 +- .../views/component/scenario/condition.vue | 122 ++++++++++++++---- .../component/scenario/createscenario.vue | 64 ++++++--- .../src/views/component/scenario/index.vue | 99 +++++++++----- 6 files changed, 212 insertions(+), 79 deletions(-) diff --git a/business-css/frontend/src/api/business/database/criticalData/index.ts b/business-css/frontend/src/api/business/database/criticalData/index.ts index 5910e11..78e46ac 100644 --- a/business-css/frontend/src/api/business/database/criticalData/index.ts +++ b/business-css/frontend/src/api/business/database/criticalData/index.ts @@ -50,7 +50,7 @@ export function deleteBatchCriticalData (queryParams:any){ } // 导出临界数据 export function exportAllExports(deviceType:any){ - let url = '/critical-data/v2/export/?deviceType='+deviceType + let url = '/critical-data/v2/export?deviceType='+deviceType return request({ url: url , diff --git a/business-css/frontend/src/api/business/database/device/index.ts b/business-css/frontend/src/api/business/database/device/index.ts index 771eb05..739a7df 100644 --- a/business-css/frontend/src/api/business/database/device/index.ts +++ b/business-css/frontend/src/api/business/database/device/index.ts @@ -61,7 +61,7 @@ export function sizeSchemaAll(queryParams:any){ // 导出全部结果 export function exportAllExports(deviceType:any){ - let url = '/devices/v2/export/?deviceType='+deviceType + let url = '/devices/v2/export?deviceType='+deviceType return request({ url: url , diff --git a/business-css/frontend/src/api/business/database/material/index.ts b/business-css/frontend/src/api/business/database/material/index.ts index c548fff..34f9f47 100644 --- a/business-css/frontend/src/api/business/database/material/index.ts +++ b/business-css/frontend/src/api/business/database/material/index.ts @@ -78,4 +78,4 @@ export function materialsById (id:any){ method: 'get' // params: queryParams }); -} \ No newline at end of file +} \ No newline at end of file diff --git a/business-css/frontend/src/views/component/scenario/condition.vue b/business-css/frontend/src/views/component/scenario/condition.vue index 6c3bb6a..de1f5de 100644 --- a/business-css/frontend/src/views/component/scenario/condition.vue +++ b/business-css/frontend/src/views/component/scenario/condition.vue @@ -12,6 +12,7 @@ import { getDictItemById } from '@/api/dict'; import { topologyDevicesLsit } from '@/api/business/project'; import { getToken } from '@/utils/auth'; import { searchEventsByScenarioId } from '@/api/business/event'; +import { sizeSchemaAll } from "@/api/business/database/device"; const url = import.meta.env.VITE_APP_BASE_API; const conditionData:any = ref([{ // 套件数据 @@ -69,7 +70,7 @@ function initConditionData(){ } } if(res.length > 0){ - getDeviceInfo(menuList.value[0].device) + getInitDeviceInfo(menuList.value[0].device) } }) @@ -78,13 +79,25 @@ onMounted(() => { DicInit() initDeviceData() initConditionData() + getSizeSchemaList() }); + +//获取所有项目列表 +const sizeSchemaInfo:any = ref({}); + +async function getSizeSchemaList(){ // 获取所有项目列表 + let result = await sizeSchemaAll({}) + sizeSchemaInfo.value = result +} + + const deviceData:any = ref([]) // 始发设备数据 const attributeData:any = ref([]) // 设备属性数据 const materialData:any = ref([]) // 变化物料数据 const menuList:any = ref([ { label: '条件1', + deviceType: '', target:{ entityType: '', entityId: '', @@ -136,6 +149,7 @@ function addMenu(){ //添加导菜单 menuList.value.push({ label: '条件' + (menuList.value.length + 1), + deviceType: '', target:{ entityType: '', entityId: '', @@ -159,18 +173,6 @@ function delMenu(){ // 删除导菜单 // 查询字典项 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 = { dictId: '9d87f873bc80e79c6d399131cbe01016', size:99, @@ -179,7 +181,7 @@ function DicInit() { getDictItemById(paramss).then((result: any) => { materialData.value = result.data.records; if(menuList.value[menuIndex.value].target.entityType == 'device'){ - getDeviceInfo(menuList.value[menuIndex.value].device) + getInitDeviceInfo(menuList.value[menuIndex.value].device) } }).catch((err: any) => { }); @@ -195,15 +197,13 @@ function changeAttribute(e:any){ // 设备属性改变时,清空变化物料 menuList.value[menuIndex.value].target.entityType = 'device' menuList.value[menuIndex.value].target.property = e 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 } }) } - - - getDeviceInfo(e) + getAttributeMaterial(e) } function changeMaterial(e:any){ // 设备属性改变时,清空变化物料 menuList.value[menuIndex.value].target.entityType = '' @@ -213,14 +213,13 @@ function changeMaterial(e:any){ // 设备属性改变时,清空变化物料 menuList.value[menuIndex.value].target.entityId = '' 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.property = e } - - getDeviceInfo(e) + getAttributeMaterial(e) } 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 = "" deviceMaterial.value = "" 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 + 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'){ 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'){ @@ -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) function handleSuccess(file: any) { if(file.code =="0"){ @@ -299,19 +357,24 @@ function handleSuccess(file: any) { - +
- + + :disabled="(menuList[menuIndex].attribute!='' && menuList[menuIndex].attribute!=null)|| isEdit == false + || menuList[menuIndex].device == '' || menuList[menuIndex].device == null" @change="changeMaterial"> @@ -492,6 +555,7 @@ function handleSuccess(file: any) { .segmentation-content{ width: 590px; height: calc(100vh - 530px); + /* height: calc(100vh - 400px); */ background: rgba(250, 250, 250, 1); box-sizing: border-box; border: 1px solid rgba(242, 242, 242, 1); @@ -691,6 +755,8 @@ function handleSuccess(file: any) { .condition-right-content{ border-left: 1px solid #f0f1f2; border-top: 1px solid #f0f1f2; + overflow: auto; + max-height: calc(100vh - 400px); } .condition-right-tableheader{ display: flex; diff --git a/business-css/frontend/src/views/component/scenario/createscenario.vue b/business-css/frontend/src/views/component/scenario/createscenario.vue index 1888118..3c76fff 100644 --- a/business-css/frontend/src/views/component/scenario/createscenario.vue +++ b/business-css/frontend/src/views/component/scenario/createscenario.vue @@ -12,6 +12,7 @@ import { eventsBatchSave } from '@/api/business/event'; import ConditionModels from '@/views/component/scenario/condition.vue' import { addScenarios,updateScenarios,getActiveAlgorithms } from "@/api/business/scenario"; import { topologyDevicesLsit } from '@/api/business/project'; +import { searchAlgorithmsModelPage } from '@/api/business/algorithmModel'; const emit = defineEmits([ 'closeCreatescenario']); const props = defineProps({ // 接收父组件传递的项目信息 projectInfo: { @@ -49,28 +50,26 @@ const getAlgorithmType = async () => { } //新建事故情景-确认按钮/修改按钮 function confirmClick(formEl: any) { - console.log(info.value) formEl.validate((valid: any) => { if (valid) { - let isAlgorithmType = false - let isSonAlgorithmType = 0 + let isAlgorithmModelId = false + let isSonAlgorithmModelId = 0 for(let i = 0;i { 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 } }) @@ -185,7 +189,10 @@ function initDeviceData(){ deviceData.value.push({ deviceId: item.deviceId, deviceName: item.deviceName, - algorithmType: '' + deviceType: item.deviceType, + algorithmType: '', + algorithmModelId: '', + algorithmModelsData: [] }) }) } @@ -201,8 +208,27 @@ function changeAlgorithmType(){ item.algorithmType = "" }) } - function changeSonAlgorithmType(){ + function changeSonAlgorithmType(e:any,deviceType:any,index:any){ 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 + } + }) }