demo.vue 2.76 KB
<!--
 * @Descripttion: 
 * @version: X3版本
 * @Author: lily
 * @Date: 2021-10-12 10:21:48
 * @LastEditors: lily
 * @LastEditTime: 2021-10-12 11:01:29
-->
<template>
  <div class="wrapper">
    <!-- 头部部分 -->
    <div class="header">
      <el-input v-model="input" placeholder="请输入内容"></el-input>
    </div>
    <!-- table部分 -->
    <div class="main">
      <div class="table-box">
        <el-table class="table-list__box" ref="tableList" :data="dataList" :height="tableHeight" border stripe tooltip-effect="dark">
          <el-table-column v-for="column in columns" :key="column.key" :prop="column.key" :label="column.label" :width="column.width" :min-width="150" sortable show-overflow-tooltip filter-placement="bottom"></el-table-column>
         <template slot="empty" class="emptyBg">
        <div class="noDataImgWrap" style="width:64px;height:41px;margin:0 auto;">
        <img class="noDataImg" style="width:100%;height:100%;" src="@/assets/clientDataOverview/nodata.png"  alt="" />
        </div>
        <!-- <div>{{ noDataText }}</div> -->
        <div>暂无数据</div>
        <slot name="additionalContent"></slot>
      </template>
        </el-table>
        <!-- 分页 -->
        <div class="pagination__wrapper">
          <cd-pagination ref="pager" :total="pagination.total" :currPage="pagination.pageNow" :pageSize="pagination.pageSize"></cd-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
const columns = [
  { key: 'accountName', label: '登录账号', width: 120 },
  { key: 'phone', label: '登录手机', width: 120 },
  { key: 'userName', label: '用户名称', width: 120 },
  { key: 'email', label: '登录邮箱', width: 210 },
  { key: 'orgNames', label: '所属组织', width: 210 },
  { key: 'roleName', label: '所属角色', width: 210 },
  { key: 'memo', label: '备注', width: 120 },
  { key: 'updateTime', label: '最后操作时间' }
]
import demo from '@/common/demo.json'
export default {
  name: 'clientDemo',
  components: {},
  data() {
    return {
      input: '',
      columns,
      dataList: [],
      tableHeight: null,
      pagination: {
        pageNow: 1,
        pageSize: 20,
        pages: 0,
        total: 0
      }
    }
  },
  mounted() {
    setTimeout(() => {
      let height = this.$refs.tableList.$el.parentElement.clientHeight

      this.tableHeight = `${height}px`
      
    })

    this.dataList = []//demo.data.rows.concat([])
  }
}
</script>

<style lang="scss" scoped>
.wrapper {
  background: #fff !important;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.header {
  padding: 20px 8px;
  background: #ccc;
}
.main {
  flex: 1;
  overflow: hidden;
}

.table-box {
  height: 100%;
  display: flex;
  flex: auto;
  flex-direction: column;
  overflow: hidden;
}
</style>