total.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div class="total-container">
  3. <div class="total-title">
  4. <img src="@/assets/images/tj.png" class="title-icon" />
  5. 实施服务(汇总数据
  6. </div>
  7. <div class="total-grid">
  8. <div class="total-item">
  9. <div class="total-label">城市总数</div>
  10. <div class="total-value">{{ cityCount }}</div>
  11. </div>
  12. <div class="total-item">
  13. <div class="total-label">企业总数</div>
  14. <div class="total-value">{{ enterpriseCount }}</div>
  15. </div>
  16. <div class="total-item">
  17. <div class="total-label">合同总数</div>
  18. <div class="total-value">{{ contractCount }}</div>
  19. </div>
  20. <div class="total-item">
  21. <div class="total-label">履约次数</div>
  22. <div class="total-value">{{ performanceCount }}</div>
  23. </div>
  24. <div class="total-item">
  25. <div class="total-label">服务时长</div>
  26. <div class="total-value">{{ serviceHours }}</div>
  27. </div>
  28. <div class="total-item">
  29. <div class="total-label">项目总数</div>
  30. <div class="total-value">{{ projectCount }}</div>
  31. </div>
  32. <div class="total-item">
  33. <div class="total-label">签约户数</div>
  34. <div class="total-value">{{ signedUserCount }}</div>
  35. </div>
  36. <div class="total-item">
  37. <div class="total-label">实施户数</div>
  38. <div class="total-value">{{ implementationUserCount }}</div>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import { mapState } from "vuex"
  45. import { api } from "@/api"
  46. export default {
  47. name: "ImplementationTotal",
  48. data() {
  49. return {
  50. cityCount: 99,
  51. enterpriseCount: 99,
  52. contractCount: 99,
  53. performanceCount: 99,
  54. serviceHours: 99,
  55. projectCount: 99,
  56. signedUserCount: 99,
  57. implementationUserCount: 99,
  58. timer: null,
  59. }
  60. },
  61. computed: {
  62. ...mapState(["entCode", "communityId"]),
  63. },
  64. mounted() {
  65. this.init()
  66. // 设置定时刷新
  67. this.timer = setInterval(() => {
  68. this.init()
  69. }, 60000) // 每分钟刷新一次
  70. },
  71. beforeDestroy() {
  72. if (this.timer) {
  73. clearInterval(this.timer)
  74. }
  75. },
  76. methods: {
  77. // 初始化数据
  78. async init() {
  79. try {
  80. const params = {
  81. entCode: this.entCode,
  82. communityId: this.communityId,
  83. }
  84. // 这里应该调用实际的API获取数据
  85. // const res = await api.getImplementationTotal(params)
  86. // 暂时使用模拟数据
  87. this.updateData()
  88. } catch (error) {
  89. console.error("获取实施服务汇总数据失败:", error)
  90. }
  91. },
  92. // 更新数据
  93. updateData() {
  94. // 这里可以根据实际API返回的数据进行更新
  95. // 目前使用固定值展示
  96. this.cityCount = 99
  97. this.enterpriseCount = 99
  98. this.contractCount = 99
  99. this.performanceCount = 99
  100. this.serviceHours = 99
  101. this.projectCount = 99
  102. this.signedUserCount = 99
  103. this.implementationUserCount = 99
  104. },
  105. // 格式化数字显示
  106. formatNumber(num) {
  107. if (num >= 10000) {
  108. return (num / 10000).toFixed(1) + "万"
  109. }
  110. return num.toString()
  111. },
  112. },
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. @import "@/assets/css/theme.scss";
  117. .total-container {
  118. background: var(--title-bg);
  119. border-radius: 4px;
  120. padding: 20px;
  121. position: relative;
  122. overflow: hidden;
  123. &::before {
  124. content: "";
  125. position: absolute;
  126. top: 0;
  127. left: 0;
  128. right: 0;
  129. height: 2px;
  130. background: linear-gradient(90deg, transparent, #409eff, transparent);
  131. }
  132. .total-title {
  133. display: flex;
  134. align-items: center;
  135. font-size: 18px;
  136. font-weight: 500;
  137. color: var(--title-primary);
  138. margin-bottom: 20px;
  139. }
  140. .total-grid {
  141. display: grid;
  142. grid-template-columns: repeat(2, 1fr);
  143. grid-template-rows: repeat(4, 1fr);
  144. gap: 16px;
  145. }
  146. .total-item {
  147. background: var(--content-bg);
  148. border-radius: 6px;
  149. padding: 16px;
  150. text-align: center;
  151. transition: all 0.3s ease;
  152. border: 1px solid rgba(64, 158, 255, 0.1);
  153. &:hover {
  154. transform: translateY(-2px);
  155. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
  156. border-color: rgba(64, 158, 255, 0.3);
  157. }
  158. .total-label {
  159. font-size: 14px;
  160. color: #a0b3d6;
  161. margin-bottom: 8px;
  162. }
  163. .total-value {
  164. font-size: 28px;
  165. font-weight: bold;
  166. color: #ffffff;
  167. line-height: 1.2;
  168. // 添加数字闪烁动画
  169. animation: pulse 2s infinite;
  170. }
  171. }
  172. }
  173. @keyframes pulse {
  174. 0% {
  175. opacity: 1;
  176. transform: scale(1);
  177. }
  178. 50% {
  179. opacity: 0.9;
  180. transform: scale(1.02);
  181. }
  182. 100% {
  183. opacity: 1;
  184. transform: scale(1);
  185. }
  186. }
  187. // 响应式设计
  188. @media (max-width: 1200px) {
  189. .total-grid {
  190. grid-template-columns: repeat(3, 1fr);
  191. grid-template-rows: repeat(3, 1fr);
  192. }
  193. .total-value {
  194. font-size: 24px !important;
  195. }
  196. }
  197. @media (max-width: 768px) {
  198. .total-grid {
  199. grid-template-columns: repeat(2, 1fr);
  200. grid-template-rows: repeat(4, 1fr);
  201. }
  202. .total-value {
  203. font-size: 20px !important;
  204. }
  205. }
  206. </style>