index.vue 2.2 KB

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