cert_check.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <section id="cert-check">
  3. <div class="table">
  4. <el-table v-if="tableData.length" height="100%" border style="width: 100%" :data="tableData">
  5. <el-table-column v-for="(prop, index) of tableProps" :key="index" :prop="prop" :label="tableHeaders[index]">
  6. <template slot-scope="scope">
  7. <el-button type="text" v-if="prop === 'ctrl'" @click="clickCheck(scope.row)">{{scope.row[prop]}}</el-button>
  8. <el-button type="text" v-else-if="prop === 'nickname'" @click="clickDetail(scope.row['uid'])">{{scope.row[prop]}}</el-button>
  9. <span v-else>{{scope.row[prop]}}</span>
  10. </template>
  11. </el-table-column>
  12. </el-table>
  13. </div>
  14. <el-pagination
  15. background
  16. @current-change="changePagination"
  17. @size-change="changePageSize"
  18. :current-page.sync="currentPage"
  19. :page-sizes="[10, 20, 30, 40]"
  20. :page-size="20"
  21. layout="total, sizes, prev, pager, next, jumper"
  22. :total="totalCount">
  23. </el-pagination>
  24. </section>
  25. </template>
  26. <script>
  27. import dayjs from 'dayjs'
  28. const tableHeaders = [
  29. "ID",
  30. "昵称",
  31. "认证类型",
  32. "证书状态",
  33. "工作",
  34. "职业方向",
  35. "技能",
  36. "城市",
  37. "工龄",
  38. "接单数量",
  39. "自由职业",
  40. "开始时间",
  41. "过期时间",
  42. "操作"
  43. ]
  44. const tableProps = [
  45. "uid",
  46. "nickname",
  47. "name",
  48. "cert_status_name",
  49. "work_status_name",
  50. "direction_name",
  51. "skills",
  52. "city_name",
  53. "work_year_op",
  54. "projectCountInfoStr",
  55. "freelancer_name",
  56. "startDate",
  57. "endDate",
  58. "ctrl"
  59. ]
  60. const apis = {
  61. dataList: `/api/admin/cert/getUserList`,
  62. }
  63. let env = 'test'
  64. // 获取当前状态
  65. const getOnProjectShow = i => {
  66. let str = ''
  67. if(i.on_project === 0 && i.on_hire === 0 & i.on_job === 0 && i.work_status === 1) str = '空闲'
  68. else {
  69. if(i.on_project) str = '项目'
  70. else if(i.on_hire) str = '雇佣'
  71. else if(i.on_job) str = '云端'
  72. else if(!i.work_status) str = '不接单'
  73. }
  74. return str
  75. }
  76. export default {
  77. data() {
  78. return {
  79. // 数据总条目
  80. totalCount: 0,
  81. currentPage: 1,
  82. currentPageSize: 20,
  83. // 列表头显示内容
  84. tableHeaders,
  85. // 列表头字段
  86. tableProps,
  87. // 列表数据
  88. tableData: []
  89. }
  90. },
  91. mounted() {
  92. this.getTableData()
  93. },
  94. methods: {
  95. clickDetail(uid) {
  96. window.open(`/rooter/user/${uid}`)
  97. },
  98. clickCheck(item) {
  99. if(env === 'test') window.open(`https://dev.test.proginn.com/rooter/developerVerifyAuditList?uid=${item.uid}&audit_type=1`)
  100. else window.open(`https://www.proginn.com/rooter/developerVerifyAuditList?uid=${item.uid}&audit_type=1`)
  101. },
  102. // 格式化列表数据
  103. formatTableData(data, resData) {
  104. const userSkills = resData.userSkills
  105. return data.map(i => {
  106. const projectCountInfo = i.project_count_info
  107. , countDevelopProject = projectCountInfo.project
  108. , countHire = projectCountInfo.hire
  109. , countJob = projectCountInfo.job
  110. return {
  111. ...i,
  112. projectCountInfoStr: `项目:${countDevelopProject},雇佣:${countHire},云端:${countJob}`,
  113. startDate: i.start_date, //dayjs(i.start_time * 1000).format('YYYY-MM-DD'),
  114. endDate: i.end_date, //dayjs(i.end_time * 1000).format('YYYY-MM-DD'),
  115. ctrl: "审核"
  116. }
  117. })
  118. },
  119. // 页码变动
  120. changePagination(page) {
  121. this.currentPage = page
  122. this.getTableData()
  123. },
  124. changePageSize(pageSize) {
  125. this.currentPageSize = pageSize
  126. this.getTableData()
  127. },
  128. // 获取列表数据
  129. async getTableData(status = 0) {
  130. this.tableData = []
  131. let body = { page: this.currentPage,page_size:this.currentPageSize}
  132. const res = await this.$post('/api/admin/cert/getUserList', body)
  133. , data = res.data
  134. , list = data.list
  135. env = data.current_env
  136. this.tableData = this.formatTableData(list, data)
  137. this.totalCount = Number(data.total)
  138. this.totalPage = data.totalPage
  139. }
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .table {
  145. height: calc(100% - 40px);
  146. }
  147. </style>