index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="datavScr box">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <div id="index" ref="appRef">
  7. <div class="bg">
  8. <dv-loading v-if="loading">Loading...</dv-loading>
  9. <div v-else class="host-body">
  10. <div class="d-flex jc-center">
  11. <dv-decoration-10 class="dv-dec-10" />
  12. <div class="d-flex jc-center">
  13. <dv-decoration-8 class="dv-dec-8" :color="decorationColor" />
  14. <div class="title">
  15. <span class="title-text">数据可视化面板</span>
  16. <dv-decoration-6
  17. class="dv-dec-6"
  18. :reverse="true"
  19. :color="['#50e3c2', '#67a1e5']"
  20. />
  21. </div>
  22. <dv-decoration-8
  23. class="dv-dec-8"
  24. :reverse="true"
  25. :color="decorationColor"
  26. />
  27. </div>
  28. <dv-decoration-10 class="dv-dec-10-s" />
  29. </div>
  30. <!-- 第二行 -->
  31. <div class="d-flex jc-between px-2">
  32. <div class="d-flex aside-width">
  33. <div class="react-left ml-4 react-l-s">
  34. <span class="react-left"></span>
  35. <span class="text">今日相关</span>
  36. </div>
  37. <div class="react-left ml-3">
  38. <span class="text">数据概览</span>
  39. </div>
  40. </div>
  41. <div class="d-flex aside-width">
  42. <div class="react-right bg-color-blue mr-3">
  43. <span class="text fw-b">待处理</span>
  44. </div>
  45. <div class="react-right mr-4 react-l-s">
  46. <span class="react-after"></span>
  47. <span class="text" style="white-space: nowrap"
  48. >{{ dateYear }} {{ dateWeek }} {{ dateDay }}</span
  49. >
  50. </div>
  51. </div>
  52. </div>
  53. <div class="body-box" v-if="initFlag">
  54. <!-- 第三行数据 -->
  55. <div class="content-box">
  56. <div>
  57. <dv-border-box-12>
  58. <centerLeft1 />
  59. </dv-border-box-12>
  60. </div>
  61. <div>
  62. <dv-border-box-12>
  63. <centerLeft2 />
  64. </dv-border-box-12>
  65. </div>
  66. <!-- 中间 -->
  67. <div>
  68. <center />
  69. </div>
  70. <!-- 中间 -->
  71. <!-- <div>
  72. <dv-border-box-13>
  73. <centerRight2 />
  74. </dv-border-box-13>
  75. </div> -->
  76. <div>
  77. <dv-border-box-13>
  78. <centerRight1 />
  79. </dv-border-box-13>
  80. </div>
  81. </div>
  82. <!-- 第四行数据 -->
  83. <div class="bototm-box">
  84. <dv-border-box-13>
  85. <bottomLeft />
  86. </dv-border-box-13>
  87. <dv-border-box-12>
  88. <bottomRight />
  89. </dv-border-box-12>
  90. </div>
  91. </div>
  92. <!-- 防止数据更新闪白屏 -->
  93. <div style="width:100%;height:100vh;" v-if="!initFlag"></div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div v-else>
  99. <no-auth></no-auth>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. // import drawMixin from "../drawMixin";
  105. import { mapGetters } from "vuex";
  106. import resToken from "@/mixins/resToken";
  107. import { formatTime } from "../index.js";
  108. import centerLeft1 from "./centerLeft1";
  109. import centerLeft2 from "./centerLeft2";
  110. import centerRight1 from "./centerRight1";
  111. import centerRight2 from "./centerRight2";
  112. import center from "./center";
  113. import bottomLeft from "./bottomLeft";
  114. import bottomRight from "./bottomRight";
  115. export default {
  116. mixins: [resToken],
  117. computed: {
  118. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  119. powers() {
  120. let tran =
  121. this.$store.getters.btnList.find(
  122. (item) => item.menu_route == "datavScr"
  123. ) || {};
  124. if (tran && tran.action && tran.action.length > 0) {
  125. return tran.action;
  126. } else {
  127. return [];
  128. }
  129. },
  130. },
  131. data() {
  132. return {
  133. timing: null,
  134. loading: true,
  135. dateDay: null,
  136. dateYear: null,
  137. dateWeek: null,
  138. weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  139. decorationColor: ["#568aea", "#000000"],
  140. initFlag: true,
  141. time: null,
  142. };
  143. },
  144. components: {
  145. centerLeft1,
  146. centerLeft2,
  147. centerRight1,
  148. centerRight2,
  149. center,
  150. bottomLeft,
  151. bottomRight,
  152. },
  153. mounted() {
  154. this.timeFn();
  155. this.cancelLoading();
  156. this.timeInit();
  157. },
  158. beforeDestroy() {
  159. clearInterval(this.timing);
  160. clearInterval(this.time);
  161. this.timing = null;
  162. this.time = null;
  163. },
  164. methods: {
  165. timeFn() {
  166. this.timing = setInterval(() => {
  167. this.dateDay = formatTime(new Date(), "HH: mm: ss");
  168. this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
  169. this.dateWeek = this.weekday[new Date().getDay()];
  170. }, 1000);
  171. },
  172. cancelLoading() {
  173. // setTimeout(() => {
  174. this.loading = false;
  175. // }, 0);
  176. },
  177. //一分钟更新一次数据
  178. timeInit() {
  179. this.time = null;
  180. this.time = setInterval(() => {
  181. this.initFlag = false;
  182. setTimeout(() => {
  183. this.$message({
  184. message: "更新数据成功",
  185. type: "success",
  186. });
  187. this.initFlag = true;
  188. }, 100);
  189. }, 60000);
  190. },
  191. },
  192. };
  193. </script>
  194. <style lang="scss" scoped>
  195. @import "../assetsDv/scss/index.scss";
  196. @import "../assetsDv/scss/style.scss";
  197. .datavScr.box {
  198. width: 100%;
  199. height: 100%;
  200. background: #000;
  201. margin: 0;
  202. }
  203. </style>