企微助手 ,仓库名 短剧

publicTable.vue 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div>
  3. <!-- table -->
  4. <el-table v-loading="loading" ref="multipleTable"
  5. border
  6. :height='height'
  7. :data="tableData"
  8. tooltip-effect="dark"
  9. :header-cell-style="()=>{return { backgroundColor: '#f9f9f9 !important' }}"
  10. style="width: 100%">
  11. <template v-for="item in propsData.desCol">
  12. <el-table-column :key="item.prop" :label="item.label" align="center"
  13. :show-overflow-tooltip="item.showOverTooltip"
  14. :min-width="item.min_width?item.min_width:120">
  15. <template #header v-if="item.tooltip">
  16. {{item.label?item.label:'-'}}
  17. <el-tooltip class="disinblock" :content="item.tooltip" placement="top">
  18. <i class="el-icon-question"></i>
  19. </el-tooltip>
  20. </template>
  21. <template slot-scope="scope">
  22. <div>{{scope.row[item.prop] ? scope.row[item.prop] : '-'}}</div>
  23. </template>
  24. </el-table-column>
  25. </template>
  26. <el-table-column label="操作" align="center" min-width="180px">
  27. <template slot-scope="scope">
  28. <template v-if="propsData.source=='codeIndex'">
  29. <div class="flex">
  30. <div class="c-00B38A pointer">禁用</div>
  31. <div class="c-00B38A pointer lMar8">删除</div>
  32. <div class="c-00B38A pointer lMar8">复制</div>
  33. <div class="c-00B38A pointer lMar8">下载</div>
  34. <div class="c-00B38A pointer lMar8">分析数据</div>
  35. </div>
  36. </template>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. <div class="pagination" v-show="total>0">
  41. <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
  42. </el-pagination>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. export default {
  48. name: "publicTable",
  49. props:['propsData'],
  50. data(){
  51. return{
  52. loading: false,
  53. dataLoading: false,
  54. page: 1,
  55. pages: 0,
  56. total: 0,
  57. page_size: 20,
  58. height: '',
  59. tableData:[]
  60. }
  61. },
  62. watch:{
  63. 'propsData.initFlag'(){
  64. this.init(1)
  65. }
  66. },
  67. created() {
  68. this.height = document.documentElement.clientHeight - 300 > 400 ? document.documentElement.clientHeight - 300 : 400
  69. this.init(1)
  70. },
  71. methods:{
  72. init (page, type) {
  73. if (type != 'export') {
  74. this.page = page ? page : this.page;
  75. } else {
  76. if (this.total == 0) {
  77. this.$message({
  78. message: '暂无数据可导出',
  79. type: "warning"
  80. })
  81. return
  82. }
  83. }
  84. this.loading = true
  85. this.$axios.get(this.URL.BASEURL + this.URL.batchAddCustomer_statistic, {
  86. params:{
  87. start_date: '2022-05-14',
  88. end_date: '2022-06-13',
  89. page: type == 'export' ? 1 : this.page,
  90. pagesize: type == 'export' ? this.$store.state.exportNumber : this.page_size,
  91. }
  92. }).then((res) => {
  93. var res = res.data
  94. this.loading = false
  95. if (res && res.errno == 0) {
  96. if (type == 'export') {
  97. this.exportEvent(res.rst.data)
  98. } else {
  99. this.tableData = res.rst.data
  100. this.total = res.rst.pageInfo.total;
  101. this.pages = res.rst.pageInfo.pages;
  102. }
  103. } else if (res.errno != 4002) {
  104. this.$message({
  105. message: res.err,
  106. type: "warning"
  107. })
  108. }
  109. }).catch((err) => {
  110. this.loading = false
  111. });
  112. },
  113. handleCurrentChange (val) {
  114. this.init(val)
  115. },
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. </style>