SeizedInfo.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <Card title="查获信息展示">
  3. <div class="content">
  4. <div class="svgIcon">
  5. <Svg></Svg>
  6. <div class="svgContent">
  7. <div class="value">{{ chartsData.totalSeizeNum }}</div>
  8. <div class="tips">
  9. <span>查获总数</span>
  10. <span>(所有人员)</span>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="charts">
  15. <div ref="bar" style="width: 100%; height: 100%;"></div>
  16. </div>
  17. </div>
  18. </Card>
  19. </template>
  20. <script setup>
  21. import { computed } from 'vue';
  22. import Card from './card.vue';
  23. import { useECharts } from '@/hooks/useEcharts.js';
  24. import Svg from './Svg.vue';
  25. const bar = ref(null)
  26. const props = defineProps({
  27. chartsData: {
  28. type: Object,
  29. default: () => ({ totalSeizeNum: 0, itemList: [] })
  30. }
  31. })
  32. const colors = [
  33. {
  34. type: 'linear',
  35. x: 0,
  36. y: 0,
  37. x2: 0,
  38. y2: 1,
  39. colorStops: [{
  40. offset: 0, color: '#A674FC'
  41. }, {
  42. offset: 1, color: '#2C2B53'
  43. }],
  44. global: false
  45. },
  46. {
  47. type: 'linear',
  48. x: 0,
  49. y: 0,
  50. x2: 0,
  51. y2: 1,
  52. colorStops: [{
  53. offset: 0, color: '#71A3FC'
  54. }, {
  55. offset: 1, color: '#1E2144'
  56. }],
  57. global: false
  58. },
  59. {
  60. type: 'linear',
  61. x: 0,
  62. y: 0,
  63. x2: 0,
  64. y2: 1,
  65. colorStops: [{
  66. offset: 0, color: '#F462CC'
  67. }, {
  68. offset: 1, color: '#2C244B'
  69. }],
  70. global: false
  71. },
  72. ]
  73. const setChartsOptionsBar = computed(() => {
  74. return {
  75. grid: {
  76. top: 20,
  77. bottom: 40,
  78. left: 45,
  79. right: 15
  80. },
  81. xAxis: {
  82. type: 'category',
  83. data: props.chartsData.itemList.map(item => item.name),
  84. axisLabel: { color: '#fff', fontSize: 14 },
  85. axisLine: { lineStyle: { color: '#344067' } }
  86. },
  87. yAxis: [
  88. {
  89. type: 'value',
  90. position: 'left',
  91. axisLabel: { color: '#fff', fontSize: 14 },
  92. axisLine: { lineStyle: { color: '#fff' } },
  93. splitLine: { lineStyle: { color: '#344067' } }
  94. }
  95. ],
  96. series: [
  97. {
  98. name: '查获数',
  99. type: 'bar',
  100. data: props.chartsData.itemList.map(item => item.seizeNum),
  101. itemStyle: {
  102. color: (params) => {
  103. return colors[params.dataIndex % colors.length]
  104. },
  105. borderRadius: [5, 5, 0, 0],
  106. },
  107. barWidth: '50%'
  108. },
  109. ],
  110. tooltip: {
  111. trigger: 'axis',
  112. backgroundColor: 'rgba(13,80,122,1)',
  113. borderColor: '#70CFE7',
  114. textStyle: { color: '#fff' }
  115. }
  116. }
  117. })
  118. useECharts(bar, setChartsOptionsBar);
  119. </script>
  120. <style lang="scss" scoped>
  121. .content {
  122. display: flex;
  123. width: 100%;
  124. height: 100%;
  125. column-gap: 20px;
  126. .svgIcon {
  127. width: 280px;
  128. box-sizing: border-box;
  129. padding: 20px;
  130. position: relative;
  131. .svgContent {
  132. position: absolute;
  133. width: 175px;
  134. height: 175px;
  135. inset: 0;
  136. margin: auto;
  137. border-radius: 50%;
  138. display: flex;
  139. flex-direction: column;
  140. align-items: center;
  141. justify-content: center;
  142. background: radial-gradient(
  143. circle at center,
  144. transparent 0%,
  145. transparent 50%,
  146. #a19dd2 100%
  147. );
  148. color: #fff;
  149. .value {
  150. font-size: 48px;
  151. font-weight: 500;
  152. text-shadow: 2px 2px 1px #BBA7E2;
  153. color: #fff;
  154. }
  155. .tips {
  156. display: flex;
  157. flex-direction: column;
  158. font-size: 14px;
  159. font-weight: 500;
  160. color: #BBA7E2;
  161. }
  162. }
  163. }
  164. .charts {
  165. flex: 1;
  166. }
  167. }
  168. </style>