stat.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <view class="container">
  3. <!-- 顶部分段器区域 -->
  4. <view class="control" v-if="flag">
  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. {{fail_count}}
  22. </view>
  23. <view class="mes">
  24. 异常次数(次)
  25. </view>
  26. </view>
  27. <view class="success">
  28. <view class="number">
  29. {{success_count}}
  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>({{month}}月)</span>
  42. </view>
  43. <view class="calendar_body">
  44. <uni-calendar :showMonth="false" @change="change" :selected="list" />
  45. </view>
  46. <view class="calendar_foot" v-if="current==1">
  47. <!-- 每一条记录区域 -->
  48. <view class="foot_item" v-for="item in list2" :key="item.id">
  49. <view>
  50. 规则:{{item.ruleName}} {{item.timeRange}}
  51. </view>
  52. <view class="box">
  53. <view class="circular" v-if="item.finish"></view>
  54. <view class="circular color" v-else></view>
  55. {{item.finish?"已打卡":"未打卡"}}
  56. <span v-if="item.finish">{{item.updateTime}}</span>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 环形图区域 -->
  61. <view class="progress" v-if="current==0">
  62. <view class="chart">
  63. <progressBar :progress_txt="progress_txt" :progress_total="progress_total" />
  64. </view>
  65. <view class="look">
  66. <view class="info">
  67. 查看明细
  68. </view>
  69. <img src="../../static/right.png">
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 异常人员名单区域 -->
  74. <view class="errPeople" v-if="current==0">
  75. <!-- 标题区域 -->
  76. <view class="e_header">
  77. <view class="left">
  78. 异常人员名单
  79. </view>
  80. <view class="right">
  81. <view class="icon">
  82. <img src="../../static/notice.png">
  83. </view>
  84. <view class="info">
  85. 通知
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 选择时间区域 -->
  90. <view class="e_calendar">
  91. <!-- 双左箭头区域 -->
  92. <view class="double" @click="handleDoubleLeft">
  93. <img src="../../static/double_left.png">
  94. </view>
  95. <!-- 左箭头区域区域 -->
  96. <view class="single" @click="handleLeft">
  97. <img src="../../static/left.png">
  98. </view>
  99. <!-- 时间区域 -->
  100. <view class="time">
  101. {{year}}-{{comMonth}}
  102. </view>
  103. <!-- 双右箭头区域 -->
  104. <view class="single2" @click="handleRight">
  105. <img src="../../static/right2.png">
  106. </view>
  107. <!-- 右箭头区域 -->
  108. <view class="double" @click="handleDoubleRight">
  109. <img src="../../static/double_right.png">
  110. </view>
  111. </view>
  112. <view class="e_list">
  113. <view class="e_box" v-for="item in errList" :key="item.id">
  114. <view class="e_img">
  115. <img :src="item.peopleImg">
  116. </view>
  117. <view class="e_name">
  118. {{item.name}}
  119. </view>
  120. <view class="e_msg">
  121. 未打卡{{item.num}}次
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import progressBar from '../../components/chocolate-progress-bar/chocolate-progress-bar.vue'
  130. export default {
  131. components: {
  132. progressBar
  133. },
  134. data() {
  135. return {
  136. flag: false,
  137. // 有标记点的数组日期
  138. list: [{
  139. date: "2022-12-20",
  140. info: ''
  141. },
  142. {
  143. date: "2022-12-21",
  144. info: '',
  145. data: {
  146. custom: '自定义信息',
  147. name: '自定义消息头'
  148. }
  149. },
  150. {
  151. date: "2022-12-22",
  152. info: ''
  153. }
  154. ],
  155. // 考勤规则列表
  156. list2: [{
  157. id: 1,
  158. msg: "规则:课间操考勤打卡09:00 - 09:15",
  159. status: 0,
  160. time: "09:25:25"
  161. },
  162. {
  163. id: 2,
  164. msg: "规则:考勤打卡19:00 - 20:15",
  165. status: 1,
  166. time: "19:25:25"
  167. },
  168. ],
  169. month: null,
  170. items: ['团队统计', '我的统计'],
  171. current: 1,
  172. year: null,
  173. month: null,
  174. errList: [{
  175. id: 1,
  176. 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",
  177. name: "程佳欢",
  178. num: 20
  179. },
  180. {
  181. id: 2,
  182. 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",
  183. name: "程欢",
  184. num: 10
  185. },
  186. {
  187. id: 3,
  188. 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",
  189. name: "张三",
  190. num: 30
  191. },
  192. {
  193. id: 4,
  194. 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",
  195. name: "李四",
  196. num: 30
  197. },
  198. ],
  199. progress_txt: 50,
  200. progress_total: 70,
  201. // 当前时间
  202. nowTime: "",
  203. // 打卡异常次数
  204. fail_count: 0,
  205. // 打卡成功次数
  206. success_count: 0
  207. };
  208. },
  209. onLoad() {
  210. if (this.flag) {
  211. this.current = 0
  212. }
  213. this.getTime()
  214. this.getMonthTimes()
  215. this.getRulesList()
  216. },
  217. computed: {
  218. comMonth() {
  219. if (this.month) {
  220. let month = this.month < 10 ? '0' + this.month : this.month
  221. return month
  222. }
  223. }
  224. },
  225. methods: {
  226. // 获取当前年 月 日
  227. getTime() {
  228. let date = new Date()
  229. let year = date.getFullYear()
  230. let month = date.getMonth() + 1
  231. let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  232. this.nowTime = year + "-" + month + "-" + day + " " + "00:00:00"
  233. this.year = year
  234. this.month = month
  235. },
  236. // 获取我的月打卡次数
  237. async getMonthTimes() {
  238. let res = await this.$myRequest({
  239. url: "/attendance/api/sign/check/in/month/times",
  240. data: {
  241. time: this.nowTime
  242. }
  243. })
  244. // console.log(res);
  245. if (res.code == 200) {
  246. this.fail_count = res.data.fail
  247. this.success_count = res.data.success
  248. }
  249. },
  250. // 获取打卡规则列表
  251. async getRulesList() {
  252. let name = uni.getStorageSync("userInfo").username
  253. let res = await this.$myRequest({
  254. url: "/attendance/api/sign/check/in/list",
  255. data: {
  256. name: name ? name : "",
  257. size: 999,
  258. beginTimeBegin: this.nowTime
  259. }
  260. })
  261. // console.log(res);
  262. if (res.code == 200) {
  263. this.list2 = res.data.list
  264. }
  265. },
  266. // 点击日历日期回调
  267. change(e) {
  268. console.log('change 返回:', e.fulldate)
  269. this.nowTime = e.fulldate + " " + "00:00:00"
  270. this.getRulesList()
  271. },
  272. onClickItem(e) {
  273. console.log(e.currentIndex);
  274. this.current = e.currentIndex
  275. // if (e.currentIndex == 0) {
  276. // this.list = this.list2
  277. // } else {
  278. // this.list = this.list3
  279. // }
  280. },
  281. // 跳转统计详情页面
  282. goToDetail() {
  283. if (this.current == 1) {
  284. uni.navigateTo({
  285. url: `/pages/statDetail/statDetail?month=${this.month}`
  286. })
  287. } else {
  288. uni.navigateTo({
  289. url: "/pages/particulars/particulars"
  290. })
  291. }
  292. },
  293. handleDoubleLeft() {
  294. if (this.year <= 2000) {
  295. uni.showToast({
  296. title: "不能选择2000年之前",
  297. icon: 'none'
  298. })
  299. } else {
  300. this.year -= 1
  301. }
  302. },
  303. handleLeft() {
  304. if (this.month <= 1) {
  305. if (this.year <= 2000) {
  306. uni.showToast({
  307. title: "不能选择2000年之前",
  308. icon: 'none'
  309. })
  310. } else {
  311. this.year -= 1
  312. this.month = 12
  313. }
  314. } else {
  315. this.month -= 1
  316. }
  317. },
  318. handleRight() {
  319. if (this.month >= 12) {
  320. if (this.year >= 2025) {
  321. uni.showToast({
  322. title: "不能选择2025年之后",
  323. icon: 'none'
  324. })
  325. } else {
  326. this.year += 1
  327. this.month = 1
  328. }
  329. } else {
  330. this.month += 1
  331. }
  332. },
  333. handleDoubleRight() {
  334. if (this.year >= 2025) {
  335. uni.showToast({
  336. title: "不能选择2025年之后",
  337. icon: 'none'
  338. })
  339. } else {
  340. this.year += 1
  341. }
  342. },
  343. }
  344. }
  345. </script>
  346. <style lang="scss" scoped>
  347. .container {
  348. padding-top: 20rpx;
  349. .control {
  350. margin-bottom: 20rpx;
  351. width: 750rpx;
  352. height: 90rpx;
  353. background-color: #fff;
  354. }
  355. .header {
  356. margin: 0 auto;
  357. width: 690rpx;
  358. height: 236rpx;
  359. background-color: #fff;
  360. .title {
  361. display: flex;
  362. height: 92rpx;
  363. .month {
  364. flex: 8;
  365. margin: 30rpx 0 0 30rpx;
  366. font-size: 32rpx;
  367. font-weight: 500
  368. }
  369. .right {
  370. display: flex;
  371. justify-content: center;
  372. align-items: center;
  373. flex: 1;
  374. img {
  375. width: 15rpx;
  376. height: 30rpx
  377. }
  378. }
  379. }
  380. .state {
  381. display: flex;
  382. height: 144rpx;
  383. .err {
  384. flex: 1;
  385. display: flex;
  386. flex-direction: column;
  387. justify-content: center;
  388. align-items: center;
  389. .number {
  390. font-size: 46rpx;
  391. font-weight: 700;
  392. }
  393. .mes {
  394. font-size: 28rpx;
  395. color: #999999;
  396. }
  397. }
  398. .success {
  399. flex: 1;
  400. display: flex;
  401. flex-direction: column;
  402. justify-content: center;
  403. align-items: center;
  404. .number {
  405. font-size: 46rpx;
  406. font-weight: 700;
  407. }
  408. .mes {
  409. font-size: 28rpx;
  410. color: #999999;
  411. }
  412. }
  413. }
  414. }
  415. .calendar {
  416. margin: 0 auto;
  417. margin-top: 30rpx;
  418. width: 693rpx;
  419. background-color: #fff;
  420. .calendar_title {
  421. padding-left: 30rpx;
  422. height: 100rpx;
  423. line-height: 100rpx;
  424. font-size: 32rpx;
  425. font-weight: 500;
  426. span {
  427. font-size: 26rpx;
  428. color: #999999
  429. }
  430. }
  431. .calendar_body {
  432. height: 690rpx;
  433. background-color: skyblue;
  434. }
  435. .calendar_foot {
  436. padding: 0 30rpx;
  437. .foot_item {
  438. box-sizing: border-box;
  439. padding: 30rpx;
  440. display: flex;
  441. flex-direction: column;
  442. justify-content: space-evenly;
  443. height: 130rpx;
  444. font-size: 24rpx;
  445. color: #808080;
  446. .box {
  447. display: flex;
  448. align-items: center;
  449. .circular {
  450. margin-right: 18rpx;
  451. width: 12rpx;
  452. height: 12rpx;
  453. border-radius: 6rpx;
  454. background-color: #31C20E;
  455. }
  456. .color {
  457. background-color: #999999;
  458. }
  459. span {
  460. margin-left: 18rpx;
  461. }
  462. }
  463. }
  464. }
  465. .progress {
  466. position: relative;
  467. display: flex;
  468. justify-content: center;
  469. padding: 0 30rpx;
  470. height: 121px;
  471. .chart {
  472. margin-top: 20rpx;
  473. width: 170px;
  474. height: 100%;
  475. }
  476. .look {
  477. position: absolute;
  478. top: 40rpx;
  479. right: 36rpx;
  480. display: flex;
  481. align-items: center;
  482. width: 150rpx;
  483. height: 42rpx;
  484. .info {
  485. margin-right: 15rpx;
  486. font-size: 28rpx;
  487. color: #A6A6A6;
  488. }
  489. img {
  490. width: 16rpx;
  491. height: 24rpx;
  492. }
  493. }
  494. }
  495. }
  496. .errPeople {
  497. margin: 0 auto;
  498. margin-top: 32rpx;
  499. width: 690rpx;
  500. border-radius: 7rpx;
  501. background-color: #fff;
  502. .e_header {
  503. display: flex;
  504. align-items: center;
  505. width: 690rpx;
  506. height: 121rpx;
  507. .left {
  508. flex: 1;
  509. margin-left: 30rpx;
  510. font-size: 32rpx;
  511. font-weight: 500;
  512. }
  513. .right {
  514. flex: 1;
  515. display: flex;
  516. justify-content: flex-end;
  517. align-items: center;
  518. margin-right: 32rpx;
  519. .icon {
  520. margin-right: 10rpx;
  521. width: 26rpx;
  522. height: 26rpx;
  523. line-height: 26rpx;
  524. img {
  525. width: 100%;
  526. height: 100%;
  527. }
  528. }
  529. .info {
  530. width: 56rpx;
  531. height: 41rpx;
  532. font-size: 28rpx;
  533. color: #2A82E4;
  534. }
  535. }
  536. }
  537. .e_calendar {
  538. display: flex;
  539. justify-content: flex-end;
  540. align-items: center;
  541. .double {
  542. margin-right: 30rpx;
  543. width: 40rpx;
  544. height: 40rpx;
  545. img {
  546. width: 100%;
  547. height: 100%;
  548. }
  549. }
  550. .single {
  551. width: 40rpx;
  552. height: 40rpx;
  553. img {
  554. width: 80%;
  555. height: 70%;
  556. }
  557. }
  558. .single2 {
  559. margin-right: 30rpx;
  560. width: 40rpx;
  561. height: 40rpx;
  562. img {
  563. width: 100%;
  564. height: 70%;
  565. }
  566. }
  567. .time {
  568. width: 180rpx;
  569. height: 44rpx;
  570. font-size: 32rpx;
  571. text-align: center;
  572. }
  573. }
  574. .e_list {
  575. display: flex;
  576. flex-wrap: wrap;
  577. justify-content: space-evenly;
  578. align-items: center;
  579. margin-top: 20rpx;
  580. padding: 30rpx;
  581. width: 630rpx;
  582. .e_box {
  583. display: flex;
  584. flex-direction: column;
  585. justify-content: space-evenly;
  586. align-items: center;
  587. margin-bottom: 20rpx;
  588. width: 180rpx;
  589. height: 190rpx;
  590. .e_img {
  591. width: 100rpx;
  592. height: 100rpx;
  593. img {
  594. width: 100%;
  595. height: 100%;
  596. border-radius: 50%;
  597. }
  598. }
  599. .e_name {
  600. font-size: 28rpx;
  601. }
  602. .e_msg {
  603. font-size: 24rpx;
  604. color: #808080;
  605. }
  606. }
  607. }
  608. }
  609. }
  610. // 修改选中日期盒子圆角
  611. ::v-deep .uni-calendar-item--isDay {
  612. border-radius: 50rpx;
  613. }
  614. ::v-deep .uni-calendar-item--checked {
  615. border-radius: 50rpx;
  616. }
  617. </style>