stat.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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. 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>({{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. nowTime: ""
  202. };
  203. },
  204. onLoad() {
  205. if (this.flag) {
  206. this.current = 0
  207. }
  208. this.getTime()
  209. this.getRulesList()
  210. },
  211. computed: {
  212. comMonth() {
  213. if (this.month) {
  214. let month = this.month < 10 ? '0' + this.month : this.month
  215. return month
  216. }
  217. }
  218. },
  219. methods: {
  220. // 获取当前年 月 日
  221. getTime() {
  222. let date = new Date()
  223. let year = date.getFullYear()
  224. let month = date.getMonth() + 1
  225. let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  226. this.nowTime = year + "-" + month + "-" + day + " " + "00:00:00"
  227. this.year = year
  228. this.month = month
  229. },
  230. // 获取打卡规则列表
  231. async getRulesList() {
  232. let name = uni.getStorageSync("userInfo").username
  233. let res = await this.$myRequest({
  234. url: "/attendance/api/sign/check/in/list",
  235. data: {
  236. name: name ? name : "",
  237. size: 999,
  238. beginTimeBegin: this.nowTime
  239. }
  240. })
  241. console.log(res);
  242. if (res.code == 200) {
  243. this.list2 = res.data.list
  244. }
  245. },
  246. // 点击日历日期回调
  247. change(e) {
  248. console.log('change 返回:', e.fulldate)
  249. this.nowTime = e.fulldate+ " " + "00:00:00"
  250. this.getRulesList()
  251. },
  252. onClickItem(e) {
  253. console.log(e.currentIndex);
  254. this.current = e.currentIndex
  255. // if (e.currentIndex == 0) {
  256. // this.list = this.list2
  257. // } else {
  258. // this.list = this.list3
  259. // }
  260. },
  261. // 跳转统计详情页面
  262. goToDetail() {
  263. if (this.current == 1) {
  264. uni.navigateTo({
  265. url: `/pages/statDetail/statDetail?month=${this.month}`
  266. })
  267. } else {
  268. uni.navigateTo({
  269. url: "/pages/particulars/particulars"
  270. })
  271. }
  272. },
  273. handleDoubleLeft() {
  274. if (this.year <= 2000) {
  275. uni.showToast({
  276. title: "不能选择2000年之前",
  277. icon: 'none'
  278. })
  279. } else {
  280. this.year -= 1
  281. }
  282. },
  283. handleLeft() {
  284. if (this.month <= 1) {
  285. if (this.year <= 2000) {
  286. uni.showToast({
  287. title: "不能选择2000年之前",
  288. icon: 'none'
  289. })
  290. } else {
  291. this.year -= 1
  292. this.month = 12
  293. }
  294. } else {
  295. this.month -= 1
  296. }
  297. },
  298. handleRight() {
  299. if (this.month >= 12) {
  300. if (this.year >= 2025) {
  301. uni.showToast({
  302. title: "不能选择2025年之后",
  303. icon: 'none'
  304. })
  305. } else {
  306. this.year += 1
  307. this.month = 1
  308. }
  309. } else {
  310. this.month += 1
  311. }
  312. },
  313. handleDoubleRight() {
  314. if (this.year >= 2025) {
  315. uni.showToast({
  316. title: "不能选择2025年之后",
  317. icon: 'none'
  318. })
  319. } else {
  320. this.year += 1
  321. }
  322. },
  323. }
  324. }
  325. </script>
  326. <style lang="scss" scoped>
  327. .container {
  328. padding-top: 20rpx;
  329. .control {
  330. margin-bottom: 20rpx;
  331. width: 750rpx;
  332. height: 90rpx;
  333. background-color: #fff;
  334. }
  335. .header {
  336. margin: 0 auto;
  337. width: 690rpx;
  338. height: 236rpx;
  339. background-color: #fff;
  340. .title {
  341. display: flex;
  342. height: 92rpx;
  343. .month {
  344. flex: 8;
  345. margin: 30rpx 0 0 30rpx;
  346. font-size: 32rpx;
  347. font-weight: 500
  348. }
  349. .right {
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. flex: 1;
  354. img {
  355. width: 15rpx;
  356. height: 30rpx
  357. }
  358. }
  359. }
  360. .state {
  361. display: flex;
  362. height: 144rpx;
  363. .err {
  364. flex: 1;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: center;
  368. align-items: center;
  369. .number {
  370. font-size: 46rpx;
  371. font-weight: 700;
  372. }
  373. .mes {
  374. font-size: 28rpx;
  375. color: #999999;
  376. }
  377. }
  378. .success {
  379. flex: 1;
  380. display: flex;
  381. flex-direction: column;
  382. justify-content: center;
  383. align-items: center;
  384. .number {
  385. font-size: 46rpx;
  386. font-weight: 700;
  387. }
  388. .mes {
  389. font-size: 28rpx;
  390. color: #999999;
  391. }
  392. }
  393. }
  394. }
  395. .calendar {
  396. margin: 0 auto;
  397. margin-top: 30rpx;
  398. width: 693rpx;
  399. background-color: #fff;
  400. .calendar_title {
  401. padding-left: 30rpx;
  402. height: 100rpx;
  403. line-height: 100rpx;
  404. font-size: 32rpx;
  405. font-weight: 500;
  406. span {
  407. font-size: 26rpx;
  408. color: #999999
  409. }
  410. }
  411. .calendar_body {
  412. height: 690rpx;
  413. background-color: skyblue;
  414. }
  415. .calendar_foot {
  416. padding: 0 30rpx;
  417. .foot_item {
  418. box-sizing: border-box;
  419. padding: 30rpx;
  420. display: flex;
  421. flex-direction: column;
  422. justify-content: space-evenly;
  423. height: 130rpx;
  424. font-size: 24rpx;
  425. color: #808080;
  426. .box {
  427. display: flex;
  428. align-items: center;
  429. .circular {
  430. margin-right: 18rpx;
  431. width: 12rpx;
  432. height: 12rpx;
  433. border-radius: 6rpx;
  434. background-color: #31C20E;
  435. }
  436. .color {
  437. background-color: #999999;
  438. }
  439. span {
  440. margin-left: 18rpx;
  441. }
  442. }
  443. }
  444. }
  445. .progress {
  446. position: relative;
  447. display: flex;
  448. justify-content: center;
  449. padding: 0 30rpx;
  450. height: 121px;
  451. .chart {
  452. margin-top: 20rpx;
  453. width: 170px;
  454. height: 100%;
  455. }
  456. .look {
  457. position: absolute;
  458. top: 40rpx;
  459. right: 36rpx;
  460. display: flex;
  461. align-items: center;
  462. width: 150rpx;
  463. height: 42rpx;
  464. .info {
  465. margin-right: 15rpx;
  466. font-size: 28rpx;
  467. color: #A6A6A6;
  468. }
  469. img {
  470. width: 16rpx;
  471. height: 24rpx;
  472. }
  473. }
  474. }
  475. }
  476. .errPeople {
  477. margin: 0 auto;
  478. margin-top: 32rpx;
  479. width: 690rpx;
  480. border-radius: 7rpx;
  481. background-color: #fff;
  482. .e_header {
  483. display: flex;
  484. align-items: center;
  485. width: 690rpx;
  486. height: 121rpx;
  487. .left {
  488. flex: 1;
  489. margin-left: 30rpx;
  490. font-size: 32rpx;
  491. font-weight: 500;
  492. }
  493. .right {
  494. flex: 1;
  495. display: flex;
  496. justify-content: flex-end;
  497. align-items: center;
  498. margin-right: 32rpx;
  499. .icon {
  500. margin-right: 10rpx;
  501. width: 26rpx;
  502. height: 26rpx;
  503. line-height: 26rpx;
  504. img {
  505. width: 100%;
  506. height: 100%;
  507. }
  508. }
  509. .info {
  510. width: 56rpx;
  511. height: 41rpx;
  512. font-size: 28rpx;
  513. color: #2A82E4;
  514. }
  515. }
  516. }
  517. .e_calendar {
  518. display: flex;
  519. justify-content: flex-end;
  520. align-items: center;
  521. .double {
  522. margin-right: 30rpx;
  523. width: 40rpx;
  524. height: 40rpx;
  525. img {
  526. width: 100%;
  527. height: 100%;
  528. }
  529. }
  530. .single {
  531. width: 40rpx;
  532. height: 40rpx;
  533. img {
  534. width: 80%;
  535. height: 70%;
  536. }
  537. }
  538. .single2 {
  539. margin-right: 30rpx;
  540. width: 40rpx;
  541. height: 40rpx;
  542. img {
  543. width: 100%;
  544. height: 70%;
  545. }
  546. }
  547. .time {
  548. width: 180rpx;
  549. height: 44rpx;
  550. font-size: 32rpx;
  551. text-align: center;
  552. }
  553. }
  554. .e_list {
  555. display: flex;
  556. flex-wrap: wrap;
  557. justify-content: space-evenly;
  558. align-items: center;
  559. margin-top: 20rpx;
  560. padding: 30rpx;
  561. width: 630rpx;
  562. .e_box {
  563. display: flex;
  564. flex-direction: column;
  565. justify-content: space-evenly;
  566. align-items: center;
  567. margin-bottom: 20rpx;
  568. width: 180rpx;
  569. height: 190rpx;
  570. .e_img {
  571. width: 100rpx;
  572. height: 100rpx;
  573. img {
  574. width: 100%;
  575. height: 100%;
  576. border-radius: 50%;
  577. }
  578. }
  579. .e_name {
  580. font-size: 28rpx;
  581. }
  582. .e_msg {
  583. font-size: 24rpx;
  584. color: #808080;
  585. }
  586. }
  587. }
  588. }
  589. }
  590. // 修改选中日期盒子圆角
  591. ::v-deep .uni-calendar-item--isDay {
  592. border-radius: 50rpx;
  593. }
  594. ::v-deep .uni-calendar-item--checked {
  595. border-radius: 50rpx;
  596. }
  597. </style>