kanban.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="chart-panel">
  3. <view class="charts-item">
  4. <view class="flex">
  5. <text
  6. style="width: 12rpx;height: 40rpx;background: #DD4250;border-radius: 12rpx; margin-right: 20rpx;"></text>
  7. <view class="bold font-size-30">占比饼状图</view>
  8. </view>
  9. <view class="charts-box">
  10. <qiun-data-charts type="pie" :opts="opts" :chartData="chartData" />
  11. </view>
  12. </view>
  13. <view class="charts-item">
  14. <view class="flex">
  15. <text
  16. style="width: 12rpx;height: 40rpx;background: #DD4250;border-radius: 12rpx; margin-right: 20rpx;"></text>
  17. <view class="bold font-size-30">金字塔漏斗图</view>
  18. </view>
  19. <view class="charts-box" style="height: 500px;">
  20. <qiun-data-charts type="funnel" :opts="optsFunel" :chartData="chartData" />
  21. </view>
  22. </view>
  23. <view class="charts-item">
  24. <view class="flex">
  25. <text
  26. style="width: 12rpx;height: 40rpx;background: #DD4250;border-radius: 12rpx; margin-right: 20rpx;"></text>
  27. <view class="bold font-size-30">城市词云图</view>
  28. </view>
  29. <view class="charts-box" style="height: 500px;">
  30. <qiun-data-charts type="word" :opts="opts" :chartData="chartDataWord" />
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getTalentsCount
  38. } from '@/api/app';
  39. import {
  40. mapActions,
  41. mapGetters
  42. } from 'vuex'
  43. export default {
  44. data() {
  45. return {
  46. chartData: {},
  47. chartDataWord: {},
  48. opts: {
  49. // dataLabel: false,
  50. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  51. "#ea7ccc"
  52. ],
  53. // padding: [5, 5, 5, 5],
  54. xAxis: {
  55. disableGrid: true
  56. },
  57. yAxis: {
  58. data: [{
  59. min: 0
  60. }]
  61. },
  62. enableScroll: false,
  63. legend: {
  64. padding: 5,
  65. margin: 5,
  66. float: 'left'
  67. },
  68. extra: {
  69. pie: {
  70. activeOpacity: 0.5,
  71. activeRadius: 10,
  72. offsetAngle: 0,
  73. labelWidth: 10,
  74. border: true,
  75. borderWidth: 1,
  76. borderColor: "#FFFFFF",
  77. // linearType: "custom"
  78. },
  79. funnel: {
  80. activeOpacity: 0.3,
  81. activeWidth: 10,
  82. border: true,
  83. borderWidth: 2,
  84. borderColor: "#FFFFFF",
  85. fillOpacity: 1,
  86. labelAlign: "right",
  87. type: "pyramid"
  88. },
  89. word: {
  90. type: "normal",
  91. autoColors: true
  92. }
  93. }
  94. },
  95. optsFunel: {
  96. dataLabel: false,
  97. },
  98. }
  99. },
  100. onLoad(options) {
  101. Object.assign(this.optsFunel, this.opts);
  102. },
  103. onReady() {
  104. },
  105. onUnload() {},
  106. onShow() {
  107. this.getCountFun();
  108. this.getUser();
  109. },
  110. onPullDownRefresh() {
  111. this.getCountFun();
  112. this.getUser().then(() => {
  113. uni.stopPullDownRefresh();
  114. })
  115. },
  116. onHide() {},
  117. methods: {
  118. ...mapActions(['getUser']),
  119. async getCountFun() {
  120. const {
  121. status,
  122. data
  123. } = await getTalentsCount({});
  124. if (status == 1) {
  125. let res = {
  126. series: [{
  127. data: data.normal,
  128. }]
  129. };
  130. this.chartData = JSON.parse(JSON.stringify(res));
  131. res = {
  132. series: data.word
  133. };
  134. this.chartDataWord = JSON.parse(JSON.stringify(res));
  135. }
  136. uni.stopPullDownRefresh();
  137. },
  138. },
  139. computed: {
  140. ...mapGetters(['sysInfo', 'appConfig']),
  141. }
  142. }
  143. </script>
  144. <style lang="scss">
  145. page {
  146. padding: 0;
  147. height: 100%;
  148. }
  149. .chart-panel {
  150. padding-bottom: calc(50px + env(safe-area-inset-bottom));
  151. }
  152. .charts-item {
  153. background: #FFFFFF;
  154. box-shadow: 0px 4px 8px 1px rgba(0, 0, 0, 0.03);
  155. border-radius: 6px 6px 6px 6px;
  156. padding: 20rpx;
  157. margin: 30rpx;
  158. }
  159. /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
  160. .charts-box {
  161. width: 100%;
  162. height: 350px;
  163. }
  164. </style>