plan.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="get">
  3. <view>
  4. <uni-calendar :insert="true" :lunar="true" :selected="selected" @change="change" />
  5. </view>
  6. <view class="get-list">
  7. <view v-for="(item, index) in recordList" :key="index" class="row" @tap="navTo(item)">
  8. <view class="carrier">
  9. <view class="get-wrapper">
  10. <view class="title in1line">
  11. {{item.attendClasses.title}}<template v-if="item.type==1">[签退]</template><template v-if="item.type==0">[签到]</template>
  12. </view>
  13. <view class="content in2line">
  14. <template v-for="(record, index) in checkState">
  15. <template v-if="record.key==item.state">考勤状态:{{ record.value }}(上班时间:{{item.attendClasses.begin_time}}-{{item.attendClasses.end_time}})</template>
  16. </template>
  17. </view>
  18. <view class="time">{{item.member.realname}} {{item.created_at|time}} </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="add-round bg-deepBlue" :class="'bg-' + themeColor.name" @click="navToAdd(`/pages/attend/add`)">
  24. <text class="cuIcon-add text-xxl"></text>
  25. </view>
  26. <!--加载动画-->
  27. </view>
  28. </template>
  29. <script>
  30. import uniCalendar from '@/components/oa-calendar/oa-calendar.vue'
  31. import moment from '@/common/moment';
  32. export default {
  33. components: {
  34. uniCalendar
  35. },
  36. data() {
  37. return {
  38. today: undefined,
  39. selectdate: undefined,
  40. startTime: moment().startOf('day').format('YYYY-MM-DD'),
  41. getList: [],
  42. checkState: [{"key":0,"value":"未打卡"},{"key":1,"value":"正常"},{"key":2,"value":"迟到"},{"key":3,"value":"早退"}],
  43. selected: [{date: '2020-12-12',info: "考勤"},{date: '2020-12-13',info: "考勤"},{date: '2020-12-14',info: "考勤"}],
  44. recordList: [],
  45. // 控制滑动效果
  46. theIndex: null,
  47. oldIndex: null
  48. };
  49. },
  50. filters: {
  51. time(val) {
  52. return moment(val * 1000).format('YYYY-MM-DD HH:mm:ss');
  53. },
  54. },
  55. onShow() {
  56. this.initData();
  57. },
  58. // 下拉刷新
  59. onPullDownRefresh() {
  60. this.page = 1;
  61. this.getList = [];
  62. this.recordList = [];
  63. this.loading = true;
  64. this.getPlanList('refresh');
  65. this.getRecordList('refresh', this.selectdate);
  66. },
  67. // 加载更多
  68. onReachBottom() {
  69. if (this.loadingType === 'nomore') return;
  70. this.page++;
  71. this.getRecordList('', this.selectdate);
  72. },
  73. async onLoad(options) {},
  74. methods: {
  75. change(e) {
  76. if (e.type !== 0) this.selectdate = e.fulldate;
  77. else this.selectdate = '9999';
  78. this.getRecordList('refresh', this.selectdate);
  79. },
  80. // 数据初始化
  81. initData() {
  82. this.hasLogin = this.$mStore.getters.hasLogin;
  83. this.page = 1;
  84. this.recordList.length = 0;
  85. this.getList.length = 0;
  86. this.getPlanList();
  87. this.getRecordList('', this.selectdate);
  88. uni.setNavigationBarColor({
  89. frontColor: '#ffffff',
  90. backgroundColor: this.themeColor.color,
  91. animation: {
  92. duration: 400,
  93. timingFunc: 'easeIn'
  94. }
  95. })
  96. },
  97. // 获取计划列表
  98. async getPlanList(type) {
  99. this.getList = [{"id":"1","merchant_id":"2","member_id":"69","classes_id":"1","check_date":"2020-12-01,2020-12-02,2020-12-03,2020-12-04,2020-12-05,2020-12-06,2020-12-07,2020-12-08,2020-12-09,2020-12-10,2020-12-11,2020-12-12,2020-12-13,2020-12-14,2020-12-15,2020-12-16,2020-12-17,2020-12-18,2020-12-19,2020-12-20,2020-12-21,2020-12-22,2020-12-23,2020-12-24,2020-12-25,2020-12-26,2020-12-27,2020-12-28,2020-12-29,2020-12-30,2020-12-31","begin_time":"08:00:00","end_time":"18:00:00","status":"1","created_at":"1602046812","updated_at":"1605764620","member":{"id":"69","merchant_id":"2","department_id":"13","role_id":"18","username":"18986860543","password_hash":"$2y$13$AiBhEM4eFqzVPz4LDLkPBOk/z7Kbt3RJJiEwbVpZCTpi0qum0OHfK","auth_key":"PhdPH1ybPa3G5lKq4gf4IsOfSbX4X2IM","password_reset_token":"","type":"1","realname":"古月","head_portrait":"","gender":"1","qq":"219311","email":"21931118@qq.com","birthday":"1999-09-09","province_id":"0","city_id":"0","area_id":"0","address":"","mobile":"18986860543","home_phone":"","dingtalk_robot_token":"","visit_count":"251","last_time":"1608219242","last_ip":"171.115.80.26","role":"10","status":"1","created_at":"1601722792","updated_at":"1608219242"},"attendClasses":{"id":"1","merchant_id":"2","title":"白班","begin_time":"08:30:00","end_time":"17:00:00","status":"1","created_at":"1605834038","updated_at":"1606783421"},"check":[{"id":"32","merchant_id":"2","member_id":"69","classes_id":"1","type":"0","picture":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg","covers":"[\"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg\"]","lon":"116.444908","lat":"39.917903","address":"北京市朝阳区秀水北街25号","state":"2","begin_time":"08:00:00","end_time":"18:00:00","status":"1","created_at":"1607001281","updated_at":"1607001281"},{"id":"33","merchant_id":"2","member_id":"69","classes_id":"1","type":"0","picture":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg","covers":"[\"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg\"]","lon":"116.444908","lat":"39.917903","address":"北京市朝阳区秀水北街25号","state":"2","begin_time":"08:00:00","end_time":"18:00:00","status":"1","created_at":"1607318712","updated_at":"1607318712"}]}];
  100. for (let i = 0, m = 0; i < this.getList.length; i++) {
  101. let check = this.getList[i].check_date.split(",");
  102. }
  103. },
  104. // 获取记录列表
  105. getRecordList(type, date) {
  106. this.recordList = [{"id":"33","merchant_id":"2","member_id":"69","classes_id":"1","type":"0","picture":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg","covers":"[\"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg\"]","lon":"116.444908","lat":"39.917903","address":"北京市朝阳区秀水北街25号","state":"2","begin_time":"08:00:00","end_time":"18:00:00","status":"1","created_at":"1607318712","updated_at":"1607318712","member":{"id":"69","merchant_id":"2","department_id":"13","role_id":"18","username":"18986860543","password_hash":"$2y$13$AiBhEM4eFqzVPz4LDLkPBOk/z7Kbt3RJJiEwbVpZCTpi0qum0OHfK","auth_key":"PhdPH1ybPa3G5lKq4gf4IsOfSbX4X2IM","password_reset_token":"","type":"1","realname":"古月","head_portrait":"","gender":"1","qq":"219311","email":"21931118@qq.com","birthday":"1999-09-09","province_id":"0","city_id":"0","area_id":"0","address":"","mobile":"18986860543","home_phone":"","dingtalk_robot_token":"","visit_count":"251","last_time":"1608219242","last_ip":"171.115.80.26","role":"10","status":"1","created_at":"1601722792","updated_at":"1608219242"},"attendClasses":{"id":"1","merchant_id":"2","title":"白班","begin_time":"08:30:00","end_time":"17:00:00","status":"1","created_at":"1605834038","updated_at":"1606783421"}},{"id":"32","merchant_id":"2","member_id":"69","classes_id":"1","type":"0","picture":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg","covers":"[\"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/12/02/image_1606918536_fYvzCA8w.jpg\"]","lon":"116.444908","lat":"39.917903","address":"北京市朝阳区秀水北街25号","state":"2","begin_time":"08:00:00","end_time":"18:00:00","status":"1","created_at":"1607001281","updated_at":"1607001281","member":{"id":"69","merchant_id":"2","department_id":"13","role_id":"18","username":"18986860543","password_hash":"$2y$13$AiBhEM4eFqzVPz4LDLkPBOk/z7Kbt3RJJiEwbVpZCTpi0qum0OHfK","auth_key":"PhdPH1ybPa3G5lKq4gf4IsOfSbX4X2IM","password_reset_token":"","type":"1","realname":"古月","head_portrait":"","gender":"1","qq":"219311","email":"21931118@qq.com","birthday":"1999-09-09","province_id":"0","city_id":"0","area_id":"0","address":"","mobile":"18986860543","home_phone":"","dingtalk_robot_token":"","visit_count":"251","last_time":"1608219242","last_ip":"171.115.80.26","role":"10","status":"1","created_at":"1601722792","updated_at":"1608219242"},"attendClasses":{"id":"1","merchant_id":"2","title":"白班","begin_time":"08:30:00","end_time":"17:00:00","status":"1","created_at":"1605834038","updated_at":"1606783421"}}];
  107. },
  108. navToAdd(route) {
  109. this.$mRouter.push({
  110. route: route
  111. });
  112. },
  113. navTo(item) {
  114. if (item.state == 0)
  115. this.$mRouter.push({
  116. route: `/pages/attend/add?id=${item.id}`
  117. });
  118. else
  119. uni.showToast({
  120. title: '该计划已经打过卡',
  121. icon: 'none',
  122. duration: 1000
  123. });
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss">
  129. page {
  130. background-color: $page-color-base;
  131. }
  132. .get {
  133. .add-round {
  134. position: fixed;
  135. z-index: 999;
  136. right: 30rpx;
  137. bottom: 30rpx;
  138. border-radius: 50%;
  139. width: 120rpx;
  140. height: 120rpx;
  141. color: #fff;
  142. text-align: center;
  143. line-height: 120rpx;
  144. font-weight: 100;
  145. font-size: 80rpx;
  146. }
  147. .get-list {
  148. margin-top: 20upx;
  149. .row {
  150. width: calc(94%);
  151. height: calc(22vw + 40upx);
  152. margin: 0 auto $spacing-base;
  153. border-radius: 15upx;
  154. box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
  155. display: flex;
  156. align-items: center;
  157. position: relative;
  158. overflow: hidden;
  159. z-index: 4;
  160. border: 0;
  161. .carrier {
  162. @keyframes showMenu {
  163. 0% {
  164. transform: translateX(0);
  165. }
  166. 100% {
  167. transform: translateX(-30%);
  168. }
  169. }
  170. @keyframes closeMenu {
  171. 0% {
  172. transform: translateX(-30%);
  173. }
  174. 100% {
  175. transform: translateX(0);
  176. }
  177. }
  178. background-color: #fff;
  179. position: absolute;
  180. width: 100%;
  181. padding: 0 0;
  182. height: 100%;
  183. z-index: 3;
  184. display: flex;
  185. align-items: center;
  186. }
  187. }
  188. .get-wrapper {
  189. background-color: $color-white;
  190. width: 100%;
  191. padding: $spacing-base $spacing-lg $spacing-base $spacing-lg;
  192. margin: $spacing-base 0 0;
  193. border-radius: 15upx;
  194. position: relative;
  195. .title {
  196. font-size: $font-lg;
  197. color: $font-color-dark;
  198. font-weight: 500;
  199. margin: 0 0 $spacing-sm;
  200. }
  201. .content {
  202. font-size: $font-sm;
  203. color: $font-color-base;
  204. height: 75upx;
  205. line-height: 36upx;
  206. }
  207. .time {
  208. font-size: $font-base;
  209. color: $font-color-light;
  210. }
  211. }
  212. }
  213. }
  214. </style>