index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="top">
  5. <topInfo :topTitle="topTitle" :display="display" @add="add"></topInfo>
  6. </el-col>
  7. <el-col :span="24" class="main">
  8. <el-col :span="24" class="search">
  9. <searchInfo></searchInfo>
  10. </el-col>
  11. <el-col :span="24" class="list">
  12. <otheruserList :debtTable="debtTable" :total="total" @deleteRow="deleteRow" @clickRest="clickRest"></otheruserList>
  13. </el-col>
  14. </el-col>
  15. </el-row>
  16. <!-- <el-col :span="24" class="debt">
  17. <el-col :span="24" class="top">
  18. <topInfo :topTitle="topTitle" :display="display" @clickBtn="clickBtn"></otheruserList>
  19. </el-col>
  20. <el-col :span="24" class="search">
  21. <searchInfo></searchInfo>
  22. </el-col>
  23. <el-col :span="24" class="main">
  24. <otheruserList :debtTable="debtTable" :total="total" @deleteRow="deleteRow" @clickRest="clickRest"></otheruserList>
  25. </el-col>
  26. </el-col> -->
  27. </div>
  28. </template>
  29. <script>
  30. import topInfo from '@/layout/common/topInfo.vue';
  31. import searchInfo from '@/layout/common/searchInfo.vue';
  32. import otheruserList from '@/layout/otheruser/otheruserList.vue';
  33. import { createNamespacedHelpers, mapGetters } from 'vuex';
  34. const { mapActions: otheruser } = createNamespacedHelpers('otheruser');
  35. const { mapActions: character } = createNamespacedHelpers('character');
  36. export default {
  37. name: 'index',
  38. props: {},
  39. components: {
  40. topInfo, //头部导航
  41. searchInfo, //搜素
  42. otheruserList, //其他用户列表
  43. },
  44. data: () => ({
  45. topTitle: '其他用户',
  46. display: 'block',
  47. debtTable: [],
  48. total: '',
  49. }),
  50. created() {
  51. this.searchInfo();
  52. },
  53. computed: {},
  54. methods: {
  55. ...otheruser(['query', 'delete']),
  56. ...character({ userquery: 'query' }),
  57. ...otheruser(['query', 'delete', 'update']),
  58. async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
  59. const res = await this.query({ skip, limit, ...info });
  60. this.$set(this, `debtTable`, res.data);
  61. this.$set(this, `total`, res.total);
  62. },
  63. // 添加
  64. add() {
  65. this.$router.push({ path: '/otheruser/detail' });
  66. },
  67. // 删除
  68. async deleteRow(id) {
  69. const res = await this.delete(id);
  70. this.$checkRes(res, '删除成功', '删除失败');
  71. this.searchInfo();
  72. },
  73. async clickRest(id) {
  74. let data = {};
  75. data.id = id;
  76. data.passwd = '123456';
  77. const res = await this.update(data);
  78. if (res.errcode === 0) {
  79. this.$message({
  80. message: '密码重置成功',
  81. type: 'success',
  82. });
  83. }
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang="less" scoped>
  89. .debt {
  90. padding: 20px;
  91. }
  92. .top {
  93. border-bottom: 1px solid #ccc;
  94. }
  95. </style>