my.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. :operationsDefaultLength="6"
  17. :isAdd="true"
  18. @add="openPopup"
  19. >
  20. </table-list>
  21. <popup-edit
  22. :isShow="isDtlShow"
  23. :curObj="curObj"
  24. @close="closePopup"
  25. />
  26. </div>
  27. </template>
  28. <script>
  29. import { arrToObj } from '@/utils'
  30. import SearchForm from './components/searchForm/My'
  31. import PopupEdit from './components/popup/IndexEdit'
  32. import baseTable from '_m/baseTable.js'
  33. export default {
  34. name: 'index',
  35. components: {
  36. SearchForm,
  37. PopupEdit,
  38. },
  39. provide() {
  40. return {
  41. parentData: this
  42. }
  43. },
  44. mixins: [baseTable],
  45. data() {
  46. return {
  47. apiStr: 'cust.admcustomerlist',
  48. searchForm: null,
  49. isDtlShow: false,
  50. curObj: {},
  51. isQShow: false,
  52. isAShow: false,
  53. }
  54. },
  55. computed: {
  56. tableData2() {
  57. const arr = [...this.tableData]
  58. arr.map(item => {})
  59. return arr
  60. }
  61. },
  62. created() {},
  63. mounted() {
  64. this.listConfig = {
  65. rows: [
  66. { label: '姓名', prop: 'name' },
  67. { label: '电话', prop: 'phone' },
  68. { label: '性别', prop: 'sex', type: 'tag', tags: arrToObj(this.$dictData.sex), tagTypeObj: {'male': 'primary', 'female': 'danger'} },
  69. { label: '备注', prop: 'demand', fullShow: true, minWidth: 200, align: 'left' },
  70. { label: '创建时间', prop: 'create_at' },
  71. { label: '操作', width: 120, type: 'handle2', operations:
  72. [
  73. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  74. { label: '删除', func: this.delHandle, btnType: 'danger' },
  75. ]
  76. }
  77. ]
  78. }
  79. },
  80. methods: {
  81. delHandle(row) {
  82. this.$msg(`您确定要删除该客户吗?`, 'confirm', () => {
  83. this.$api.cust.admcustomerdel({
  84. id: row.id
  85. }).then(data => {
  86. this.$msgs(`已删除!`)
  87. this.fetchData()
  88. })
  89. }, null, true)
  90. },
  91. openPopup(row) {
  92. if (row && row.id) {
  93. this.curObj = row
  94. } else {
  95. this.curObj = {}
  96. }
  97. this.isDtlShow = true
  98. },
  99. closePopup(obj) {
  100. this.isDtlShow = false
  101. if (obj) {
  102. this.fetchData()
  103. }
  104. }
  105. }
  106. }
  107. </script>