theme.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="app-container">
  3. <search-form
  4. :list-loading="listLoading"
  5. @change="searchHandle"
  6. />
  7. <el-tabs v-model="curNavVal" @tab-click="navHandle">
  8. <el-tab-pane :label="item.key" :name="item.val" v-for="(item, index) in mtArr" :key="index"></el-tab-pane>
  9. </el-tabs>
  10. <table-list
  11. :list-loading="listLoading"
  12. :data="tableData2"
  13. :columns="listConfig"
  14. :current-page="currentPage"
  15. :page-size="pageSize"
  16. :total-records="totalRecords"
  17. @currentChange="pageHandle"
  18. :isAdd="true"
  19. @add="openPopup"
  20. :operationsDefaultLength="5"
  21. />
  22. <popup-edit
  23. :isShow="isDtlShow"
  24. :curObj="curObj"
  25. @close="closePopup"
  26. />
  27. <lottery-edit
  28. :isShow="isLEShow"
  29. :curObj="curObj"
  30. @close="closeLEPopup"
  31. />
  32. </div>
  33. </template>
  34. <script>
  35. import { arrToObj } from '@/utils'
  36. import SearchForm from './components/searchForm/Theme'
  37. import PopupEdit from './components/popup/ThemeEdit'
  38. import LotteryEdit from './components/popup/LotteryEdit'
  39. import baseTable from '_m/baseTable.js'
  40. export default {
  41. name: 'old',
  42. components: {
  43. SearchForm,
  44. PopupEdit,
  45. LotteryEdit,
  46. },
  47. provide() {
  48. return {
  49. parentData: this
  50. }
  51. },
  52. mixins: [baseTable],
  53. data() {
  54. const mtArr = this.$dictData.module_type || []
  55. const curNavVal = mtArr.length > 0 ? mtArr[1].val : ''
  56. return {
  57. apiStr: 'house.admestatemodulelist',
  58. searchForm: {},
  59. isDtlShow: false,
  60. // noCreated: true,
  61. curObj: {},
  62. mtArr,
  63. curNavVal,
  64. isLEShow: false,
  65. }
  66. },
  67. computed: {
  68. tableData2() {
  69. const arr = [...this.tableData]
  70. arr.map(item => {
  71. })
  72. return arr
  73. }
  74. },
  75. created() {
  76. this.searchForm = {
  77. module_type: this.curNavVal
  78. }
  79. },
  80. mounted() {
  81. this.getConfig()
  82. },
  83. methods: {
  84. getConfig () {
  85. if (this.curNavVal === 'yhjg' || this.curNavVal === 'zzyh') {
  86. this.listConfig = {
  87. rows: [
  88. { label: '楼盘名称', prop: 'estate_name' },
  89. { label: '模块主题', prop: 'module_type', type: 'flag', flags: arrToObj(this.$dictData.module_type) },
  90. { label: '排序', prop: 'sort' },
  91. { label: '更新人', prop: 'update_by' },
  92. { label: '更新时间', prop: 'update_at' },
  93. { label: '操作', width: 220, type: 'handle2', operations:
  94. [
  95. { label: '更新摇号信息', func: this.openLEPopup, btnType: 'success' },
  96. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  97. { label: '删除', func: this.delHandle, btnType: 'danger' },
  98. ]
  99. }
  100. ]
  101. }
  102. } else {
  103. this.listConfig = {
  104. rows: [
  105. { label: '楼盘名称', prop: 'estate_name' },
  106. { label: '模块主题', prop: 'module_type', type: 'flag', flags: arrToObj(this.$dictData.module_type) },
  107. { label: '排序', prop: 'sort' },
  108. { label: '更新人', prop: 'update_by' },
  109. { label: '更新时间', prop: 'update_at' },
  110. { label: '操作', width: 120, type: 'handle2', operations:
  111. [
  112. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  113. { label: '删除', func: this.delHandle, btnType: 'danger' },
  114. ]
  115. }
  116. ]
  117. }
  118. }
  119. },
  120. navHandle () {
  121. this.getConfig()
  122. this.searchForm.module_type = this.curNavVal
  123. this.fetchData()
  124. },
  125. delHandle(row) {
  126. this.$msg(`您确定要删除该模块主题吗?`, 'confirm', () => {
  127. this.$api.house.admestatemoduledel({
  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. openLEPopup(row) {
  150. if (row && row.id) {
  151. this.curObj = row
  152. } else {
  153. this.curObj = {}
  154. }
  155. this.isLEShow = true
  156. },
  157. closeLEPopup(obj) {
  158. this.isLEShow = false
  159. if (obj) {
  160. this.fetchData()
  161. }
  162. }
  163. }
  164. }
  165. </script>