dklist.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. })
  119. },
  120. // 选择年月
  121. bindDateChange(e) {
  122. let time = e.detail.value.split('-')
  123. this.showdate = time[0] + '-' + time[1]
  124. this.getKqList()
  125. },
  126. // 获取当前年月
  127. getTime() {
  128. let date = new Date()
  129. try {
  130. let M = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : ('0' + (date.getMonth() + 1))
  131. console.log(M)
  132. this.showdate = date.getFullYear() + '-' + M
  133. this.getKqList()
  134. } catch (e) {
  135. //TODO handle the exception
  136. console.log(e);
  137. }
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. .select-top {
  144. width: 100%;
  145. height: 100rpx;
  146. display: flex;
  147. justify-content: space-between;
  148. align-items: center;
  149. border: 1px solid #F5F5F5;
  150. font-size: 32rpx;
  151. font-weight: bold;
  152. color: #000000;
  153. padding: 0 30rpx;
  154. background-color: #fff;
  155. .top-right {
  156. font-size: 28rpx;
  157. font-weight: bold;
  158. color: #000000;
  159. display: flex;
  160. align-items: center;
  161. justify-content: flex-end;
  162. image {
  163. width: 19rpx;
  164. height: 11rpx;
  165. }
  166. }
  167. }
  168. .err {
  169. color: #E05742;
  170. }
  171. .dk-info {
  172. height: 326rpx;
  173. width: 100%;
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: center;
  177. align-items: center;
  178. background-color: #fff;
  179. margin-bottom: 20rpx;
  180. .big {
  181. font-size: 46rpx !important;
  182. font-weight: 800;
  183. color: #000000;
  184. margin-bottom: 10rpx;
  185. }
  186. .dk-day,
  187. .dk-tit {
  188. display: flex;
  189. flex-direction: row;
  190. justify-content: center;
  191. width: 100%;
  192. font-size: 26rpx;
  193. .dk-left {
  194. width: 48%;
  195. text-align: right;
  196. }
  197. .dk-center {
  198. width: 4%;
  199. flex-shrink: 0;
  200. text-align: center;
  201. color: #D7D7D7;
  202. }
  203. .dk-right {
  204. width: 48%;
  205. }
  206. }
  207. .dk-detail {
  208. display: flex;
  209. justify-content: center;
  210. width: 100%;
  211. margin-top: 50rpx;
  212. .detail-item {
  213. width: 30%;
  214. text-align: center;
  215. font-size: 28rpx;
  216. font-weight: bold;
  217. color: #000000;
  218. .item-tit {
  219. margin-top: 15rpx;
  220. font-size: 24rpx;
  221. font-weight: 500;
  222. color: #666666;
  223. }
  224. }
  225. }
  226. }
  227. .yg-list {
  228. background-color: #fff;
  229. width: 100%;
  230. .yg-wrap {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. padding: 0 40rpx 0 30rpx;
  235. height: 100rpx;
  236. border-bottom: 1px solid #F2F2F2;
  237. font-size: 28rpx;
  238. font-weight: bold;
  239. color: #000000;
  240. .yg-name {}
  241. .dk-status {
  242. display: flex;
  243. align-items: center;
  244. image {
  245. width: 11rpx;
  246. height: 19rpx;
  247. margin-left: 10rpx;
  248. }
  249. }
  250. }
  251. }
  252. .select-time {
  253. position: absolute;
  254. top: 30rpx;
  255. right: 30rpx;
  256. font-size: 28rpx;
  257. font-weight: 500;
  258. color: #000;
  259. display: flex;
  260. align-items: center;
  261. font-weight: bold;
  262. image {
  263. width: 17rpx;
  264. margin-left: 10rpx;
  265. }
  266. }
  267. </style>