index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/Index'
  28. import PopupEdit from './components/popup/IndexEdit'
  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.admeshouselist',
  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', minWidth: 200, fullShow: true },
  70. { label: '主图', prop: 'pri_image', type: 'img' },
  71. { label: '总价', prop: 'price' },
  72. { label: '面积㎡', prop: 'area' },
  73. { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
  74. { label: '状态', prop: 'hide_status', type: 'tag', tags: arrToObj(this.$dictData.hide_status), tagTypeObj: {'1': 'success', '2': 'danger'} },
  75. { label: '更新时间', prop: 'update_at' },
  76. { label: '创建人', prop: 'sale_name' },
  77. { label: '创建时间', prop: 'create_at' },
  78. { label: '操作', width: 80, type: 'handle2', operations:
  79. [
  80. { labelFor: 'hide_status', disabled: true, func: this.statusHandle, hide: 'nosys',
  81. labelConfig: {
  82. texts: {
  83. 1: '隐藏',
  84. 2: '显示'
  85. },
  86. btnTypes: {
  87. 1: 'danger',
  88. 2: 'success'
  89. }
  90. }
  91. },
  92. ]
  93. }
  94. ]
  95. }
  96. },
  97. methods: {
  98. statusHandle (row) {
  99. const hide_status = Number(row.hide_status) === 1 ? 2 : 1
  100. const msgText = Number(row.hide_status) === 1 ? '隐藏' : '显示'
  101. this.$msg(`确定要${msgText}该房源吗?`, 'confirm', ()=> {
  102. this.$api.house.admeshouseshow({
  103. id: row.id,
  104. hide_status
  105. }).then(data => {
  106. this.$msgs(`${msgText}成功!`)
  107. this.fetchData()
  108. })
  109. }, null, true)
  110. },
  111. // saveHandle (row) {
  112. // this.$api.house.admoldhousesortedit({
  113. // id: row.id,
  114. // sort: row.sort,
  115. // }).then(data => {
  116. // this.$msgs(`已保存!`)
  117. // this.fetchData()
  118. // })
  119. // },
  120. // delHandle(row) {
  121. // this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  122. // this.$api.house.admoldhousedel({
  123. // id: row.id,
  124. // status: 2
  125. // }).then(data => {
  126. // this.$msgs(`已删除!`)
  127. // this.fetchData()
  128. // })
  129. // }, null, true)
  130. // },
  131. openPopup(row) {
  132. if (row && row.id) {
  133. this.curObj = row
  134. } else {
  135. this.curObj = {}
  136. }
  137. this.isDtlShow = true
  138. },
  139. closePopup(obj) {
  140. this.isDtlShow = false
  141. if (obj) {
  142. this.fetchData()
  143. }
  144. }
  145. }
  146. }
  147. </script>