修改提交
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
@ -48,3 +48,12 @@ export function deleteBatchScenarios(queryParams:any){
|
||||
data: queryParams
|
||||
});
|
||||
}
|
||||
|
||||
//获取所有项目列表
|
||||
export function getActiveAlgorithms(){
|
||||
return request({
|
||||
url: '/algorithms/getActiveAlgorithms' ,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
BIN
business-css/frontend/src/assets/table/moni.png
Normal file
|
After Width: | Height: | Size: 679 B |
BIN
business-css/frontend/src/assets/table/moni_disabled.png
Normal file
|
After Width: | Height: | Size: 687 B |
BIN
business-css/frontend/src/assets/table/result.png
Normal file
|
After Width: | Height: | Size: 576 B |
BIN
business-css/frontend/src/assets/table/result_disabled.png
Normal file
|
After Width: | Height: | Size: 615 B |
BIN
business-css/frontend/src/assets/table/see.png
Normal file
|
After Width: | Height: | Size: 616 B |
BIN
business-css/frontend/src/assets/table/shifa.png
Normal file
|
After Width: | Height: | Size: 555 B |
BIN
business-css/frontend/src/assets/table/u267.png
Normal file
|
After Width: | Height: | Size: 478 B |
BIN
business-css/frontend/src/assets/table/u419_disabled.png
Normal file
|
After Width: | Height: | Size: 510 B |
BIN
business-css/frontend/src/assets/table/view.png
Normal file
|
After Width: | Height: | Size: 517 B |
@ -8,6 +8,8 @@ export default {
|
||||
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({
|
||||
@ -44,20 +46,23 @@ const materialName:any = ref(props.materialInfo.name) // 变动物料信息
|
||||
const tableData:any = ref([])
|
||||
|
||||
function gettableData() {
|
||||
let params = {
|
||||
name: "",
|
||||
type: deviceTypetype.value,
|
||||
pageNum: 1,
|
||||
pageSize: 999,
|
||||
};
|
||||
if(deviceTypetype.value == ''){
|
||||
return
|
||||
}
|
||||
searchDevicesPage(params).then((result:any) => {
|
||||
deviceList.value = result.records;
|
||||
}).catch((err) => {
|
||||
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) => {
|
||||
|
||||
// });
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +199,7 @@ function dialogMaterialClose(){ // 变动公式设置关闭
|
||||
isDialogFormula.value = false
|
||||
}
|
||||
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
|
||||
}
|
||||
function handleClose(){ // 变动公式设置关闭
|
||||
@ -258,7 +263,7 @@ function confirmTableClick(){ // 确认变动公式设置
|
||||
<div v-for="(item, index) in deviceList" :key="index" class="choiceMateria-left-item"
|
||||
:class="{'choiceMateria-item-active': index == isAcitve}"
|
||||
@click="handleClick(item, index)">
|
||||
{{ item.name }}
|
||||
{{ item.deviceName }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1018,10 +1018,10 @@ function setFormulaInit(formula:any) {
|
||||
|
||||
function getBias(formula:any){
|
||||
// 从后往前找最后一个+的位置
|
||||
const lastPlusIndex = formula.lastIndexOf('+');
|
||||
// 从+的位置后截取到】之前
|
||||
const constantStr = formula.slice(lastPlusIndex + 1, -1);
|
||||
const constant = parseFloat(constantStr);
|
||||
// 匹配最后一个+号后面的数字(支持整数、小数)
|
||||
const regex = /\+(\d+\.?\d*)$/;
|
||||
const match = formula.match(regex);
|
||||
const constant = parseFloat(match[1]);
|
||||
return constant
|
||||
}
|
||||
|
||||
@ -1043,16 +1043,17 @@ function saveDesign() { // 保存设计
|
||||
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: unit, // 铀浓度(g/L)
|
||||
property: name, // 铀浓度(g/L)
|
||||
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] = {
|
||||
@ -1082,6 +1083,7 @@ function saveDesign() { // 保存设计
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const topology = {
|
||||
projectId: projectInfo.value.projectId,
|
||||
name: projectInfo.value.name,
|
||||
@ -1099,6 +1101,7 @@ function saveDesign() { // 保存设计
|
||||
},
|
||||
designData:cells
|
||||
}
|
||||
console.log(topology)
|
||||
// 添加保存信息
|
||||
const saveData = {
|
||||
projectId: projectInfo.value.projectId,
|
||||
|
||||
1518
business-css/frontend/src/components/antvx6/viewx6.vue
Normal file
@ -10,7 +10,7 @@ import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getDictItemById } from '@/api/dict';
|
||||
import { eventsBatchSave } from '@/api/business/event';
|
||||
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 props = defineProps({ // 接收父组件传递的项目信息
|
||||
@ -41,15 +41,8 @@ function handleScenarioClose(){
|
||||
}
|
||||
const getAlgorithmType = async () => {
|
||||
try {
|
||||
let params = {
|
||||
dictId: '595502b91e7741b5033b53622d8731a3',
|
||||
size:99,
|
||||
current:1
|
||||
}
|
||||
const result:any = await getDictItemById(params);
|
||||
if (result.code == '0') {
|
||||
algorithmTypeData.value = result.data.records
|
||||
}
|
||||
const result:any = await getActiveAlgorithms();
|
||||
algorithmTypeData.value = result
|
||||
} catch (error) {
|
||||
}
|
||||
}
|
||||
@ -152,7 +145,7 @@ onMounted(() => {
|
||||
</el-form-item>
|
||||
<el-form-item label="算法类型:" prop="algorithmType">
|
||||
<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-form-item>
|
||||
<el-form-item label="事故情景描述:">
|
||||
|
||||
@ -8,6 +8,9 @@ export default {
|
||||
import { onMounted, ref, nextTick } from "vue";
|
||||
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
||||
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 { getDictItemById } from '@/api/dict';
|
||||
// import ConditionModel from '@/views/component/scenario/condition.vue'
|
||||
@ -268,6 +271,48 @@ function closeCreatescenario(){
|
||||
dialogVisible.value = false;
|
||||
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>
|
||||
|
||||
<template>
|
||||
@ -312,15 +357,27 @@ function closeCreatescenario(){
|
||||
<span
|
||||
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; ">
|
||||
<img src="@/assets/table/design.png" alt="" title="分享设计"
|
||||
style="cursor: pointer; ">
|
||||
<img src="@/assets/table/simulation.png" alt="" title="模拟分析"
|
||||
style="cursor: pointer; ">
|
||||
<img src="@/assets/table/export.png" alt="" title="导出事故情景工程"
|
||||
style="cursor: pointer; ">
|
||||
<img src="@/assets/table/del.png" alt="" title="删除"
|
||||
<img src="@/assets/table/view.png" alt="" title="查看" v-if="scope.row.status != 0"
|
||||
@click="editClick(scope.row)" style="cursor: pointer; ">
|
||||
|
||||
<img src="@/assets/table/shifa.png" alt="" title="始发事件" v-if="scope.row.status == 0"
|
||||
@click="editClick(scope.row)" 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="删除"
|
||||
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
|
||||
</span>
|
||||
</template>
|
||||
|
||||