customList.vue 3.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<template>
  <d2-container class="companyNews">
    <headerLayout active="0"></headerLayout>
    <div class="news-wrapper">
      <div class="news-title d-flex jc-between">
        <label>重要客户</label>
        <span @click="goBack">&lt; 返回</span>
      </div>
      <div class="news-content">
        <el-table stripe :data="tableData" style="width: 100%">
11 12
          <el-table-column prop="name"></el-table-column>
          <el-table-column align="right" prop="createAt"></el-table-column>
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
        </el-table>
        <Pagination
          v-show="pageObj.total > 0"
          :total="pageObj.total"
          layout="->,total, prev, pager, next"
          :page.sync="pageObj.pageNo"
          :limit.sync="pageObj.pageSize"
          @pagination="pageChange"
        />
      </div>
    </div>
  </d2-container>
</template>

<script>
import headerLayout from '@/components/headerLayout/index' // 公共头部
import Pagination from '@/components/Pagination'
import * as API_CLIENT from '@/api/con.client.js'
export default {
  components: { headerLayout, Pagination },
  data () {
    return {
      pageObj: {
        pageNo: 1,
        total: 1,
        pageSize: 10
      },
      tableData: []
    }
  },
  mounted () {
44 45 46 47 48 49 50
    this.type = this.$route.query.type
    console.log(this.type)
    if (this.type === 1) {
      this.getCustomList()
    } else {
      this.getPartner()
    }
51 52
  },
  methods: {
53 54 55 56 57 58
    getPartner () {
      API_CLIENT.getPartner({ _index: this.pageObj.pageNo, _size: this.pageObj.pageSize }).then(res => {
        this.tableData = res.data.records
        this.pageObj.total = Number(res.data.total)
      })
    },
59 60 61
    // 查询概况页面数据
    getCustomList () {
      API_CLIENT.getCustomPageList({ _index: this.pageObj.pageNo, _size: this.pageObj.pageSize }).then(res => {
62 63 64 65 66 67
        this.tableData = res.data.records.map(item => {
          return {
            name: item.customerName,
            createAt: item.createTime
          }
        })
68 69 70 71 72 73 74 75 76 77
        this.pageObj.total = Number(res.data.total)
      })
    },
    goBack () {
      this.$router.back(-1)
    },
    // 翻页
    pageChange (page) {
      this.pageObj.pageSize = page.limit
      this.pageObj.pageNo = page.page
78 79 80 81 82
      if (this.type === 1) {
        this.getCustomList()
      } else {
        this.getPartner()
      }
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
    }
  }
}
</script>

<style lang="scss" scoped>
.companyNews {
  .news-wrapper {
    padding: .5rem 1rem;
  }
  .news-title {
    width: 100%;
    height: .54rem;
    font-size: .24rem;
    line-height: 1.5;
    color: $color-primary;
    border-bottom: .02rem solid $color-primary;
    margin-bottom: .5rem;
    span {
      cursor: pointer;
    }
  }
  .news-content {
    ::v-deep .el-table {
      font-size: .16rem;
      color: #fff;
      margin-bottom: .24rem;
      background-color: rgba(47, 219, 243, 0.05);
      &::before {
        height: 0;
      }
      .el-table__header-wrapper {
        display: none;
      }
      td {
        border-bottom: none;
      }
      .el-table__row--striped td {
        background-color: $color-bg;
      }
      tr {
        background-color: $color-bg;
        cursor: pointer;
        &.is-leaf {
          border-bottom: none;
        }
      }
      .el-table__body tr:hover>td {
        background-color: rgba(47, 219, 243, 0.15);
      }
    }
    ::v-deep .el-pagination.is-background {
      .el-pager li:not(.disabled):hover {
        color: $color-primary;
      }
      .el-pager li:not(.disabled).active {
        background-color:$color-primary;
        color: #fff;
      }

    }
  }
}
</style>