index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="total-page page-env-160 page-box">
  3. <Nav :title="'工作台导航'" :back="false" :is_fixed="true" :opacity="scrollTop" :justify="'left'" :color="'#fff'">
  4. <view class="p-20">
  5. <IndexPersonal ref="memberObj" @setMemberData="setMemberData"></IndexPersonal>
  6. <IndexColumn ref="columnObj" :memberData="memberData" :model-time="modelTime"></IndexColumn>
  7. </view>
  8. </Nav>
  9. <view class="p-lr20 m-tb30">
  10. <view class="personal m-lr10 row-justify-sb center">
  11. <text class="sys-weight-600">我的待办</text>
  12. <view class="row-justify-sb center">
  13. <view class="personal_text">
  14. <uni-datetime-picker type="date" v-model="modelTime" @change="onChangeTime"
  15. @touchmove.stop.prevent="moveHandle">
  16. <view class="personal sys-background-fff size-24 sys-weight-600 p-lr30 r-40">{{indexTime}}
  17. </view>
  18. </uni-datetime-picker>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="page-box-bg-fff m-t30 m-lr20 r-30 row-justify-sb flex p-b30" v-show="backlogList.length>0">
  24. <view class="">
  25. <view class="row-c">
  26. <view class="pie_chart column-c">
  27. <PieChart ref="pieChart"></PieChart>
  28. <text class="size-24 text-color-12">任务完成情况</text>
  29. </view>
  30. <view class="m-b30">
  31. <view class="row-c p-tb10" style="text-align: center;" v-for="(item,index) in chartList"
  32. :key="index">
  33. <view class="row-c">
  34. <view class="row-c" style="line-height: 30rpx;">
  35. <view class="chart_dot" :style="{backgroundColor:item.color}"></view>
  36. <text class="m-l16 size-28 text-color-787">{{item.name}}</text>
  37. </view>
  38. </view>
  39. <text class="text-color-12 sys-weight-600 m-l20 size-28">{{item.value}}%</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="circle_chart column-sb-c m-t10">
  45. <CircleChart ref="circleObj" :width="'185rpx'" :height="'185rpx'" bgColor="#0FB160"></CircleChart>
  46. <text class="size-24 text-color-12">任务进度</text>
  47. </view>
  48. </view>
  49. <TaskItem :type="5" :taskList="backlogList"></TaskItem>
  50. <Tab class="tabs_height" :tab-index="0"></Tab>
  51. </view>
  52. </template>
  53. <script>
  54. import TaskItem from "@/common/task/task-item.vue"
  55. import PieChart from "@/common/chart/pie_chart.vue"
  56. import CircleChart from "@/common/chart/circle_chart.vue"
  57. // 个人信息
  58. import IndexColumn from "./module/index_column.vue"
  59. // 顶部栏目
  60. import IndexPersonal from "./module/index_personal.vue"
  61. import {
  62. getDateBacklogStatistics,
  63. getDayBacklogList
  64. } from "@/api/task";
  65. import {
  66. date
  67. } from "@/uni_modules/uv-ui-tools/libs/function/test";
  68. export default {
  69. components: {
  70. TaskItem,
  71. PieChart,
  72. CircleChart,
  73. IndexColumn,
  74. IndexPersonal
  75. },
  76. data() {
  77. return {
  78. modelTime: this.$tools.getDate('-'),
  79. indexTime: this.$tools.getDate('-'),
  80. is_admin: false,
  81. scrollTop: 0,
  82. topNavHeight: 0,
  83. chartList: [{
  84. name: "超期",
  85. color: '#DE5847',
  86. value: "0"
  87. }, {
  88. name: "滞后",
  89. color: '#EF8F27',
  90. value: "0"
  91. }, {
  92. name: "正常",
  93. color: '#3ABF7D',
  94. value: "0"
  95. }, ],
  96. memberData: {},
  97. statisticsData: {
  98. endNum: 0,
  99. exceedDate: 0,
  100. lagDate: 0,
  101. totalNum: 0,
  102. },
  103. backlogList: [],
  104. weekData: [],
  105. weekNum: 1,
  106. dayNum: 0,
  107. day: '',
  108. month: '',
  109. page: 1,
  110. isAjax: false,
  111. total: null
  112. }
  113. },
  114. watch: {
  115. 'modelTime': function() {
  116. this.startList()
  117. }
  118. },
  119. onLoad() {
  120. uni.hideTabBar()
  121. },
  122. onShow() {
  123. this.startList()
  124. this.$refs.memberObj.getMemberInfo()
  125. this.$refs.columnObj.getSysCashier()
  126. },
  127. onPageScroll(res) {
  128. this.scrollTop = res.scrollTop / 120
  129. },
  130. onReachBottom() {
  131. this.getDayBacklogList()
  132. },
  133. methods: {
  134. getDateBacklogStatistics() {
  135. getDateBacklogStatistics({
  136. 'dateNum': this.modelTime
  137. }).then(res => {
  138. if (res.code === 1) {
  139. if (res.data.totalNum > 0) {
  140. this.chartList[0].value = (res.data.exceedNum / res.data.totalNum * 100).toFixed(0) *
  141. 1;
  142. this.chartList[1].value = (res.data.lagNum / res.data.totalNum * 100).toFixed(0) * 1;
  143. this.chartList[2].value = (res.data.normalNum / res.data.totalNum * 100).toFixed(0) *
  144. 1;
  145. setTimeout(() => {
  146. this.$refs.circleObj.setServerData((res.data.endNum / res.data.totalNum)
  147. .toFixed(2) * 1)
  148. this.$refs.pieChart.setServerData(this.chartList)
  149. }, 50)
  150. } else {
  151. this.chartList[0].value = 0;
  152. this.chartList[1].value = 0;
  153. this.chartList[2].value = 0;
  154. setTimeout(() => {
  155. this.$refs.pieChart.setNoData()
  156. this.$refs.circleObj.notServerData()
  157. }, 50)
  158. }
  159. }
  160. })
  161. },
  162. startList() {
  163. this.backlogList = [];
  164. this.page = 1;
  165. this.total = null;
  166. this.getDayBacklogList();
  167. this.getDateBacklogStatistics()
  168. },
  169. getDayBacklogList() {
  170. if (this.total !== null && this.total <= this.backlogList.length) {
  171. return
  172. }
  173. getDayBacklogList({
  174. 'dateNum': this.modelTime,
  175. 'page': this.page
  176. }).then((res) => {
  177. if (res.code === 1) {
  178. this.backlogList.push(...res.data.items)
  179. this.total = res.data.total
  180. ++this.page
  181. }
  182. })
  183. },
  184. setMemberData(memberData) {
  185. this.memberData = memberData
  186. },
  187. onChangeTime(e) {
  188. this.indexTime = e
  189. },
  190. moveHandle() {
  191. return false
  192. },
  193. },
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .personal {
  198. height: 55rpx;
  199. line-height: 55rpx;
  200. }
  201. .pie_chart {
  202. width: 135px
  203. }
  204. .circle_chart {
  205. width: 135px;
  206. padding-top: 20rpx;
  207. }
  208. .chart_dot {
  209. width: 16rpx;
  210. height: 16rpx;
  211. border-radius: 50%;
  212. }
  213. </style>