personnel-orientation-population-trend.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view>
  3. <view class="section">
  4. <view class="title" @click="change_qushi_title()">{{qushi_title}}
  5. <uni-icons type="bottom" style="margin-left: 10rpx;"></uni-icons>
  6. </view>
  7. <view class="charts-box" v-if="qushi_type == 0">
  8. <qiun-data-charts type="column" :opts="column_1" tooltipFormat="personnel_statistics_ren"
  9. :chartData="chartData_column_1" />
  10. </view>
  11. <view class="charts-box" v-if="qushi_type == 1">
  12. <qiun-data-charts type="column" :opts="column_2" tooltipFormat="personnel_statistics_ren"
  13. :chartData="chartData_column_2" />
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: "personnel-orientation-population-trend",
  21. props:[
  22. "mine"
  23. ],
  24. data() {
  25. return {
  26. // 周、月下井趋势
  27. column_1: {
  28. legend: {
  29. position: "top",
  30. },
  31. dataLabel: false,
  32. xAxis: {
  33. disableGrid: true
  34. },
  35. extra: {
  36. column: {
  37. type: "stack",
  38. width: 20
  39. }
  40. }
  41. },
  42. column_2: {
  43. legend: {
  44. position: "top",
  45. },
  46. dataLabel: false,
  47. xAxis: {
  48. disableGrid: true,
  49. fontSize: 11
  50. },
  51. extra: {
  52. column: {
  53. type: "stack",
  54. width: 10
  55. }
  56. }
  57. },
  58. chartData_column_1: {},
  59. chartData_column_2: {},
  60. qushi_title: "周下井人数趋势",
  61. qushi_title_list: ["周下井人数趋势", "月下井人数趋势"],
  62. qushi_type: 0
  63. };
  64. },
  65. mounted() {
  66. // console.log(this.mine)
  67. this.getServerData()
  68. },
  69. methods: {
  70. getServerData() {
  71. this.$p_api.personnel_getPeopleXJQS({
  72. type: "week",
  73. mine: this.mine
  74. }).then((res)=>{
  75. this.chartData_column_1 = res.data.data
  76. })
  77. this.$p_api.personnel_getPeopleXJQS({
  78. type: "month",
  79. mine: this.mine
  80. }).then((res)=>{
  81. this.chartData_column_2 = res.data.data
  82. })
  83. // setTimeout(() => {
  84. // let res = {
  85. // categories: ["30日", "31日", "1日", "2日", "3日", "4日", "5日"],
  86. // series: [{
  87. // name: "早班",
  88. // data: [35, 36, 31, 33, 13, 34, 32]
  89. // },
  90. // {
  91. // name: "中班",
  92. // data: [18, 27, 21, 24, 6, 28, 2]
  93. // },
  94. // {
  95. // name: "晚班",
  96. // data: [18, 27, 21, 24, 6, 28, 4]
  97. // }
  98. // ]
  99. // };
  100. // this.chartData_column_1 = JSON.parse(JSON.stringify(res));
  101. // }, 500);
  102. // setTimeout(() => {
  103. // let res = {
  104. // categories: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月",
  105. // "12月"
  106. // ],
  107. // series: [{
  108. // name: "早班",
  109. // data: [35, 36, 31, 33, 13, 34, 32, 31, 33, 13, 34, 32]
  110. // },
  111. // {
  112. // name: "中班",
  113. // data: [18, 27, 21, 24, 6, 28, 2, 31, 33, 13, 34, 32]
  114. // },
  115. // {
  116. // name: "晚班",
  117. // data: [18, 27, 21, 24, 6, 28, 4, 31, 33, 13, 34, 32]
  118. // }
  119. // ]
  120. // };
  121. // this.chartData_column_2 = JSON.parse(JSON.stringify(res));
  122. // }, 500);
  123. },
  124. change_qushi_title(type) {
  125. uni.showActionSheet({
  126. itemList: this.qushi_title_list,
  127. success: (res) => {
  128. // console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
  129. this.qushi_title = this.qushi_title_list[res.tapIndex]
  130. this.qushi_type = res.tapIndex
  131. }
  132. });
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .charts-box {
  139. width: 350px;
  140. height: 300px;
  141. }
  142. .content {
  143. width: 750rpx;
  144. box-sizing: border-box;
  145. padding: 25rpx;
  146. }
  147. .section {
  148. background-color: #FFFFFF;
  149. border-radius: 8px;
  150. overflow: hidden;
  151. padding-bottom: 30rpx;
  152. margin-bottom: 25rpx;
  153. .title {
  154. padding: 40rpx 20rpx 0;
  155. font-weight: 700;
  156. }
  157. }
  158. </style>