kanban.vue 6.2 KB

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