index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. :isAdd="true"
  17. @add="openPopup"
  18. />
  19. <popup-edit
  20. :isShow="isDtlShow"
  21. :curObj="curObj"
  22. @close="closePopup"
  23. />
  24. <cur-qrcode
  25. :isShow="isQrcodeShow"
  26. :curObj="curObj"
  27. @close="closeQrcodePopup"
  28. />
  29. </div>
  30. </template>
  31. <script>
  32. import { arrToObj } from '@/utils'
  33. import SearchForm from './components/searchForm/Index'
  34. import PopupEdit from './components/popup/IndexEdit'
  35. import CurQrcode from './components/popup/Qrcode'
  36. import baseTable from '_m/baseTable.js'
  37. export default {
  38. name: 'index',
  39. components: {
  40. SearchForm,
  41. PopupEdit,
  42. CurQrcode,
  43. },
  44. provide() {
  45. return {
  46. parentData: this
  47. }
  48. },
  49. mixins: [baseTable],
  50. data() {
  51. return {
  52. isQrcodeShow: false,
  53. apiStr: 'other.admactivitylist',
  54. searchForm: null,
  55. isDtlShow: false,
  56. curObj: {},
  57. }
  58. },
  59. computed: {
  60. tableData2() {
  61. const arr = [...this.tableData,]
  62. arr.map(item => {})
  63. return arr
  64. }
  65. },
  66. created() {},
  67. mounted() {
  68. this.listConfig = {
  69. rows: [
  70. { label: '楼盘名称', prop: 'estate_name' },
  71. { label: '活动内容', prop: 'remark' },
  72. { label: '分类', prop: 'activity_type', type: 'flag', flags: arrToObj(this.$dictData.activity_type ) },
  73. { label: '图片', prop: 'image', type: 'img' },
  74. { label: '更新时间', prop: 'update_at' },
  75. { label: '操作', width: 200, type: 'handle2', operations:
  76. [
  77. { label: '统计', func: this.linkDtl, btnType: 'success' },
  78. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  79. { label: '二维码', func: this.openQrcodePopup, btnType: 'info' },
  80. { label: '删除', func: this.delHandle, btnType: 'danger' },
  81. ]
  82. }
  83. ]
  84. }
  85. },
  86. methods: {
  87. linkDtl (row) {
  88. this.$router.push(`/activity/dtl?name=${row.estate_name}${row.remark}&id=${row.id}&t=${row.activity_type}`)
  89. },
  90. delHandle(row) {
  91. this.$msg(`您确定要删除该活动吗?`, 'confirm', () => {
  92. this.$api.other.admactivitydel({
  93. id: row.id,
  94. }).then(data => {
  95. this.$msgs(`已删除!`)
  96. this.fetchData()
  97. })
  98. }, null, true)
  99. },
  100. openPopup(row) {
  101. if (row && row.id) {
  102. this.curObj = row
  103. } else {
  104. this.curObj = {}
  105. }
  106. this.isDtlShow = true
  107. },
  108. closePopup(obj) {
  109. this.isDtlShow = false
  110. if (obj) {
  111. this.fetchData()
  112. }
  113. },
  114. openQrcodePopup(row) {
  115. if (row && row.code) {
  116. this.curObj = row
  117. this.isQrcodeShow = true
  118. } else {
  119. this.$msg('未找到二维码')
  120. }
  121. },
  122. closeQrcodePopup(obj) {
  123. this.isQrcodeShow = false
  124. if (obj) {
  125. this.fetchData()
  126. }
  127. }
  128. }
  129. }
  130. </script>