workList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div class="bgColor">
  3. <div slot="content" class="scroll-wrapper" style="height:100%;">
  4. <div class="demo" style="height:100%;">
  5. <div class="header">
  6. <div class="nav" :class="{active:searchType1 === '1'}" @click="tapClick('1')">上班记录</div>
  7. <div class="nav" :class="{active:searchType1 === '2'}" @click="tapClick('2')">下班记录</div>
  8. </div>
  9. <div class="stateSearch">
  10. <cube-button
  11. light
  12. class="stateSearch_item btn"
  13. @click="showDatePicker"
  14. >{{ nowDate | timeFormat("MM-dd") }}<i class="cube-select-icon"></i
  15. ></cube-button>
  16. <!-- <cube-select
  17. class="stateSearch_item"
  18. v-model="searchType1"
  19. :options="searchsType1"
  20. @change="stateChange1()"
  21. ></cube-select> -->
  22. <cube-select
  23. class="stateSearch_item"
  24. v-model="searchType2"
  25. :options="searchsType2"
  26. @change="stateChange2()"
  27. ></cube-select>
  28. </div>
  29. <div class="scroll-list-wrap" v-show="!loadShow && !wushuju">
  30. <cube-scroll ref="scroll" :data="items" :options="options">
  31. <div class="conentBox">
  32. <div class="conent" v-for="item in items" :key="item.id">
  33. <div class="head">
  34. <div class="head_d">
  35. <span>{{ item.userName }}</span>
  36. <span v-if="item.opValue" :style="{
  37. color: (item.extra2 === '正常' && item.opValue) ? 'green' : 'red'
  38. }">{{ item.extra2 }}</span>
  39. <span style="color:red" v-if="!item.opValue">未打卡</span>
  40. <span>{{ item.opTime }}</span>
  41. </div>
  42. </div>
  43. <div class="center">
  44. <!-- <div>{{ item.opValue == 1 ? "上班" : "下班" }}打卡</div> -->
  45. <div style="word-break:break-all;text-align:justify;">
  46. 三方公司:{{ item.company || "无" }}
  47. </div>
  48. <div style="word-break:break-all;text-align:justify;">
  49. 打卡地址:{{ item.extra1 || "无" }}
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </cube-scroll>
  55. </div>
  56. <div class="wushuju scroll-list-wrap" v-show="wushuju">
  57. <img src="./../../static/images/wushuju.svg" alt />
  58. <p>暂无数据</p>
  59. </div>
  60. </div>
  61. </div>
  62. <load-ing v-show="loadShow"></load-ing>
  63. </div>
  64. </template>
  65. <script>
  66. import { formatDate } from "./../components/js/date.js";
  67. import LoadIng from "./../views/loading.vue";
  68. export default {
  69. data() {
  70. return {
  71. items: [],
  72. itemsSave: [],
  73. itemsSaveNoOn: [],//未打卡-上班
  74. itemsSaveNoOff: [],//未打卡-下班
  75. wushuju: false,
  76. searchsType1: [
  77. {
  78. text: "全部",
  79. value: "0"
  80. },
  81. {
  82. text: "上班",
  83. value: "1"
  84. },
  85. {
  86. text: "下班",
  87. value: "2"
  88. }
  89. ],
  90. searchsType2: [],
  91. searchsType2_on:[
  92. {
  93. text: "全部",
  94. value: "0"
  95. },
  96. {
  97. text: "实到",
  98. value: "1"
  99. },
  100. {
  101. text: "迟到",
  102. value: "2"
  103. },
  104. {
  105. text: "未打卡",
  106. value: "4"
  107. },
  108. ],
  109. searchsType2_off:[
  110. {
  111. text: "全部",
  112. value: "0"
  113. },
  114. {
  115. text: "早退",
  116. value: "3"
  117. },
  118. {
  119. text: "未打卡",
  120. value: "4"
  121. },
  122. ],
  123. searchType1: '1',
  124. searchType2: "0",
  125. stateClass: "",
  126. loadShow: false,
  127. datePicker: null,
  128. nowDate: new Date()
  129. };
  130. },
  131. components: {
  132. LoadIng
  133. },
  134. computed: {
  135. options() {
  136. return {};
  137. }
  138. },
  139. methods: {
  140. // 上班记录或者下班记录
  141. tapClick(type){
  142. this.searchType1 = type;
  143. this.searchType2 = '0';
  144. this.searchsType2 = this.searchType1 === '1' ? this.searchsType2_on : this.searchsType2_off;
  145. this.stateChange();
  146. },
  147. showDatePicker() {
  148. if (!this.datePicker) {
  149. this.datePicker = this.$createDatePicker({
  150. title: "日期选择",
  151. max: new Date(),
  152. value: this.nowDate,
  153. onSelect: this.selectHandle
  154. });
  155. }
  156. this.datePicker.show();
  157. },
  158. selectHandle(date, selectedVal, selectedText) {
  159. this.nowDate = date;
  160. this.getData();
  161. },
  162. stateChange() {
  163. var arr = [];
  164. if (this.searchType1 === "1") {
  165. //上班
  166. arr = this.itemsSave.filter(v => v.opValue === "1");
  167. } else if (this.searchType1 === "2") {
  168. //下班
  169. arr = this.itemsSave.filter(v => v.opValue === "0");
  170. } else if (this.searchType1 === "0") {
  171. //全部
  172. arr = JSON.parse(JSON.stringify(this.itemsSave));
  173. }
  174. if (this.searchType2 === "1") {
  175. //实到
  176. let arr1 = arr.filter(v => v.extra2 == "迟到");
  177. let arr2 = arr.filter(v => v.extra2 == "正常");
  178. this.items = [...arr1,...arr2];
  179. } else if (this.searchType2 === "2") {
  180. //迟到
  181. this.items = arr.filter(v => v.extra2 == "迟到");
  182. } else if (this.searchType2 === "3") {
  183. //早退
  184. this.items = arr.filter(v => v.extra2 == "早退");
  185. } else if (this.searchType2 === "4") {
  186. //未打卡
  187. if(this.searchType1 === '1'){
  188. // 上班
  189. this.items = JSON.parse(JSON.stringify(this.itemsSaveNoOn));
  190. }else if(this.searchType1 === '2'){
  191. // 下班
  192. this.items = JSON.parse(JSON.stringify(this.itemsSaveNoOff));
  193. }
  194. } else if (this.searchType2 === "0") {
  195. //全部
  196. if(this.searchType1 === '1'){
  197. // 上班
  198. this.items = JSON.parse(JSON.stringify(arr.concat(this.itemsSaveNoOn)));
  199. }else if(this.searchType1 === '2'){
  200. // 下班
  201. this.items = JSON.parse(JSON.stringify(arr.concat(this.itemsSaveNoOff)));
  202. }
  203. }
  204. this.wushuju = this.items.length === 0;
  205. },
  206. stateChange1() {
  207. this.stateChange();
  208. },
  209. stateChange2() {
  210. this.stateChange();
  211. },
  212. getData() {
  213. this.loadShow = true;
  214. let postData = formatDate(this.nowDate, "yyyy-MM-dd");
  215. this.$http.post("service/auth/onlineInfo/" + postData, {}).then(res => {
  216. if (res.data.data.length > 0) {
  217. this.wushuju = false;
  218. for (var i = 0; i < res.data.data.length; i++) {
  219. res.data.data[i].opTime = formatDate(
  220. new Date(res.data.data[i].opTime),
  221. "hh:mm"
  222. );
  223. }
  224. // this.items = res.data.data;
  225. this.itemsSave = JSON.parse(JSON.stringify(res.data.data));
  226. this.itemsSaveNoOn = res.data.unOnlineList?JSON.parse(JSON.stringify(res.data.unOnlineList)):[];
  227. this.itemsSaveNoOff = res.data.unOnlineList?JSON.parse(JSON.stringify(res.data.unOfflineList)):[];
  228. this.stateChange();
  229. } else if (res.data.data.length === 0) {
  230. this.items = [];
  231. this.itemsSave = [];
  232. this.itemsSaveNoOn = [];
  233. this.itemsSaveNoOff = [];
  234. this.wushuju = true;
  235. }
  236. this.loadShow = false;
  237. });
  238. }
  239. },
  240. created() {
  241. console.log(this.$route)
  242. const { type, status } = this.$route.params;//type是上班1还是下班2,status是具体的状态
  243. this.searchType1 = type;
  244. this.searchType2 = status;
  245. if(status === '3'){
  246. // 昨日早退
  247. this.nowDate = new Date(new Date().getTime() - 24*60*60*1000);
  248. }
  249. this.searchsType2 = this.searchType1 === '1' ? this.searchsType2_on : this.searchsType2_off;
  250. this.getData();
  251. }
  252. };
  253. </script>
  254. <style lang="stylus" rel="stylesheet/stylus" scoped>
  255. .scroll-list-wrap {
  256. height: calc(100% - 1.81rem);
  257. border-radius: 5px;
  258. transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
  259. overflow: hidden;
  260. padding-top: 1.81rem;
  261. }
  262. .foods-wrapper {
  263. .food-item {
  264. display: flex;
  265. /* padding: 18px */
  266. /* border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
  267. /* border-top: 1px solid rgba(7, 17, 27, 0.1)!important */
  268. &:last-child {
  269. border-none();
  270. margin-bottom: 0;
  271. }
  272. .icon {
  273. flex: 0 0 57px;
  274. margin-right: 10px;
  275. }
  276. .food-content {
  277. flex: 1;
  278. .name {
  279. margin: 2px 0 8px 0;
  280. height: 14px;
  281. line-height: 14px;
  282. font-size: 14px;
  283. color: rgb(7, 17, 27);
  284. }
  285. .description, .extra {
  286. line-height: 10px;
  287. font-size: 10px;
  288. color: rgb(147, 153, 159);
  289. }
  290. .description {
  291. line-height: 12px;
  292. margin-bottom: 8px;
  293. }
  294. .extra {
  295. .count {
  296. margin-right: 12px;
  297. }
  298. }
  299. .price {
  300. font-weight: 700;
  301. line-height: 24px;
  302. .now {
  303. margin-right: 8px;
  304. font-size: 14px;
  305. color: rgb(240, 20, 20);
  306. }
  307. .old {
  308. text-decoration: line-through;
  309. font-size: 10px;
  310. color: rgb(147, 153, 159);
  311. }
  312. }
  313. .cartcontrol-wrapper {
  314. position: absolute;
  315. right: 0;
  316. bottom: 12px;
  317. .scroll-wrapper {
  318. .cube-pulldown-wrapper {
  319. .before-trigger {
  320. font-size: 30px;
  321. line-height: 30px;
  322. align-self: flex-end;
  323. span {
  324. display: inline-block;
  325. transition: all 0.3s;
  326. color: #666;
  327. &.rotate {
  328. transform: rotate(180deg);
  329. }
  330. }
  331. }
  332. .after-trigger {
  333. .refresh-text {
  334. color: grey;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }
  342. }
  343. </style>
  344. <style lang="less" scoped>
  345. .cont {
  346. margin-top: 1.86rem;
  347. }
  348. .header {
  349. width: 100%;
  350. height: 0.88rem;
  351. line-height: 0.88rem;
  352. text-align: center;
  353. color: #fff;
  354. font-size: 0.37rem;
  355. position: fixed;
  356. top: 0;
  357. z-index: 6;
  358. display: flex;
  359. color: #2e2f32;
  360. border-bottom: 0.05rem solid #2e2f32;
  361. }
  362. .header .nav{
  363. flex: 1;
  364. border-right: 0.02rem solid #2e2f32;
  365. }
  366. .header :last-child{
  367. border-right: none;
  368. }
  369. .header .nav.active{
  370. background: linear-gradient(#2e2f32, #414246);
  371. color:#fff;
  372. }
  373. .stateSearch {
  374. width: 100%;
  375. position: fixed;
  376. top: 0.93rem;
  377. z-index: 6;
  378. display: flex;
  379. justify-content: center;
  380. align-items: center;
  381. .stateSearch_item {
  382. flex: 1;
  383. &.btn {
  384. position: relative;
  385. text-align: left;
  386. }
  387. .cube-select-icon {
  388. position: absolute;
  389. right: 8px;
  390. top: 50%;
  391. -webkit-transform: translate(0, -50%);
  392. transform: translate(0, -50%);
  393. border-style: solid;
  394. border-color: #999 transparent transparent transparent;
  395. border-width: 4px 4px 0 4px;
  396. -webkit-transition: -webkit-transform 0.3s ease-in-out;
  397. transition: -webkit-transform 0.3s ease-in-out;
  398. transition: transform 0.3s ease-in-out;
  399. transition: transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;
  400. }
  401. }
  402. }
  403. .bgColor {
  404. background-color: white;
  405. }
  406. .food-item {
  407. border-top: 0.16rem rgb(238, 238, 238) solid;
  408. }
  409. .food-content {
  410. border-top: 0.01rem rgb(223, 222, 222) solid;
  411. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  412. }
  413. .cube-btn-light,
  414. .cube-select {
  415. box-shadow: none;
  416. border-bottom: 0.02rem solid #e5e5e5;
  417. }
  418. .cube-select,
  419. .cube-btn {
  420. height: 0.88rem;
  421. line-height: 0.88rem;
  422. padding: 0 0.24rem;
  423. font-size: 0.36rem;
  424. color: #333333;
  425. background-color: #fff;
  426. }
  427. .cube-btn{
  428. border-top: 0.02rem solid #e5e5e5;
  429. }
  430. .title {
  431. display: flex;
  432. justify-content: space-between;
  433. height: 0.7rem;
  434. line-height: 0.7rem;
  435. border-top: 0.01rem rgb(223, 222, 222) solid;
  436. padding: 0 0.24rem;
  437. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  438. }
  439. .title i {
  440. font-size: 0.32rem;
  441. color: #005395;
  442. }
  443. .title div:nth-child(1) {
  444. font-size: 0.32rem;
  445. }
  446. .title div:nth-child(1) span {
  447. display: inline-block;
  448. margin-left: 0.08rem;
  449. }
  450. .title div:nth-child(2) {
  451. padding: 0.05rem 0.3rem;
  452. /* border: 0.01rem rgb(0,0,255) solid; */
  453. border-radius: 16px;
  454. /* color: rgb(0,0,255); */
  455. height: 0.25rem;
  456. line-height: 0.25rem;
  457. margin-top: 0.15rem;
  458. font-size: 0.24rem;
  459. }
  460. .weishouli {
  461. color: #991f00;
  462. border: 0.01rem #991f00 solid;
  463. background-color: #f4e8e5;
  464. }
  465. .bushouli {
  466. color: #666666;
  467. background-color: #eeeeee;
  468. border: 0.01rem #666666 solid;
  469. }
  470. .chulizhong {
  471. color: #003057;
  472. background-color: #e5eaee;
  473. border: 0.01rem #003057 solid;
  474. }
  475. .daipingjia {
  476. color: #825b00;
  477. background-color: #f2eee5;
  478. border: 0.01rem #825b00 solid;
  479. }
  480. .yijiejue {
  481. color: #40a19c;
  482. background-color: #ebf5f5;
  483. border: 0.01rem #40a19c solid;
  484. }
  485. .yichehui {
  486. color: #48a843;
  487. background-color: #ecf6ec;
  488. border: 0.01rem #48a843 solid;
  489. }
  490. // .conent {
  491. // font-size: 0.28rem;
  492. // line-height: 0.39rem;
  493. // overflow: hidden;
  494. // display: -webkit-box;
  495. // -webkit-line-clamp: 2;
  496. // -webkit-box-orient: vertical;
  497. // word-break: break-all;
  498. // padding: 0 0.64rem;
  499. // margin: 0.24rem 0;
  500. // }
  501. .timeBox {
  502. display: flex;
  503. justify-content: space-between;
  504. font-size: 0.24rem;
  505. color: #999999;
  506. border-top: 0.01rem rgb(223, 222, 222) solid;
  507. height: 0.7rem;
  508. line-height: 0.7rem;
  509. padding: 0 0.24rem 0 0.64rem;
  510. }
  511. .wushuju {
  512. text-align: center;
  513. color: #999;
  514. display: flex;
  515. justify-content: center;
  516. align-items: center;
  517. flex-direction: column;
  518. }
  519. .wushuju img {
  520. width: 5.12rem;
  521. height: 2.84rem;
  522. }
  523. .conentBox {
  524. width: 100%;
  525. height: 100%;
  526. .conent {
  527. font-size: 0.32rem;
  528. font-weight: 400;
  529. line-height: 0.45rem;
  530. border-bottom: 0.16rem solid #e5e5e5;
  531. .head {
  532. .head_d {
  533. padding: 0.12rem 0.48rem;
  534. display: flex;
  535. span {
  536. flex: 1;
  537. text-align: right;
  538. &:first-of-type {
  539. text-align: left;
  540. }
  541. }
  542. }
  543. }
  544. .center {
  545. color: #333333;
  546. div {
  547. padding: 0.12rem 0.48rem;
  548. }
  549. }
  550. .bottom {
  551. display: flex;
  552. justify-content: space-between;
  553. align-items: center;
  554. overflow: hidden;
  555. height: 0.86rem;
  556. border-bottom: 0.01rem solid #e6e6e6;
  557. font-size: 0.24rem;
  558. color: #999;
  559. padding: 0 0.24rem 0 0.48rem;
  560. }
  561. }
  562. }
  563. </style>