Status.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <HeaderNav @typeFlag="typeFlag" :isAll="true" />
  3. <div class="status">
  4. <el-scrollbar>
  5. <el-row
  6. class="simp_content"
  7. style="box-sizing: border-box"
  8. v-if="datas.length"
  9. >
  10. <el-col v-for="(data, index) of datas" :key="index" :span="4.5">
  11. <StatusPanel :data="data"></StatusPanel>
  12. </el-col>
  13. </el-row>
  14. </el-scrollbar>
  15. </div>
  16. </template>
  17. <script>
  18. import StatusPanel from "@/views/stateMonitor/Status/components/status-panel.vue";
  19. import HeaderNav from "@/components/headerNav/index.vue";
  20. import { getStatusDatas } from "@/api/monitor/index.js";
  21. export default {
  22. // 名称
  23. name: "Status",
  24. // 使用组件
  25. components: {
  26. StatusPanel,
  27. HeaderNav,
  28. },
  29. // 数据
  30. data() {
  31. return {
  32. timmer: null, // 遮罩开关
  33. sourceMap: {}, // 核心数据
  34. datas: [],
  35. // wpId1: "",
  36. wpId: "",
  37. dwkGzqd: "",
  38. plGzqd: "",
  39. zhGzqd: "",
  40. mchGzqd: "",
  41. hzjGzqd: "",
  42. activeTab: "all",
  43. tabIndex: 0,
  44. enterpriseIndex: "all",
  45. };
  46. },
  47. methods: {
  48. // 头部tab选择
  49. typeFlag(activeTab, enterpriseIndex) {
  50. this.activeTab = activeTab;
  51. this.tabIndex = activeTab == "all" ? 0 : activeTab == "fc" ? -1 : -2;
  52. this.enterpriseIndex = enterpriseIndex;
  53. this.$nextTick(() => {
  54. this.requestData();
  55. });
  56. },
  57. // 请求服务
  58. requestData() {
  59. getStatusDatas({
  60. company:
  61. this.enterpriseIndex == "all" ? "0" : this.enterpriseIndex.toString(),
  62. type: this.tabIndex.toString(),
  63. }).then(({ data }) => {
  64. if (data) {
  65. this.datas = data.data;
  66. } else {
  67. this.datas = [];
  68. }
  69. });
  70. },
  71. },
  72. watch: {
  73. },
  74. created() {
  75. let that = this;
  76. that.$nextTick(() => {
  77. that.requestData();
  78. });
  79. },
  80. mounted() {
  81. this.timmer = setInterval(() => {
  82. this.requestData();
  83. }, 5000);
  84. },
  85. unmounted() {
  86. clearInterval(this.timmer);
  87. this.timmer = null;
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .status {
  93. height: calc(100vh - 7.222vh);
  94. overflow: hidden;
  95. .el-col + .el-col {
  96. padding-left: 0;
  97. }
  98. .simp_content {
  99. display: grid;
  100. justify-content: space-evenly;
  101. grid-template-columns: repeat(auto-fill, 352px);
  102. height: 100;
  103. overflow-y: auto;
  104. overflow-x: hidden;
  105. }
  106. }
  107. // .light-status {
  108. // .simp_content {
  109. // display: grid;
  110. // justify-content: space-evenly;
  111. // grid-template-columns: repeat(auto-fill, 352px);
  112. // height: calc(100vh - 117px);
  113. // overflow-y: auto;
  114. // overflow-x: hidden;
  115. // }
  116. // .simp_ui {
  117. // width: 353px;
  118. // height: 229px;
  119. // background: #fff;
  120. // border-radius: 8px;
  121. // margin-bottom: 11px;
  122. // padding: 0 12px;
  123. // li {
  124. // display: flex;
  125. // margin: 0 auto;
  126. // }
  127. // }
  128. // }
  129. // .dark-status {
  130. // .simp_content {
  131. // display: grid;
  132. // justify-content: space-evenly;
  133. // grid-template-columns: repeat(auto-fill, 352px);
  134. // height: calc(100vh - 117px);
  135. // overflow-y: auto;
  136. // overflow-x: hidden;
  137. // }
  138. // .simp_ui {
  139. // width: 353px;
  140. // height: 229px;
  141. // background: rgba(96, 103, 105, 0.2);
  142. // border-radius: 8px;
  143. // margin-bottom: 11px;
  144. // padding: 0 12px;
  145. // li {
  146. // display: flex;
  147. // margin: 0 auto;
  148. // }
  149. // }
  150. // }
  151. </style>