修改提交

This commit is contained in:
limengnan 2026-01-17 12:32:55 +08:00
parent 5e03b4e79f
commit 45f5a28775
16 changed files with 1639 additions and 38 deletions

View File

@ -59,4 +59,20 @@ export function topologyDevicesLsit(queryParams:any){
}); });
} }
//初始化项目模拟数据
export function simulationInit(queryParams:any){
return request({
url:'/projects/simulation/init' ,
method: 'Post',
params:queryParams
});
}
// 运行项目模拟
export function simulationRun(projectId:string,scenarioId:string, data:any){
return request({
url:'/projects/simulation/run?projectId='+projectId+'&scenarioId='+scenarioId ,
method: 'Post',
data: data
});
}

View File

@ -48,3 +48,12 @@ export function deleteBatchScenarios(queryParams:any){
data: queryParams data: queryParams
}); });
} }
//获取所有项目列表
export function getActiveAlgorithms(){
return request({
url: '/algorithms/getActiveAlgorithms' ,
method: 'get'
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

View File

@ -8,6 +8,8 @@ export default {
import { onMounted, ref, nextTick } from "vue"; import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus"; import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchDevicesPage } from "@/api/business/database/device"; import { searchDevicesPage } from "@/api/business/database/device";
import { topologyDevicesLsit } from '@/api/business/project';
const emit = defineEmits([ 'closeChangesettingsModel']); const emit = defineEmits([ 'closeChangesettingsModel']);
const props = defineProps({ const props = defineProps({
@ -44,20 +46,23 @@ const materialName:any = ref(props.materialInfo.name) // 变动物料信息
const tableData:any = ref([]) const tableData:any = ref([])
function gettableData() { function gettableData() {
let params = {
name: "",
type: deviceTypetype.value,
pageNum: 1,
pageSize: 999,
};
if(deviceTypetype.value == ''){ if(deviceTypetype.value == ''){
return return
} }
searchDevicesPage(params).then((result:any) => { topologyDevicesLsit({
deviceList.value = result.records; id: props.projectInfo.projectId
}).catch((err) => { }).then((res:any) => {
if (res.code == 0) {
deviceList.value = res.data;
}
})
// topologyDevicesLsit(params).then((result:any) => {
// deviceList.value = result.records;
// }).catch((err) => {
// });
});
} }
@ -194,7 +199,7 @@ function dialogMaterialClose(){ // 变动公式设置关闭
isDialogFormula.value = false isDialogFormula.value = false
} }
function handleClick(item:any, index:any){ function handleClick(item:any, index:any){
formulaInfo.value.correlation = JSON.parse(JSON.stringify(item.name)) formulaInfo.value.correlation = JSON.parse(JSON.stringify(item.deviceName))
isAcitve.value = index isAcitve.value = index
} }
function handleClose(){ // function handleClose(){ //
@ -258,7 +263,7 @@ function confirmTableClick(){ // 确认变动公式设置
<div v-for="(item, index) in deviceList" :key="index" class="choiceMateria-left-item" <div v-for="(item, index) in deviceList" :key="index" class="choiceMateria-left-item"
:class="{'choiceMateria-item-active': index == isAcitve}" :class="{'choiceMateria-item-active': index == isAcitve}"
@click="handleClick(item, index)"> @click="handleClick(item, index)">
{{ item.name }} {{ item.deviceName }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1018,10 +1018,10 @@ function setFormulaInit(formula:any) {
function getBias(formula:any){ function getBias(formula:any){
// + // +
const lastPlusIndex = formula.lastIndexOf('+'); // +
// + const regex = /\+(\d+\.?\d*)$/;
const constantStr = formula.slice(lastPlusIndex + 1, -1); const match = formula.match(regex);
const constant = parseFloat(constantStr); const constant = parseFloat(match[1]);
return constant return constant
} }
@ -1043,16 +1043,17 @@ function saveDesign() { // 保存设计
if(cells[i].changesettings[j].formula != '' && cells[i].changesettings[j].formula != null){ if(cells[i].changesettings[j].formula != '' && cells[i].changesettings[j].formula != null){
const key = cells[i].changesettings[j].name as string const key = cells[i].changesettings[j].name as string
const unit = cells[i].changesettings[j].unit const unit = cells[i].changesettings[j].unit
const name = cells[i].changesettings[j].name
const delay= cells[i].changesettings[j].delay
let tempSources = [] let tempSources = []
for(let k=0;k<setFormulaInit(cells[i].changesettings[j].formula).length;k++){ for(let k=0;k<setFormulaInit(cells[i].changesettings[j].formula).length;k++){
tempSources.push({ tempSources.push({
entityType: 'material', //B entityType: 'material', //B
entityId: cells[i].materialInfo.materialId , //materialId : cdeeca2e-1e0c-4bdd-b946-f347c104752c entityId: cells[i].materialInfo.materialId , //materialId : cdeeca2e-1e0c-4bdd-b946-f347c104752c
property: unit, // g/L property: name, // g/L
coefficient: setFormulaInit(cells[i].changesettings[j].formula)[k], //0.2 coefficient: setFormulaInit(cells[i].changesettings[j].formula)[k], //0.2
delay: { enabled: true, time: 0, unit: 's' } // 5 delay: { enabled: true, time: delay, unit: 's' } // 5
}) })
} }
tempData[key] = { tempData[key] = {
@ -1082,6 +1083,7 @@ function saveDesign() { // 保存设计
}) })
} }
} }
const topology = { const topology = {
projectId: projectInfo.value.projectId, projectId: projectInfo.value.projectId,
name: projectInfo.value.name, name: projectInfo.value.name,
@ -1099,6 +1101,7 @@ function saveDesign() { // 保存设计
}, },
designData:cells designData:cells
} }
console.log(topology)
// //
const saveData = { const saveData = {
projectId: projectInfo.value.projectId, projectId: projectInfo.value.projectId,

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { getDictItemById } from '@/api/dict'; import { getDictItemById } from '@/api/dict';
import { eventsBatchSave } from '@/api/business/event'; import { eventsBatchSave } from '@/api/business/event';
import ConditionModel from '@/views/component/scenario/condition.vue' import ConditionModel from '@/views/component/scenario/condition.vue'
import { addScenarios,updateScenarios} from "@/api/business/scenario"; import { addScenarios,updateScenarios,getActiveAlgorithms } from "@/api/business/scenario";
const emit = defineEmits([ 'closeCreatescenario']); const emit = defineEmits([ 'closeCreatescenario']);
const props = defineProps({ // const props = defineProps({ //
@ -41,15 +41,8 @@ function handleScenarioClose(){
} }
const getAlgorithmType = async () => { const getAlgorithmType = async () => {
try { try {
let params = { const result:any = await getActiveAlgorithms();
dictId: '595502b91e7741b5033b53622d8731a3', algorithmTypeData.value = result
size:99,
current:1
}
const result:any = await getDictItemById(params);
if (result.code == '0') {
algorithmTypeData.value = result.data.records
}
} catch (error) { } catch (error) {
} }
} }
@ -152,7 +145,7 @@ onMounted(() => {
</el-form-item> </el-form-item>
<el-form-item label="算法类型:" prop="algorithmType"> <el-form-item label="算法类型:" prop="algorithmType">
<el-select v-model="info.algorithmType" placeholder="请选择" style="width:100%;" clearable> <el-select v-model="info.algorithmType" placeholder="请选择" style="width:100%;" clearable>
<el-option v-for="item in algorithmTypeData" :key="item.id" :label="item.dictName" :value="item.itemCode" /> <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="事故情景描述:"> <el-form-item label="事故情景描述:">

View File

@ -8,6 +8,9 @@ export default {
import { onMounted, ref, nextTick } from "vue"; import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus"; import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchScenariosLsit,addScenarios,updateScenarios,deleteScenarios,deleteBatchScenarios} from "@/api/business/scenario"; import { searchScenariosLsit,addScenarios,updateScenarios,deleteScenarios,deleteBatchScenarios} from "@/api/business/scenario";
import { simulationInit,simulationRun } from "@/api/business/project";
import Page from '@/components/Pagination/page.vue' import Page from '@/components/Pagination/page.vue'
import { getDictItemById } from '@/api/dict'; import { getDictItemById } from '@/api/dict';
// import ConditionModel from '@/views/component/scenario/condition.vue' // import ConditionModel from '@/views/component/scenario/condition.vue'
@ -268,6 +271,48 @@ function closeCreatescenario(){
dialogVisible.value = false; dialogVisible.value = false;
gettableData(); gettableData();
} }
function confirmationAnalysis(row: any) {
ElMessageBox.confirm("确定对"+ row.name +"故情景分析进行模拟吗?", "确认模拟", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let params = {
projectId: row.projectId,
scenarioId: row.scenarioId,
};
simulationInit(params).then((res:any) => {
if (res.code == '0') {
let data = {
data: res.data
}
simulationRun(row.projectId, row.scenarioId, data || {}).then((res) => {
gettableData();
}).catch((error) => {
console.error('模拟运行失败:', error);
ElMessage({
type: "error",
message: "模拟运行失败,请检查后端服务是否正常",
});
})
}else{
ElMessage({
type: "error",
message: "模拟初始化失败",
});
}
});
})
}
</script> </script>
<template> <template>
@ -312,14 +357,26 @@ function closeCreatescenario(){
<span <span
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; "> style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/table/edit.png" alt="" title="修改" <img src="@/assets/table/edit.png" alt="" title="修改" v-if="scope.row.status == 0"
@click="editClick(scope.row)" style="cursor: pointer; "> @click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/design.png" alt="" title="分享设计" <img src="@/assets/table/view.png" alt="" title="查看" v-if="scope.row.status != 0"
style="cursor: pointer; "> @click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/simulation.png" alt="" title="模拟分析"
style="cursor: pointer; "> <img src="@/assets/table/shifa.png" alt="" title="始发事件" v-if="scope.row.status == 0"
<img src="@/assets/table/export.png" alt="" title="导出事故情景工程" @click="editClick(scope.row)" style="cursor: pointer; ">
style="cursor: pointer; "> <img src="@/assets/table/see.png" alt="" title="查看始发事件" v-if="scope.row.status != 0"
@click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/moni.png" alt="" title="模拟计算" v-if="scope.row.status == 0"
@click="confirmationAnalysis(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/moni_disabled.png" alt="" title="查看始发事件" v-if="scope.row.status != 0">
<img src="@/assets/table/result.png" alt="" title="计算结果" v-if="scope.row.status == 2"
@click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/result_disabled.png" alt="" title="计算结果" v-if="scope.row.status != 2">
<img src="@/assets/table/del.png" alt="" title="删除" <img src="@/assets/table/del.png" alt="" title="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; "> @click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span> </span>