stat.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <view class="container">
  3. <!-- 顶部分段器区域 -->
  4. <view class="control">
  5. <uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem"
  6. activeColor="#0082FC"></uni-segmented-control>
  7. </view>
  8. <!-- 头部月份区域 -->
  9. <view class="header">
  10. <view class="title">
  11. <view class="month">
  12. {{month}}月汇总
  13. </view>
  14. <view class="right" @click="goToDetail">
  15. <img src="../../static/right.png" alt="">
  16. </view>
  17. </view>
  18. <view class="state">
  19. <view class="err">
  20. <view class="number">
  21. 0
  22. </view>
  23. <view class="mes">
  24. 异常次数(次)
  25. </view>
  26. </view>
  27. <view class="success">
  28. <view class="number">
  29. 1
  30. </view>
  31. <view class="mes">
  32. 打卡成功(次)
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 日历区域 -->
  38. <view class="calendar">
  39. <view class="calendar_title">
  40. 每日记录
  41. <span>(5月)</span>
  42. </view>
  43. <view class="calendar_body">
  44. <uni-calendar :showMonth="false" @change="change" :selected="list" />
  45. </view>
  46. <view class="calendar_foot">
  47. <!-- 每一条记录区域 -->
  48. <view class="foot_item" v-for="item in list2" :key="item.id">
  49. <view>
  50. {{item.msg}}
  51. </view>
  52. <view class="box">
  53. <view class="circular" v-if="item.status==1"></view>
  54. <view class="circular color" v-else></view>
  55. {{item.status==0?"未打卡":"已打卡"}}
  56. <span>{{item.time}}</span>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 异常人员名单区域 -->
  62. <view class="errPeople">
  63. <!-- 标题区域 -->
  64. <view class="e_header">
  65. <view class="left">
  66. 异常人员名单
  67. </view>
  68. <view class="right">
  69. <view class="icon">
  70. <img src="../../static/notice.png">
  71. </view>
  72. <view class="info">
  73. 通知
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 选择时间区域 -->
  78. <view class="e_calendar">
  79. <!-- 双左箭头区域 -->
  80. <view class="double" @click="handleDoubleLeft">
  81. <img src="../../static/double_left.png">
  82. </view>
  83. <!-- 左箭头区域区域 -->
  84. <view class="single" @click="handleLeft">
  85. <img src="../../static/left.png">
  86. </view>
  87. <!-- 时间区域 -->
  88. <view class="time">
  89. {{year}}-{{comMonth}}
  90. </view>
  91. <!-- 双右箭头区域 -->
  92. <view class="single2" @click="handleRight">
  93. <img src="../../static/right2.png">
  94. </view>
  95. <!-- 右箭头区域 -->
  96. <view class="double" @click="handleDoubleRight">
  97. <img src="../../static/double_right.png">
  98. </view>
  99. </view>
  100. <view class="e_list">
  101. <view class="e_box" v-for="item in errList" :key="item.id">
  102. <view class="e_img">
  103. <img :src="item.peopleImg">
  104. </view>
  105. <view class="e_name">
  106. {{item.name}}
  107. </view>
  108. <view class="e_msg">
  109. 未打卡{{item.num}}次
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. export default {
  118. data() {
  119. return {
  120. list: [{
  121. date: "2022-11-20",
  122. info: ''
  123. },
  124. {
  125. date: "2022-11-21",
  126. info: '',
  127. data: {
  128. custom: '自定义信息',
  129. name: '自定义消息头'
  130. }
  131. },
  132. {
  133. date: "2022-11-22",
  134. info: ''
  135. }
  136. ],
  137. list2: [{
  138. id: 1,
  139. msg: "规则:课间操考勤打卡09:00 - 09:15",
  140. status: 0,
  141. time: "09:25:25"
  142. },
  143. {
  144. id: 2,
  145. msg: "规则:考勤打卡19:00 - 20:15",
  146. status: 1,
  147. time: "19:25:25"
  148. },
  149. ],
  150. month: null,
  151. items: ['团队统计', '我的统计'],
  152. current: 0,
  153. year: null,
  154. month: null,
  155. errList: [{
  156. id: 1,
  157. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  158. name: "程佳欢",
  159. num: 20
  160. },
  161. {
  162. id: 2,
  163. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  164. name: "程欢",
  165. num: 10
  166. },
  167. {
  168. id: 3,
  169. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  170. name: "张三",
  171. num: 30
  172. },
  173. {
  174. id: 4,
  175. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  176. name: "李四",
  177. num: 30
  178. },
  179. ],
  180. };
  181. },
  182. onLoad() {
  183. this.getTime()
  184. },
  185. computed: {
  186. comMonth() {
  187. if (this.month) {
  188. let month = this.month < 10 ? '0' + this.month : this.month
  189. console.log(month);
  190. return month
  191. }
  192. }
  193. },
  194. methods: {
  195. // 获取当前年份
  196. getTime() {
  197. let date = new Date()
  198. let year = date.getFullYear()
  199. let month = date.getMonth() + 1
  200. this.year = year
  201. this.month = month
  202. },
  203. // 点击日历日期回调
  204. change(e) {
  205. console.log('change 返回:', e)
  206. },
  207. onClickItem(e) {
  208. console.log(e.currentIndex);
  209. // if (e.currentIndex == 0) {
  210. // this.list = this.list2
  211. // } else {
  212. // this.list = this.list3
  213. // }
  214. },
  215. // 跳转统计详情页面
  216. goToDetail() {
  217. uni.navigateTo({
  218. url: `/pages/statDetail/statDetail?month=${this.month}`
  219. })
  220. },
  221. handleDoubleLeft() {
  222. if (this.year <= 2000) {
  223. uni.showToast({
  224. title: "不能选择2000年之前",
  225. icon: 'none'
  226. })
  227. } else {
  228. this.year -= 1
  229. }
  230. },
  231. handleLeft() {
  232. if (this.month <= 1) {
  233. if (this.year <= 2000) {
  234. uni.showToast({
  235. title: "不能选择2000年之前",
  236. icon: 'none'
  237. })
  238. } else {
  239. this.year -= 1
  240. this.month = 12
  241. }
  242. } else {
  243. this.month -= 1
  244. }
  245. },
  246. handleRight() {
  247. if (this.month >= 12) {
  248. if (this.year >= 2025) {
  249. uni.showToast({
  250. title: "不能选择2025年之后",
  251. icon: 'none'
  252. })
  253. } else {
  254. this.year += 1
  255. this.month = 1
  256. }
  257. } else {
  258. this.month += 1
  259. }
  260. },
  261. handleDoubleRight() {
  262. if (this.year >= 2025) {
  263. uni.showToast({
  264. title: "不能选择2025年之后",
  265. icon: 'none'
  266. })
  267. } else {
  268. this.year += 1
  269. }
  270. },
  271. }
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. .container {
  276. padding-top: 20rpx;
  277. .control {
  278. margin-bottom: 20rpx;
  279. width: 750rpx;
  280. height: 90rpx;
  281. background-color: #fff;
  282. }
  283. .header {
  284. margin: 0 auto;
  285. width: 690rpx;
  286. height: 236rpx;
  287. background-color: #fff;
  288. .title {
  289. display: flex;
  290. height: 92rpx;
  291. .month {
  292. flex: 8;
  293. margin: 30rpx 0 0 30rpx;
  294. font-size: 32rpx;
  295. font-weight: 500
  296. }
  297. .right {
  298. display: flex;
  299. justify-content: center;
  300. align-items: center;
  301. flex: 1;
  302. img {
  303. width: 15rpx;
  304. height: 30rpx
  305. }
  306. }
  307. }
  308. .state {
  309. display: flex;
  310. height: 144rpx;
  311. .err {
  312. flex: 1;
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: center;
  316. align-items: center;
  317. .number {
  318. font-size: 46rpx;
  319. font-weight: 700;
  320. }
  321. .mes {
  322. font-size: 28rpx;
  323. color: #999999;
  324. }
  325. }
  326. .success {
  327. flex: 1;
  328. display: flex;
  329. flex-direction: column;
  330. justify-content: center;
  331. align-items: center;
  332. .number {
  333. font-size: 46rpx;
  334. font-weight: 700;
  335. }
  336. .mes {
  337. font-size: 28rpx;
  338. color: #999999;
  339. }
  340. }
  341. }
  342. }
  343. .calendar {
  344. margin: 0 auto;
  345. margin-top: 30rpx;
  346. width: 693rpx;
  347. background-color: #fff;
  348. .calendar_title {
  349. padding-left: 30rpx;
  350. height: 100rpx;
  351. line-height: 100rpx;
  352. font-size: 32rpx;
  353. font-weight: 500;
  354. span {
  355. font-size: 26rpx;
  356. color: #999999
  357. }
  358. }
  359. .calendar_body {
  360. height: 690rpx;
  361. background-color: skyblue;
  362. }
  363. .calendar_foot {
  364. padding: 0 30rpx;
  365. // margin-bottom: 80rpx;
  366. .foot_item {
  367. box-sizing: border-box;
  368. padding: 30rpx;
  369. display: flex;
  370. flex-direction: column;
  371. justify-content: space-evenly;
  372. height: 130rpx;
  373. font-size: 24rpx;
  374. color: #808080;
  375. .box {
  376. display: flex;
  377. align-items: center;
  378. .circular {
  379. margin-right: 18rpx;
  380. width: 12rpx;
  381. height: 12rpx;
  382. border-radius: 6rpx;
  383. background-color: #31C20E;
  384. }
  385. .color {
  386. background-color: #999999;
  387. }
  388. span {
  389. margin-left: 18rpx;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .errPeople {
  396. margin: 0 auto;
  397. margin-top: 32rpx;
  398. width: 690rpx;
  399. border-radius: 7rpx;
  400. background-color: #fff;
  401. .e_header {
  402. display: flex;
  403. align-items: center;
  404. width: 690rpx;
  405. height: 121rpx;
  406. .left {
  407. flex: 1;
  408. margin-left: 30rpx;
  409. font-size: 32rpx;
  410. font-weight: 500;
  411. }
  412. .right {
  413. flex: 1;
  414. display: flex;
  415. justify-content: flex-end;
  416. align-items: center;
  417. margin-right: 32rpx;
  418. .icon {
  419. margin-right: 10rpx;
  420. width: 26rpx;
  421. height: 26rpx;
  422. line-height: 26rpx;
  423. img {
  424. width: 100%;
  425. height: 100%;
  426. }
  427. }
  428. .info {
  429. width: 56rpx;
  430. height: 41rpx;
  431. font-size: 28rpx;
  432. color: #2A82E4;
  433. }
  434. }
  435. }
  436. .e_calendar {
  437. display: flex;
  438. justify-content: flex-end;
  439. align-items: center;
  440. .double {
  441. margin-right: 30rpx;
  442. width: 40rpx;
  443. height: 40rpx;
  444. img {
  445. width: 100%;
  446. height: 100%;
  447. }
  448. }
  449. .single {
  450. width: 40rpx;
  451. height: 40rpx;
  452. img {
  453. width: 80%;
  454. height: 70%;
  455. }
  456. }
  457. .single2 {
  458. margin-right: 30rpx;
  459. width: 40rpx;
  460. height: 40rpx;
  461. img {
  462. width: 100%;
  463. height: 70%;
  464. }
  465. }
  466. .time {
  467. width: 180rpx;
  468. height: 44rpx;
  469. font-size: 32rpx;
  470. text-align: center;
  471. }
  472. }
  473. .e_list {
  474. display: flex;
  475. flex-wrap: wrap;
  476. justify-content: space-evenly;
  477. align-items: center;
  478. margin-top: 20rpx;
  479. padding: 30rpx;
  480. width: 630rpx;
  481. .e_box {
  482. display: flex;
  483. flex-direction: column;
  484. justify-content: space-evenly;
  485. align-items: center;
  486. margin-bottom: 20rpx;
  487. width: 180rpx;
  488. height: 190rpx;
  489. .e_img {
  490. width: 100rpx;
  491. height: 100rpx;
  492. img {
  493. width: 100%;
  494. height: 100%;
  495. border-radius: 50%;
  496. }
  497. }
  498. .e_name {
  499. font-size: 28rpx;
  500. }
  501. .e_msg {
  502. font-size: 24rpx;
  503. color: #808080;
  504. }
  505. }
  506. }
  507. }
  508. }
  509. // 修改选中日期盒子圆角
  510. ::v-deep .uni-calendar-item--isDay {
  511. border-radius: 50rpx;
  512. }
  513. ::v-deep .uni-calendar-item--checked {
  514. border-radius: 50rpx;
  515. }
  516. </style>