mainPage.vue 19 KB

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