index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="bruefReport_wrap">
  3. <view class="clue_state_wrap">
  4. <view class="header_wrap">
  5. <view class="header_left">线索阶段</view>
  6. <dateSelect @confirm="dateSelectChange"></dateSelect>
  7. </view>
  8. <view class="charts-box">
  9. <qiun-data-charts
  10. type="ring"
  11. :opts="opts"
  12. :chartData="chartData"
  13. />
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import dateSelect from "../dateSelect/index.vue";
  20. export default {
  21. components : {
  22. dateSelect
  23. },
  24. props : {
  25. type : {
  26. type: [Number, String]
  27. },
  28. },
  29. data() {
  30. return {
  31. chartData: {},
  32. opts: {
  33. rotate: false,
  34. rotateLock: false,
  35. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4","#ea7ccc"],
  36. padding: [5,5,5, 5],
  37. dataLabel: true,
  38. enableScroll: false,
  39. legend: {
  40. show: true,
  41. position: "right",
  42. lineHeight: 25,
  43. },
  44. title: {
  45. name: "线索量",
  46. fontSize: 15,
  47. color: "#666666"
  48. },
  49. subtitle: {
  50. name: "0",
  51. fontSize: 10,
  52. color: "#7cb5ec"
  53. },
  54. extra: {
  55. ring: {
  56. ringWidth: 16,
  57. activeOpacity: 0.5,
  58. activeRadius: 10,
  59. offsetAngle: 0,
  60. labelWidth: 1,
  61. border: false,
  62. borderWidth: 3,
  63. borderColor: "#FFFFFF"
  64. }
  65. }
  66. }
  67. };
  68. },
  69. methods: {
  70. dateSelectChange(queryParams){
  71. queryParams.type = this.type;
  72. this.getServerData(queryParams);
  73. },
  74. handleToClue(){
  75. if(this.type === "1"){
  76. uni.switchTab({
  77. url : "/pages/publicClue/index"
  78. });
  79. }else{
  80. uni.switchTab({
  81. url : "/pages/privateClue/index"
  82. });
  83. }
  84. },
  85. async getServerData(queryParams) {
  86. const { data } = await uni.$u.api.statisticsCaseState(queryParams);
  87. const seriesData = data.map(v=>({
  88. name:v.clueStateName + "(" + v.count + ")",
  89. value:v.count
  90. }));
  91. const totalCount = data.reduce((acc,cur)=>{
  92. return acc + cur.count;
  93. },0);
  94. this.opts.subtitle.name = totalCount;
  95. this.chartData = { series : [ { data : seriesData } ] };
  96. },
  97. }
  98. };
  99. </script>
  100. <style scoped lang="scss">
  101. .header_wrap {
  102. display: flex;
  103. justify-content: space-between;
  104. padding: 10px;
  105. border-bottom: 1px solid #ddd;
  106. background-color: #fff;
  107. .header_left {
  108. font-size: 18px;
  109. }
  110. .haeder_right {
  111. display: flex;
  112. align-items: center;
  113. text {
  114. font-size: 14px;
  115. color: #b8b8b8;
  116. margin-right: 10px;
  117. }
  118. ::v-deep .u-icon__icon {
  119. font-size: 12px !important;
  120. }
  121. }
  122. }
  123. .clue_state_wrap {
  124. margin:0 20px;
  125. background-color: #fff;
  126. }
  127. .staticts_wrap {
  128. display: flex;
  129. justify-content: center;
  130. background: #fff;
  131. margin: 20px;
  132. border-radius: 10px;
  133. .staticts_item {
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. flex-direction: column;
  138. width: 33%;
  139. padding: 20px;
  140. .label {
  141. color: #aaa;
  142. font-size: 16px;
  143. }
  144. .count {
  145. font-size: 20px;
  146. font-weight: bold;
  147. }
  148. }
  149. }
  150. /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
  151. .charts-box {
  152. width: 100%;
  153. height: 300px;
  154. }
  155. </style>