首页 > 其他分享 >element-ui表格模板

element-ui表格模板

时间:2023-07-03 16:14:03浏览次数:43  
标签:name 普陀区 王小虎 element ui date 2016 05 模板

<template>
  <div class="container">
    <div class="breadcrumb">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item>个人中心</el-breadcrumb-item>
        <el-breadcrumb-item>我的订阅</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="content">
      <div class="box">
        <div style="width:100%;height: calc(100% - 2.5rem)">
          <!--                        :header-cell-style="{background:'#d5f5ff',color:'#49b8de'}"
-->
          <el-table
            v-loading="tableLoading"
            :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
            border height="100%">
            <el-table-column
              sortable
              prop="name"
              label="订阅产品"
              width="180">
            </el-table-column>
            <el-table-column
              sortable
              prop="extent"
              label="订阅范围"
              width="180">
            </el-table-column>
            <el-table-column
              sortable
              prop="time"
              label="订阅时间">
            </el-table-column>
            <el-table-column
              sortable
              label="当前状态"
              align="center"
              prop="status"
              min-width="150"
            >
              <template slot-scope="scope">
                <el-tag style="font-size: .5rem;" :type="formatType(scope.row.status)">{{formatVal(scope.row.status)}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column
              min-width="140"
              label="操作"
              align="center">
              <template slot-scope="scope">
                <el-button size="small" type="primary" @click="down(scope.row)"
                           style="margin-right: .5rem" plain>下载
                </el-button>
                <el-button size="small" type="primary" @click="cancel(scope.row)"
                           plain>取消
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="height: 2.5rem;display: flex;align-items:center;justify-content: flex-end">
          <el-pagination
            small
            background
            @current-change="pageChange"
            :current-page="currentPage"
            layout="total,prev, pager, next"
            :page-size="pageSize"
            :pager-count="pageSize"
            :total="totalPage">
          </el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "accountInfo",
    data() {
      return {

        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          extent: '上海市普陀区金沙江路 1517 弄',
          status: 0,
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄',
          status: 1,
        }, {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄',
          status: 2,
        },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄',
            status: 3,
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
          {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          },
        ],
        tableLoading: false,
        totalPage: 30,
        pageSize: 10,
        currentPage: 1,
      }

    },
    methods: {
      pageChange(currentPage) {
        this.currentPage = currentPage;
      },
      formatType(val) {
        if (val == 0) {
          return "success";
        } else if (val == 1) {
          return "danger";
        } else if (val == 2) {
          return "primary";
        } else if (val == 3) {
          return "info";
        }
      },
      formatVal(val) {
        if (val == 0) {
          return "成功";
        } else if (val == 1) {
          return "失败";
        } else if (val == 2) {
          return "运行";
        } else if (val == 3) {
          return "未运行";
        }
      },
      get(searchVal) {
        this.tableLoading = true;
        this.graph && this.graph.destroy();
        this.graphData = null;
        get({
          params: {
            pageNum: this.currentPage,
            pageSize: this.pageSize,
            ...this.searchForm,
          }
        }).then(res => {
          this.tableLoading = false;
          this.tableData = res.data.data.records || [];
          this.total = res.data.data.total || 0;
          // if (this.tableData && this.tableData[0] && !searchVal) {
          //     this.view(this.tableData[0])
          // }
          if (this.tableData && this.tableData[0]) {
            this.view(this.tableData[0]);
            this.$refs['table'].setCurrentRow(this.tableData[0])
          }
        })
      },

    }
  }
</script>

<style scoped>
  .container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
  }

  .breadcrumb {

  }

  .content {
    flex: 1;

    padding:1rem;
    overflow: hidden; //表格高度生效

  }
  .box {
    width: 100%;
    height: 100%;
    padding: 3rem;
  }
</style>

  

标签:name,普陀区,王小虎,element,ui,date,2016,05,模板
From: https://www.cnblogs.com/bruce-lee-blog/p/17523145.html

相关文章

  • vue+element-ui 实现可编辑表格、动态渲染表头和表格数据、列向数据合计(每行末尾合计
    HTML部分代码<template> <div>  <el-container>   <el-header>Header</el-header>   <el-main>    <div>     //表格数据在这里::data="tableData"     <el-table      border    ......
  • OGG-02912 Patch 17030189 is required on your Oracle mining database for trail fo
    Therewillbeascript"prvtlmpg.plb"undergghomedirectory[oracle@OGGR2-1ogg]$ls-lrtprvtlmpg.plb-rw-r-----1oracleoinstall9487May272015prvtlmpg.plb[oracle@OGGR2-1ogg]$pwd/ogg[oracle@OGGR2-1ogg]$Logintothedatabaseand......
  • selenium ui自动化遇到切换窗口,点击高级并继续访问的处理方式
    在python自动化中(ui),遇到了一个需要浏览器切换窗口,点击“高级”-“接受风险并继续”的操作,前期在本地编写代码调试时,没有任何问题。切换环境,放到Linux服务中,使用无头模式去运行代码时,发现切换窗口时,总是找不到页面元素,查看截图发现页面为空白,检查两天无果。场景图片,如下图所示,当......
  • elementui 手动上传文件 post 请求
    //上传图片校验  fileChange(file){   constisJPG=file.raw.type==='image/jpeg'   constisPNG=file.raw.type==='image/png'   constisLt2M=file.raw.size/1024/1024<0.2   if(!isPNG&&!isJPG){   ......
  • vue+elementui实现树形结构表格且合并同一个children的单元格
    1、实现效果2、结构代码(给table添加classname)3、通过设置css实现合并同一个children的单元格.nonRelationalDatabase{//去除横向边框::v-deep.el-table__row{  td{   border-bottom:none!important;  } }//......
  • vue element admin 环境搭建
    安装node.js及npm参考官网node-vnpm-v项目下载#克隆项目gitclonehttps://github.com/PanJiaChen/vue-element-admin.git#安装依赖npminstall#设置淘宝仓库npminstall--registry=https://registry.npm.taobao.org#启动服务npmrundev......
  • vue2-props-required必填项
    props的required必填项<template><div><h5>Count组件</h5><p>count的值是:{{count}}</p><button@click="add">+1</button></div></template><script>expo......
  • 四、Gin模板
    四、Gin模板模板在web开发中⼴泛使⽤,它能够有效的将业务逻辑和页⾯逻辑分开,使代码可读性增强、并且更加容易理解和维护。模板简单来说就是⼀个其中包涵占位变量表⽰动态的部分的⽂件,模板⽂件在经过动态赋值后,返回给⽤户。4.1、变量渲染视图部分:packagemainimport"github......
  • 开心档之C++ 模板
    C++模板模板是泛型编程的基础,泛型编程即以一种独立于任何特定类型的方式编写代码。模板是创建泛型类或函数的蓝图或公式。库容器,比如迭代器和算法,都是泛型编程的例子,它们都使用了模板的概念。每个容器都有一个单一的定义,比如 向量 ,我们可以定义许多不同类型的向量,比如 vect......
  • 浅析C语言之uint8_t / uint16_t / uint32_t /uint64_t
    一、C语言基本数据类型回顾在C语言中有6种基本数据类型:short、int、long、float、double、char1、数值类型1)整型:short、int、long2)浮点型:float、double2、字符类型:char二、typedef回顾typedef用来定义关键字或标识符的别名,例如:typedefdoublewages;typedefwagessal......