dklist.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="content">
  3. <view class="select-top">
  4. <view class="">
  5. 本月统计
  6. </view>
  7. <view class="top-right">
  8. <view class="select-time">
  9. <picker mode="date" @change="bindDateChange" fields="month">
  10. <view class="uni-input">{{showdate}}</view>
  11. </picker>
  12. <image src="../../static/img/downjian.png" mode="widthFix"></image>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- <view class="dk-info">
  17. <view class="dk-day big">
  18. <view class="dk-left">
  19. 20
  20. </view>
  21. <view class="dk-center">
  22. /
  23. </view>
  24. <view class="dk-right err">
  25. 20
  26. </view>
  27. </view>
  28. <view class="dk-tit">
  29. <view class="dk-left">
  30. 正常天数
  31. </view>
  32. <view class="dk-center">
  33. /
  34. </view>
  35. <view class="dk-right">
  36. 异常天数
  37. </view>
  38. </view>
  39. <view class="dk-detail">
  40. <view class="detail-item green">
  41. <view class="">
  42. 20
  43. </view>
  44. <view class="item-tit">
  45. 已打卡(次)
  46. </view>
  47. </view>
  48. <view class="detail-item">
  49. <view class="">
  50. 20
  51. </view>
  52. <view class="item-tit">
  53. 未打卡(次)
  54. </view>
  55. </view>
  56. <view class="detail-item">
  57. <view class="err">
  58. 20
  59. </view>
  60. <view class="item-tit">
  61. 迟到(次)
  62. </view>
  63. </view>
  64. </view>
  65. </view> -->
  66. <scroll-view scroll-y="true" class="yg-list" :style="{'height': height}">
  67. <view class="yg-wrap" v-for="item in list">
  68. <view class="yg-name">
  69. {{item.staffName}}
  70. </view>
  71. <view class="dk-status" @click="goPage('/pagesS/yg/dkdetail?id=' + item.id)"
  72. :class="{'err': item.abnormal != 0}">
  73. {{item.abnormal == 0? '正常': '异常'}}
  74. <image src="../../static/img/downright.png" mode=""></image>
  75. </view>
  76. </view>
  77. </scroll-view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. showdate: '',
  85. height: '',
  86. list: []
  87. }
  88. },
  89. onLoad() {
  90. },
  91. onShow() {
  92. this.getTime()
  93. },
  94. onReachBottom() {
  95. },
  96. onReady() {
  97. var obj = this;
  98. uni.getSystemInfo({
  99. success: resu => {
  100. const query = uni.createSelectorQuery();
  101. query.select('.yg-list').boundingClientRect();
  102. query.exec(function(res) {
  103. obj.height = resu.windowHeight - res[0].top + 'px';
  104. });
  105. },
  106. fail: res => {}
  107. });
  108. },
  109. methods: {
  110. getKqList() {
  111. this.$u.api.getKqList({
  112. month: this.showdate //选择月份
  113. }).then(({
  114. data
  115. }) => {
  116. console.log(data, 'getKqList')
  117. this.list = data
  118. }).catch(err => {
  119. console.log(err);
  120. })
  121. },
  122. // 选择年月
  123. bindDateChange(e) {
  124. let time = e.detail.value.split('-')
  125. this.showdate = time[0] + '-' + time[1]
  126. this.getKqList()
  127. },
  128. // 获取当前年月
  129. getTime() {
  130. let date = new Date()
  131. try {
  132. let M = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : ('0' + (date.getMonth() + 1))
  133. console.log(M)
  134. this.showdate = date.getFullYear() + '-' + M
  135. this.getKqList()
  136. } catch (e) {
  137. //TODO handle the exception
  138. console.log(e);
  139. }
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss">
  145. .select-top {
  146. width: 100%;
  147. height: 100rpx;
  148. display: flex;
  149. justify-content: space-between;
  150. align-items: center;
  151. border: 1px solid #F5F5F5;
  152. font-size: 32rpx;
  153. font-weight: bold;
  154. color: #000000;
  155. padding: 0 30rpx;
  156. background-color: #fff;
  157. .top-right {
  158. font-size: 28rpx;
  159. font-weight: bold;
  160. color: #000000;
  161. display: flex;
  162. align-items: center;
  163. justify-content: flex-end;
  164. image {
  165. width: 19rpx;
  166. height: 11rpx;
  167. }
  168. }
  169. }
  170. .err {
  171. color: #E05742;
  172. }
  173. .dk-info {
  174. height: 326rpx;
  175. width: 100%;
  176. display: flex;
  177. flex-direction: column;
  178. justify-content: center;
  179. align-items: center;
  180. background-color: #fff;
  181. margin-bottom: 20rpx;
  182. .big {
  183. font-size: 46rpx !important;
  184. font-weight: 800;
  185. color: #000000;
  186. margin-bottom: 10rpx;
  187. }
  188. .dk-day,
  189. .dk-tit {
  190. display: flex;
  191. flex-direction: row;
  192. justify-content: center;
  193. width: 100%;
  194. font-size: 26rpx;
  195. .dk-left {
  196. width: 48%;
  197. text-align: right;
  198. }
  199. .dk-center {
  200. width: 4%;
  201. flex-shrink: 0;
  202. text-align: center;
  203. color: #D7D7D7;
  204. }
  205. .dk-right {
  206. width: 48%;
  207. }
  208. }
  209. .dk-detail {
  210. display: flex;
  211. justify-content: center;
  212. width: 100%;
  213. margin-top: 50rpx;
  214. .detail-item {
  215. width: 30%;
  216. text-align: center;
  217. font-size: 28rpx;
  218. font-weight: bold;
  219. color: #000000;
  220. .item-tit {
  221. margin-top: 15rpx;
  222. font-size: 24rpx;
  223. font-weight: 500;
  224. color: #666666;
  225. }
  226. }
  227. }
  228. }
  229. .yg-list {
  230. background-color: #fff;
  231. width: 100%;
  232. .yg-wrap {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. padding: 0 40rpx 0 30rpx;
  237. height: 100rpx;
  238. border-bottom: 1px solid #F2F2F2;
  239. font-size: 28rpx;
  240. font-weight: bold;
  241. color: #000000;
  242. .yg-name {}
  243. .dk-status {
  244. display: flex;
  245. align-items: center;
  246. image {
  247. width: 11rpx;
  248. height: 19rpx;
  249. margin-left: 10rpx;
  250. }
  251. }
  252. }
  253. }
  254. .select-time {
  255. position: absolute;
  256. top: 30rpx;
  257. right: 30rpx;
  258. font-size: 28rpx;
  259. font-weight: 500;
  260. color: #000;
  261. display: flex;
  262. align-items: center;
  263. font-weight: bold;
  264. image {
  265. width: 17rpx;
  266. margin-left: 10rpx;
  267. }
  268. }
  269. </style>