index.vue 4.3 KB

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