rent.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. :operationsDefaultLength="5"
  17. />
  18. <popup-edit
  19. :isShow="isDtlShow"
  20. :curObj="curObj"
  21. @close="closePopup"
  22. />
  23. </div>
  24. </template>
  25. <script>
  26. import { arrToObj } from '@/utils'
  27. import SearchForm from './components/searchForm/Rent'
  28. import PopupEdit from './components/popup/RentEdit'
  29. import baseTable from '_m/baseTable.js'
  30. export default {
  31. name: 'Index',
  32. components: {
  33. SearchForm,
  34. PopupEdit,
  35. },
  36. provide() {
  37. return {
  38. parentData: this
  39. }
  40. },
  41. mixins: [baseTable],
  42. data() {
  43. return {
  44. apiStr: 'house.admrenthouselist',
  45. searchForm: null,
  46. isDtlShow: false,
  47. // noCreated: true,
  48. curObj: {},
  49. }
  50. },
  51. computed: {
  52. tableData2() {
  53. const arr = [...this.tableData]
  54. arr.map(item => {
  55. item.pri_image = this.IMadd(item.pri_image)
  56. })
  57. return arr
  58. }
  59. },
  60. created() {},
  61. mounted() {
  62. this.listConfig = {
  63. rows: [
  64. // { label: '排序', prop: 'sort', type: 'input', width: 80},
  65. { label: '编号', prop: 'id' },
  66. { label: '楼盘', prop: 'estate_name' },
  67. // { label: '浏览数', prop: 'view_count' },
  68. // { label: '置业经理', prop: 'sale_name' },
  69. { label: '标题', prop: 'title' },
  70. { label: '主图', prop: 'pri_image', type: 'img' },
  71. // { label: '详细地址', prop: 'detail_address', fullShow: true, minWidth: 100 },
  72. { label: '总价', prop: 'price' },
  73. { label: '面积㎡', prop: 'area' },
  74. // { label: '房源类型', prop: 'house_type', width: 100, fullShow: true, type: 'flag', flags: arrToObj(this.$dictData.house_type) },
  75. { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
  76. { label: '状态', prop: 'hide_status', type: 'tag', tags: arrToObj(this.$dictData.hide_status), tagTypeObj: {'1': 'success', '2': 'danger'} },
  77. // { label: '更新人', prop: 'update_by' },
  78. { label: '更新时间', prop: 'update_at' },
  79. // { label: '创建人', prop: 'create_by' },
  80. { label: '创建时间', prop: 'create_at' },
  81. { label: '操作', width: 80, type: 'handle2', operations:
  82. [
  83. { labelFor: 'hide_status', disabled: true, func: this.statusHandle, hide: 'nosys',
  84. labelConfig: {
  85. texts: {
  86. 1: '隐藏',
  87. 2: '显示'
  88. },
  89. btnTypes: {
  90. 1: 'danger',
  91. 2: 'success'
  92. }
  93. }
  94. },
  95. // { label: '保存排序', func: this.saveHandle, btnType: 'success' },
  96. // { label: '编辑', func: this.openPopup, btnType: 'primary' },
  97. // { label: '删除', func: this.delHandle, btnType: 'danger' },
  98. ]
  99. }
  100. ]
  101. }
  102. },
  103. methods: {
  104. statusHandle (row) {
  105. const hide_status = Number(row.hide_status) === 1 ? 2 : 1
  106. const msgText = Number(row.hide_status) === 1 ? '隐藏' : '显示'
  107. this.$msg(`确定要${msgText}该房源吗?`, 'confirm', ()=> {
  108. this.$api.house.admrenthouseshow({
  109. id: row.id,
  110. hide_status
  111. }).then(data => {
  112. this.$msgs(`${msgText}成功!`)
  113. this.fetchData()
  114. })
  115. }, null, true)
  116. },
  117. saveHandle (row) {
  118. this.$api.house.admrenthousesortedit({
  119. id: row.id,
  120. sort: row.sort,
  121. }).then(data => {
  122. this.$msgs(`已保存!`)
  123. this.fetchData()
  124. })
  125. },
  126. delHandle(row) {
  127. this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  128. this.$api.house.admrenthousedel({
  129. id: row.id,
  130. status: 2
  131. }).then(data => {
  132. this.$msgs(`已删除!`)
  133. this.fetchData()
  134. })
  135. }, null, true)
  136. },
  137. openPopup(row) {
  138. if (row && row.id) {
  139. this.curObj = row
  140. } else {
  141. this.curObj = {}
  142. }
  143. this.isDtlShow = true
  144. },
  145. closePopup(obj) {
  146. this.isDtlShow = false
  147. if (obj) {
  148. this.fetchData()
  149. }
  150. }
  151. }
  152. }
  153. </script>