cert_check.vue 4.3 KB

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