123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623 |
- <template>
- <div class="mainPagePanel">
- <div class="myTabsBox">
- <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
- <!--
- <el-tab-pane label="系统监控" name="1"></el-tab-pane>
- <el-tab-pane label="系统概览" name="2"></el-tab-pane>
- -->
- <el-tab-pane v-for="(item, i) in tabsList" :label="item.label" :name="item.name" :key="i"></el-tab-pane>
- </el-tabs>
- </div>
- <div v-show="activeName === '1'" class="tabBox">
- <div class="boxContent">
- <div class="titlePanel">
- <div class="titlePanelBor">硬件监控</div>
- </div>
- <ul class="listPanel">
- <li class="shadowBox colorA">
- <span></span>
- <b>服务器数量</b>
- <i>{{ hardware.serverNumber || 0 }}</i>
- </li>
- <li class="shadowBox colorB">
- <span></span>
- <b>内存使用率</b>
- <i>{{ hardware.memoryUsage || 0 }}</i>
- </li>
- <li class="shadowBox colorC">
- <span></span>
- <b>磁盘占用率</b>
- <i>{{ hardware.diskUsage || 0 }}</i>
- </li>
- <li class="shadowBox colorD">
- <span></span>
- <b>CPU使用率</b>
- <i>{{ hardware.cpuUsage || 0 }}</i>
- </li>
- <li class="shadowBox colorE">
- <span></span>
- <b>GPU使用率</b>
- <i>{{ hardware.gpuUsage || 0 }}</i>
- </li>
- </ul>
- </div>
- <div class="boxContent">
- <div class="titlePanel">
- <div class="titlePanelBor">服务监控</div>
- </div>
- <ul class="listPanel listPanelB">
- <li class="shadowBox">
- <b>用户数量</b>
- <i>{{ serviceData.userNumber || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>当前在线人数</b>
- <i>{{ serviceData.onlineNumber || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>仿真节点数量</b>
- <i>{{ serviceData.simulationNodeNumber || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>仿真软件license占用数量</b>
- <i>{{ serviceData.simulationLicenseNumber || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>动力学软件license占用数量</b>
- <i>{{ serviceData.dynamicsLicenseNumber || 0 }}</i>
- </li>
- </ul>
- </div>
- <div class="boxContent">
- <div class="titlePanel">
- <div class="titlePanelBor">日访问人数</div>
- </div>
- <div class="chartABox shadowBox">
- <line-chart-main-page
- :dataList="dateAccessList"
- id="dateAccessList"
- >
- </line-chart-main-page>
- </div>
- </div>
- <div class="boxContent padTop20">
- <div class="titlePanel">
- <div class="titlePanelBor">服务器监控</div>
- </div>
- <div>
- <tableList
- :columns="columns"
- :getDataWay="getDataWay"
- :pagination="pagination"
- index
- >
- </tableList>
- </div>
- </div>
- </div>
- <div v-show="activeName === '2'" class="tabBox">
- <div class="boxContent padBot10">
- <div class="titlePanel">
- <div class="titlePanelBor">数据概览</div>
- </div>
- <ul class="listPanel listPanelB">
- <li class="shadowBox">
- <b>场景数量</b>
- <i>{{ dataOverview.SceneNum || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>车辆配置数量</b>
- <i>{{ dataOverview.ConfigTotal || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>算法文件数量</b>
- <i>{{ dataOverview.fileNum || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>算法地址数量</b>
- <i>{{ dataOverview.pathNum || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>最大并发数量</b>
- <i>{{ dataOverview.maxConcurrency || 0 }}</i>
- </li>
- <li class="shadowBox">
- <b>当前并发数量</b>
- <i>{{ dataOverview.currentConcurrency || 0 }}</i>
- </li>
- </ul>
- </div>
- <div class="boxContent">
- <div>
- <el-tabs
- v-model="activitedPageNumA"
- @tab-click="pageControlA"
- class="tabsA"
- >
- <el-tab-pane label="运行项目" name="1">
- <div class="chartBBox shadowBox">
- <line-chart-main-page-a
- id="runProjectLine"
- :dataList="runProjectList"
- ></line-chart-main-page-a>
- </div>
- </el-tab-pane>
- <el-tab-pane label="运行任务" name="2">
- <div class="chartBBox shadowBox">
- <line-chart-main-page-a
- id="runTaskLine"
- :dataList="runTaskList"
- ></line-chart-main-page-a>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
- </div>
- <div class="boxContent boxContentB">
- <div class="titlePanel">
- <div class="titlePanelBor">状态统计</div>
- </div>
- <div class="piesBox">
- <div class="shadowBox">
- <div class="title">项目运行状态统计</div>
- <div class="pieBox">
- <pie-chart-main-page
- id="mainPagePieA"
- :dataList="dataListA"
- stateName="nowRunState"
- seriesName="项目运行状态统计"
- ></pie-chart-main-page>
- </div>
- </div>
- <div class="shadowBox shadowBoxB">
- <div class="title">任务运行状态统计</div>
- <div class="pieBox">
- <pie-chart-main-page
- id="mainPagePieB"
- :dataList="dataListB"
- stateName="runState"
- seriesName="任务运行状态统计"
- ></pie-chart-main-page>
- </div>
- </div>
- <div class="shadowBox">
- <div class="title">评测等级分布</div>
- <div class="pieBox">
- <pie-chart-main-page
- id="mainPagePieC"
- :dataList="dataListC"
- stateName="evaluationLevel"
- seriesName="评测等级分布"
- ></pie-chart-main-page>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import toolbarTab from "@/components/toolbar/toolbarTab";
- import tableList from "@/components/grid/TableList";
- import lineChartMainPage from "../components/echarts/lineChartMainPage";
- import lineChartMainPageA from "../components/echarts/lineChartMainPageA";
- import pieChartMainPage from "../components/echarts/pieChartMainPage";
- export default {
- name: "mainPage", // 首页
- components: {
- toolbarTab,
- tableList,
- lineChartMainPage,
- lineChartMainPageA,
- pieChartMainPage,
- },
- data() {
- return {
- activeName: "1",
- activitedPageNumA: "1",
- tabsList:[
- //{label: '系统监控', name: '1'},
- //{label: '系统监控', name: '2'},
- ],
- pageBtnListA: [
- {
- type: "primary",
- title: "运行项目",
- key: "all",
- fromId: 1,
- method: "showAllA",
- plain: true,
- disabled: false,
- },
- {
- type: "primary",
- title: "运行任务",
- key: "notRead",
- fromId: 2,
- method: "showNotReadA",
- plain: true,
- disabled: false,
- },
- ],
- columns: [
- {
- label: "服务器ID",
- prop: "serverId",
- },
- {
- label: "服务器地址",
- prop: "serverAddress",
- },
- {
- label: "服务器类型",
- prop: "serverType",
- },
- {
- label: "CPU使用率(%)",
- prop: "cpuUsage",
- },
- {
- label: "内存使用率(%)",
- prop: "memoryUsage",
- },
- {
- label: "可用内存(G)",
- prop: "memoryAvailable",
- },
- {
- label: "磁盘使用率(%)",
- prop: "diskUsage",
- },
- {
- label: "剩余容量(G)",
- prop: "diskAvailable",
- },
- {
- label: "执行任务数量",
- prop: "taskNumber",
- },
- ],
- pagination: {
- //分页使用
- currentPage: 1,
- pageSize: 10,
- position: "right",
- pageSizes: [10, 30, 50, 100, 200],
- layout: "sizes, total, prev, pager, next, jumper",
- },
- getDataWay: {
- //加载表格数据
- dataType: "data",
- type: "post",
- data: [],
- param: {},
- },
- hardware: {}, // 硬件监控
- serviceData: {}, // 服务监控
- dateAccessList: [], // 日访问人数
- dataOverview: {}, // 数据概览
- runProjectList: [], // 运行项目
- runTaskList: [], // 运行任务
- // 三个饼图
- dataListA: [],
- dataListB: [],
- dataListC: [],
- };
- },
- computed: {
- roleCode(){
- return this.$store.state.roleCode
- }
- },
- watch:{
- roleCode(newV){
- if(newV == '0'|| newV == '1'){
- this.tabsList=[
- {label: '系统监控', name: '1'},
- {label: '系统监控', name: '2'},
- ]
- this.activeName = '1'
- }else{
- this.tabsList=[
- {label: '系统监控', name: '2'},
- ]
- this.activeName = '2'
- }
- }
- },
- methods: {
- pageControl(data) {
- this.activeName = data.name;
- },
- pageControlA(data) {
- this.activitedPageNumA = data.name;
- },
- getData(url, infoObj) {
- this.$axios({
- method: "post",
- url,
- data: {},
- }).then((res) => {
- if (res.code == 200 && res.info) {
- this[infoObj] = res.info;
- } else {
- this.$message.error(res.message || "获取信息失败");
- }
- });
- },
- getDataOverview() {
- this.$axios({
- method: "post",
- url: this.$api.mainPage.queryAllNum,
- data: {},
- }).then((res) => {
- if (res.code == 200 && res.info) {
- this.dataOverview = res.info;
- } else {
- this.$message.error(res.message || "获取信息失败");
- }
- });
- },
- init() {
- this.getData(this.$api.mainPage.selectHardware, "hardware");
- this.getData(this.$api.mainPage.selectService, "serviceData");
- this.getData(this.$api.mainPage.selectAccess, "dateAccessList");
- this.getDataWay = {
- dataType: "url",
- type: "post",
- data: this.$api.mainPage.selectServer,
- param: {},
- };
- this.getData(this.$api.mainPage.queryAllNum, "dataOverview");
- this.getData(
- this.$api.mainPage.selectRunProjectBySy,
- "runProjectList"
- );
- this.getData(this.$api.mainPage.selectRunTaskBySy, "runTaskList");
- this.getData(
- this.$api.mainPage.selectRunProjectByState,
- "dataListA"
- );
- this.getData(this.$api.mainPage.selectRunTaskByState, "dataListB");
- this.getData(this.$api.mainPage.selectEvaluationLevel, "dataListC");
- },
- },
- mounted() {
- if (localStorage.getItem("Authorization")) {
- this.init();
- }else{ //如果没有Authorization
- /*this.$alert('用户信息过期,请重新登陆','提示',{
- confirmButtonText:'确定',
- callback: action => {
- let loginUrl = window.location.origin + '/login'
- window.location.href = loginUrl
- }
- })*/
- }
- },
- };
- </script>
- <style lang='less' scoped>
- .mainPagePanel {
- padding: 20px 20px 20px 0;
- .tabBox {
- padding: 10px 30px 0;
- }
- .myTabsBox {
- /deep/ .el-tabs {
- width: auto;
- margin: 0;
- .el-tabs__nav-scroll {
- &:after {
- width: 100%;
- }
- }
- }
- }
- .boxContent {
- padding-bottom: 20px;
- .titlePanel {
- padding-bottom: 10px;
- }
- .listPanel {
- display: flex;
- flex-wrap: nowrap;
- color: @themeColor;
- li {
- flex: 1;
- display: flex;
- height: 10vh;
- padding: 10px 1%;
- margin-right: 3%;
- justify-content: space-around;
- align-items: center;
- span,
- i,
- b {
- display: inline-block;
- font-weight: normal;
- font-style: normal;
- }
- b {
- font-size: 90%;
- }
- i {
- font-size: 150%;
- }
- &:last-child {
- margin-right: 0;
- }
- }
- .colorA,
- .colorB,
- .colorC,
- .colorD,
- .colorE {
- span {
- width: 15%;
- height: 45%;
- }
- }
- .colorA {
- color: @themeColor;
- span {
- // width: 36px;
- // height: 38px;
- background: url("../assets/common/image/index/hw1.png")
- center center no-repeat;
- background-size: contain;
- }
- }
- .colorB {
- color: #8479ff;
- span {
- background: url("../assets/common/image/index/hw2.png")
- center center no-repeat;
- background-size: contain;
- }
- }
- .colorC {
- color: #ffc935;
- span {
- background: url("../assets/common/image/index/hw3.png")
- center center no-repeat;
- background-size: contain;
- }
- }
- .colorD {
- color: #bf5bff;
- span {
- background: url("../assets/common/image/index/hw4.png")
- center center no-repeat;
- background-size: contain;
- }
- }
- .colorE {
- color: #ff6161;
- span {
- background: url("../assets/common/image/index/hw5.png")
- center center no-repeat;
- background-size: contain;
- }
- }
- }
- .listPanelB {
- li {
- display: flex;
- flex-direction: column;
- i,
- b {
- display: block;
- text-align: center;
- }
- }
- }
- .piesBox {
- display: flex;
- > div {
- flex: 1;
- width: 30%;
- }
- .title {
- padding: 10px 0;
- text-align: center;
- font-size: 16px;
- line-height: 1;
- font-weight: bold;
- }
- .shadowBoxB {
- margin: 0 50px;
- }
- .shadowBox {
- padding: 0;
- }
- }
- }
- .padTop20 {
- padding-top: 20px;
- }
- .padBot10 {
- padding-bottom: 10px;
- }
- /deep/ .el-tabs__item.is-active {
- color: @themeColor;
- }
- .chartABox {
- height: calc(80vh - 260px);
- }
- .chartBBox {
- height: calc(48vh - 165px);
- overflow: hidden;
- }
- .chartABox.shadowBox,
- .chartBBox.shadowBox {
- padding: 0;
- }
- .boxContentB {
- padding-bottom: 0;
- }
- .pieBox {
- height: calc(42vh - 165px);
- .shadowBox {
- padding: 0;
- }
- }
- .tabsA /deep/ .el-tabs__nav-wrap::after {
- background-color: @themeColor;
- }
- .tabsA /deep/ .el-tabs__active-bar {
- height: 4px;
- }
- }
- </style>
|