clockin.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="打卡记录" :background-color="backgroundColor"
  5. :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
  6. </uni-nav-bar>
  7. <view class="plr16" :style="'background:'+backgroundColor">
  8. <view class="search flexc mb4">
  9. <image :src="serimg"></image>
  10. <input placeholder="请输入人员姓名进行搜索" confirm-type="search" placeholder-style="color:#B9DCF7" v-model="title" @confirm="getConfirm"/>
  11. </view>
  12. <!-- 搜索 -->
  13. <view class="lbtab flexc">
  14. <image :src="licoimg" class="limg" @click='getResetFn'></image>
  15. <view class="lbtabs flexc">
  16. <!-- <picker class="pickbox" range-key='dictLabel' :range="adrlist" @change="bindTimeChangea">
  17. <view class="pickboxa">
  18. <view class="tit overtwo" >{{deptName||'全部部门'}}</view>
  19. <image :src="wupimg" class="hupimg"></image>
  20. </view>
  21. </picker> -->
  22. <picker mode="date" class="pickbox"
  23. @change="bindTimeChangea">
  24. <view class="pickboxa">
  25. <view class="tit" >{{time||'选择时间'}}</view>
  26. <image :src="wupimg" class="hupimg"></image>
  27. </view>
  28. </picker>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <image :src="navbg" class="navbg"></image>
  34. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  35. <!-- 列表 -->
  36. <y-list type='clock' :datalist="list" :wtdt="wtdt" @getDetail='getDetail' :adrlist="adrlist" @getDelFn="getDelFn" @gettypeFn="gettypeFn"></y-list>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  42. import yList from "@/work/components/yuyue/list.vue"
  43. import {getClockList} from "@/api/mine/work.js"
  44. import {getDictionaryFn} from "@/api/mine/register.js"
  45. export default {
  46. components: {yList},
  47. data() {
  48. return {
  49. wupimg:require("@/work/static/record/wup.png"),
  50. serimg:require("@/work/static/record/search.png"),
  51. licoimg:require("@/work/static/record/lico.png"),
  52. navbg:require("@/static/images/navbg.png"),
  53. backgroundColor: "transparent",
  54. datainfo:{},
  55. nvaHeight: 44,
  56. marTop: 0, //距离顶部的距离
  57. stubarHeight: 0, //
  58. title:'',
  59. list:[],
  60. pageSize: 10,
  61. pageNum: 1,
  62. reachflag: false,
  63. wtdt:'',
  64. userId:this.$store.state.user.userId,
  65. deptName:'',
  66. time:'',
  67. adrlist:[],
  68. }
  69. },
  70. onPageScroll(e) {
  71. var scrollTop = Number(e.scrollTop);
  72. if (scrollTop > 0) {
  73. this.backgroundColor = '#0491FD'
  74. } else {
  75. this.backgroundColor = 'transparent'
  76. }
  77. },
  78. onLoad: function() {
  79. this.init()
  80. this.getDataFn()
  81. uni.getSystemInfo({
  82. success: (e) => {
  83. this.stubarHeight = Number(e.statusBarHeight);
  84. this.nvaHeight = Number(e.statusBarHeight) + 44;
  85. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  86. }
  87. })
  88. },
  89. onUnload() {
  90. uni.$off('refreshdatalist')
  91. },
  92. onShow() {},
  93. mounted() {
  94. this.getHeightFn()
  95. },
  96. // 上拉触底加载更多触发事件
  97. onReachBottom() {
  98. if (this.reachflag) {
  99. this.pageNum++
  100. this.getDataFn()
  101. }
  102. },
  103. methods: {
  104. checkPermi,
  105. checkRole,
  106. getConfirm(){
  107. this.pageNum=1;
  108. this.list=[];
  109. this.reachflag=true;
  110. this.getDataFn()
  111. },
  112. getResetFn(){
  113. this.time='';
  114. this.title='';
  115. this.getConfirm()
  116. },
  117. getBack() {
  118. uni.navigateBack({
  119. delta: 1
  120. })
  121. },
  122. gettypeFn(){
  123. },
  124. getDelFn(){
  125. },
  126. getDetail(ite){
  127. var obj={
  128. userId:ite.userId,
  129. recordTime:ite.recordTime
  130. }
  131. this.$tab.navigateTo('/work/pages/record/detail?data='+encodeURIComponent(JSON.stringify(obj)))
  132. },
  133. bindTimeChangea(e){
  134. var val=e.detail.value;
  135. this.time=val
  136. this.getConfirm()
  137. },
  138. getHeightFn() {
  139. let query = uni.createSelectorQuery().in(this);
  140. //需要给黄色区域设置一个id标识,在这里是demo
  141. query.select('.navbox').boundingClientRect(data => {
  142. var top = data.top < 0 ? -data.top : data.top;
  143. var stubarHeight = Number(this.stubarHeight);
  144. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  145. 2 + 40 //赋值,待会要用
  146. if (top <= this.nvaHeight) {
  147. const opacity = top / 100 // 计算透明度值
  148. const color = `rgba(4, 145, 253, ${opacity})`
  149. this.backgroundColor = color // 更新盒子背景颜色
  150. } else {
  151. this.backgroundColor = '#00A9F0'
  152. }
  153. }).exec();
  154. },
  155. init() {
  156. // 门卫
  157. // getDictionaryFn('is_read').then(res=>{
  158. // if(res.code==200){
  159. // this.ydztlist = res.data.map(v => {
  160. // return {
  161. // label: v.dictLabel,
  162. // value: v.dictValue
  163. // }
  164. // })
  165. // }
  166. // })
  167. },
  168. getDataFn() {
  169. var params = {
  170. pageSize: this.pageSize,
  171. pageNum: this.pageNum,
  172. }
  173. if(!checkRole(['administrators'])){
  174. params.userId=this.userId
  175. }
  176. if(this.time){
  177. params.recordTime=this.time
  178. }
  179. if(this.title){
  180. params.userName=this.title
  181. }
  182. getClockList(params).then(res => {
  183. if (res.code == 200) {
  184. if (res.rows.length < this.pageSize) {
  185. this.reachflag = false
  186. this.wtdt = '到底了~';
  187. } else {
  188. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
  189. 1)
  190. if (num < res.total) {
  191. this.reachflag = true
  192. this.wtdt = '上拉加载更多'
  193. } else {
  194. this.reachflag = false
  195. this.wtdt = '到底了~';
  196. }
  197. }
  198. if (this.pageNum == 1) {
  199. this.list = res.rows;
  200. } else {
  201. this.list = this.list.concat(res.rows)
  202. }
  203. } else {
  204. this.$toast(res.msg)
  205. }
  206. })
  207. },
  208. },
  209. }
  210. </script>
  211. <style>
  212. /* page {
  213. background: #ffffff;
  214. } */
  215. </style>
  216. <style lang="scss" scoped>
  217. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  218. .navbg{width: 100%;height: 692rpx;}
  219. .zxmain{position: relative;padding: 8rpx 32rpx 40rpx;box-sizing: border-box;}
  220. .search{padding: 0 52rpx;box-sizing: border-box;
  221. width: 100%;height: 76rpx;background: rgba(40, 139, 214, 0.5);border-radius: 38rpx;
  222. image{width: 24rpx;height: 24rpx;margin-right: 22rpx;flex: 0 0 auto;}
  223. input{flex: 1;font-weight: 500;font-size: 22rpx;color: #FFFFFF;}
  224. }
  225. .lbtab{padding: 0 56rpx;
  226. .limg{width: 24rpx;height: 24rpx;margin-right: 16rpx;flex:0 0 auto;}
  227. .lbtabs{overflow: auto;flex-wrap: nowrap;flex:1;
  228. .pickbox{text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;min-height:88rpx;margin: 0 10rpx;
  229. .pickboxa{justify-content: center;
  230. min-height: 88rpx;display: flex;align-items: center;
  231. }
  232. .tit{font-weight: 500;font-size: 26rpx;color: #FFFFFF;}
  233. .hupimg{width: 16rpx;height: 10rpx;margin-left: 26rpx;flex: 0 0 auto;}
  234. }
  235. }
  236. }
  237. </style>