index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. :isAdd="true"
  16. @add="openPopup"
  17. :operationsDefaultLength="6"
  18. />
  19. <popup-edit
  20. :isShow="isDtlShow"
  21. :curObj="curObj"
  22. @close="closePopup"
  23. />
  24. <photo-edit
  25. :isShow="isPhotoShow"
  26. :curObj="curObj"
  27. @close="closePhotoPopup"
  28. />
  29. <theme-house-edit
  30. :isShow="isTHEShow"
  31. :curObj="curObj"
  32. @close="closeTHEPopup"
  33. />
  34. </div>
  35. </template>
  36. <script>
  37. import { arrToObj } from '@/utils'
  38. import SearchForm from './components/searchForm/Index'
  39. import PopupEdit from './components/popup/IndexEdit'
  40. import PhotoEdit from './components/popup/PhotoEdit'
  41. import ThemeHouseEdit from './components/popup/ThemeHouseEdit'
  42. import baseTable from '_m/baseTable.js'
  43. export default {
  44. name: 'index',
  45. components: {
  46. SearchForm,
  47. PopupEdit,
  48. PhotoEdit,
  49. ThemeHouseEdit,
  50. },
  51. provide() {
  52. return {
  53. parentData: this
  54. }
  55. },
  56. mixins: [baseTable],
  57. data() {
  58. return {
  59. apiStr: 'house.admestatelist',
  60. searchForm: null,
  61. isDtlShow: false,
  62. isPhotoShow: false,
  63. // noCreated: true,
  64. curObj: {},
  65. isTHEShow: false,
  66. }
  67. },
  68. computed: {
  69. tableData2() {
  70. const arr = [...this.tableData]
  71. arr.map(item => {
  72. const metro_type = item.metro_type ? item.metro_type.split(',') : []
  73. const metroTypeName = metro_type.map(v => {
  74. return arrToObj(this.$dictData.metro_type)[v]
  75. })
  76. item.metroTypeName = metroTypeName.join(',')
  77. const product_type = item.product_type ? item.product_type.split(',') : []
  78. const productTypeName = product_type.map(v => {
  79. return arrToObj(this.$dictData.product_type)[v]
  80. })
  81. item.productTypeName = productTypeName.join(',')
  82. const metro_line = item.metro_line ? item.metro_line.split(',') : []
  83. const metroLineName = metro_line.map(v => {
  84. return arrToObj(this.$dictData.metro_line)[v]
  85. })
  86. item.metroLineName = metroLineName.join(',')
  87. })
  88. return arr
  89. }
  90. },
  91. created() {},
  92. mounted() {
  93. this.listConfig = {
  94. rows: [
  95. { label: '楼盘名称', prop: 'estate_name' },
  96. { label: '图片', prop: 'pri_image', type: 'img' },
  97. { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
  98. // { label: '楼盘地址', prop: 'address', fullShow: true, minWidth: 200 },
  99. // { label: '地铁线路', prop: 'metroLineName'},
  100. // { label: '地铁站名', prop: 'metroTypeName'},
  101. { label: '产品类型', prop: 'productTypeName'},
  102. // { label: '周边医院', prop: 'hospital_type', type: 'flag', flags: arrToObj(this.$dictData.hospital_type)},
  103. // { label: '周边商圈', prop: 'high_street', type: 'flag', flags: arrToObj(this.$dictData.high_street)},
  104. // { label: '公园', prop: 'park_type', type: 'flag', flags: arrToObj(this.$dictData.park_type)},
  105. { label: '创建人', prop: 'create_by' },
  106. { label: '创建时间', prop: 'create_at' },
  107. { label: '更新人', prop: 'update_by' },
  108. { label: '更新时间', prop: 'update_at' },
  109. { label: '操作', width: 400, type: 'handle2', operations:
  110. [
  111. { label: '编辑信息', func: this.openPopup, btnType: 'primary' },
  112. { label: '编辑相册', func: this.openPhotoPopup, btnType: 'info' },
  113. { label: '楼盘动态', func: this.openNews, btnType: 'info' },
  114. { label: '模块主题', func: this.openTHEPopup, btnType: 'info' },
  115. { label: '删除', func: this.delHandle, btnType: 'danger' },
  116. ]
  117. }
  118. ]
  119. }
  120. },
  121. methods: {
  122. delHandle(row) {
  123. this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  124. this.$api.house.admestatedel({
  125. id: row.id,
  126. status: 2
  127. }).then(data => {
  128. this.$msgs(`已删除!`)
  129. this.fetchData()
  130. })
  131. }, null, true)
  132. },
  133. openNews (item) {
  134. this.$router.push('/house/news?id=' + item.id)
  135. },
  136. openPhotoPopup(row) {
  137. if (row && row.id) {
  138. this.curObj = row
  139. } else {
  140. this.curObj = {}
  141. }
  142. this.isPhotoShow = true
  143. },
  144. closePhotoPopup(obj) {
  145. this.isPhotoShow = false
  146. if (obj) {
  147. this.fetchData()
  148. }
  149. },
  150. openPopup(row) {
  151. if (row && row.id) {
  152. this.curObj = row
  153. } else {
  154. this.curObj = {}
  155. }
  156. this.isDtlShow = true
  157. },
  158. closePopup(obj) {
  159. this.isDtlShow = false
  160. if (obj) {
  161. this.fetchData()
  162. }
  163. },
  164. openTHEPopup(row) {
  165. if (row && row.id) {
  166. this.curObj = row
  167. } else {
  168. this.curObj = {}
  169. }
  170. this.isTHEShow = true
  171. },
  172. closeTHEPopup(obj) {
  173. this.isTHEShow = false
  174. if (obj) {
  175. this.fetchData()
  176. }
  177. }
  178. }
  179. }
  180. </script>