stationPie.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="stationEchartsClass">
  3. <div class="lineEchartsClass">
  4. <div class="titleBg">
  5. <div class="titleFont">电子站台统计</div>
  6. </div>
  7. <div class="divContent"
  8. style="display: flex;flex-direction: row;justify-content: space-around;align-items: center;padding-right: 1vw;">
  9. <div style="display: flex;flex-direction: row;margin-top: 1vh;padding-left: 1vw;">
  10. <div ref="stationchart" style="width:10vw;height: 20vh;"></div>
  11. <div style="display: flex;flex-direction: column;">
  12. <div class="countDiv"
  13. style="display: flex;flex-direction: column;justify-content: space-between;">
  14. <div><img style="width: 2vw;height: 1vh;" src="@/assets/images/homeImages/up.png"></div>
  15. <div style="display: flex;flex-direction: row;justify-content: space-between;padding-left: 0.5vw;padding-right: 1vw;">
  16. <div class="typeClass">
  17. 总装备数
  18. </div>
  19. <div class="countClass" style="color: #FEF822;">
  20. 80
  21. </div>
  22. </div>
  23. <div style="margin-left: 6vw;"><img style="width: 2vw;height: 1vh;"
  24. src="@/assets/images/homeImages/bottom.png"></div>
  25. </div>
  26. <div class="countDiv"
  27. style="display: flex;flex-direction: column;justify-content: space-between;margin-top: 0.5vh;">
  28. <div><img style="width: 2vw;height: 1vh;" src="@/assets/images/homeImages/up.png"></div>
  29. <div style="display: flex;flex-direction: row;justify-content: space-between;padding-left: 0.5vw;padding-right: 1vw;">
  30. <div class="typeClass">
  31. 在线设备
  32. </div>
  33. <div class="countClass" style="color: #22FE31;">
  34. 1
  35. </div>
  36. </div>
  37. <div style="margin-left: 6vw;"><img style="width: 2vw;height: 1vh;"
  38. src="@/assets/images/homeImages/bottom.png"></div>
  39. </div>
  40. <div class="countDiv"
  41. style="display: flex;flex-direction: column;justify-content: space-between;margin-top: 0.5vh;">
  42. <div><img style="width: 2vw;height: 1vh;" src="@/assets/images/homeImages/up.png"></div>
  43. <div style="display: flex;flex-direction: row;justify-content: space-between;padding-left: 0.5vw;padding-right: 1vw;">
  44. <div class="typeClass">
  45. 箱体总数
  46. </div>
  47. <div class="countClass" style="color: #FEF822;">
  48. 3200
  49. </div>
  50. </div>
  51. <div style="margin-left: 6vw;"><img style="width: 2vw;height: 1vh;"
  52. src="@/assets/images/homeImages/bottom.png"></div>
  53. </div>
  54. <div class="countDiv"
  55. style="display: flex;flex-direction: column;justify-content: space-between;margin-top: 0.5vh;">
  56. <div><img style="width: 2vw;height: 1vh;" src="@/assets/images/homeImages/up.png"></div>
  57. <div style="display: flex;flex-direction: row;justify-content: space-between;padding-left: 0.5vw;padding-right: 1vw;">
  58. <div class="typeClass">
  59. 空闲箱体
  60. </div>
  61. <div class="countClass" style="color: #22FE31;">
  62. 3100
  63. </div>
  64. </div>
  65. <div style="margin-left: 6vw;"><img style="width: 2vw;height: 1vh;"
  66. src="@/assets/images/homeImages/bottom.png"></div>
  67. </div>
  68. </div>
  69. <!-- <div style="width:10vw;margin-left: 1vw;padding-right: 1vw;">
  70. <div
  71. style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;">
  72. <div class="stationkeyClass">设备总数</div>
  73. <div class="stationvalueClass">80</div>
  74. <div class="stationunitClass">台</div>
  75. </div>
  76. <img class="imageDiv" src="@/assets/images/home/Bg(4).png" />
  77. <div
  78. style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
  79. <div class="stationkeyClass">在线设备</div>
  80. <div class="stationvalueClass">1</div>
  81. <div class="stationunitClass">台</div>
  82. </div>
  83. <img class="imageDiv" src="@/assets/images/home/Bg(7).png" />
  84. <div
  85. style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
  86. <div class="stationkeyClass">箱体总数</div>
  87. <div class="stationvalueClass">3200</div>
  88. <div class="stationunitClass">台</div>
  89. </div>
  90. <img class="imageDiv" src="@/assets/images/home/Bg(5).png" />
  91. <div
  92. style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
  93. <div class="stationkeyClass">空闲箱体</div>
  94. <div class="stationvalueClass">3100</div>
  95. <div class="stationunitClass">台</div>
  96. </div>
  97. <img class="imageDiv" src="@/assets/images/home/Bg(6).png" />
  98. </div> -->
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </template>
  104. <script setup name="Index" lang="ts">
  105. import * as echarts from 'echarts';
  106. const stationchart = ref();
  107. const drawEchart = () => {
  108. let echartsObj = echarts.init(stationchart.value, "macarons");
  109. var dateArray = getRecentDays();
  110. var option = {
  111. color: ['#707070', '#0EEFFF'],
  112. title: {
  113. // 图形标题(如果想要换行则使用ES6 `` 模板字符串)
  114. // 例如: `示例
  115. // 这里的文字会变为第二行(因为会保留格式)
  116. text: '75%',
  117. subtext: "在线率",
  118. left: "center",//对齐方式居中
  119. top: "40%",//距离顶部
  120. textStyle: {//文字配置
  121. color: "#ffffff",//文字颜色
  122. fontSize: 30,//字号
  123. align: "center"//对齐方式
  124. },
  125. subtextStyle: {
  126. color: "#C1D2E4"
  127. }
  128. },
  129. series: [
  130. {
  131. name: 'Access From',
  132. type: 'pie',
  133. radius: ['65%', '80%'],
  134. avoidLabelOverlap: false,
  135. label: {
  136. show: false,
  137. position: 'center'
  138. },
  139. labelLine: {
  140. show: false
  141. },
  142. data: [
  143. { value: 25, name: 'Search Engine' },
  144. { value: 75, name: 'Direct' },
  145. ]
  146. }
  147. ]
  148. };
  149. echartsObj.setOption(option);
  150. }
  151. const getRecentDays = () => {
  152. const oneDay = 24 * 60 * 60 * 1000; // 这里定义一天的毫秒数
  153. const resultArray = [];
  154. for (let i = 6; i >= 0; i--) {
  155. const currentDate = new Date(Date.now() - i * oneDay); // 计算出每天的日期
  156. const year = currentDate.getFullYear();
  157. const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // 月份需要补零
  158. const day = String(currentDate.getDate()).padStart(2, "0"); // 日期也需要补零
  159. const formattedDate = `${month}-${day}`; // 格式化日期为 yyyy-mm-dd 的形式
  160. resultArray.push(formattedDate);
  161. }
  162. return resultArray;
  163. }
  164. onMounted(() => {
  165. drawEchart();
  166. })
  167. </script>
  168. <style lang="scss">
  169. .stationEchartsClass {
  170. height: 20vh;
  171. width: 20vw;
  172. .titleBg {
  173. background: url("@/assets/images/homeImages/titleBg.png") no-repeat;
  174. background-size: 100% 100%;
  175. }
  176. .titleFont {
  177. font-family: Source Han Sans CN, Source Han Sans CN;
  178. font-weight: 400;
  179. font-size: 18px;
  180. color: #FFFFFF;
  181. line-height: 4vh;
  182. text-shadow: 0px 4px 0px rgba(10, 40, 95, 0.69);
  183. text-align: left;
  184. font-style: normal;
  185. text-transform: none;
  186. margin-left: 2vw;
  187. letter-spacing: 5px;
  188. }
  189. .divContent {
  190. background: url("@/assets/images/homeImages/contentBg.png") no-repeat;
  191. background-size: 100% 100%;
  192. width: 20vw;
  193. height: 22vh;
  194. }
  195. }
  196. .countDiv {
  197. width: 8vw;
  198. height: 4vh;
  199. background-color: #375785;
  200. }
  201. .countClass {
  202. font-family: Source Han Sans CN, Source Han Sans CN;
  203. font-weight: bold;
  204. font-size: 20px;
  205. line-height: 24px;
  206. letter-spacing: 5px;
  207. text-align: right;
  208. font-style: normal;
  209. text-transform: none;
  210. }
  211. .typeClass {
  212. font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
  213. font-weight: normal;
  214. font-size: 14px;
  215. color: #FFFFFE;
  216. line-height: 24px;
  217. letter-spacing: 5px;
  218. text-align: left;
  219. font-style: normal;
  220. text-transform: none;
  221. }
  222. .stationkeyClass {
  223. font-family: Source Han Sans CN, Source Han Sans CN;
  224. font-weight: 400;
  225. font-size: 14px;
  226. color: #000000;
  227. line-height: 15px;
  228. text-align: left;
  229. font-style: normal;
  230. text-transform: none;
  231. }
  232. .stationvalueClass {
  233. font-family: Source Han Sans CN, Source Han Sans CN;
  234. font-weight: bold;
  235. font-size: 24px;
  236. color: #000000;
  237. line-height: 11px;
  238. text-align: right;
  239. font-style: normal;
  240. text-transform: none;
  241. }
  242. .stationunitClass {
  243. font-family: Source Han Sans CN, Source Han Sans CN;
  244. font-weight: 400;
  245. font-size: 12px;
  246. color: #000000;
  247. line-height: 11px;
  248. text-align: left;
  249. font-style: normal;
  250. text-transform: none;
  251. }
  252. .imageDiv {
  253. width: 9vw;
  254. margin-top: 1vh;
  255. }
  256. </style>