From dee3a3e051e058abad7869e6ae081e81740556d4 Mon Sep 17 00:00:00 2001
From: limengnan <420004014@qq.com>
Date: Mon, 19 Jan 2026 17:31:35 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8E=86=E5=8F=B2?=
=?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=88=86=E6=9E=90=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
business-css/frontend/.env.development | 1 +
business-css/frontend/.env.production | 1 +
.../frontend/src/api/business/event/index.ts | 14 +-
.../src/components/antvx6/echartsModel.vue | 218 +++++++++++++
.../src/components/antvx6/tableModel.vue | 145 ++++-----
.../frontend/src/components/antvx6/viewx6.vue | 295 +++++++++++++-----
.../views/component/scenario/condition.vue | 93 +++++-
.../src/views/component/scenario/index.vue | 213 ++++++++-----
8 files changed, 726 insertions(+), 254 deletions(-)
create mode 100644 business-css/frontend/src/components/antvx6/echartsModel.vue
diff --git a/business-css/frontend/.env.development b/business-css/frontend/.env.development
index 8af9418..470ff49 100644
--- a/business-css/frontend/.env.development
+++ b/business-css/frontend/.env.development
@@ -6,3 +6,4 @@ NODE_ENV='development'
VITE_APP_TITLE = '临界事故情景分析模拟系统'
VITE_APP_PORT = 3000
VITE_APP_BASE_API = '/dev-api'
+VITE_APP_BASE_HTTP = 'http://localhost:3000'
diff --git a/business-css/frontend/.env.production b/business-css/frontend/.env.production
index 728f41a..7a2d7c7 100644
--- a/business-css/frontend/.env.production
+++ b/business-css/frontend/.env.production
@@ -4,3 +4,4 @@ NODE_ENV='production'
VITE_APP_TITLE = 'NewFrameWork2023-WEB'
VITE_APP_PORT = 3000
VITE_APP_BASE_API = '/prod-api'
+VITE_APP_BASE_HTTP = 'http://localhost:3000'
\ No newline at end of file
diff --git a/business-css/frontend/src/api/business/event/index.ts b/business-css/frontend/src/api/business/event/index.ts
index f662ee2..9909ede 100644
--- a/business-css/frontend/src/api/business/event/index.ts
+++ b/business-css/frontend/src/api/business/event/index.ts
@@ -1,13 +1,13 @@
import request from '@/utils/request';
// //获取所有项目列表
-// export function searchScenariosLsit(queryParams:any){
-// return request({
-// url: '/events/by-project' ,
-// method: 'get',
-// params:queryParams
-// });
-// }
+export function searchEventsByScenarioId(queryParams:any){
+ return request({
+ url: '/events/by-scenario' ,
+ method: 'get',
+ params:queryParams
+ });
+}
diff --git a/business-css/frontend/src/components/antvx6/echartsModel.vue b/business-css/frontend/src/components/antvx6/echartsModel.vue
new file mode 100644
index 0000000..09e625e
--- /dev/null
+++ b/business-css/frontend/src/components/antvx6/echartsModel.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
diff --git a/business-css/frontend/src/components/antvx6/tableModel.vue b/business-css/frontend/src/components/antvx6/tableModel.vue
index 36e4bb2..72adcfc 100644
--- a/business-css/frontend/src/components/antvx6/tableModel.vue
+++ b/business-css/frontend/src/components/antvx6/tableModel.vue
@@ -6,7 +6,8 @@ export default {
@@ -545,9 +671,10 @@ function dialogTableModel(){ // 关闭变动设置弹窗
@@ -877,4 +994,40 @@ function dialogTableModel(){ // 关闭变动设置弹窗
border-bottom:1px solid rgba(238, 238, 238, 1);
padding-left: 15px;
}
+
+
+
+
\ 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 601507d..4c77fc5 100644
--- a/business-css/frontend/src/views/component/scenario/condition.vue
+++ b/business-css/frontend/src/views/component/scenario/condition.vue
@@ -11,6 +11,7 @@ import Page from '@/components/Pagination/page.vue'
import { getDictItemById } from '@/api/dict';
import { topologyDevicesLsit } from '@/api/business/project';
+import { searchEventsByScenarioId } from '@/api/business/event';
const conditionData:any = ref([{ // 套件数据
@@ -30,12 +31,18 @@ const props = defineProps({ // 接收父组件传递的项目信息
type: String,
default: ''
},
+ isEdit: {
+ required: true,
+ type: Boolean,
+ default: false
+ },
});
+const isEdit = ref(props.isEdit)
function submitClick() {
+ debugger
return menuList.value
}
function initDeviceData(){
- console.log(props.projectInfo)
topologyDevicesLsit({
id: props.projectInfo.projectId
}).then((res:any) => {
@@ -44,9 +51,34 @@ function initDeviceData(){
}
})
}
+function initConditionData(){
+ searchEventsByScenarioId({
+ scenarioId: props.scenarioId
+ }).then((res:any) => {
+ if(res.length > 0){
+ menuList.value = []
+ }
+ for(let i = 0; i < res.length; i++){
+ if(res[i].attrChanges != null && res[i].attrChanges != ''){
+ let attrChanges = JSON.parse(res[i].attrChanges)
+ menuList.value.push({
+ ...attrChanges,
+ eventId: res[i].eventId,
+ })
+
+ getTimelineList()
+ }
+ }
+ if(res.length > 0){
+ getDeviceInfo(menuList.value[0].device)
+ }
+
+ })
+}
onMounted(() => {
DicInit()
-initDeviceData()
+ initDeviceData()
+ initConditionData()
});
const deviceData:any = ref([]) // 始发设备数据
const attributeData:any = ref([]) // 设备属性数据
@@ -94,6 +126,7 @@ function addAttr(){ // 添加自定义属性
function menuClick(index:any){ // 点击菜单切换
menuIndex.value = index;
segmentationIndex.value = 0;
+ getTimelineList()
}
function addMenu(){ //添加导菜单
menuList.value.push({
@@ -124,6 +157,9 @@ function DicInit() {
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',
@@ -132,6 +168,9 @@ 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)
+ }
}).catch((err: any) => {
});
}
@@ -173,6 +212,25 @@ function changeMaterial(e:any){ // 设备属性改变时,清空变化物料
getDeviceInfo(e)
}
+// 查询字典项
+// async function DicInit() {
+// let params = {
+// dictId: 'dc7419e5f8a655966e6bb90b0cb5c0c2',
+// size:99,
+// current:1
+// }
+
+// const attributeResult = await getDictItemById(params)
+// attributeData.value = attributeResult.data.records;
+// let paramss = {
+// dictId: '9d87f873bc80e79c6d399131cbe01016',
+// size:99,
+// current:1
+// }
+// const materialResult = await getDictItemById(paramss)
+// materialData.value = materialResult.data.records;
+// initConditionData()
+// }
const devicename = ref('') // 选中始发设备
@@ -181,13 +239,21 @@ const timelineList:any = ref([]) // 时间线数据
function getTimelineList(){
timelineList.value = []
- menuList.value.forEach((item:any) => {
+ // menuList.value.forEach((item:any) => {
+ // item.segments.forEach((segment:any) => {
+ // segment.timeline.forEach((timeline:any) => {
+ // console.log(timeline)
+ // timelineList.value.push(timeline)
+ // })
+ // })
+ // })
+ let item = menuList.value[menuIndex.value]
item.segments.forEach((segment:any) => {
segment.timeline.forEach((timeline:any) => {
+ console.log(timeline)
timelineList.value.push(timeline)
})
})
- })
}
function getDeviceInfo(e:any){ // 获取设备信息
devicename.value = ""
@@ -227,25 +293,26 @@ function getDeviceInfo(e:any){ // 获取设备信息
:class="{'condition-item-active': index == menuIndex}" @click="menuClick(index)">
{{ item.label }}
-
+
-
+
+ :disabled="(menuList[menuIndex].material!='' && menuList[menuIndex].material!=null) || isEdit == false" @change="changeAttribute">
+ :disabled="(menuList[menuIndex].attribute!='' && menuList[menuIndex].attribute!=null)|| isEdit == true" @change="changeMaterial">
@@ -254,9 +321,9 @@ function getDeviceInfo(e:any){ // 获取设备信息
-
@@ -291,12 +358,12 @@ function getDeviceInfo(e:any){ // 获取设备信息
-
-
+
diff --git a/business-css/frontend/src/views/component/scenario/index.vue b/business-css/frontend/src/views/component/scenario/index.vue
index 85f3766..d4d4cf8 100644
--- a/business-css/frontend/src/views/component/scenario/index.vue
+++ b/business-css/frontend/src/views/component/scenario/index.vue
@@ -8,14 +8,14 @@ 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 { getActiveAlgorithms } from "@/api/business/scenario";
+import ConditionModel from '@/views/component/scenario/condition.vue'
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'
import Createscenario from '@/views/component/scenario/createscenario.vue'
import { eventsBatchSave } from '@/api/business/event';
+const webUrl = import.meta.env.VITE_APP_BASE_HTTP; // 基础路径
const algorithmTypeData: any = ref([]); // 算法类型数据
const stepsActive = ref(0); // 步骤导航栏当前激活的步骤索引
const props = defineProps({ // 接收父组件传递的项目信息
@@ -25,7 +25,6 @@ const props = defineProps({ // 接收父组件传递的项目信息
default: {}
}
});
-
// 搜索框
const queryParams = ref({
current: 1,
@@ -72,7 +71,8 @@ const info: any = ref({
description: "",
});
const scenarioId = ref(""); // 事故情景id
-const dialogVisible = ref(false);
+const dialogVisible = ref(false); // 新增事故情景弹窗是否显示
+const dialogEditVisible = ref(false); // 修改或查看事故情景弹窗是否显示
function addClick() {
title.value = "新增事故情景";
info.value = {
@@ -142,25 +142,37 @@ function confirmClick(formEl: any) {
//新建角色-取消按钮
function handleClose() {
- dialogVisible.value = false;
+ dialogEditVisible.value = false;
if (infoForm.value != null) infoForm.value.resetFields();
}
-function handleScenarioClose(){
- dialogVisible.value = false;
- gettableData();
- if (infoForm.value != null) infoForm.value.resetFields();
-
-}
//新建事故情景
const rules = ref({
name: [{ required: true, message: "请输入事故情景名称", trigger: "blur" }],
algorithmType: [{ required: true, message: "请选择算法类型", trigger: "change" }],
});
//修改事故情景
-function editClick(row: any) {
- title.value = "修改事故情景";
+function editClick(row: any,type: string) {
+ title.value =type + "事故情景";
info.value = JSON.parse(JSON.stringify(row));
- dialogVisible.value = true;
+
+ dialogEditVisible.value = true;
+}
+const isEdit = ref(false);
+function departureClick(row: any,type: string) {
+ title.value =type;
+ if(type == "初始条件设置"){
+ isEdit.value = true;
+ } else {
+ isEdit.value = false;
+ }
+ info.value = JSON.parse(JSON.stringify(row));
+ scenarioId.value = row.scenarioId;
+ isShowCondition.value = true;
+}
+function editClick1(row: any) {
+
+ info.value = JSON.parse(JSON.stringify(row));
+ dialogEditVisible.value = true;
}
//删除事故情景
@@ -226,38 +238,27 @@ function dateFormat(row: any) {
}
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) {
}
}
-const conditionModel = ref()
function submitClick(){
- const tempData = conditionModel.value?.submitClick()
- let data:any = []
-
- tempData.forEach((item: any) => {
- data.push({
- triggerTime:'0',
- attrChanges:JSON.stringify(item) ,
- scenarioId: scenarioId.value
- })
- })
- eventsBatchSave(data).then((res:any) => {
- if (res.code == '0') {
- // ElMessage({
- // type: "success",
- // message: "保存成功",
- // });
- dialogVisible.value = false;
+ let data = {
+ scenarioId: info.value.scenarioId,
+ algorithm_type: info.value.algorithmType,
+ name: info.value.name,
+ description: info.value.description,
+ }
+ updateScenarios(data).then((res:any) => {
+ if (res == true) {
+ ElMessage({
+ type: "success",
+ message: "保存成功",
+ });
+ dialogEditVisible.value = false;
+ gettableData();
}
})
@@ -288,8 +289,24 @@ function confirmationAnalysis(row: any) {
let data = {
data: res.data
}
- simulationRun(row.projectId, row.scenarioId, data || {}).then((res) => {
- gettableData();
+ simulationRun(row.projectId, row.scenarioId, data || {}).then((res:any) => {
+ if(res.code == '0'){
+ ElMessage({
+ type: "success",
+ message: "模拟计算成功",
+ });
+ gettableData();
+ setTimeout(() => {
+ window.open(webUrl + '/#/viewanalysis?projectId='+ row.projectId +'&scenarioId='+ row.scenarioId, '_blank');
+ }, 1000);
+
+ }else{
+ ElMessage({
+ type: "error",
+ message: "模拟运行失败,请检查后端服务是否正常",
+ });
+ }{}
+
}).catch((error) => {
console.error('模拟运行失败:', error);
ElMessage({
@@ -303,15 +320,39 @@ function confirmationAnalysis(row: any) {
message: "模拟初始化失败",
});
}
-
-
-
});
})
}
+const isShowCondition = ref
(false); // 是否显示条件模型
+const conditionModelRef = ref() // 条件模型实例
+function handleScenarioClose(){
+ isShowCondition.value = false;
+}
+function submitConditionClick(){
+ const tempData = conditionModelRef.value?.submitClick()
+ let data:any = []
+ tempData.forEach((item: any) => {
+ data.push({
+ triggerTime:'0',
+ eventId: item.eventId ==null? '' : item.eventId,
+ attrChanges:JSON.stringify(item) ,
+ scenarioId: scenarioId.value
+ })
+ })
+ eventsBatchSave(data).then((res:any) => {
+ if (res.code == '0') {
+ isShowCondition.value = false;
+ gettableData();
+ ElMessage({
+ type: "success",
+ message: "修改成功",
+ });
+ }
+ })
-
+
+}
@@ -358,25 +399,24 @@ function confirmationAnalysis(row: any) {
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
+ @click="editClick(scope.row,'修改')" style="cursor: pointer; ">
+
+ @click="editClick(scope.row,'查看')" style="cursor: pointer; ">
+ @click="departureClick(scope.row,'初始条件设置')" style="cursor: pointer; ">
+ @click="departureClick(scope.row,'查看初始条件')" style="cursor: pointer; ">
+ @click="editClick1(scope.row)" style="cursor: pointer; ">
-
-
-
+
@@ -387,38 +427,43 @@ function confirmationAnalysis(row: any) {
-
+
+
From 293407919a9b4ff991677b07813931a2dffadf68 Mon Sep 17 00:00:00 2001
From: limengnan <420004014@qq.com>
Date: Tue, 20 Jan 2026 09:36:41 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/antvx6/changesettings.vue | 7 -
.../src/components/antvx6/echartsModel.vue | 2 +-
.../src/components/antvx6/tableModel.vue | 2 +-
.../src/views/component/scenario/index.vue | 226 +++++++++++++-----
business-css/frontend/vite.config.ts | 2 +-
5 files changed, 168 insertions(+), 71 deletions(-)
diff --git a/business-css/frontend/src/components/antvx6/changesettings.vue b/business-css/frontend/src/components/antvx6/changesettings.vue
index 1ff3255..4da9b32 100644
--- a/business-css/frontend/src/components/antvx6/changesettings.vue
+++ b/business-css/frontend/src/components/antvx6/changesettings.vue
@@ -56,13 +56,6 @@ if(deviceTypetype.value == ''){
deviceList.value = res.data;
}
})
-// topologyDevicesLsit(params).then((result:any) => {
-// deviceList.value = result.records;
-// }).catch((err) => {
-
-// });
-
-
}
diff --git a/business-css/frontend/src/components/antvx6/echartsModel.vue b/business-css/frontend/src/components/antvx6/echartsModel.vue
index 09e625e..a5b6d9a 100644
--- a/business-css/frontend/src/components/antvx6/echartsModel.vue
+++ b/business-css/frontend/src/components/antvx6/echartsModel.vue
@@ -1,6 +1,6 @@
-
+
@@ -414,7 +403,7 @@ function submitConditionClick(){
+ @click="resultClick(scope.row)" style="cursor: pointer; ">
取消
确定
+
+
+
+
+
+
+
设备列表
+
+
+ {{ item.deviceName }}
+
+
+
+
+
+
@@ -634,4 +651,91 @@ function submitConditionClick(){
align-items: center;
}
-
\ No newline at end of file
+.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;
+}
+
+
+
+
+.adddevice_navigation_left{
+ width: 110px;
+ height: 32px;
+ line-height: 32px;
+ text-align: center;
+ cursor: pointer;
+ font-family: 'Arial Normal', 'Arial';
+ font-weight: 400;
+ font-style: normal;
+ font-size: 14px;
+ color: #363636;
+ background-image: url('@/assets/x6/navleft.png');
+}
+.adddevice_navigation_left:hover{
+ color: #266fff ;
+}
+.adddevice_navigation_activeleft{
+ background-image: url('@/assets/x6/navleft_active.png');
+ color: #fff !important;
+}
+.adddevice_navigation_right{
+ width: 110px;
+ height: 32px;
+ line-height: 32px;
+ text-align: center;
+ cursor: pointer;
+ font-family: 'Arial Normal', 'Arial';
+ font-weight: 400;
+ font-style: normal;
+ font-size: 14px;
+ color: #363636;
+ background-image: url('@/assets/x6/navright.png');
+}
+.adddevice_navigation_right:hover{
+ color: #266fff ;
+}
+.adddevice_navigation_activeright{
+ background-image: url('@/assets/x6/navright_active.png');
+ color: #fff !important;
+}
+
+
+
diff --git a/business-css/frontend/vite.config.ts b/business-css/frontend/vite.config.ts
index fe7de1f..5df1cfe 100644
--- a/business-css/frontend/vite.config.ts
+++ b/business-css/frontend/vite.config.ts
@@ -25,7 +25,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
proxy: {
[env.VITE_APP_BASE_API]: {
// 线上API地址
- //target: 'http://192.168.1.20:8090/',
+ // target: 'http://192.168.1.166:8090/',
// 本地API地址
target: 'http://localhost:8090',
changeOrigin: true,