stat.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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>(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" v-if="current==1">
  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. <!-- 环形图区域 -->
  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. list: [{
  138. date: "2022-11-20",
  139. info: ''
  140. },
  141. {
  142. date: "2022-11-21",
  143. info: '',
  144. data: {
  145. custom: '自定义信息',
  146. name: '自定义消息头'
  147. }
  148. },
  149. {
  150. date: "2022-11-22",
  151. info: ''
  152. }
  153. ],
  154. list2: [{
  155. id: 1,
  156. msg: "规则:课间操考勤打卡09:00 - 09:15",
  157. status: 0,
  158. time: "09:25:25"
  159. },
  160. {
  161. id: 2,
  162. msg: "规则:考勤打卡19:00 - 20:15",
  163. status: 1,
  164. time: "19:25:25"
  165. },
  166. ],
  167. month: null,
  168. items: ['团队统计', '我的统计'],
  169. current: 1,
  170. year: null,
  171. month: null,
  172. errList: [{
  173. id: 1,
  174. 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",
  175. name: "程佳欢",
  176. num: 20
  177. },
  178. {
  179. id: 2,
  180. 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",
  181. name: "程欢",
  182. num: 10
  183. },
  184. {
  185. id: 3,
  186. 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",
  187. name: "张三",
  188. num: 30
  189. },
  190. {
  191. id: 4,
  192. 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",
  193. name: "李四",
  194. num: 30
  195. },
  196. ],
  197. progress_txt: 50,
  198. progress_total: 70
  199. };
  200. },
  201. onLoad() {
  202. this.getTime()
  203. if (this.flag) {
  204. this.current = 0
  205. }
  206. },
  207. computed: {
  208. comMonth() {
  209. if (this.month) {
  210. let month = this.month < 10 ? '0' + this.month : this.month
  211. console.log(month);
  212. return month
  213. }
  214. }
  215. },
  216. methods: {
  217. // 获取当前年份
  218. getTime() {
  219. let date = new Date()
  220. let year = date.getFullYear()
  221. let month = date.getMonth() + 1
  222. this.year = year
  223. this.month = month
  224. },
  225. // 点击日历日期回调
  226. change(e) {
  227. console.log('change 返回:', e)
  228. },
  229. onClickItem(e) {
  230. console.log(e.currentIndex);
  231. this.current = e.currentIndex
  232. // if (e.currentIndex == 0) {
  233. // this.list = this.list2
  234. // } else {
  235. // this.list = this.list3
  236. // }
  237. },
  238. // 跳转统计详情页面
  239. goToDetail() {
  240. if (this.current == 1) {
  241. uni.navigateTo({
  242. url: `/pages/statDetail/statDetail?month=${this.month}`
  243. })
  244. } else {
  245. uni.navigateTo({
  246. url: "/pages/particulars/particulars"
  247. })
  248. }
  249. },
  250. handleDoubleLeft() {
  251. if (this.year <= 2000) {
  252. uni.showToast({
  253. title: "不能选择2000年之前",
  254. icon: 'none'
  255. })
  256. } else {
  257. this.year -= 1
  258. }
  259. },
  260. handleLeft() {
  261. if (this.month <= 1) {
  262. if (this.year <= 2000) {
  263. uni.showToast({
  264. title: "不能选择2000年之前",
  265. icon: 'none'
  266. })
  267. } else {
  268. this.year -= 1
  269. this.month = 12
  270. }
  271. } else {
  272. this.month -= 1
  273. }
  274. },
  275. handleRight() {
  276. if (this.month >= 12) {
  277. if (this.year >= 2025) {
  278. uni.showToast({
  279. title: "不能选择2025年之后",
  280. icon: 'none'
  281. })
  282. } else {
  283. this.year += 1
  284. this.month = 1
  285. }
  286. } else {
  287. this.month += 1
  288. }
  289. },
  290. handleDoubleRight() {
  291. if (this.year >= 2025) {
  292. uni.showToast({
  293. title: "不能选择2025年之后",
  294. icon: 'none'
  295. })
  296. } else {
  297. this.year += 1
  298. }
  299. },
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. .container {
  305. padding-top: 20rpx;
  306. .control {
  307. margin-bottom: 20rpx;
  308. width: 750rpx;
  309. height: 90rpx;
  310. background-color: #fff;
  311. }
  312. .header {
  313. margin: 0 auto;
  314. width: 690rpx;
  315. height: 236rpx;
  316. background-color: #fff;
  317. .title {
  318. display: flex;
  319. height: 92rpx;
  320. .month {
  321. flex: 8;
  322. margin: 30rpx 0 0 30rpx;
  323. font-size: 32rpx;
  324. font-weight: 500
  325. }
  326. .right {
  327. display: flex;
  328. justify-content: center;
  329. align-items: center;
  330. flex: 1;
  331. img {
  332. width: 15rpx;
  333. height: 30rpx
  334. }
  335. }
  336. }
  337. .state {
  338. display: flex;
  339. height: 144rpx;
  340. .err {
  341. flex: 1;
  342. display: flex;
  343. flex-direction: column;
  344. justify-content: center;
  345. align-items: center;
  346. .number {
  347. font-size: 46rpx;
  348. font-weight: 700;
  349. }
  350. .mes {
  351. font-size: 28rpx;
  352. color: #999999;
  353. }
  354. }
  355. .success {
  356. flex: 1;
  357. display: flex;
  358. flex-direction: column;
  359. justify-content: center;
  360. align-items: center;
  361. .number {
  362. font-size: 46rpx;
  363. font-weight: 700;
  364. }
  365. .mes {
  366. font-size: 28rpx;
  367. color: #999999;
  368. }
  369. }
  370. }
  371. }
  372. .calendar {
  373. margin: 0 auto;
  374. margin-top: 30rpx;
  375. width: 693rpx;
  376. background-color: #fff;
  377. .calendar_title {
  378. padding-left: 30rpx;
  379. height: 100rpx;
  380. line-height: 100rpx;
  381. font-size: 32rpx;
  382. font-weight: 500;
  383. span {
  384. font-size: 26rpx;
  385. color: #999999
  386. }
  387. }
  388. .calendar_body {
  389. height: 690rpx;
  390. background-color: skyblue;
  391. }
  392. .calendar_foot {
  393. padding: 0 30rpx;
  394. .foot_item {
  395. box-sizing: border-box;
  396. padding: 30rpx;
  397. display: flex;
  398. flex-direction: column;
  399. justify-content: space-evenly;
  400. height: 130rpx;
  401. font-size: 24rpx;
  402. color: #808080;
  403. .box {
  404. display: flex;
  405. align-items: center;
  406. .circular {
  407. margin-right: 18rpx;
  408. width: 12rpx;
  409. height: 12rpx;
  410. border-radius: 6rpx;
  411. background-color: #31C20E;
  412. }
  413. .color {
  414. background-color: #999999;
  415. }
  416. span {
  417. margin-left: 18rpx;
  418. }
  419. }
  420. }
  421. }
  422. .progress {
  423. position: relative;
  424. display: flex;
  425. justify-content: center;
  426. padding: 0 30rpx;
  427. height: 121px;
  428. .chart {
  429. margin-top: 20rpx;
  430. width: 170px;
  431. height: 100%;
  432. }
  433. .look {
  434. position: absolute;
  435. top: 40rpx;
  436. right: 36rpx;
  437. display: flex;
  438. align-items: center;
  439. width: 150rpx;
  440. height: 42rpx;
  441. .info {
  442. margin-right: 15rpx;
  443. font-size: 28rpx;
  444. color: #A6A6A6;
  445. }
  446. img {
  447. width: 16rpx;
  448. height: 24rpx;
  449. }
  450. }
  451. }
  452. }
  453. .errPeople {
  454. margin: 0 auto;
  455. margin-top: 32rpx;
  456. width: 690rpx;
  457. border-radius: 7rpx;
  458. background-color: #fff;
  459. .e_header {
  460. display: flex;
  461. align-items: center;
  462. width: 690rpx;
  463. height: 121rpx;
  464. .left {
  465. flex: 1;
  466. margin-left: 30rpx;
  467. font-size: 32rpx;
  468. font-weight: 500;
  469. }
  470. .right {
  471. flex: 1;
  472. display: flex;
  473. justify-content: flex-end;
  474. align-items: center;
  475. margin-right: 32rpx;
  476. .icon {
  477. margin-right: 10rpx;
  478. width: 26rpx;
  479. height: 26rpx;
  480. line-height: 26rpx;
  481. img {
  482. width: 100%;
  483. height: 100%;
  484. }
  485. }
  486. .info {
  487. width: 56rpx;
  488. height: 41rpx;
  489. font-size: 28rpx;
  490. color: #2A82E4;
  491. }
  492. }
  493. }
  494. .e_calendar {
  495. display: flex;
  496. justify-content: flex-end;
  497. align-items: center;
  498. .double {
  499. margin-right: 30rpx;
  500. width: 40rpx;
  501. height: 40rpx;
  502. img {
  503. width: 100%;
  504. height: 100%;
  505. }
  506. }
  507. .single {
  508. width: 40rpx;
  509. height: 40rpx;
  510. img {
  511. width: 80%;
  512. height: 70%;
  513. }
  514. }
  515. .single2 {
  516. margin-right: 30rpx;
  517. width: 40rpx;
  518. height: 40rpx;
  519. img {
  520. width: 100%;
  521. height: 70%;
  522. }
  523. }
  524. .time {
  525. width: 180rpx;
  526. height: 44rpx;
  527. font-size: 32rpx;
  528. text-align: center;
  529. }
  530. }
  531. .e_list {
  532. display: flex;
  533. flex-wrap: wrap;
  534. justify-content: space-evenly;
  535. align-items: center;
  536. margin-top: 20rpx;
  537. padding: 30rpx;
  538. width: 630rpx;
  539. .e_box {
  540. display: flex;
  541. flex-direction: column;
  542. justify-content: space-evenly;
  543. align-items: center;
  544. margin-bottom: 20rpx;
  545. width: 180rpx;
  546. height: 190rpx;
  547. .e_img {
  548. width: 100rpx;
  549. height: 100rpx;
  550. img {
  551. width: 100%;
  552. height: 100%;
  553. border-radius: 50%;
  554. }
  555. }
  556. .e_name {
  557. font-size: 28rpx;
  558. }
  559. .e_msg {
  560. font-size: 24rpx;
  561. color: #808080;
  562. }
  563. }
  564. }
  565. }
  566. }
  567. // 修改选中日期盒子圆角
  568. ::v-deep .uni-calendar-item--isDay {
  569. border-radius: 50rpx;
  570. }
  571. ::v-deep .uni-calendar-item--checked {
  572. border-radius: 50rpx;
  573. }
  574. </style>