all.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. :operationsDefaultLength="3"
  19. >
  20. </table-list>
  21. <popup-edit
  22. :isShow="isDtlShow"
  23. :curObj="curObj"
  24. @close="closePopup"
  25. />
  26. </div>
  27. </template>
  28. <script>
  29. import { arrToObj } from '@/utils'
  30. import SearchForm from './components/searchForm/All'
  31. import PopupEdit from './components/popup/AllEdit'
  32. import baseTable from '_m/baseTable.js'
  33. export default {
  34. name: 'all',
  35. components: {
  36. SearchForm,
  37. PopupEdit,
  38. },
  39. provide() {
  40. return {
  41. parentData: this
  42. }
  43. },
  44. mixins: [baseTable],
  45. data() {
  46. return {
  47. apiStr: 'house.admestateliblist',
  48. searchForm: null,
  49. isDtlShow: false,
  50. curObj: {},
  51. isHRShow: false,
  52. }
  53. },
  54. computed: {
  55. tableData2() {
  56. const arr = [...this.tableData]
  57. arr.map(item => {
  58. item.brokerageTag = item.brokerage_tag ? JSON.parse(item.brokerage_tag).join(',') : ''
  59. })
  60. return arr
  61. }
  62. },
  63. created() {},
  64. mounted() {
  65. this.listConfig = {
  66. rows: [
  67. // { label: '排序', prop: 'sort', type: 'input', width: 80},
  68. { label: '图片', prop: 'pri_image', type: 'img' },
  69. { label: '楼盘名称', prop: 'estate_name' },
  70. { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
  71. { label: '合作平台渠道', prop: 'brokerageTag' },
  72. { label: '更新时间', prop: 'update_at' },
  73. { label: '操作', width: 220, type: 'handle2', operations:
  74. [
  75. { label: '编辑信息', func: this.openPopup, btnType: 'primary' },
  76. { label: '渠道平台', func: this.linkBrokerage, btnType: 'info' },
  77. { label: '删除', func: this.delHandle, btnType: 'danger' },
  78. ]
  79. }
  80. ]
  81. }
  82. },
  83. methods: {
  84. linkBrokerage (row) {
  85. this.$router.push(`/house/brokerage?id=${row.id}&name=${row.estate_name}`)
  86. },
  87. // saveHandle (row) {
  88. // this.$api.house.admestatesortedit({
  89. // id: row.id,
  90. // sort: row.sort,
  91. // }).then(data => {
  92. // this.$msgs(`已保存!`)
  93. // this.fetchData()
  94. // })
  95. // },
  96. delHandle(row) {
  97. this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  98. this.$api.house.admestatelibdel({
  99. id: row.id,
  100. status: 2
  101. }).then(data => {
  102. this.$msgs(`已删除!`)
  103. this.fetchData()
  104. })
  105. }, null, true)
  106. },
  107. openPopup(row) {
  108. if (row && row.id) {
  109. this.curObj = row
  110. } else {
  111. this.curObj = {}
  112. }
  113. this.isDtlShow = true
  114. },
  115. closePopup(obj) {
  116. this.isDtlShow = false
  117. if (obj) {
  118. this.fetchData()
  119. }
  120. },
  121. openHRPopup(row) {
  122. if (row && row.id) {
  123. this.curObj = row
  124. } else {
  125. this.curObj = {}
  126. }
  127. this.isHRShow = true
  128. },
  129. closeHRPopup(obj) {
  130. this.isHRShow = false
  131. if (obj) {
  132. this.fetchData()
  133. }
  134. },
  135. }
  136. }
  137. </script>