Merge branch 'develop-business-css' of http://121.37.111.42:3000/ThbTech/JavaProjectRepo into development-business-css

This commit is contained in:
wanxiaoli 2026-01-17 13:40:34 +08:00
commit 10970ab165
18 changed files with 2172 additions and 85 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

@ -120,7 +120,7 @@ function confirmDevice(){ // 确定添加设备
} }
addDevices(params).then((res:any) => { addDevices(params).then((res:any) => {
if(res == true){ if(res == true){
emit('closeAdddevice', selectedDevice.value) emit('closeAdddevice', params)
} }
}); });
} }
@ -213,8 +213,6 @@ function addClick() {
</div> </div>
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 300px);margin-bottom: 10px;" border <el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 300px);margin-bottom: 10px;" border
@cell-click="selectPatient" highlight-current-row row-key="id" :header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }"> @cell-click="selectPatient" highlight-current-row row-key="id" :header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="70" align="center"></el-table-column> <el-table-column type="index" label="序号" width="70" 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 v-if="deviceTypetype == 'FlatTank'" prop="length" label="长度(cm)" min-width="100"></el-table-column> <el-table-column v-if="deviceTypetype == 'FlatTank'" prop="length" label="长度(cm)" min-width="100"></el-table-column>

View File

@ -0,0 +1,374 @@
<script lang="ts">
export default {
name: "变动设置",
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchDevicesPage } from "@/api/business/database/device";
import { topologyDevicesLsit } from '@/api/business/project';
const emit = defineEmits([ 'closeChangesettingsModel']);
const props = defineProps({
projectInfo: {
required: false,
type: Object,
default: {}
},
deviceInfo:{
required: false,
type: Object,
default: {}
},
materialInfo: {
required: false,
type: Object,
default: {}
},
materialId: {
required: false,
type: String,
default: ""
},
changesettingsData: {
required: false,
type: Array,
default: []
}
})
const deviceTypetype:any = ref("")
const deviceName:any = ref(props.deviceInfo.name) //
const materialName:any = ref(props.materialInfo.name) //
const tableData:any = ref([])
function gettableData() {
if(deviceTypetype.value == ''){
return
}
topologyDevicesLsit({
id: props.projectInfo.projectId
}).then((res:any) => {
if (res.code == 0) {
deviceList.value = res.data;
}
})
// topologyDevicesLsit(params).then((result:any) => {
// deviceList.value = result.records;
// }).catch((err) => {
// });
}
onMounted(() => {
deviceTypetype.value = props.deviceInfo.type
if(props.changesettingsData != null && props.changesettingsData.length > 0){
tableData.value = props.changesettingsData
}else{
getInit(props.materialInfo);
}
gettableData()
});
function getInit(row:any){
tableData.value = []
if(row != null){
tableData.value.push({
key: "铀浓度g/L",
name: "u_concentration",
value: row.uConcentration,
unit: "g/L",
formula: '',
correlation: '',
delay: '',
},{
key: "氧化铀密度g/cm3",
name: "uo2_density",
value: row.uo2Density,
unit: "g/cm3",
formula: '',
correlation: '',
delay: '',
},{
key: "铀富集度(%",
name: "u_enrichment",
value: row.uEnrichment,
unit: "%",
formula: '',
correlation: '',
delay: '',
},{
key: "钚浓度g/L",
name: "pu_concentration",
value: row.puConcentration,
unit: "g/L",
formula: '',
correlation: '',
delay: '',
},{
key: "氧化钚密度g/cm3",
name: "puo2_density",
value: row.puo2Density,
unit: "g/cm3",
formula: '',
correlation: '',
delay: '',
},{
key: "钚同位素比例PU-240占比%",
name: "pu_isotope",
value: row.puIsotope,
unit: "%",
formula: '',
correlation: '',
delay: '',
},{
key: "硝酸酸度mol/L",
name: "hno3_acidity",
value: row.hno3Acidity,
unit: "mol/L",
},{
key: "草酸浓度mol/L",
name: "h2c2o4_concentration",
value: row.h2c2o4Concentration,
unit: "mol/L",
formula: '',
correlation: '',
delay: '',
},{
key: "有机相比例%",
name: "organic_ratio",
value: row.organicRatio,
unit: "%",
formula: '',
correlation: '',
delay: '',
},{
key: "含水率%",
name: "moisture_content",
value: row.moistureContent,
unit: "%",
formula: '',
correlation: '',
delay: '',
})
let tempData = []
if(row.customAttrs !=null && row.customAttrs != ""){
tempData = JSON.parse(row.customAttrs)
}
for(let i = 0; i < tempData.length; i++){
let attr = tempData[i]
tableData.value.push({
key: attr.key,
value: attr.value,
unit: attr.unit,
formula: '',
correlation: '',
delay: '',
})
}
}
}
function confirmClick(){ //
emit('closeChangesettingsModel',tableData.value)
}
const isDialogFormula:any = ref(false) //
const deviceList:any = ref([]) //
const isAcitve:any = ref(-1) //
const tempFormulaInfo:any = ref({})
const formulaInfo:any = ref({})
const tableIndex:any = ref(-1) //
function dialogFormulaOpen(row:any,index:any){
isAcitve.value = -1
tableIndex.value = index
formulaInfo.value = JSON.parse(JSON.stringify(row))
tempFormulaInfo.value = row
isDialogFormula.value = true
}
function dialogMaterialClose(){ //
isDialogFormula.value = false
}
function handleClick(item:any, index:any){
formulaInfo.value.correlation = JSON.parse(JSON.stringify(item.deviceName))
isAcitve.value = index
}
function handleClose(){ //
isDialogFormula.value = false
}
function confirmTableClick(){ //
tableData.value[tableIndex.value].formula = formulaInfo.value.formula
tableData.value[tableIndex.value].correlation = formulaInfo.value.correlation
tableData.value[tableIndex.value].delay = formulaInfo.value.delay
isDialogFormula.value = false
}
</script>
<template>
<div class="editdevice-box">
<div>
<div style="display: flex; align-items: center;">
<div style="width: 80px;">
变动设备
</div>
<el-input v-model="deviceName" style="width: 300px" placeholder="" :disabled="true"></el-input>
<div style="width: 80px;">
物料名称
</div>
<el-input v-model="materialName" style="width: 300px" placeholder="" :disabled="true"></el-input>
</div>
</div>
<div style="display: flex;align-items: center;padding: 20px 0;">
<div class="materialmodel-title-line"></div>
<div>物料成分</div>
</div>
<div class="table-box">
<el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="key" label="属性" width="280"></el-table-column>
<el-table-column prop="value" label="值" width="150"></el-table-column>
<el-table-column prop="formula" label="计算公式" min-width="100"></el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template #default="scope">
<span style=" font-family: '微软雅黑';
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #266FFF;
text-align: left;
cursor: pointer;" @click="dialogFormulaOpen(scope.row,scope.$index)">设置</span>
</template>
</el-table-column>
</el-table>
</div>
<div style="display: flex; justify-content: flex-end;margin-top: 10px;">
<el-button type="primary" @click="confirmClick">确定</el-button>
</div>
<el-dialog v-model="isDialogFormula" :close-on-click-modal="false" :modal="false" draggable
:before-close="dialogMaterialClose" title="变动公式设置" append-to-body width="994px" class="materialmodel-dialog-box">
<div style="display: flex;">
<div class="choiceMateria-left">
<div class="choiceMateria-left-title">设备列表</div>
<div style="height: calc(100% - 70px);overflow: auto;margin-top: 10px;">
<div v-for="(item, index) in deviceList" :key="index" class="choiceMateria-left-item"
:class="{'choiceMateria-item-active': index == isAcitve}"
@click="handleClick(item, index)">
{{ item.deviceName }}
</div>
</div>
</div>
<div style="padding-left: 45px;padding-top: 40px; width: calc(100% - 290px);">
<el-form :model="formulaInfo" label-width="80px"
style="height: calc(100vh - 360px) ; overflow: auto;">
<el-form-item label="变动设备" style="width: 100%;" label-width="80px">
<el-input v-model="deviceName" style="width: 100%" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="物料名称" style="width: 100%;" label-width="80px">
<el-input v-model="materialName" style="width: 100%" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="成分" style="width: 100%;" label-width="80px">
<el-input v-model="formulaInfo.key" style="width: 100%" :disabled="true"></el-input>
</el-form-item>
<div style="display: flex;align-items: center;padding: 20px 0;">
<div class="materialmodel-title-line"></div>
<div>变动公式</div>
</div>
<el-form-item label="值=" style="width: 100%;" label-width="80px">
<el-input v-model="formulaInfo.formula" style="width: 100%"></el-input>
</el-form-item>
<div style="display: flex;align-items: center;padding: 20px 0;">
<div class="materialmodel-title-line"></div>
<div>延时设置</div>
</div>
<div style="display: flex;align-items: center;">
<el-form-item label="关联设备" >
<el-input v-model="formulaInfo.correlation" style="width: 100%" placeholder=""></el-input>
</el-form-item>
<el-form-item label="延时时间" >
<el-input v-model="formulaInfo.delay" style="width: 100%" placeholder=""></el-input>
</el-form-item>
</div>
</el-form>
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="confirmTableClick"> </el-button>
</span>
</div>
</div>
</el-dialog>
</div>
</template>
<style scoped>
.editdevice-box{
width: 100%;
height: calc(100vh - 200px);
}
.materialmodel-title-line{
width: 4px;
height: 12px;
background-color: rgba(38, 111, 255, 1);
margin-right: 4px;
}
.choiceMateria-left{
width: 240px;
height: calc(100vh - 200px);
border-right: 1px solid rgba(240, 240, 240, 1);
box-sizing: border-box;
}
.choiceMateria-left-title{
width: 240px;
height: 44px;
line-height: 44px;
font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
font-weight: 700;
font-style: normal;
font-size: 14px;
color: #1B1B1B;
padding-left: 16px;
border-bottom: 1px solid rgba(240, 240, 240, 1);
}
.choiceMateria-left-item{
width: 100%;
height: 40px;
line-height: 40px;
padding-left: 16px;
font-family: 'Arial Normal', 'Arial';
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #333333;
cursor: pointer;
}
.choiceMateria-left-item:hover{
background-color: #f5f8ff;
}
.choiceMateria-item-active{
background-color: #f5f8ff;
color: #266fff;
}
</style>
<style>
.materialmodel-dialog-box.el-dialog .el-dialog__body{
padding: 0 !important;
}
</style>

View File

@ -35,7 +35,7 @@ import line6 from '@/assets/x6/line6.png'
import AdddeviceModel from './adddevice.vue'; import AdddeviceModel from './adddevice.vue';
import EditdeviceModel from './editdevice.vue'; import EditdeviceModel from './editdevice.vue';
import MaterialModels from './materialmodel.vue'; import MaterialModels from './materialmodel.vue';
import ChangesettingsModels from './changesettings.vue';
const emit = defineEmits([ 'closeAntvx6']); const emit = defineEmits([ 'closeAntvx6']);
@ -639,7 +639,6 @@ graph.on('blank:mouseup', (e) => {
}, },
}), }),
) )
console.log(imageNodes)
stencil.load(imageNodes, 'group2') stencil.load(imageNodes, 'group2')
// 线 // 线
@ -858,51 +857,7 @@ function copyNode() { // 复制节点
function closeAntvx6() { function closeAntvx6() {
emit('closeAntvx6') emit('closeAntvx6')
} }
function saveDesign() { //
try {
// JSON
const designData:any = graph.toJSON()
let cells = []
if(designData !=null && designData.cells.length>0){
cells = designData.cells
}
const topology = {
projectId: projectInfo.value.projectId,
name: projectInfo.value.name,
devices:[],
pipelines:[],
systemboundaries:[],
globalDisplay:{
device:{
showProperties:[]
},
material:{
showProperties:[]
},
},
designData:cells
}
//
const saveData = {
projectId: projectInfo.value.projectId,
topology: JSON.stringify(topology)
}
updateProjects(saveData).then((res:any) => {
if(res === true){
ElMessage({
type: "success",
message: "保存成功",
});
}
});
//
return saveData
} catch (error) {
console.error('保存设计失败:', error)
return null
}
}
function revokeClick(){ function revokeClick(){
graph.undo() graph.undo()
} }
@ -989,14 +944,183 @@ function dialogMaterialModel(){ // 关闭物料信息弹窗
} }
function closeMaterialModel(e:any){ // function closeMaterialModel(e:any){ //
if(e == false){ if(e == false){
isEditdevice.value = false; isMaterialModel.value = false;
return return
} }
selectedMaterial.value = e selectedMaterial.value = e
let retrievedNode:any = graph.getCellById(nodeId.value) let retrievedNode:any = graph.getCellById(nodeId.value)
retrievedNode.store.data.materialInfo = e retrievedNode.store.data.materialInfo = e
isEditdevice.value = false; isMaterialModel.value = false;
}
const isChangesettings = ref(false)
const changesettingsData:any = ref([]) //
function dialogChangesettings(){ //
isChangesettings.value = false;
}
function ChangesettingsClick(){ //
changesettingsData.value = []
if(selectedNode.value.store.data.deviceInfo == null){
ElMessage({
type: "error",
message: "请先添加设备信息",
});
return
}
if(selectedNode.value.store.data.materialInfo == null){
ElMessage({
type: "error",
message: "请先添加物料信息",
});
return
}
deviceInfo.value = selectedNode.value.store.data.deviceInfo
materialInfo.value = selectedNode.value.store.data.materialInfo
if(selectedNode.value.store.data.changesettings != null){
changesettingsData.value = selectedNode.value.store.data.changesettings
}
nodeId.value = selectedNode.value.id
if(materialInfo.value != null){
deviceTypetype.value = materialInfo.value.type
}
isChangesettings.value = true;
}
function closeChangesettingsModel(e:any){ //
if(e == false){
isChangesettings.value = false;
return
}
selectedMaterial.value = e
let retrievedNode:any = graph.getCellById(nodeId.value)
retrievedNode.store.data.changesettings = e
isChangesettings.value = false;
}
function setFormulaInit(formula:any) {
// const formula = "(B)*0.2+(A)*1.0+0.5";
// *+)
const regex = /\*(\d+\.?\d*)/g;
const coefficients = [];
let match;
//
while ((match = regex.exec(formula)) !== null) {
coefficients.push(parseFloat(match[1])); //
}
console.log(coefficients); // : [0.2, 1.0]
return coefficients
}
function getBias(formula:any){
// +
// +
const regex = /\+(\d+\.?\d*)$/;
const match = formula.match(regex);
const constant = parseFloat(match[1]);
return constant
}
function saveDesign() { //
try {
// JSON
const designData:any = graph.toJSON()
let cells:any = []
if(designData !=null && designData.cells.length>0){
cells = designData.cells
}
let devices = []
for(let i=0;i<cells.length;i++){
if(cells[i].shape == 'custom-image'){
let tempData:any = {}
if(cells[i].changesettings && cells[i].changesettings.length > 0){
for(let j=0;j<cells[i].changesettings.length;j++){
if(cells[i].changesettings[j].formula != '' && cells[i].changesettings[j].formula != null){
const key = cells[i].changesettings[j].name as string
const unit = cells[i].changesettings[j].unit
const name = cells[i].changesettings[j].name
const delay= cells[i].changesettings[j].delay
let tempSources = []
for(let k=0;k<setFormulaInit(cells[i].changesettings[j].formula).length;k++){
tempSources.push({
entityType: 'material', //B
entityId: cells[i].materialInfo.materialId , //materialId : cdeeca2e-1e0c-4bdd-b946-f347c104752c
property: name, // g/L
coefficient: setFormulaInit(cells[i].changesettings[j].formula)[k], //0.2
delay: { enabled: true, time: delay, unit: 's' } // 5
})
}
tempData[key] = {
name: tempData[key],
type:'influence',
unit:unit,
base:0,
bias: getBias(cells[i].changesettings[j].formula) || 0,
sources:tempSources,
expression:cells[i].changesettings[j].formula
}
}
}
}
devices.push({
deviceId:cells[i].id,
name:cells[i].deviceInfo.name,
type:cells[i].deviceInfo.type,
properties:{},
material: cells[i].materialInfo != null ? {
materialId:cells[i].id,
name:cells[i].materialInfo.name,
properties:tempData
}:{}
})
}
}
const topology = {
projectId: projectInfo.value.projectId,
name: projectInfo.value.name,
devices:devices,
pipelines:[],
systemboundaries:[],
globalDisplay:{
device:{
showProperties:[]
},
material:{
showProperties:[]
},
},
designData:cells
}
console.log(topology)
//
const saveData = {
projectId: projectInfo.value.projectId,
topology: JSON.stringify(topology)
}
updateProjects(saveData).then((res:any) => {
if(res === true){
ElMessage({
type: "success",
message: "保存成功",
});
}
});
//
return saveData
} catch (error) {
console.error('保存设计失败:', error)
return null
}
} }
</script> </script>
@ -1062,7 +1186,7 @@ function closeMaterialModel(e:any){ // 关闭物料信息弹窗
<div class="context-menu" v-if="isMenuShow" :style="{left: left +'px', top: top+'px'}"> <div class="context-menu" v-if="isMenuShow" :style="{left: left +'px', top: top+'px'}">
<img src="@/assets/x6/info.png" alt="图标" title="设备信息" style="cursor: pointer;" @click="EditdeviceClick"> <img src="@/assets/x6/info.png" alt="图标" title="设备信息" style="cursor: pointer;" @click="EditdeviceClick">
<img src="@/assets/x6/material.png" alt="图标" title="物料信息" style="cursor: pointer;" @click="MaterialModelClick"> <img src="@/assets/x6/material.png" alt="图标" title="物料信息" style="cursor: pointer;" @click="MaterialModelClick">
<img src="@/assets/x6/change.png" alt="图标" title="变动设置" style="cursor: pointer;"> <img src="@/assets/x6/change.png" alt="图标" title="变动设置" style="cursor: pointer;" @click="ChangesettingsClick">
<img src="@/assets/x6/copy.png" alt="图标" title="复制" style="cursor: pointer;" @click="copyNode"> <img src="@/assets/x6/copy.png" alt="图标" title="复制" style="cursor: pointer;" @click="copyNode">
<img src="@/assets/x6/del.png" alt="图标" title="删除" style="cursor: pointer;" <img src="@/assets/x6/del.png" alt="图标" title="删除" style="cursor: pointer;"
@click="deleteNode"> @click="deleteNode">
@ -1100,20 +1224,17 @@ function closeMaterialModel(e:any){ // 关闭物料信息弹窗
:deviceTypetype="deviceTypetype" ref="Editdevice" @closeEditdevice="closeEditdevice"/> :deviceTypetype="deviceTypetype" ref="Editdevice" @closeEditdevice="closeEditdevice"/>
</el-dialog> </el-dialog>
<!-- <el-dialog v-model="isEditdevice" :close-on-click-modal="false" :modal="false" draggable :before-close="dialogEditdevice" title="添加设备" append-to-body width="1050px">
<EditdeviceModel v-if="isEditdevice == true" :deviceId="nodeId" :deviceInfo="deviceInfo"
:deviceTypetype="deviceTypetype" ref="Editdevice" @closeEditdevice="closeEditdevice"/>
</el-dialog> -->
<!-- <el-dialog v-model="isEditdevice" :close-on-click-modal="false" :modal="false" draggable :before-close="dialogEditdevice" title="添加设备" append-to-body width="1050px">
<EditdeviceModel v-if="isEditdevice == true" :deviceId="nodeId" :deviceInfo="deviceInfo"
:deviceTypetype="deviceTypetype" ref="Editdevice" @closeEditdevice="closeEditdevice"/>
</el-dialog> -->
<el-dialog v-model="isMaterialModel" :close-on-click-modal="false" :modal="false" draggable :before-close="dialogMaterialModel" title="物料信息" append-to-body width="1014px"> <el-dialog v-model="isMaterialModel" :close-on-click-modal="false" :modal="false" draggable :before-close="dialogMaterialModel" title="物料信息" append-to-body width="1014px">
<MaterialModels v-if="isMaterialModel == true" :materiaId="nodeId" :materialInfo="materialInfo" :deviceInfo="deviceInfo" <MaterialModels v-if="isMaterialModel == true" :materialId="nodeId" :projectInfo="projectInfo"
:deviceTypetype="deviceTypetype" ref="MaterialModel" @closeMaterialModel="closeMaterialModel"/> :materialInfo="materialInfo" :deviceInfo="deviceInfo" :deviceTypetype="deviceTypetype" ref="MaterialModel" @closeMaterialModel="closeMaterialModel"/>
</el-dialog> </el-dialog>
<el-dialog v-model="isChangesettings" :close-on-click-modal="false" :modal="false" draggable :before-close="dialogChangesettings" title="变动设置" append-to-body width="1014px">
<ChangesettingsModels v-if="isChangesettings == true" :materialId="nodeId" :projectInfo="projectInfo" :changesettingsData="changesettingsData"
:materialInfo="materialInfo" :deviceInfo="deviceInfo" ref="ChangesettingsModel" @closeChangesettingsModel="closeChangesettingsModel"/>
</el-dialog>
</div> </div>
</template> </template>

View File

@ -215,7 +215,7 @@ function handleClick(item:any, index:any){
for(let i = 0; i < tempData.length; i++){ for(let i = 0; i < tempData.length; i++){
let attr = tempData[i] let attr = tempData[i]
ingredientData.value.push({ ingredientData.value.push({
key: attr.name, key: attr.key,
value: attr.value, value: attr.value,
unit: attr.unit, unit: attr.unit,
}) })
@ -443,6 +443,7 @@ function confirmMaterial(){
font-style: normal; font-style: normal;
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
cursor: pointer;
} }
.choiceMateria-left-item:hover{ .choiceMateria-left-item:hover{
background-color: #f5f8ff; background-color: #f5f8ff;

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,15 +357,27 @@ 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"
<img src="@/assets/table/del.png" alt="" title="删除" @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="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; "> @click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span> </span>
</template> </template>