checkApplications.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="main-card__body" v-loading="pageLoading">
  3. <h1 class="main-card__title">
  4. 认证审核
  5. </h1>
  6. <el-table
  7. :data="applications"
  8. stripe
  9. class="main-card__table"
  10. >
  11. <el-table-column
  12. fixed
  13. type="index"
  14. width="50">
  15. </el-table-column>
  16. <el-table-column
  17. prop="realName"
  18. label="姓名"
  19. fixed
  20. width="90">
  21. </el-table-column>
  22. <el-table-column
  23. label="申请类型"
  24. width="100">
  25. <template slot-scope="scope" v-if="applications.length > 0">
  26. {{roleDic[scope.row.role]}}
  27. </template>
  28. </el-table-column>
  29. <el-table-column
  30. prop="organization"
  31. label="所属单位"
  32. width="150">
  33. </el-table-column>
  34. <el-table-column
  35. prop="jobNumber"
  36. label="工号"
  37. width="120">
  38. </el-table-column>
  39. <el-table-column
  40. prop="userDetail.phone"
  41. label="手机"
  42. width="120">
  43. </el-table-column>
  44. <el-table-column
  45. prop="userDetail.email"
  46. label="邮箱"
  47. width="200">
  48. </el-table-column>
  49. <el-table-column
  50. fixed="right"
  51. label="操作"
  52. width="100">
  53. <template slot-scope="scope">
  54. <el-button @click="pass(scope.row)" type="text" size="small">通过</el-button>
  55. <el-button @click="reject(scope.row)" type="text" size="small">否决</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'checkApplications',
  64. layout: 'admin',
  65. data () {
  66. return {
  67. applications: [],
  68. pageLoading: true,
  69. roleDic: { TEACHER: '教师', STAFF: '职员', HR: 'HR', ASSISTANT: '助教' }
  70. }
  71. },
  72. mounted () {
  73. this.getApplications()
  74. this.pageLoading = false
  75. },
  76. methods: {
  77. getApplications () {
  78. this.$api.$get('/admin/getApplication').then((res) => {
  79. if (res.code === 0) {
  80. this.applications = res.data
  81. } else {
  82. this.$message({
  83. showClose: true,
  84. message: res.message,
  85. type: 'error'
  86. })
  87. }
  88. }
  89. ).catch((e) => {
  90. console.log(e)
  91. })
  92. },
  93. pass (row) {
  94. this.$api.$post('/admin/passApplication', { id: row.id, uid: row.uid }).then((res) => {
  95. console.log(res.data)
  96. if (res.code === 0) {
  97. this.$message({
  98. showClose: true,
  99. message: '已通过' + row.realName + '的认证',
  100. type: 'success'
  101. })
  102. this.applications.splice(this.applications.indexOf(row), 1)
  103. } else {
  104. this.$message({
  105. showClose: true,
  106. message: res.message,
  107. type: 'error'
  108. })
  109. }
  110. }
  111. ).catch((e) => {
  112. console.log(e)
  113. })
  114. },
  115. reject (row) {
  116. this.$api.$post('/admin/rejectApplication', { id: row.id }).then((res) => {
  117. if (res.code === 0) {
  118. this.$message({
  119. showClose: true,
  120. message: '已否决' + row.realName + '的认证',
  121. type: 'success'
  122. })
  123. this.applications.splice(this.applications.indexOf(row), 1)
  124. } else {
  125. this.$message({
  126. showClose: true,
  127. message: res.message,
  128. type: 'error'
  129. })
  130. }
  131. }
  132. ).catch((e) => {
  133. console.log(e)
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. @import '~/assets/css/person.scss';
  141. </style>