charlist.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. />
  17. <popup-edit
  18. :isShow="isDtlShow"
  19. :curObj="curObj"
  20. @close="closePopup"
  21. />
  22. </div>
  23. </template>
  24. <script>
  25. import { arrToObj } from '@/utils'
  26. import SearchForm from './components/searchForm/Charlist'
  27. import PopupEdit from './components/popup/Charlist'
  28. import baseTable from '_m/baseTable.js'
  29. export default {
  30. name: 'Index',
  31. components: {
  32. SearchForm,
  33. PopupEdit,
  34. },
  35. provide() {
  36. return {
  37. parentData: this
  38. }
  39. },
  40. mixins: [baseTable],
  41. data() {
  42. return {
  43. apiStr: 'other.admlotterycharlist',
  44. searchForm: null,
  45. isDtlShow: false,
  46. // noCreated: true,
  47. curObj: {},
  48. }
  49. },
  50. computed: {
  51. tableData2() {
  52. const arr = [...this.tableData]
  53. arr.map(item => {
  54. if (item.total === 0 && item.name !== '春') {
  55. item.total = '999'
  56. }
  57. })
  58. return arr
  59. }
  60. },
  61. created() {},
  62. mounted() {
  63. this.listConfig = {
  64. rows: [
  65. { label: '字', prop: 'name' },
  66. { label: '概率', prop: 'v' },
  67. { label: '剩余数量', prop: 'total' },
  68. { label: '操作', width: 80, type: 'handle2', operations:
  69. [
  70. { label: '设置', func: this.openPopup, btnType: 'primary' },
  71. ]
  72. }
  73. ]
  74. }
  75. },
  76. methods: {
  77. openPopup(row) {
  78. if (row && row.id) {
  79. this.curObj = row
  80. } else {
  81. this.curObj = {}
  82. }
  83. this.isDtlShow = true
  84. },
  85. closePopup(obj) {
  86. this.isDtlShow = false
  87. if (obj) {
  88. this.fetchData()
  89. }
  90. }
  91. }
  92. }
  93. </script>