pageTable.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <div>
  4. <tableLayout :layout="tablecols" :data="list2" :opwidth="200" :custom="true" :width="false" fixedName="operation" :customHeader="true">
  5. <template v-slot:header="data">
  6. <div v-if="data.data.label == '综合折扣'" style="display:flex;align-items:center">
  7. <span>{{ data.data.label }}</span>
  8. <el-tooltip class="item" effect="dark" content="综合折扣=(产品明细平均折扣+产品类别平均折扣)÷2×100%" placement="top">
  9. <i class="el-icon-warning-outline" style="margin-left:10px;cursor: pointer;"></i>
  10. </el-tooltip>
  11. </div>
  12. <div v-else>
  13. <span>{{ data.data.label }}</span>
  14. </div>
  15. </template>
  16. <template v-slot:customcol="scope">
  17. <slot v-if="custom" name="custom" :data="scope.column"></slot>
  18. <div v-else>
  19. <div v-if="scope.column.columnname == 'stagecount'">
  20. <el-tag size="small" v-for="(item,index) in scope.column.data.stagecount" :key="index">{{ item.stagename }}</el-tag>
  21. </div>
  22. <div v-else>
  23. {{ scope.column.data[scope.column.columnname] }}
  24. </div>
  25. </div>
  26. </template>
  27. </tableLayout>
  28. </div>
  29. <div style="margin-top:16px;text-align:right">
  30. <el-pagination
  31. background
  32. small
  33. @size-change="handleSizeChange"
  34. @current-change="handleCurrentChange"
  35. :current-page="param.content.pageNumber"
  36. :page-sizes="[20, 50, 100, 200]"
  37. layout="total,sizes, prev, pager, next, jumper"
  38. :total="total">
  39. </el-pagination>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. props:["tablecols",'param','custom'],
  46. data () {
  47. return {
  48. list:[],
  49. list2:[],
  50. total:0,
  51. options:[
  52. ],
  53. }
  54. },
  55. methods:{
  56. async listData(){
  57. const res = await this.$api.requested(this.param)
  58. this.list = res.data
  59. this.list2 = res.data.length && res.data[0].isEmpty ? [] : res.data
  60. this.total = res.data.length && res.data[0].isEmpty ? 0 : res.total
  61. console.log(this.list)
  62. },
  63. handleSizeChange(val) {
  64. // console.log(`每页 ${val} 条`);
  65. this.param.content.pageSize = val
  66. this.listData()
  67. },
  68. handleCurrentChange(val) {
  69. // console.log(`当前页: ${val}`);
  70. this.param.content.pageNumber = val
  71. this.listData()
  72. },
  73. },
  74. created() {
  75. this.listData()
  76. }
  77. }
  78. </script>
  79. <style scoped>
  80. </style>