新增场景模块
This commit is contained in:
parent
731f5fadad
commit
64f1b0dae7
@ -9,8 +9,9 @@ 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'
|
||||||
|
|
||||||
|
const isScenario = ref(false) //是否展示历史模拟场景
|
||||||
// 搜索框
|
// 搜索框
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
current: 1,
|
current: 1,
|
||||||
@ -115,7 +116,10 @@ function editClick(row: any) {
|
|||||||
info.value = JSON.parse(JSON.stringify(row));
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
|
function simulationClick(row: any) {
|
||||||
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
|
isScenario.value = true;
|
||||||
|
}
|
||||||
//删除项目
|
//删除项目
|
||||||
function delAloneClick(row: any) {
|
function delAloneClick(row: any) {
|
||||||
ElMessageBox.confirm("确定删除此项目吗?", "删除提示", {
|
ElMessageBox.confirm("确定删除此项目吗?", "删除提示", {
|
||||||
@ -219,9 +223,10 @@ onMounted(() => {
|
|||||||
|
|
||||||
<img src="@/assets/table/edit.png" alt="" title="修改"
|
<img src="@/assets/table/edit.png" alt="" title="修改"
|
||||||
@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/design.png" alt="" title="分析设计"
|
||||||
style="cursor: pointer; ">
|
style="cursor: pointer; ">
|
||||||
<img src="@/assets/table/simulation.png" alt="" title="模拟分析"
|
<img src="@/assets/table/simulation.png" alt="" title="模拟分析"
|
||||||
|
@click="simulationClick(scope.row)"
|
||||||
style="cursor: pointer; ">
|
style="cursor: pointer; ">
|
||||||
<img src="@/assets/table/export.png" alt="" title="导出项目工程"
|
<img src="@/assets/table/export.png" alt="" title="导出项目工程"
|
||||||
style="cursor: pointer; ">
|
style="cursor: pointer; ">
|
||||||
@ -245,7 +250,7 @@ onMounted(() => {
|
|||||||
<el-form-item label="项目名称:" prop="name">
|
<el-form-item label="项目名称:" prop="name">
|
||||||
<el-input v-model="info.name" style="width: 100%" placeholder="输入项目名称" ></el-input>
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入项目名称" ></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色描述:">
|
<el-form-item label="项目描述:">
|
||||||
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入项目描述"></el-input>
|
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入项目描述"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<span class="dialog-footer"
|
<span class="dialog-footer"
|
||||||
@ -255,6 +260,15 @@ onMounted(() => {
|
|||||||
</span>
|
</span>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog v-model="isScenario" :close-on-click-modal="false"
|
||||||
|
:modal="false" draggable :before-close="handleClose" title="历史模拟分析"
|
||||||
|
append-to-body width="1142px" height="600px">
|
||||||
|
<Scenario v-if="isScenario"
|
||||||
|
:project="info" ref="Scenario" @close="dialogVisible = false" />
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -284,6 +298,7 @@ onMounted(() => {
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
@ -339,10 +354,10 @@ onMounted(() => {
|
|||||||
--el-input-inner-height: 38px
|
--el-input-inner-height: 38px
|
||||||
}
|
}
|
||||||
.project-box .el-button{
|
.project-box .el-button{
|
||||||
height: 40px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
.el-dialog .el-button{
|
.el-dialog .el-button{
|
||||||
height: 38px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
355
business-css/frontend/src/views/component/scenario/index.vue
Normal file
355
business-css/frontend/src/views/component/scenario/index.vue
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: "scenario-事故情景",
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, nextTick } from "vue";
|
||||||
|
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects} from "@/api/business/project";
|
||||||
|
import Page from '@/components/Pagination/page.vue'
|
||||||
|
|
||||||
|
|
||||||
|
// 搜索框
|
||||||
|
const queryParams = ref({
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
querystr: ''
|
||||||
|
});
|
||||||
|
//分页 总条数
|
||||||
|
const total = ref()
|
||||||
|
//定义表格数据
|
||||||
|
|
||||||
|
const tableData: any = ref([]);
|
||||||
|
const multipleSelection = ref([]);
|
||||||
|
// 表格加载
|
||||||
|
const loading = ref(false)
|
||||||
|
function gettableData() {
|
||||||
|
let params = {
|
||||||
|
name: input.value,
|
||||||
|
pageNum: queryParams.value.current,
|
||||||
|
pageSize: queryParams.value.size,
|
||||||
|
};
|
||||||
|
loading.value = true;
|
||||||
|
searchProjectsLsit(params).then((result:any) => {
|
||||||
|
tableData.value = result.records;
|
||||||
|
total.value = result.total;
|
||||||
|
loading.value = false;
|
||||||
|
}).catch((err) => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//表格多选事件
|
||||||
|
function handleSelectionChange(val: any) {
|
||||||
|
multipleSelection.value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const infoForm = ref();
|
||||||
|
//搜索内容及点击搜索按钮
|
||||||
|
const input = ref("");
|
||||||
|
//新建事故情景
|
||||||
|
const title = ref("");
|
||||||
|
const info: any = ref({
|
||||||
|
name: "",
|
||||||
|
code: "",
|
||||||
|
description: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const dialogVisible = ref(false);
|
||||||
|
function addClick() {
|
||||||
|
title.value = "新增事故情景";
|
||||||
|
info.value = {
|
||||||
|
name: "",
|
||||||
|
code: "",
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
dialogVisible.value = true;
|
||||||
|
}
|
||||||
|
//新建事故情景-确认按钮/修改按钮
|
||||||
|
function confirmClick(formEl: any) {
|
||||||
|
console.log(info.value)
|
||||||
|
formEl.validate((valid: any) => {
|
||||||
|
if (valid) {
|
||||||
|
|
||||||
|
if (!info.value.projectId) {
|
||||||
|
const params = {
|
||||||
|
name: info.value.name,
|
||||||
|
code: info.value.code,
|
||||||
|
description: info.value.description,
|
||||||
|
};
|
||||||
|
addProjects(params).then((res) => {
|
||||||
|
gettableData();
|
||||||
|
dialogVisible.value = false;
|
||||||
|
});
|
||||||
|
} else if (info.value.projectId) {
|
||||||
|
const params = {
|
||||||
|
name: info.value.name,
|
||||||
|
description: info.value.description,
|
||||||
|
projectId: info.value.projectId,
|
||||||
|
};
|
||||||
|
updateProjects(params).then((res) => {
|
||||||
|
gettableData();
|
||||||
|
dialogVisible.value = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//新建角色-取消按钮
|
||||||
|
function handleClose() {
|
||||||
|
dialogVisible.value = false;
|
||||||
|
if (infoForm.value != null) infoForm.value.resetFields();
|
||||||
|
}
|
||||||
|
//新建事故情景
|
||||||
|
const rules = ref({
|
||||||
|
name: [{ required: true, message: "请输入事故情景名称", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "请输入事故情景编码", trigger: "blur" }],
|
||||||
|
});
|
||||||
|
//修改事故情景
|
||||||
|
function editClick(row: any) {
|
||||||
|
title.value = "修改事故情景";
|
||||||
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
|
dialogVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除事故情景
|
||||||
|
function delAloneClick(row: any) {
|
||||||
|
ElMessageBox.confirm("确定删除此事故情景吗?", "删除提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
let params = {
|
||||||
|
id: row.projectId,
|
||||||
|
};
|
||||||
|
deleteProjects(params).then(() => {
|
||||||
|
gettableData();
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: "删除成功",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 多选删除?
|
||||||
|
function delClick() {
|
||||||
|
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
let id = [] as any[];
|
||||||
|
multipleSelection.value.forEach((item: any) => {
|
||||||
|
id.push(item.projectId)
|
||||||
|
})
|
||||||
|
let params = {
|
||||||
|
ids: id,
|
||||||
|
};
|
||||||
|
deleteBatchProjects(params.ids).then(() => {
|
||||||
|
gettableData();
|
||||||
|
ElMessage({
|
||||||
|
message: "删除成功",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function dateFormat(row: any) {
|
||||||
|
const daterc = row;
|
||||||
|
if (daterc != null) {
|
||||||
|
var date = new Date(daterc);
|
||||||
|
var year = date.getFullYear();
|
||||||
|
var month =
|
||||||
|
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||||
|
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||||
|
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||||
|
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||||
|
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||||
|
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||||
|
// 拼接
|
||||||
|
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
gettableData();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="scenario-box">
|
||||||
|
<div class="conductscenario-bg-box">
|
||||||
|
<div class="scenario-search-box"
|
||||||
|
style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;margin-bottom: 10px">
|
||||||
|
<div style="display: flex;display: -webkit-flex;">
|
||||||
|
<el-input v-model="input" placeholder="请输入事故情景名称" @keyup.enter="gettableData" style="width: 200px" clearable />
|
||||||
|
<el-button type="primary" style="margin-left: 10px" @click="gettableData">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" @click="addClick">
|
||||||
|
新增</el-button>
|
||||||
|
<el-button :type="multipleSelection.length > 0 ? 'primary' : ''"
|
||||||
|
:disabled="multipleSelection.length <= 0" @click="delClick">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 260px);margin-bottom: 10px;" border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
: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 prop="name" label="事故情景名称" width="180"></el-table-column>
|
||||||
|
<el-table-column prop="name" label="算法模型" width="180"></el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="updatedAt" label="模拟时间" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.updatedAt != null">{{ dateFormat(scope.row.updatedAt) }}</span>
|
||||||
|
<span v-else>--</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="updatedAt" label="状态" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ dateFormat(scope.row.updatedAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column fixed="right" label="操作" width="190">
|
||||||
|
<template #default="scope">
|
||||||
|
<span
|
||||||
|
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
|
||||||
|
|
||||||
|
<img src="@/assets/table/edit.png" alt="" title="修改"
|
||||||
|
@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="删除"
|
||||||
|
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Page :total="total" v-model:size="queryParams.size" v-model:current="queryParams.current" @pagination="gettableData()" ></Page>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
||||||
|
:modal="false" draggable :before-close="handleClose" :title="title"
|
||||||
|
append-to-body width="620px" height="600px">
|
||||||
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="事故情景编号:" prop="code">
|
||||||
|
<el-input v-model="info.code" style="width: 100%" placeholder="输入事故情景编码"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="事故情景名称:" prop="name">
|
||||||
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入事故情景名称" ></el-input>
|
||||||
|
</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>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scenario-box {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node__content) {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
display: block;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conductscenario-bg-box {
|
||||||
|
padding: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100vh - 130px);
|
||||||
|
overflow: auto;
|
||||||
|
background-color: rgba(255, 255, 255, 1);
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
height: 1px;
|
||||||
|
background: rgba(240, 241, 242, 1);
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menuspan {
|
||||||
|
display: inline-block;
|
||||||
|
width: 120px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: "微软雅黑";
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
color: #787878;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.el-dialog {
|
||||||
|
padding: 0 !important;
|
||||||
|
border-radius: 10px !important;
|
||||||
|
border: 1px solid #363636 !important;
|
||||||
|
}
|
||||||
|
.el-dialog .el-dialog__header{
|
||||||
|
display: flex;
|
||||||
|
display: -webkit-flex;
|
||||||
|
justify-content: flex-start;-webkit-justify-content: flex-start;
|
||||||
|
align-items: center;-webkit-align-items: center;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: #f1f3f8 !important;
|
||||||
|
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #1B1B1B;
|
||||||
|
text-align: left;
|
||||||
|
border-radius: 10px 10px 0 0;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
.el-dialog .el-dialog__close{
|
||||||
|
font-size: 22px;
|
||||||
|
color: rgb(80, 80, 80);
|
||||||
|
}
|
||||||
|
.el-dialog .el-dialog__headerbtn{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.el-dialog .el-dialog__body{
|
||||||
|
padding: 20px 40px !important;
|
||||||
|
}
|
||||||
|
.el-dialog .el-input{
|
||||||
|
--el-input-inner-height: 38px
|
||||||
|
}
|
||||||
|
.scenario-search-box .el-button{
|
||||||
|
height: 36px !important;
|
||||||
|
}
|
||||||
|
.el-dialog .el-button{
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -593,7 +593,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="draggable">
|
<div class="draggable">
|
||||||
<el-table v-loading="loading" ref="multipleTable" :data="tableData" default-expand-all tooltip-effect="dark"
|
<el-table v-loading="loading" ref="multipleTable" :data="tableData" default-expand-all tooltip-effect="dark"
|
||||||
style="width: 100%;height: calc(104vh - 230px)" row-key="id" border
|
style="width: 100%;height: calc(100vh - 200px)" row-key="id" border
|
||||||
: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 label="菜单标题" width="250" prop="name" show-overflow-tooltip>
|
<el-table-column label="菜单标题" width="250" prop="name" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user