修改场景代码
This commit is contained in:
parent
a9b5057d9d
commit
0ec2f3ea1a
@ -15,7 +15,7 @@ export function searchProjectsLsit(queryParams:any){
|
|||||||
//新增项目
|
//新增项目
|
||||||
export function addProjects(data:any){
|
export function addProjects(data:any){
|
||||||
return request({
|
return request({
|
||||||
url:'/projects' ,
|
url:'/projects/createAndReturn' ,
|
||||||
method: 'Post',
|
method: 'Post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
@ -48,3 +48,15 @@ export function deleteBatchProjects (queryParams:any){
|
|||||||
data: queryParams
|
data: queryParams
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function topologyDevicesLsit(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url: `/projects/search/${queryParams.id}/topology/devices` ,
|
||||||
|
method: 'get',
|
||||||
|
params:queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
50
business-css/frontend/src/api/business/scenario/index.ts
Normal file
50
business-css/frontend/src/api/business/scenario/index.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
//获取所有项目列表
|
||||||
|
export function searchScenariosLsit(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url: '/scenarios/by-project' ,
|
||||||
|
method: 'get',
|
||||||
|
params:queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//新增项目
|
||||||
|
export function addScenarios(data:any){
|
||||||
|
return request({
|
||||||
|
url:'/scenarios' ,
|
||||||
|
method: 'Post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//更新项目信息
|
||||||
|
export function updateScenarios(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url:'/scenarios' ,
|
||||||
|
method: 'PUT',
|
||||||
|
data: queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//单个删除项目
|
||||||
|
export function deleteScenarios(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url:'/scenarios/'+queryParams.id ,
|
||||||
|
method: 'delete'
|
||||||
|
// params: queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//多选删除项目
|
||||||
|
export function deleteBatchScenarios(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url:'/scenarios',
|
||||||
|
method: 'delete',
|
||||||
|
data: queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -9,8 +9,7 @@ import { onMounted, ref, nextTick } from "vue";
|
|||||||
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects} from "@/api/business/project";
|
import { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects} from "@/api/business/project";
|
||||||
import Page from '@/components/Pagination/page.vue'
|
import Page from '@/components/Pagination/page.vue'
|
||||||
import Scenario from '@/views/component/scenario/index.vue'
|
import ScenarioModel from '@/views/component/scenario/index.vue'
|
||||||
|
|
||||||
const isScenario = ref(false) //是否展示历史模拟场景
|
const isScenario = ref(false) //是否展示历史模拟场景
|
||||||
// 搜索框
|
// 搜索框
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
@ -100,9 +99,10 @@ function confirmClick(formEl: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//新建角色-取消按钮
|
//取消按钮
|
||||||
function handleClose() {
|
function handleClose() {
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
|
isScenario.value = false;
|
||||||
if (infoForm.value != null) infoForm.value.resetFields();
|
if (infoForm.value != null) infoForm.value.resetFields();
|
||||||
}
|
}
|
||||||
//新建项目
|
//新建项目
|
||||||
@ -263,9 +263,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
<el-dialog v-model="isScenario" :close-on-click-modal="false"
|
<el-dialog v-model="isScenario" :close-on-click-modal="false"
|
||||||
:modal="false" draggable :before-close="handleClose" title="历史模拟分析"
|
:modal="false" draggable :before-close="handleClose" title="历史模拟分析"
|
||||||
append-to-body width="1142px" height="600px">
|
append-to-body width="1142px">
|
||||||
<Scenario v-if="isScenario"
|
<ScenarioModel v-if="isScenario" :projectInfo="info" ref="Scenario" />
|
||||||
:project="info" ref="Scenario" @close="dialogVisible = false" />
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,18 @@ export default {
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
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 { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects} from "@/api/business/project";
|
import { searchScenariosLsit,addScenarios,updateScenarios,deleteScenarios,deleteBatchScenarios} from "@/api/business/scenario";
|
||||||
import Page from '@/components/Pagination/page.vue'
|
import Page from '@/components/Pagination/page.vue'
|
||||||
|
import { getDictItemById } from '@/api/dict';
|
||||||
|
const algorithmTypeData: any = ref([]); // 算法类型数据
|
||||||
|
const stepsActive = ref(0); // 步骤导航栏当前激活的步骤索引
|
||||||
|
const props = defineProps({ // 接收父组件传递的项目信息
|
||||||
|
projectInfo: {
|
||||||
|
required: true,
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 搜索框
|
// 搜索框
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
@ -27,12 +36,13 @@ const multipleSelection = ref([]);
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
function gettableData() {
|
function gettableData() {
|
||||||
let params = {
|
let params = {
|
||||||
|
projectId: props.projectInfo.projectId,
|
||||||
name: input.value,
|
name: input.value,
|
||||||
pageNum: queryParams.value.current,
|
pageNum: queryParams.value.current,
|
||||||
pageSize: queryParams.value.size,
|
pageSize: queryParams.value.size,
|
||||||
};
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchProjectsLsit(params).then((result:any) => {
|
searchScenariosLsit(params).then((result:any) => {
|
||||||
tableData.value = result.records;
|
tableData.value = result.records;
|
||||||
total.value = result.total;
|
total.value = result.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -64,6 +74,7 @@ function addClick() {
|
|||||||
code: "",
|
code: "",
|
||||||
description: "",
|
description: "",
|
||||||
};
|
};
|
||||||
|
stepsActive.value = 0;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
//新建事故情景-确认按钮/修改按钮
|
//新建事故情景-确认按钮/修改按钮
|
||||||
@ -72,23 +83,37 @@ function confirmClick(formEl: any) {
|
|||||||
formEl.validate((valid: any) => {
|
formEl.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
||||||
if (!info.value.projectId) {
|
if (!info.value.scenarioId) {
|
||||||
const params = {
|
const params = {
|
||||||
|
projectId: props.projectInfo.projectId,
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
code: info.value.code,
|
algorithmType: info.value.algorithmType,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
};
|
};
|
||||||
addProjects(params).then((res) => {
|
addScenarios(params).then((res:any) => {
|
||||||
gettableData();
|
if(res == true) {
|
||||||
dialogVisible.value = false;
|
gettableData();
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: "新增成功",
|
||||||
|
});
|
||||||
|
stepsActive.value = 1;
|
||||||
|
} else {
|
||||||
|
ElMessage({
|
||||||
|
type: "error",
|
||||||
|
message: "新增失败",
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (info.value.projectId) {
|
} else if (info.value.scenarioId) {
|
||||||
const params = {
|
const params = {
|
||||||
name: info.value.name,
|
scenarioId: info.value.scenarioId,
|
||||||
description: info.value.description,
|
|
||||||
projectId: info.value.projectId,
|
projectId: info.value.projectId,
|
||||||
|
name: info.value.name,
|
||||||
|
algorithmType: info.value.algorithmType,
|
||||||
|
description: info.value.description,
|
||||||
};
|
};
|
||||||
updateProjects(params).then((res) => {
|
updateScenarios(params).then((res) => {
|
||||||
gettableData();
|
gettableData();
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
});
|
});
|
||||||
@ -104,10 +129,16 @@ function handleClose() {
|
|||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
if (infoForm.value != null) infoForm.value.resetFields();
|
if (infoForm.value != null) infoForm.value.resetFields();
|
||||||
}
|
}
|
||||||
|
function handleScenarioClose(){
|
||||||
|
dialogVisible.value = false;
|
||||||
|
gettableData();
|
||||||
|
if (infoForm.value != null) infoForm.value.resetFields();
|
||||||
|
|
||||||
|
}
|
||||||
//新建事故情景
|
//新建事故情景
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
name: [{ required: true, message: "请输入事故情景名称", trigger: "blur" }],
|
name: [{ required: true, message: "请输入事故情景名称", trigger: "blur" }],
|
||||||
code: [{ required: true, message: "请输入事故情景编码", trigger: "blur" }],
|
algorithmType: [{ required: true, message: "请选择算法类型", trigger: "change" }],
|
||||||
});
|
});
|
||||||
//修改事故情景
|
//修改事故情景
|
||||||
function editClick(row: any) {
|
function editClick(row: any) {
|
||||||
@ -125,9 +156,9 @@ function delAloneClick(row: any) {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let params = {
|
let params = {
|
||||||
id: row.projectId,
|
id: row.scenarioId,
|
||||||
};
|
};
|
||||||
deleteProjects(params).then(() => {
|
deleteScenarios(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: "success",
|
||||||
@ -147,12 +178,12 @@ function delClick() {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
let id = [] as any[];
|
let id = [] as any[];
|
||||||
multipleSelection.value.forEach((item: any) => {
|
multipleSelection.value.forEach((item: any) => {
|
||||||
id.push(item.projectId)
|
id.push(item.scenarioId)
|
||||||
})
|
})
|
||||||
let params = {
|
let params = {
|
||||||
ids: id,
|
ids: id,
|
||||||
};
|
};
|
||||||
deleteBatchProjects(params.ids).then(() => {
|
deleteBatchScenarios(params.ids).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "删除成功",
|
message: "删除成功",
|
||||||
@ -177,8 +208,22 @@ function dateFormat(row: any) {
|
|||||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
}
|
||||||
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getAlgorithmType()
|
||||||
gettableData();
|
gettableData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -203,8 +248,8 @@ onMounted(() => {
|
|||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
:header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
|
: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="selection" width="50" align="center"></el-table-column>
|
||||||
<el-table-column prop="name" label="事故情景名称" width="180"></el-table-column>
|
<el-table-column prop="name" label="事故情景名称" min-width="180"></el-table-column>
|
||||||
<el-table-column prop="name" label="算法模型" width="180"></el-table-column>
|
<el-table-column prop="name" label="算法模型" min-width="180"></el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="updatedAt" label="模拟时间" width="200">
|
<el-table-column prop="updatedAt" label="模拟时间" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -213,9 +258,11 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="updatedAt" label="状态" width="200">
|
<el-table-column prop="updatedAt" label="状态" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ dateFormat(scope.row.updatedAt) }}
|
<span v-if="scope.row.status == 0" style="color: #0099FF;">初始创建</span>
|
||||||
|
<span v-else-if="scope.row.status == 1" style="color: #FF9900;">进行中</span>
|
||||||
|
<span v-else style="color: #009933;">已完成</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="190">
|
<el-table-column fixed="right" label="操作" width="190">
|
||||||
@ -242,24 +289,39 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
||||||
:modal="false" draggable :before-close="handleClose" :title="title"
|
:modal="false" draggable :before-close="handleScenarioClose" title="'新增事故情景'"
|
||||||
append-to-body width="620px" height="600px">
|
append-to-body width="1000px">
|
||||||
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px">
|
<div class="scenario-setting-box">
|
||||||
<el-form-item label="事故情景编号:" prop="code">
|
<el-steps style="width: 500px;margin:0 auto " :active="stepsActive" align-center>
|
||||||
<el-input v-model="info.code" style="width: 100%" placeholder="输入事故情景编码"></el-input>
|
<el-step title="事故情景设置"/>
|
||||||
</el-form-item>
|
<el-step title="初始条件设置" />
|
||||||
<el-form-item label="事故情景名称:" prop="name">
|
<!-- <el-step title="确认模拟" /> -->
|
||||||
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" ></el-input>
|
</el-steps>
|
||||||
</el-form-item>
|
</div>
|
||||||
<el-form-item label="事故情景描述:">
|
<div class="scenario-setting-bottombox">
|
||||||
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述"></el-input>
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="140px" style="width:600px" v-if="stepsActive == 0">
|
||||||
</el-form-item>
|
<el-form-item label="事故情景名称:" prop="name">
|
||||||
<span class="dialog-footer"
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" ></el-input>
|
||||||
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
|
</el-form-item>
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-form-item label="算法类型:" prop="algorithmType">
|
||||||
<el-button type="primary" @click="confirmClick(infoForm)">确 定</el-button>
|
<el-select v-model="info.algorithmType" placeholder="请选择" style="width:100%;" clearable>
|
||||||
</span>
|
<el-option v-for="item in algorithmTypeData" :key="item.id" :label="item.dictName" :value="item.itemCode" />
|
||||||
</el-form>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="事故情景描述:">
|
||||||
|
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入事故情景描述"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <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="confirmClick(infoForm)">确 定</el-button>
|
||||||
|
</span> -->
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<el-button type="primary" @click="confirmClick(infoForm)">下一步</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -345,6 +407,10 @@ onMounted(() => {
|
|||||||
.el-dialog .el-input{
|
.el-dialog .el-input{
|
||||||
--el-input-inner-height: 38px
|
--el-input-inner-height: 38px
|
||||||
}
|
}
|
||||||
|
.el-dialog .el-select__wrapper{
|
||||||
|
height: 40px
|
||||||
|
}
|
||||||
|
|
||||||
.scenario-search-box .el-button{
|
.scenario-search-box .el-button{
|
||||||
height: 36px !important;
|
height: 36px !important;
|
||||||
}
|
}
|
||||||
@ -352,4 +418,79 @@ onMounted(() => {
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.scenario-setting-box{
|
||||||
|
width: 900px;
|
||||||
|
height: 100px;
|
||||||
|
background: inherit;
|
||||||
|
background-color: rgba(255, 255, 255, 1);
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.scenario-setting-box .el-step__icon.is-text{
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
background-color: #c9c9c9 ;
|
||||||
|
border-color: #c9c9c9 ;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.scenario-setting-box .is-finish .el-step__icon.is-text{
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
background-color: #266fff ;
|
||||||
|
border-color: #266fff ;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scenario-setting-box .is-process .el-step__icon.is-text{
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
background-color: #266fff ;
|
||||||
|
border-color: #266fff ;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.scenario-setting-box .el-step__title{
|
||||||
|
font-family: 'Arial Normal', 'Arial', sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: normal;
|
||||||
|
}
|
||||||
|
.scenario-setting-box .el-step__title.is-finish{
|
||||||
|
color: #266fff ;
|
||||||
|
}
|
||||||
|
.scenario-setting-box .el-step__title.is-process{
|
||||||
|
color: #266fff ;
|
||||||
|
}
|
||||||
|
.scenario-setting-box .el-step__line{
|
||||||
|
height: 1px !important;
|
||||||
|
background-color: #ebebeb !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scenario-setting-bottombox{
|
||||||
|
width: 900px;
|
||||||
|
height: calc(100vh - 300px);
|
||||||
|
background: inherit;
|
||||||
|
background-color: rgba(255, 255, 255, 1);
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 20px auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user