list.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. </div>
  25. </template>
  26. <script>
  27. import { arrToObj } from '@/utils'
  28. import SearchForm from './components/searchForm/List'
  29. import PopupEdit from './components/popup/listEdit'
  30. import baseTable from '_m/baseTable.js'
  31. export default {
  32. name: 'list',
  33. components: {
  34. SearchForm,
  35. PopupEdit,
  36. },
  37. provide() {
  38. return {
  39. parentData: this
  40. }
  41. },
  42. mixins: [baseTable],
  43. data() {
  44. return {
  45. apiStr: 'other.admmapcoordinlist',
  46. searchForm: {},
  47. isDtlShow: false,
  48. curObj: {},
  49. }
  50. },
  51. computed: {
  52. tableData2() {
  53. const arr = [...this.tableData]
  54. arr.map(item => {
  55. if (
  56. item.uuid === '96512a54-4d3c-457e-a33f-3ea27c963bd0' // 区域
  57. || item.uuid === '954a527b-e460-4b67-bd39-7adcfa3c2def' // 默认
  58. || item.uuid === '95542ff1-8176-4267-8344-2aa7f1034ac5' // 初中
  59. || item.uuid === '95542fdc-b542-4582-9be2-9ab8005728d3' // 小学
  60. ) {
  61. item.isSys = true
  62. }
  63. })
  64. return arr
  65. }
  66. },
  67. created() {},
  68. mounted() {
  69. this.listConfig = {
  70. rows: [
  71. { label: 'ID', prop: 'uuid'},
  72. { label: '标题', prop: 'title'},
  73. { label: '更新人', prop: 'update_by' },
  74. { label: '更新时间', prop: 'update_at' },
  75. { label: '操作', width: 120, type: 'handle2', operations:
  76. [
  77. { label: '详情', func: this.linkDtl, btnType: 'primary' },
  78. { label: '删除', func: this.delHandle, btnType: 'danger', hide: 'isSys', },
  79. ]
  80. }
  81. ]
  82. }
  83. },
  84. methods: {
  85. delHandle(row) {
  86. this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
  87. this.$api.other.admmapcoordindel({
  88. uuid: row.uuid,
  89. }).then(() => {
  90. this.$msgs(`已删除!`)
  91. this.fetchData()
  92. })
  93. }, null, true)
  94. },
  95. linkDtl(row) {
  96. this.$router.push(`/map/dtl?e=1&id=${row.uuid}`)
  97. },
  98. openPopup(row) {
  99. if (row && row.id) {
  100. this.curObj = row
  101. } else {
  102. this.curObj = {}
  103. }
  104. this.isDtlShow = true
  105. },
  106. closePopup(obj) {
  107. this.isDtlShow = false
  108. if (obj) {
  109. this.fetchData()
  110. }
  111. },
  112. }
  113. }
  114. </script>