index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. </div>
  25. </template>
  26. <script>
  27. import { arrToObj } from '@/utils'
  28. import SearchForm from './components/searchForm/Index'
  29. import PopupEdit from './components/popup/IndexEdit'
  30. import baseTable from '_m/baseTable.js'
  31. import xData from './mixin'
  32. export default {
  33. name: 'index',
  34. components: {
  35. SearchForm,
  36. PopupEdit,
  37. },
  38. provide() {
  39. return {
  40. parentData: this
  41. }
  42. },
  43. mixins: [baseTable],
  44. data() {
  45. return {
  46. apiStr: 'house.admschoollist',
  47. searchForm: null,
  48. isDtlShow: false,
  49. curObj: {},
  50. ...xData
  51. }
  52. },
  53. computed: {
  54. tableData2() {
  55. const arr = [...this.tableData,
  56. // {id: 1, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  57. // {id: 2, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  58. // {id: 3, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  59. // {id: 4, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  60. // {id: 5, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  61. // {id: 6, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~', cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
  62. ]
  63. arr.map(item => {})
  64. return arr
  65. }
  66. },
  67. created() {},
  68. mounted() {
  69. this.listConfig = {
  70. rows: [
  71. { label: '排序', prop: 'sort', type: 'input', width: 80},
  72. { label: '学校名称', prop: 'school_name', fullShow: true, minWidth: 200, align: "left" },
  73. { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
  74. { label: '图片', prop: 'pri_image', type: 'img' },
  75. { label: '学校地址', prop: 'address' },
  76. { label: '更新人', prop: 'update_by' },
  77. { label: '更新时间', prop: 'update_at' },
  78. { label: '操作', width: 200, type: 'handle2', operations:
  79. [
  80. { label: '保存排序', func: this.saveHandle, btnType: 'success' },
  81. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  82. { label: '删除', func: this.delHandle, btnType: 'danger' },
  83. ]
  84. }
  85. ]
  86. }
  87. },
  88. methods: {
  89. saveHandle (row) {
  90. this.$api.house.admestatesortedit({
  91. id: row.id,
  92. sort: row.sort,
  93. }).then(data => {
  94. this.$msgs(`已保存!`)
  95. this.fetchData()
  96. })
  97. },
  98. delHandle(row) {
  99. this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  100. this.$api.house.admschooldel({
  101. id: row.id,
  102. }).then(data => {
  103. this.$msgs(`已删除!`)
  104. this.fetchData()
  105. })
  106. }, null, true)
  107. },
  108. openPopup(row) {
  109. if (row && row.id) {
  110. this.curObj = row
  111. } else {
  112. this.curObj = {}
  113. }
  114. this.isDtlShow = true
  115. },
  116. closePopup(obj) {
  117. this.isDtlShow = false
  118. if (obj) {
  119. this.fetchData()
  120. }
  121. }
  122. }
  123. }
  124. </script>