detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view :style="'padding-top:'+nvaHeight+'px;'">
  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>
  8. <image :src="navbg" class="navbg"></image>
  9. <view class="zxmain">
  10. <!-- <view class="locktop" @click="getNormal">
  11. <view class="locktopl">本月异常考勤</view>
  12. <view class="locktopr">
  13. 您有
  14. <text>{{ abnormainfo.count||0 }}</text>
  15. 条考勤异常记录,去处理
  16. </view>
  17. <image :src="rimg" class="locktopi"></image>
  18. </view> -->
  19. <view class="lock_header" v-if="checkPermi(['system:clock:personage:month'])">
  20. <view class="lock_headerth">
  21. <view class="tit">本月考勤记录</view>
  22. <!-- <view class="txt" @click="cords">
  23. <text>详细记录</text>
  24. </view> -->
  25. </view>
  26. <view class="lock_headerthbt">
  27. <view>
  28. <text class="tit cicr2">{{countinfo.cd}}</text>
  29. <text class="txt">迟到</text>
  30. </view>
  31. <view>
  32. <text class="tit cicr4">{{countinfo.zt}}</text>
  33. <text class="txt">早退</text>
  34. </view>
  35. <view>
  36. <text class="tit cicr3">{{countinfo.wq}}</text>
  37. <text class="txt">外勤</text>
  38. </view>
  39. <view>
  40. <text class="tit cicr5">{{countinfo.wdk}}</text>
  41. <text class="txt">未打卡</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="ytbox">
  46. <view class="ytop flexc">
  47. <view class="tit" v-if="dataobj.name">{{dataobj.name.charAt(0)}}</view>
  48. <view class="cent">
  49. <view class="ctit">{{dataobj.name}}</view>
  50. <view class="ctime">最新打卡:{{timeday}}</view>
  51. </view>
  52. </view>
  53. <!-- 日历 -->
  54. <view class="mb24">
  55. <lunc-calendar ref="calendar" :recordDate="recordDate" :showLunar="false" :configWeek="configWeek" :configHoliday="configHoliday" :firstDayOfWeek="firstDayOfWeek" :showMonthBg="false" :showShrink="true" :signList="signList"
  56. @dayChange="dayChange" weekType="" @monthChange="monthChange" @getIsSelDayFn="getIsSelDayFn" @shrinkClick="shrinkClick">
  57. </lunc-calendar>
  58. </view>
  59. <view class="tips">出勤统计:打卡
  60. <block v-if="datainfo.am&&datainfo.pm">2</block>
  61. <block v-else-if="datainfo.am||datainfo.pm">1</block>
  62. <block v-else>0</block>次,上下班时间:{{dataobj.workTime}}</view>
  63. <!-- 休息 -->
  64. <view class="restbox" v-if="datainfo.holidaytype=='NO'||weekflag&&datainfo.holidaytype!='YES'">
  65. <image :src="restimg"></image>
  66. <view>今日休息</view>
  67. <view>无需打卡哟~</view>
  68. </view>
  69. <!-- 步骤条 -->
  70. <view class="mb16 plr18" v-if="!datainfo.holidaytype||datainfo.holidaytype!='NO'||datainfo.holidaytype=='NO'&&(!datainfo.am||!datainfo.pm)">
  71. <view class="steps">
  72. <view class="cir"></view>
  73. <view class="stepsa">
  74. <view class="steptit">上班打卡</view>
  75. <view class="steptxt">
  76. <image :src="cirimg"></image>
  77. <view v-if="datainfo.am">{{datainfo.am}}<block v-if="datainfo.amex!=5">已打卡</block></view>
  78. <view class="tip" v-if="datainfo.amex>1&&datainfo.amex<5">
  79. <block v-if="datainfo.amex==2">外勤</block>
  80. <block v-if="datainfo.amex==3">迟到</block>
  81. <block v-if="datainfo.amex==4">早退</block>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="steps">
  87. <view class="cir"></view>
  88. <view class="stepsa">
  89. <view class="steptit">下班打卡</view>
  90. <view class="steptxt">
  91. <image :src="cirimg"></image>
  92. <view v-if="datainfo.pm">{{datainfo.pm}}<block v-if="datainfo.pmex!=5">已打卡</block></view>
  93. <view class="tip" v-if="datainfo.pmex>1&&datainfo.pmex<5">
  94. <block v-if="datainfo.pmex==2">外勤</block>
  95. <block v-if="datainfo.pmex==3">迟到</block>
  96. <block v-if="datainfo.pmex==4">早退</block>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="tips">统计截至 {{kaTime}}</view>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  109. import {getDictionaryFn} from "@/api/mine/register.js"
  110. import {getClockRl} from "@/api/mine/work.js"
  111. import {getClockCountper} from "@/api/work/check.js"
  112. import luncCalendar from "@/work/components/lunc-calendar/lunc-calendar.vue"
  113. export default {
  114. components: {luncCalendar},
  115. data() {
  116. return {
  117. cirimg:require("@/static/images/home/chose.png"),
  118. navbg:require("@/static/images/navbg.png"),
  119. restimg:require('@/work/static/clock/rest.png'),
  120. backgroundColor: "transparent",
  121. datainfo:{},
  122. dataobj:{},
  123. abnormainfo:[0,2,3,5],
  124. nvaHeight: 44,
  125. marTop: 0, //距离顶部的距离
  126. stubarHeight: 0, //
  127. visitName:'',
  128. signList: [],
  129. configWeek:[],
  130. configHoliday:'Y',
  131. firstDayOfWeek:'sunday',
  132. // dayflag:false,
  133. // month:'',
  134. // year:'',
  135. kaTime:'',
  136. changetime:'',//改变的日期
  137. timeday:'',//选择的日期
  138. // visitDate:'',
  139. userId:'',
  140. recordDate:'',
  141. countinfo:{},//统计,
  142. weekflag:false,
  143. }
  144. },
  145. onPageScroll(e) {
  146. var scrollTop = Number(e.scrollTop);
  147. if (scrollTop > 0) {
  148. this.backgroundColor = '#0491FD'
  149. } else {
  150. this.backgroundColor = 'transparent'
  151. }
  152. },
  153. onLoad: function(e) {
  154. if(e.data){
  155. var data=JSON.parse(decodeURIComponent(e.data))
  156. this.userId=data.userId;
  157. this.recordDate=data.recordDate;
  158. this.getCalendarList()
  159. this.timeWeek(data.recordDate)
  160. }
  161. uni.getSystemInfo({
  162. success: (e) => {
  163. this.stubarHeight = Number(e.statusBarHeight);
  164. this.nvaHeight = Number(e.statusBarHeight) + 44;
  165. }
  166. })
  167. this.time();
  168. if(checkPermi(['system:clock:personage:month'])){
  169. this.getClockCountper()
  170. }
  171. },
  172. onShow() {},
  173. methods: {
  174. checkPermi,
  175. checkRole,
  176. getBack() {
  177. uni.navigateBack({
  178. delta: 1
  179. })
  180. },
  181. getClockCountper(){
  182. var params = {
  183. userId: this.userId,
  184. recordDate: this.recordDate,
  185. }
  186. if(this.changetime){
  187. params.recordDate=this.changetime
  188. }
  189. getClockCountper(params).then(res => {
  190. if (res.code == 200) {
  191. this.countinfo=res.data;
  192. } else {
  193. this.$toast(res.msg)
  194. }
  195. })
  196. },
  197. dayChange(e){
  198. var week=e.week;
  199. // 周末标红
  200. if (week == 0 || week == 6){
  201. this.weekflag=true
  202. }else{
  203. this.weekflag=false
  204. }
  205. if(e.daySign&&e.daySign.length){
  206. var daySign=e.daySign[0];
  207. this.datainfo=JSON.parse(JSON.stringify(daySign))
  208. }
  209. },
  210. time() {
  211. var date = new Date();
  212. var y = date.getFullYear();
  213. var m = date.getMonth() + 1;
  214. var d = date.getDate();
  215. var h = date.getHours();
  216. var min = date.getMinutes();
  217. var s = date.getSeconds();
  218. var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  219. var weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  220. var yearStr = y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d);
  221. var timeStr = (h < 10 ? '0' + h : h) + ':' + (min < 10 ? '0' + min : min) + ':' + (s < 10 ? '0' + s : s);
  222. this.timeday = yearStr;
  223. this.kaTime =yearStr+' '+ timeStr;
  224. // 年,月,日, 星期几 时分秒
  225. },
  226. timeWeek(data){
  227. var date = new Date(data);
  228. var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  229. if(week==0||week==6){
  230. this.weekflag=true;
  231. }else{
  232. this.weekflag=false
  233. }
  234. },
  235. monthChange(e){
  236. var y=e.year;
  237. var m=e.month;
  238. var time=y + '-' + m + '-' + '01'
  239. this.changetime=time
  240. this.getCalendarList(time)
  241. this.getClockCountper()
  242. // if(y==this.year&&m==this.month){
  243. // this.getCalendarList()
  244. // this.changetime='';
  245. // }else{
  246. // var time=y + '-' + m + '-' + '01'
  247. // this.changetime=time
  248. // this.getCalendarList(time)
  249. // }
  250. },
  251. // 选中的日期
  252. getIsSelDayFn(e){
  253. if(e.sign&&e.sign.length){
  254. var date=e.sign[0].date;
  255. var daySign=e.sign[0];
  256. this.datainfo=JSON.parse(JSON.stringify(daySign))
  257. // if(date==this.recordDate){
  258. // var daySign=e.sign[0];
  259. // this.datainfo=JSON.parse(JSON.stringify(daySign))
  260. // }
  261. }
  262. },
  263. shrinkClick(e){
  264. console.log(e,3)
  265. },
  266. getNormal(){
  267. this.$tab.navigateTo("/work/pages/clock/abnormal")
  268. },
  269. cords(){
  270. // this.$tab.navigateTo("/work/pages/clock/abnormal")
  271. },
  272. init() {
  273. // 门卫
  274. // getDictionaryFn('is_read').then(res=>{
  275. // if(res.code==200){
  276. // this.ydztlist = res.data.map(v => {
  277. // return {
  278. // label: v.dictLabel,
  279. // value: v.dictValue
  280. // }
  281. // })
  282. // }
  283. // })
  284. },
  285. getCalendarList() {
  286. var params = {
  287. userId: this.userId,
  288. recordDate: this.recordDate,
  289. }
  290. if(this.changetime){
  291. params.recordDate=this.changetime
  292. }
  293. getClockRl(params).then(res => {
  294. if (res.code == 200) {
  295. var data=res.data;
  296. this.dataobj=res.data;
  297. var holidays=[];
  298. if(data.holidays&&data.holidays.length){
  299. holidays=data.holidays
  300. }
  301. if(data.rlData&&data.rlData.length){
  302. var newArr=JSON.parse(JSON.stringify(data.rlData))
  303. var tree=[]
  304. newArr.forEach(ite=>{
  305. const matchingData = holidays.find(d => d.holidayDate == ite.date);
  306. var obj=JSON.parse(JSON.stringify(ite))
  307. if(matchingData){
  308. obj.holidaytype=matchingData.type;
  309. tree.push(obj)
  310. }else{
  311. tree.push(obj)
  312. }
  313. if(ite.date==this.recordDate){
  314. this.datainfo=JSON.parse(JSON.stringify(obj))
  315. }
  316. })
  317. this.signList=JSON.parse(JSON.stringify(tree));
  318. // Object.keys(newArr).some((key) => {
  319. // if(newArr[key].date==this.recordDate){
  320. // this.datainfo=JSON.parse(JSON.stringify(newArr[key]))
  321. // return
  322. // }
  323. // })
  324. }
  325. } else {
  326. this.$toast(res.msg)
  327. }
  328. })
  329. },
  330. },
  331. }
  332. </script>
  333. <style>
  334. /* page {
  335. background: #ffffff;
  336. } */
  337. </style>
  338. <style lang="scss" scoped>
  339. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  340. .navbg{width: 100%;height: 692rpx;}
  341. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;flex-direction: column;}
  342. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 12rpx;border-radius: 14rpx;
  343. .ytop{padding: 16rpx 0 24rpx 16rpx;
  344. .tit{width: 62rpx;height: 62rpx;background: #0391FD;border-radius: 6rpx;font-weight: 500;
  345. font-size: 34rpx;color: #FFFFFF;margin-right: 18rpx;text-align: center;line-height: 62rpx;flex: 0 0 auto;}
  346. .cent{
  347. flex: 1;
  348. .ctit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 6rpx;}
  349. .ctime{font-weight: 500;font-size: 18rpx;color: #666666;}
  350. }
  351. }
  352. .tips{font-weight: 500;font-size: 26rpx;color: #888888;padding-left: 34rpx;margin-bottom: 24rpx;}
  353. // 步骤条
  354. .steps{position: relative;display: flex;padding-bottom:40rpx;
  355. &::after{
  356. content: '';position: absolute;left:6rpx;top: 34rpx;bottom: 4rpx;background-color: #DADADA;width: 2rpx;
  357. }
  358. .cir{width: 14rpx;height: 14rpx;background: #AFAFAF;border-radius: 50%;flex: 0 0 auto;margin-right: 38rpx;margin-top: 13rpx;}
  359. .stepsa{flex: 1;
  360. .steptit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 20rpx;}
  361. .steptxt{display: flex;
  362. image{width: 20rpx;height: 20rpx;margin-right: 14rpx;flex: 0 0 auto;margin-top: 7rpx;}
  363. view{font-weight: bold;font-size: 26rpx;color: #888888;}
  364. .tip{border-radius: 12rpx;font-weight: 500;font-size: 16rpx;color: #F87C29;border: 2rpx solid #F87C29;height: 28rpx;box-sizing: border-box;display: flex;align-items: center;padding: 0 8rpx;margin-left: 12rpx;flex: 0 0 auto;margin-top: 6rpx;}
  365. }
  366. }
  367. }
  368. }
  369. .locktop{
  370. background: #FFFFFF;
  371. box-shadow: 0px 0px 12rpx 0px rgba(153,152,152,0.39);
  372. border-radius: 14rpx;display: flex;align-items: center;padding: 40rpx 32rpx;margin-bottom: 30rpx;
  373. .locktopl{font-size: 26rpx;font-weight: bold;color: #343434;flex: 1 0 auto;margin-right: 16rpx;}
  374. .locktopr{font-size: 22rpx;color: #1678ff;flex: 0 1 auto;
  375. text{font-size: 28rpx;color: #F16435;font-weight: bold;}
  376. }
  377. .locktopi{width: 10rpx;height: 18rpx;flex: 0 0 auto;margin-left: 16rpx;}
  378. }
  379. .cof{color: #ff0000 !important;}
  380. // 标识点
  381. .cicr2{colorr: $uni-katype2 !important;}//迟到
  382. .cicr3{color: $uni-katype3 !important;}//外勤
  383. .cicr4{color: $uni-katype4 !important;}//早退
  384. .cicr5{color: $uni-katype5 !important;}//旷工
  385. .lock_header {
  386. background-color: #ffffff;
  387. margin-bottom: 30rpx;min-height: 220rpx;padding: 32rpx 34rpx 20rpx;box-shadow: 0px 0px 12rpx 0px rgba(153, 152, 152, 0.39);border-radius: 14rpx;box-sizing: border-box;
  388. .lock_headerth {display: flex;justify-content: space-between;align-items: center;
  389. .tit{font-size: 26rpx;font-weight: bold;color: #343434;}
  390. .txt{display: flex;align-items: center;
  391. text {font-size: 26rpx;font-weight: 400;color: #1678ff;}
  392. image {width: 10rpx; height: 18rpx;margin-left: 10rpx;}
  393. }
  394. }
  395. .lock_headerthbt {display: flex;justify-content: space-between;
  396. view {flex: 1;text-align: center;display: flex;flex-direction: column;align-items: center;padding: 26rpx 0 20rpx;
  397. .tit{margin-bottom: 16rpx;font-size: 34rpx;font-weight: bold;color: #343434;}
  398. .txt{font-size: 22rpx;font-weight: 400;color: #343434;
  399. }
  400. }
  401. }
  402. }
  403. .restbox{display: flex;flex-direction: column;align-items: center;margin-bottom: 48rpx;padding-top: 40rpx;
  404. image{width: 396rpx;height: 264rpx;margin-bottom: 20rpx;}
  405. view{font-weight: 500;font-size: 26rpx;color: #343434;}
  406. }
  407. </style>