one.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div id="one">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-table :data="list" style="width: 100%" border>
  6. <el-table-column prop="name" label="用户名称" align="center"> </el-table-column>
  7. <el-table-column prop="phone" label="用户ID" align="center"> </el-table-column>
  8. <el-table-column label="用户类型" align="center">
  9. <template v-slot="scoped">
  10. {{ `${scoped.row.role}` == `4` ? '个人用户' : `${scoped.row.role}` == `5` ? '机构用户' : `${scoped.row.role}` == `6` ? '专家用户' : '临时用户' }}
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="状态" align="center">
  14. <template v-slot="scoped">
  15. {{ `${scoped.row.status}` == `0` ? '审核中' : `${scoped.row.status}` == `1` ? '审核通过' : `${scoped.row.status}` == `2` ? '审核拒绝' : '草稿' }}
  16. </template>
  17. </el-table-column>
  18. <el-table-column fixed="right" label="操作" align="center">
  19. <template slot-scope="scoped">
  20. <el-tooltip content="审核" placement="bottom" effect="light">
  21. <el-button type="text" size="small" @click="handleEdit(scoped.row)"><i class="el-icon-view"></i></el-button>
  22. </el-tooltip>
  23. <el-tooltip content="删除" placement="bottom" effect="light">
  24. <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
  25. </el-tooltip>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <el-col :span="24" class="page">
  30. <el-pagination
  31. @current-change="handleCurrentChange"
  32. :current-page="currentPage"
  33. layout="total, prev, pager, next, jumper"
  34. :total="total"
  35. :page-size="pageSize"
  36. >
  37. </el-pagination>
  38. </el-col>
  39. </el-col>
  40. </el-row>
  41. </div>
  42. </template>
  43. <script>
  44. import { mapState, createNamespacedHelpers } from 'vuex';
  45. export default {
  46. name: 'one',
  47. props: {
  48. oneList: { type: Array, default: () => [] },
  49. total: { type: Number, default: 0 },
  50. },
  51. components: {},
  52. data: function() {
  53. return {
  54. currentPage: 1,
  55. pageSize: 10,
  56. origin: [],
  57. list: [],
  58. };
  59. },
  60. created() {},
  61. methods: {
  62. search(page = 1) {
  63. this.$set(this, `list`, this.origin[page - 1]);
  64. },
  65. handleCurrentChange(currentPage) {
  66. this.search(currentPage);
  67. },
  68. handleEdit(data) {
  69. this.$emit('handleEdit', data);
  70. },
  71. handleDelete(data) {
  72. this.$emit('handleDelete', data);
  73. },
  74. },
  75. computed: {
  76. ...mapState(['user']),
  77. pageTitle() {
  78. return `${this.$route.meta.title}`;
  79. },
  80. },
  81. metaInfo() {
  82. return { title: this.$route.meta.title };
  83. },
  84. watch: {
  85. oneList: {
  86. immediate: true,
  87. deep: true,
  88. handler(val) {
  89. if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
  90. this.search();
  91. },
  92. },
  93. },
  94. };
  95. </script>
  96. <style lang="less" scoped>
  97. .page {
  98. text-align: center;
  99. padding: 15px 0;
  100. }
  101. </style>