admin.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="app-container">
  3. <search-form
  4. :list-loading="listLoading"
  5. @change="searchHandle"
  6. />
  7. <table-list
  8. :list-loading="listLoading"
  9. :data="tableData2"
  10. :columns="listConfig"
  11. :current-page="currentPage"
  12. :page-size="pageSize"
  13. :total-records="totalRecords"
  14. @currentChange="pageHandle"
  15. @sizeChange="sizeChange"
  16. :isAdd="true"
  17. @add="openPopup"
  18. />
  19. <popup-edit
  20. :isShow="isDtlShow"
  21. :curObj="curObj"
  22. @close="closePopup"
  23. />
  24. </div>
  25. </template>
  26. <script>
  27. import { arrToObj } from '@/utils'
  28. import SearchForm from './components/searchForm/Admin'
  29. import PopupEdit from './components/popup/AdminEdit'
  30. import baseTable from '_m/baseTable.js'
  31. export default {
  32. name: 'admin',
  33. components: {
  34. SearchForm,
  35. PopupEdit,
  36. },
  37. provide() {
  38. return {
  39. parentData: this
  40. }
  41. },
  42. mixins: [baseTable],
  43. data() {
  44. return {
  45. apiStr: 'house.admestatemanagelist',
  46. searchForm: {},
  47. isDtlShow: false,
  48. // noCreated: true,
  49. curObj: {},
  50. }
  51. },
  52. computed: {
  53. tableData2() {
  54. const arr = [...this.tableData]
  55. arr.map(item => {
  56. })
  57. return arr
  58. }
  59. },
  60. created() {
  61. const query = this.$route.query
  62. this.searchForm.estate_id = query.id || ''
  63. },
  64. mounted() {
  65. this.listConfig = {
  66. rows: [
  67. { label: '管理员', prop: 'nickname'},
  68. { label: '手机号', prop: 'phone'},
  69. { label: '更新人', prop: 'update_by' },
  70. { label: '更新时间', prop: 'update_at' },
  71. { label: '操作', width: 120, type: 'handle2', operations:
  72. [
  73. // { label: '编辑', func: this.openPopup, btnType: 'primary' },
  74. { label: '删除', func: this.delHandle, btnType: 'danger' },
  75. ]
  76. }
  77. ]
  78. }
  79. },
  80. methods: {
  81. delHandle(row) {
  82. this.$msg(`您确定要删除该管理员吗?`, 'confirm', () => {
  83. this.$api.house.admestatemanagedel({
  84. id: row.id,
  85. }).then(data => {
  86. this.$msgs(`已删除!`)
  87. this.fetchData()
  88. })
  89. }, null, true)
  90. },
  91. openPopup(row) {
  92. if (row && row.id) {
  93. this.curObj = row
  94. } else {
  95. this.curObj = {}
  96. }
  97. this.isDtlShow = true
  98. },
  99. closePopup(obj) {
  100. this.isDtlShow = false
  101. if (obj) {
  102. this.fetchData()
  103. }
  104. }
  105. }
  106. }
  107. </script>