leave.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div id="leave">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <el-col :span="24" class="leaveBtn">
  10. <van-button round type="info" icon="smile" @click="onClickRight()">请假申请</van-button>
  11. </el-col>
  12. <el-col :span="24" class="leaveList">
  13. <leaveList :leaveList="leaveList"></leaveList>
  14. </el-col>
  15. </el-col>
  16. </el-col>
  17. </el-row>
  18. </div>
  19. </template>
  20. <script>
  21. import NavBar from '@/layout/common/topTitle.vue';
  22. import leaveList from '@/layout/user/leaveList.vue';
  23. import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
  24. const { mapActions: mapLeave } = createNamespacedHelpers('leave');
  25. export default {
  26. metaInfo: { title: '请假管理' },
  27. name: 'leave',
  28. props: {},
  29. components: {
  30. NavBar, //头部导航
  31. leaveList, //请假列表
  32. },
  33. data: () => ({
  34. leaveList: [],
  35. title: '',
  36. isleftarrow: '',
  37. transitionName: 'fade',
  38. navShow: true,
  39. }),
  40. created() {
  41. this.searchInfo();
  42. },
  43. computed: { ...mapState(['user']) },
  44. mounted() {
  45. this.title = this.$route.meta.title;
  46. this.isleftarrow = this.$route.meta.isleftarrow;
  47. },
  48. watch: {
  49. $route(to, from) {
  50. this.title = to.meta.title;
  51. this.isleftarrow = to.meta.isleftarrow;
  52. },
  53. },
  54. methods: {
  55. ...mapLeave(['query']),
  56. async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
  57. if (this.user.type == 4) {
  58. let type = 0;
  59. let name = this.user.name;
  60. const res = await this.query({ skip, limit, type, name, ...info });
  61. this.$set(this, `leaveList`, res.data);
  62. } else {
  63. let type = 0;
  64. const res = await this.query({ skip, limit, type, ...info });
  65. this.$set(this, `leaveList`, res.data);
  66. }
  67. },
  68. // 跳转到请假
  69. onClickRight() {
  70. this.$router.push({ path: '/user/leaveDetail', query: { type: 0 } });
  71. },
  72. },
  73. };
  74. </script>
  75. <style lang="less" scoped>
  76. .style {
  77. width: 100%;
  78. min-height: 667px;
  79. position: relative;
  80. background-color: #f9fafc;
  81. }
  82. .top {
  83. height: 46px;
  84. overflow: hidden;
  85. }
  86. .main {
  87. min-height: 570px;
  88. }
  89. .main .leaveBtn {
  90. text-align: center;
  91. padding: 15px 0;
  92. }
  93. </style>