ApplyRecord.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="vacationRecord">
  3. <van-nav-bar title="申请记录" left-text="返回" left-arrow @click-left="$route_back" />
  4. <van-search v-model="searchValue" class="leftkep" placeholder="搜索" @input="keyInp()" />
  5. <div class="typeItems">
  6. <div class="typeItem" v-for="(item, index) in headfl" :key="index" :class="{ active: type == item.key }" @click="type = item.key">{{ item.name }}</div>
  7. </div>
  8. <div class="headAll">
  9. <scroller :isInitRefresh="false" noDataText="没有了噢" ref="scroller" :onRefresh="refresh" :onInfinite="infinite" :list="applyList">
  10. <div class="wraper">
  11. <van-empty description="暂无数据" v-if="applyList.length == 0" />
  12. <div v-for="item of applyList" :key="item.id" class="item" @click="$router.push({ name: 'RecordDetail', query: { id: item.id } })">
  13. <div class="content">
  14. <div class="title">
  15. <div class="detail">{{ item.type_mark }}申请</div>
  16. <div :class="{ wait: item.status == 0, refuse: item.status == -1 }" class="status">{{ filterStatus(item.status) }}</div>
  17. </div>
  18. <div v-if="item.type == 4" class="desc">请假类型:{{ item.holiday_name }}</div>
  19. <div class="desc">申请时间:{{ item.application_time }}</div>
  20. <div v-if="item.type == 2">
  21. <div v-for="(innerItem, i) of item.travel_list" :key="i">
  22. <div class="desc">出差地点:{{ innerItem.name }}</div>
  23. <div class="desc">开始时间:{{ innerItem.start_time.date }}{{ innerItem.start_time.scope=='AM'? '早上':'下午' }}</div>
  24. <div class="desc">结束时间:{{ innerItem.end_time.date }}{{ innerItem.end_time.scope=='AM'? '早上':'下午' }}</div>
  25. </div>
  26. </div>
  27. <div v-else>
  28. <div class="desc">{{ item.type == 0 ? '补卡班次' : '开始时间' }}:{{ item.start_time }}</div>
  29. <div v-if="item.type != 0" class="desc">结束时间:{{ item.end_time }}</div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div style="padding-bottom: 1rem;"></div>
  35. </scroller>
  36. </div>
  37. <!-- 申请搜索 -->
  38. <div v-show="searchVisibale" class="searchWrapper">
  39. <div style="display:flex;align-items: center;">
  40. <van-search v-model="searchValue" class="leftkep" placeholder="搜索" @input="keyInp()" />
  41. <div @click="getApplyHistroy" v-if="this.searchValue" class="search">搜索</div>
  42. </div>
  43. <div class="searchTip">
  44. <span></span>
  45. 在这里可以搜索到
  46. <span></span>
  47. </div>
  48. <div class="searchItems">
  49. <div class="searchItem">
  50. <icon class="searchItemIcon" name="title"></icon>
  51. <div>审批标题</div>
  52. </div>
  53. <div class="searchItem">
  54. <icon class="searchItemIcon" name="content"></icon>
  55. <div>正文内容</div>
  56. </div>
  57. <div class="searchItem">
  58. <icon class="searchItemIcon" name="suggess"></icon>
  59. <div>审批意见</div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import { _debounce } from '@/utils/auth';
  67. export default {
  68. data() {
  69. return {
  70. applyList: [],
  71. searchValue: '',
  72. searchVisibale: false,
  73. fillterVisibale: false,
  74. profile: this.$userInfo(),
  75. applyHistoryList: [],
  76. status: 'all',
  77. type: -1,
  78. page: 1,
  79. headfl: [{ key: -1, name: '全部' }, { key: 3, name: '外出' }, { key: 2, name: '出差' }, { key: 4, name: '请假' }, { key: 1, name: '加班' }, { key: 0, name: '补卡' }],
  80. scroller: ''
  81. };
  82. },
  83. watch: {
  84. type() {
  85. this.pullDown();
  86. },
  87. '$route.query.goSearch'(val) {
  88. if (!val) {
  89. this.searchVisibale = false;
  90. }
  91. },
  92. '$route.query.goFillter'(val) {
  93. if (!val) {
  94. this.fillterVisibale = false;
  95. }
  96. }
  97. },
  98. created() {
  99. if (this.$route.query.type != undefined) {
  100. this.type = this.$route.query.type;
  101. }
  102. },
  103. activated() {
  104. this.pullDown();
  105. },
  106. methods: {
  107. pullDown(){
  108. setTimeout(() => {
  109. this.$refs.scroller.triggerPullToRefresh();
  110. }, 50);
  111. },
  112. keyInp: _debounce(function() {
  113. // 搜索
  114. this.pullDown();
  115. }),
  116. filterType(type) {
  117. switch (type) {
  118. case 0:
  119. return '补卡';
  120. case 1:
  121. return '加班';
  122. case 2:
  123. return '出差';
  124. case 3:
  125. return '外出';
  126. case 4:
  127. return '请假';
  128. }
  129. },
  130. infinite(done) {
  131. this.page += 1;
  132. this.getApplyHistroy(true,done)
  133. },
  134. refresh(done) {
  135. this.page = 1;
  136. this.getApplyHistroy(false,done)
  137. },
  138. filterStatus(status) {
  139. if (status === 0) {
  140. return '待审批';
  141. }
  142. if (status === 1) {
  143. return '审批通过';
  144. }
  145. if (status === -1) {
  146. return '审批驳回';
  147. }
  148. },
  149. getApplyHistroy(is,callback) {
  150. this.$toast.loading({
  151. mask: true,
  152. message: '加载中...'
  153. });
  154. let hasMore = false
  155. is? '':this.page=1;
  156. let data={
  157. type: this.type,
  158. page: this.page,
  159. status: this.status,
  160. page_size: 10,
  161. keyword: this.searchValue
  162. }
  163. this.$axiosKq('get', '/ad/review/history', data).then(res => {
  164. let list = res.data.data.review_list;
  165. if (this.page === 1) {
  166. this.applyList = list
  167. } else {
  168. this.applyList = this.applyList.concat(list)
  169. }
  170. hasMore = list.length !== 10
  171. callback && callback(hasMore)
  172. }) .finally(() => {
  173. this.$toast.clear();
  174. });
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. .vacationRecord .search /deep/ .mint-searchbar {
  181. padding: 0.32rem;
  182. background: #fff;
  183. }
  184. .vacationRecord .search /deep/ .mint-searchbar-inner {
  185. background: #f5f7fa;
  186. border-radius: 0.08rem;
  187. }
  188. .vacationRecord .search /deep/ .mint-searchbar-core {
  189. background: #f5f7fa;
  190. }
  191. .vacationRecord {
  192. .typeItems {
  193. display: flex;
  194. height: 0.98rem;
  195. align-items: center;
  196. justify-content: space-around;
  197. position: -webkit-sticky;
  198. position: sticky;
  199. top: 0.88rem;
  200. .typeItem {
  201. width: 0.88rem;
  202. height: 0.48rem;
  203. font-size: 0.28rem;
  204. color: rgba(96, 98, 102, 1);
  205. line-height: 0.48rem;
  206. text-align: center;
  207. &.active {
  208. color: #fff;
  209. padding: 0 0.16rem;
  210. background: rgba(38, 162, 255, 1);
  211. border-radius: 0.25rem;
  212. }
  213. }
  214. }
  215. .search {
  216. height: auto;
  217. }
  218. }
  219. .fillterWrapper {
  220. position: fixed;
  221. top: 0.88rem;
  222. .confirmBtn {
  223. position: fixed;
  224. left: 0;
  225. bottom: 0;
  226. height: 1rem;
  227. line-height: 1rem;
  228. text-align: center;
  229. color: #fff;
  230. background: rgb(55, 171, 254);
  231. width: 100%;
  232. }
  233. background-color: #fff;
  234. height: 100%;
  235. .fillterTitle {
  236. line-height: 0.8rem;
  237. position: relative;
  238. padding-left: 0.4rem;
  239. margin-left: 0.15rem;
  240. margin-top: 0.2rem;
  241. font-size: 0.3rem;
  242. &::after {
  243. content: '';
  244. position: absolute;
  245. top: 0.26rem;
  246. left: 0;
  247. width: 0.24rem;
  248. height: 0.24rem;
  249. border-radius: 50%;
  250. background-color: rgb(72, 169, 239);
  251. }
  252. }
  253. .fillter:nth-of-type(2) .fillterTitle::after {
  254. background-color: rgb(22, 195, 149);
  255. }
  256. .fillterItems {
  257. display: flex;
  258. flex-wrap: wrap;
  259. .fillterItem {
  260. width: 2rem;
  261. height: 1rem;
  262. text-align: center;
  263. line-height: 1rem;
  264. background: rgb(243, 243, 243);
  265. border-radius: 0.2rem;
  266. font-size: 0.28rem;
  267. margin-left: 0.36rem;
  268. margin-bottom: 0.36rem;
  269. &.type {
  270. width: 3.2rem;
  271. }
  272. &.active {
  273. background-color: rgb(228, 240, 250);
  274. color: rgb(119, 191, 241);
  275. }
  276. }
  277. }
  278. .fillter:nth-of-type(2) .fillterItems .fillterItem.active {
  279. background-color: rgb(220, 245, 239);
  280. color: rgb(75, 208, 172);
  281. }
  282. }
  283. .searchItems {
  284. display: flex;
  285. padding-top: 0.4rem;
  286. .searchItem {
  287. flex: 1;
  288. font-size: 0.24rem;
  289. color: #909399;
  290. text-align: center;
  291. .searchItemIcon {
  292. width: 0.5rem;
  293. margin-bottom: 0.18rem;
  294. }
  295. }
  296. }
  297. .searchTip {
  298. margin-top: 1.2rem;
  299. padding: 0 0.8rem;
  300. display: flex;
  301. align-items: center;
  302. justify-content: space-between;
  303. font-size: 0.28rem;
  304. color: #909399;
  305. span {
  306. width: 26%;
  307. height: 0.02rem;
  308. background-color: #eee;
  309. }
  310. }
  311. .searchWrapper {
  312. background-color: #fff;
  313. height: 100%;
  314. position: fixed;
  315. top: 0.88rem;
  316. left: 0;
  317. width: 100%;
  318. .search {
  319. flex: 0 0 1rem;
  320. color: #26a2ff;
  321. padding-right: 0.2rem;
  322. text-align: center;
  323. background-color: #f5f7fa;
  324. height: 0.96rem;
  325. line-height: 0.96rem;
  326. font-size: 0.32rem;
  327. }
  328. }
  329. .topBar {
  330. height: 0.88rem;
  331. background-color: #fff;
  332. border-bottom: 0.02rem solid #eee;
  333. display: flex;
  334. align-items: center;
  335. font-size: 0.3rem;
  336. line-height: 0.5rem;
  337. .left {
  338. flex: 1;
  339. text-align: center;
  340. color: #909399;
  341. .searchIcon {
  342. width: 0.4rem;
  343. margin-right: 0.1rem;
  344. }
  345. }
  346. .right {
  347. flex: 1;
  348. text-align: center;
  349. color: #909399;
  350. .fillterIcon {
  351. width: 0.4rem;
  352. margin-right: 0.1rem;
  353. }
  354. }
  355. }
  356. .vacationRecord {
  357. background-color: #f5f7fa;
  358. position: relative;
  359. }
  360. .wraper {
  361. // padding:0 0.32rem;
  362. // background-color: #fff;
  363. }
  364. .item {
  365. display: flex;
  366. padding: 0 0.32rem 0.26rem;
  367. margin-bottom: 0.24rem;
  368. background-color: #fff;
  369. }
  370. .avatar {
  371. width: 0.86rem;
  372. height: 0.86rem;
  373. border-radius: 50%;
  374. margin: 0.4rem 0.2rem 0 0;
  375. flex-shrink: 0;
  376. }
  377. .content {
  378. // padding-top: 0.2rem;
  379. width: 100%;
  380. }
  381. .content .title {
  382. display: flex;
  383. justify-content: space-between;
  384. align-items: center;
  385. // padding-bottom: 0.12rem;
  386. margin: 0.32rem 0 0.16rem 0;
  387. .detail {
  388. font-size: 0.34rem;
  389. flex: 0 0 3.6rem;
  390. overflow: hidden;
  391. text-overflow: ellipsis;
  392. white-space: nowrap;
  393. }
  394. }
  395. .content .desc {
  396. font-size: 0.28rem;
  397. color: #909399;
  398. margin-bottom: 0.08rem;
  399. }
  400. .content .status {
  401. font-size: 0.34rem;
  402. color: rgb(70, 211, 173);
  403. // line-height: 0.8rem;
  404. // padding: 0.1rem 0 0.28rem 0;
  405. }
  406. .content .status.wait {
  407. color: rgb(235, 179, 102);
  408. }
  409. .content .status.refuse {
  410. color: rgb(246, 138, 119);
  411. }
  412. .content .status.cancel {
  413. color: rgb(101, 101, 101);
  414. }
  415. .title .time {
  416. padding-right: 0.2rem;
  417. font-size: 0.28rem;
  418. color: #909399;
  419. }
  420. .leftkep {
  421. padding: 0.2rem 0.12rem 0.2rem 0.32rem;
  422. box-sizing: border-box;
  423. }
  424. .headAll {
  425. height: calc(100% - 3rem) !important;
  426. position: relative;
  427. }
  428. </style>
  429. <style>
  430. .searchIcon path {
  431. fill: rgb(51, 51, 51);
  432. }
  433. </style>