mainPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <div class="mainPagePanel">
  3. <div class="myTabsBox">
  4. <el-tabs
  5. v-bind:class="{ tabPaneA: tabsList.length <= 1 }"
  6. v-model="activeName" type="card" @tab-click="pageControl">
  7. <!--
  8. <el-tab-pane label="系统监控" name="1"></el-tab-pane>
  9. <el-tab-pane label="系统概览" name="2"></el-tab-pane>
  10. -->
  11. <el-tab-pane v-for="(item, i) in tabsList" :label="item.label" :name="item.name" :key="i"></el-tab-pane>
  12. </el-tabs>
  13. </div>
  14. <div v-show="activeName === '1'" class="tabBox">
  15. <div class="boxContent">
  16. <div class="titlePanel">
  17. <div class="titlePanelBor">硬件监控</div>
  18. </div>
  19. <ul class="listPanel">
  20. <li class="shadowBox colorA">
  21. <span></span>
  22. <b>服务器数量</b>
  23. <i>{{ hardware.serverNumber || 0 }}</i>
  24. </li>
  25. <li class="shadowBox colorB">
  26. <span></span>
  27. <b>内存使用率</b>
  28. <i>{{ hardware.memoryUsage || 0 }}</i>
  29. </li>
  30. <li class="shadowBox colorC">
  31. <span></span>
  32. <b>磁盘占用率</b>
  33. <i>{{ hardware.diskUsage || 0 }}</i>
  34. </li>
  35. <li class="shadowBox colorD">
  36. <span></span>
  37. <b>CPU使用率</b>
  38. <i>{{ hardware.cpuUsage || 0 }}</i>
  39. </li>
  40. <li class="shadowBox colorE">
  41. <span></span>
  42. <b>GPU使用率</b>
  43. <i>{{ hardware.gpuUsage || 0 }}</i>
  44. </li>
  45. </ul>
  46. </div>
  47. <div class="boxContent">
  48. <div class="titlePanel">
  49. <div class="titlePanelBor">服务监控</div>
  50. </div>
  51. <ul class="listPanel listPanelB">
  52. <li class="shadowBox">
  53. <b>用户数量</b>
  54. <i>{{ serviceData.userNumber || 0 }}</i>
  55. </li>
  56. <li class="shadowBox">
  57. <b>当前在线人数</b>
  58. <i>{{ serviceData.onlineNumber || 0 }}</i>
  59. </li>
  60. <li class="shadowBox">
  61. <b>仿真节点数量</b>
  62. <i>{{ serviceData.simulationNodeNumber || 0 }}</i>
  63. </li>
  64. <li class="shadowBox">
  65. <b>仿真软件license占用数量</b>
  66. <i>{{ serviceData.simulationLicenseNumber || 0 }}</i>
  67. </li>
  68. <li class="shadowBox">
  69. <b>动力学软件license占用数量</b>
  70. <i>{{ serviceData.dynamicsLicenseNumber || 0 }}</i>
  71. </li>
  72. </ul>
  73. </div>
  74. <div class="boxContent">
  75. <div class="titlePanel">
  76. <div class="titlePanelBor">日访问人数</div>
  77. </div>
  78. <div class="chartABox shadowBox">
  79. <line-chart-main-page
  80. :dataList="dateAccessList"
  81. id="dateAccessList"
  82. >
  83. </line-chart-main-page>
  84. </div>
  85. </div>
  86. <div class="boxContent padTop20">
  87. <div class="titlePanel">
  88. <div class="titlePanelBor">服务器监控</div>
  89. </div>
  90. <div>
  91. <tableList
  92. :columns="columns"
  93. :getDataWay="getDataWay"
  94. :pagination="pagination"
  95. index
  96. >
  97. </tableList>
  98. </div>
  99. </div>
  100. </div>
  101. <div v-show="activeName === '2'" class="tabBox">
  102. <div class="boxContent padBot10">
  103. <div class="titlePanel">
  104. <div class="titlePanelBor">数据概览</div>
  105. </div>
  106. <ul class="listPanel listPanelB">
  107. <li class="shadowBox">
  108. <b>场景数量(公有)</b>
  109. <i>{{ dataOverview.GySceneNum || 0 }}</i>
  110. </li>
  111. <li class="shadowBox">
  112. <b>场景数量(私有)</b>
  113. <i>{{ dataOverview.SySceneNum || 0 }}</i>
  114. </li>
  115. <li class="shadowBox">
  116. <b>车辆配置数量</b>
  117. <i>{{ dataOverview.ConfigTotal || 0 }}</i>
  118. </li>
  119. <li class="shadowBox">
  120. <b>算法文件数量</b>
  121. <i>{{ dataOverview.fileNum || 0 }}</i>
  122. </li>
  123. <li class="shadowBox">
  124. <b>算法地址数量</b>
  125. <i>{{ dataOverview.pathNum || 0 }}</i>
  126. </li>
  127. <li class="shadowBox">
  128. <b>最大并发数量</b>
  129. <i>{{ dataOverview.maxConcurrency || 0 }}</i>
  130. </li>
  131. <li class="shadowBox">
  132. <b>当前并发数量</b>
  133. <i>{{ dataOverview.currentConcurrency || 0 }}</i>
  134. </li>
  135. </ul>
  136. </div>
  137. <div class="boxContent">
  138. <div>
  139. <el-tabs
  140. v-model="activitedPageNumA"
  141. @tab-click="pageControlA"
  142. class="tabsA"
  143. >
  144. <el-tab-pane label="运行项目" name="1">
  145. <div class="chartBBox shadowBox">
  146. <line-chart-main-page-a
  147. id="runProjectLine"
  148. :dataList="runProjectList"
  149. ></line-chart-main-page-a>
  150. </div>
  151. </el-tab-pane>
  152. <el-tab-pane label="运行任务" name="2">
  153. <div class="chartBBox shadowBox">
  154. <line-chart-main-page-a
  155. id="runTaskLine"
  156. :dataList="runTaskList"
  157. ></line-chart-main-page-a>
  158. </div>
  159. </el-tab-pane>
  160. </el-tabs>
  161. </div>
  162. </div>
  163. <div class="boxContent boxContentB">
  164. <div class="titlePanel">
  165. <div class="titlePanelBor">状态统计</div>
  166. </div>
  167. <div class="piesBox">
  168. <div class="shadowBox">
  169. <div class="title">项目运行状态统计</div>
  170. <div class="pieBox">
  171. <pie-chart-main-page
  172. id="mainPagePieA"
  173. :dataList="dataListA"
  174. stateName="nowRunState"
  175. seriesName="项目运行状态统计"
  176. ></pie-chart-main-page>
  177. </div>
  178. </div>
  179. <div class="shadowBox shadowBoxB">
  180. <div class="title">任务运行状态统计</div>
  181. <div class="pieBox">
  182. <pie-chart-main-page
  183. id="mainPagePieB"
  184. :dataList="dataListB"
  185. stateName="runState"
  186. seriesName="任务运行状态统计"
  187. ></pie-chart-main-page>
  188. </div>
  189. </div>
  190. <div class="shadowBox">
  191. <div class="title">评测等级分布</div>
  192. <div class="pieBox">
  193. <pie-chart-main-page
  194. id="mainPagePieC"
  195. :dataList="dataListC"
  196. stateName="evaluationLevel"
  197. seriesName="评测等级分布"
  198. ></pie-chart-main-page>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </template>
  206. <script>
  207. import toolbarTab from "@/components/toolbar/toolbarTab";
  208. import tableList from "@/components/grid/TableList";
  209. import lineChartMainPage from "../components/echarts/lineChartMainPage";
  210. import lineChartMainPageA from "../components/echarts/lineChartMainPageA";
  211. import pieChartMainPage from "../components/echarts/pieChartMainPage";
  212. export default {
  213. name: "mainPage", // 首页
  214. components: {
  215. toolbarTab,
  216. tableList,
  217. lineChartMainPage,
  218. lineChartMainPageA,
  219. pieChartMainPage,
  220. },
  221. data() {
  222. return {
  223. activeName: "1",
  224. activitedPageNumA: "1",
  225. tabsList:[
  226. //{label: '系统监控', name: '1'},
  227. //{label: '系统监控', name: '2'},
  228. ],
  229. pageBtnListA: [
  230. {
  231. type: "primary",
  232. title: "运行项目",
  233. key: "all",
  234. fromId: 1,
  235. method: "showAllA",
  236. plain: true,
  237. disabled: false,
  238. },
  239. {
  240. type: "primary",
  241. title: "运行任务",
  242. key: "notRead",
  243. fromId: 2,
  244. method: "showNotReadA",
  245. plain: true,
  246. disabled: false,
  247. },
  248. ],
  249. columns: [
  250. {
  251. label: "服务器ID",
  252. prop: "serverId",
  253. },
  254. {
  255. label: "服务器地址",
  256. prop: "serverAddress",
  257. },
  258. {
  259. label: "服务器类型",
  260. prop: "serverType",
  261. },
  262. {
  263. label: "CPU使用率(%)",
  264. prop: "cpuUsage",
  265. },
  266. {
  267. label: "内存使用率(%)",
  268. prop: "memoryUsage",
  269. },
  270. {
  271. label: "可用内存(G)",
  272. prop: "memoryAvailable",
  273. },
  274. {
  275. label: "磁盘使用率(%)",
  276. prop: "diskUsage",
  277. },
  278. {
  279. label: "剩余容量(G)",
  280. prop: "diskAvailable",
  281. },
  282. {
  283. label: "执行任务数量",
  284. prop: "taskNumber",
  285. },
  286. ],
  287. pagination: {
  288. //分页使用
  289. currentPage: 1,
  290. pageSize: 10,
  291. position: "right",
  292. pageSizes: [10, 30, 50, 100, 200],
  293. layout: "sizes, total, prev, pager, next, jumper",
  294. },
  295. getDataWay: {
  296. //加载表格数据
  297. dataType: "data",
  298. type: "post",
  299. data: [],
  300. param: {},
  301. },
  302. hardware: {}, // 硬件监控
  303. serviceData: {}, // 服务监控
  304. dateAccessList: [], // 日访问人数
  305. dataOverview: {}, // 数据概览
  306. runProjectList: [], // 运行项目
  307. runTaskList: [], // 运行任务
  308. // 三个饼图
  309. dataListA: [],
  310. dataListB: [],
  311. dataListC: [],
  312. };
  313. },
  314. computed: {
  315. roleCode(){
  316. return this.$store.state.roleCode
  317. }
  318. },
  319. watch:{
  320. roleCode:{
  321. handler(newV){
  322. if(newV){
  323. if(newV == '0'|| newV == '1'){
  324. this.tabsList=[
  325. {label: '服务监控', name: '1'},
  326. {label: '系统监控', name: '2'},
  327. ]
  328. this.activeName = '1'
  329. this.init()
  330. }else{
  331. this.tabsList=[
  332. {label: '系统监控', name: '2'},
  333. ]
  334. this.activeName = '2'
  335. this.init2()
  336. }
  337. }
  338. },
  339. immediate: true
  340. }
  341. },
  342. methods: {
  343. pageControl(data) {
  344. this.activeName = data.name;
  345. },
  346. pageControlA(data) {
  347. this.activitedPageNumA = data.name;
  348. },
  349. getData(url, infoObj) {
  350. this.$axios({
  351. method: "post",
  352. url,
  353. data: {},
  354. }).then((res) => {
  355. if (res.code == 200 && res.info) {
  356. this[infoObj] = res.info;
  357. } else {
  358. this.$message.error(res.message || "获取信息失败");
  359. }
  360. });
  361. },
  362. getDataOverview() {
  363. this.$axios({
  364. method: "post",
  365. url: this.$api.mainPage.queryAllNum,
  366. data: {},
  367. }).then((res) => {
  368. if (res.code == 200 && res.info) {
  369. this.dataOverview = res.info;
  370. } else {
  371. this.$message.error(res.message || "获取信息失败");
  372. }
  373. });
  374. },
  375. init() {
  376. this.getData(this.$api.mainPage.selectHardware, "hardware"); //1
  377. this.getData(this.$api.mainPage.selectService, "serviceData"); //1
  378. this.getData(this.$api.mainPage.selectAccess, "dateAccessList"); //1
  379. this.getDataWay = {
  380. dataType: "url",
  381. type: "post",
  382. data: this.$api.mainPage.selectServer,
  383. param: {},
  384. }; //1
  385. this.getData(this.$api.mainPage.queryAllNum, "dataOverview"); //2
  386. this.getData(this.$api.mainPage.selectRunProjectBySy, "runProjectList"); //2
  387. this.getData(this.$api.mainPage.selectRunTaskBySy, "runTaskList"); //2
  388. this.getData(this.$api.mainPage.selectRunProjectByState, "dataListA"); //2
  389. this.getData(this.$api.mainPage.selectRunTaskByState, "dataListB"); //2
  390. this.getData(this.$api.mainPage.selectEvaluationLevel, "dataListC"); //2
  391. },
  392. init2(){
  393. this.getData(this.$api.mainPage.queryAllNum, "dataOverview"); //2
  394. this.getData(this.$api.mainPage.selectRunProjectBySy, "runProjectList"); //2
  395. this.getData(this.$api.mainPage.selectRunTaskBySy, "runTaskList"); //2
  396. this.getData(this.$api.mainPage.selectRunProjectByState, "dataListA"); //2
  397. this.getData(this.$api.mainPage.selectRunTaskByState, "dataListB"); //2
  398. this.getData(this.$api.mainPage.selectEvaluationLevel, "dataListC"); //2
  399. },
  400. },
  401. mounted() {
  402. /* if (localStorage.getItem("Authorization")) {
  403. //this.init();
  404. }else{ //如果没有Authorization
  405. // this.$alert('用户信息过期,请重新登陆','提示',{
  406. // confirmButtonText:'确定',
  407. // callback: action => {
  408. // let loginUrl = window.location.origin + '/login'
  409. // window.location.href = loginUrl
  410. // }
  411. // })
  412. } */
  413. },
  414. };
  415. </script>
  416. <style lang='less' scoped>
  417. .mainPagePanel {
  418. padding: 20px 20px 20px 0;
  419. .tabBox {
  420. padding: 10px 30px 0;
  421. }
  422. .myTabsBox {
  423. /deep/ .el-tabs {
  424. width: auto;
  425. margin: 0;
  426. .el-tabs__nav-scroll {
  427. &:after {
  428. width: 100%;
  429. }
  430. }
  431. }
  432. /deep/.tabPaneA.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child {
  433. padding-right: 0;
  434. }
  435. }
  436. .boxContent {
  437. padding-bottom: 20px;
  438. .titlePanel {
  439. padding-bottom: 10px;
  440. }
  441. .listPanel {
  442. display: flex;
  443. flex-wrap: nowrap;
  444. color: @themeColor;
  445. li {
  446. flex: 1;
  447. display: flex;
  448. height: 10vh;
  449. padding: 10px 1%;
  450. margin-right: 3%;
  451. justify-content: space-around;
  452. align-items: center;
  453. span,
  454. i,
  455. b {
  456. display: inline-block;
  457. font-weight: normal;
  458. font-style: normal;
  459. }
  460. b {
  461. font-size: 90%;
  462. }
  463. i {
  464. font-size: 150%;
  465. }
  466. &:last-child {
  467. margin-right: 0;
  468. }
  469. }
  470. .colorA,
  471. .colorB,
  472. .colorC,
  473. .colorD,
  474. .colorE {
  475. span {
  476. width: 15%;
  477. height: 45%;
  478. }
  479. }
  480. .colorA {
  481. color: @themeColor;
  482. span {
  483. // width: 36px;
  484. // height: 38px;
  485. background: url("../assets/common/image/index/hw1.png")
  486. center center no-repeat;
  487. background-size: contain;
  488. }
  489. }
  490. .colorB {
  491. color: #8479ff;
  492. span {
  493. background: url("../assets/common/image/index/hw2.png")
  494. center center no-repeat;
  495. background-size: contain;
  496. }
  497. }
  498. .colorC {
  499. color: #ffc935;
  500. span {
  501. background: url("../assets/common/image/index/hw3.png")
  502. center center no-repeat;
  503. background-size: contain;
  504. }
  505. }
  506. .colorD {
  507. color: #bf5bff;
  508. span {
  509. background: url("../assets/common/image/index/hw4.png")
  510. center center no-repeat;
  511. background-size: contain;
  512. }
  513. }
  514. .colorE {
  515. color: #ff6161;
  516. span {
  517. background: url("../assets/common/image/index/hw5.png")
  518. center center no-repeat;
  519. background-size: contain;
  520. }
  521. }
  522. }
  523. .listPanelB {
  524. li {
  525. display: flex;
  526. flex-direction: column;
  527. i,
  528. b {
  529. display: block;
  530. text-align: center;
  531. }
  532. }
  533. }
  534. .piesBox {
  535. display: flex;
  536. > div {
  537. flex: 1;
  538. width: 30%;
  539. }
  540. .title {
  541. padding: 10px 0;
  542. text-align: center;
  543. font-size: 16px;
  544. line-height: 1;
  545. font-weight: bold;
  546. }
  547. .shadowBoxB {
  548. margin: 0 50px;
  549. }
  550. .shadowBox {
  551. padding: 0;
  552. }
  553. }
  554. }
  555. .padTop20 {
  556. padding-top: 20px;
  557. }
  558. .padBot10 {
  559. padding-bottom: 10px;
  560. }
  561. /deep/ .el-tabs__item.is-active {
  562. color: @themeColor;
  563. }
  564. .chartABox {
  565. height: calc(80vh - 260px);
  566. }
  567. .chartBBox {
  568. height: calc(48vh - 165px);
  569. overflow: hidden;
  570. }
  571. .chartABox.shadowBox,
  572. .chartBBox.shadowBox {
  573. padding: 0;
  574. }
  575. .boxContentB {
  576. padding-bottom: 0;
  577. }
  578. .pieBox {
  579. height: calc(42vh - 165px);
  580. .shadowBox {
  581. padding: 0;
  582. }
  583. }
  584. .tabsA /deep/ .el-tabs__nav-wrap::after {
  585. background-color: @themeColor;
  586. }
  587. .tabsA /deep/ .el-tabs__active-bar {
  588. height: 4px;
  589. }
  590. }
  591. </style>