elementui table 分页 和 tabel 前加序列号
记录下来备忘
结构如下

Report.vue
<template>
<div>
<home-header></home-header>
<div class="report">
<div class="rs_1"></div>
<div class="rs_4">检测报告查询</div>
<div class="tools"> <table-view @changPage="changPage" :reportData="reportData" :count="count" :Offset="Offset" :Limit="Limit"></table-view> </div>
</div>
<footer-view></footer-view> </div>
</template>
<script>
import HomeHeader from '../header/Header'
import FooterView from '../footer/FooterView'
import TableView from './components/TableView'
import axios from 'axios'
import {urlApi} from '@/api/api.js'
import { format } from '@/util/util.js'
export default {
name:'Report',
components:{
HomeHeader,
FooterView,
TableView
},
data(){
return{
reportData:[],
count:0,
Offset:0,
Limit:10
}
},
methods:{
changPage(v){
this.Offset = (v-1)*10;
this.getReport(this.Offset,this.Limit);
},
getReport(Offset=0,Limit=10){
/* post */
let params = new URLSearchParams();
params.append('Offset',Offset);
params.append('Limit',10);
params.append('Limit',10);
params.append('postType','web'); axios.post(urlApi.getReport,params)
.then(this.getReportSucc)
/* post */
},
getReportSucc(res){
this.reportData = [];
if(res.data.error_code==0 && res.data.reason){
this.count = res.data.count;
res.data.reason.forEach((item,index) => {
// console.log(format(item.SEND_TIME));
// item.PATIENT_NAME = item.PATIENT_NAME.split(',')[0]
item.PATIENT_NAME = item.PATIENT_NAME.charAt(0)+'***';
item.SEND_TIME = format(item.SEND_TIME)
});
this.reportData = res.data.reason;
}
}
},
mounted() {
this.getReport();
},
}
</script>
<style lang="stylus">
.report
width 1280px
min-height 900px
background #161F60
margin 51px auto 0
position relative
color white
float left
left 50%
margin-left -640px
.rs_1
position absolute
top 0
left 0
width 73px
height 75px
background url('../../assets/dat/rs_1.png') no-repeat
.rs_2
position absolute
bottom 0
left 0
width 1280px
height 228px
background url('../../assets/dat/rs_2.png') no-repeat
z-index 9
.rs_3
position absolute
top 0px
right 0
width 80px
height 6px
background url('../../assets/dat/rs_3.png') no-repeat
.rs_4
position absolute
top 28px
left 25px
width 221px
height 46px
background url('../../assets/dat/rs_4.jpg') no-repeat
text-align center
line-height 46px
font-size 18px
.tools
margin-top 140px
</style>
Table.vue
<template>
<div> <el-table
:data="reportData"
border
style="width: 100%">
<el-table-column
label="序号"
width="70"
>
<template scope="scope">
<span>
{{scope.$index+((Offset+10)/10-1)*Limit+1}}
</span>
</template>
</el-table-column>
<el-table-column
prop="PATIENT_NAME"
label="患者姓名"
width="180">
</el-table-column>
<el-table-column
prop="SEND_TIME"
label="送检日期"
width="180">
</el-table-column>
<el-table-column
prop="PHY_NAME"
label="医生"
width="180">
</el-table-column>
<el-table-column
prop="REPORT_TYPE"
label="检测类型"
width="180">
</el-table-column>
<el-table-column
prop="PKG_NUM"
label="检测条码"
width="180">
</el-table-column>
<el-table-column
prop="REPORT_STATUS"
label="REPORT_STATUS"
width="180">
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="button" v-if="scope.row.REPORT_STATUS == '有报告'" @click="checkDetail(scope.row.REPORT_CODE,scope.row.PATIENT_NAME)">下载报告</el-button>
<div v-else>{{scope.row.REPORT_STATUS}}</div>
</template>
</el-table-column>
</el-table>
<div class="page">
<el-pagination
@current-change="handleCurrentChange"
small
background
layout="prev, pager, next"
:total="count">
</el-pagination>
</div> <el-dialog :title="name" :visible.sync="dialogTableVisible">
<el-table border :data="ihcdata">
<el-table-column property="REPORT_TYPE" label="报告类型" width="150"></el-table-column>
<el-table-column property="SEND_TIME" label="送检日期" width="200"></el-table-column>
<el-table-column property="BARCODE" label="样本检测条码"></el-table-column> <el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="button" @click="checkDownload(scope.row.ATTACH_ID)">下载</el-button>
</template>
</el-table-column> </el-table> <el-table border :data="ngsdata" class="myrow">
<el-table-column property="REPORT_TYPE" label="报告类型" width="150"></el-table-column>
<el-table-column property="SEND_TIME" label="送检日期" width="200"></el-table-column>
<el-table-column property="BARCODE" label="样本检测条码"></el-table-column> <el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="button" @click="checkDownload(scope.row.ATTACH_ID)">下载</el-button>
</template>
</el-table-column> </el-table>
</el-dialog> </div>
</template>
<script>
import axios from 'axios'
import {urlApi} from '@/api/api.js'
import { format } from '@/util/util.js'
export default {
name:'TableView',
props:{
reportData:Array,
count:Number,
Offset:Number,
Limit:Number
},
data(){
return{
dialogTableVisible:false,
name:'',
ihcdata: [],
ngsdata:[],
}
},
methods:{
checkDownload(id){
//console.log(v);
/* post */
/*
let iparams = new URLSearchParams();
iparams.append('ATTACH_ID',id); axios.post(urlApi.downloadReport,iparams)
.then(this.downloadReportSucc)
*/
/* post */
window.location.href=urlApi.downloadReport+'&ATTACH_ID='+id;
},
downloadReportSucc(res){ if(res.data.error_code != 0){
this.$message(res.data.msg);
}else{
console.log(res);
window.location.href=res;
}
},
handleCurrentChange(currentPage){
this.$emit("changPage",currentPage);
},
checkDetail(detail,name){
this.name = name+'的检测报告';
this.getReportsByOrderId(detail,name);
},
getReportsByOrderId(reportcode,name){
/* post */
let params = new URLSearchParams();
params.append('REPORT_CODE',reportcode);
params.append('postType','web'); axios.post(urlApi.getReportsByOrderId,params)
.then(this.getReportsByOrderIdSucc)
/* post */
},
getReportsByOrderIdSucc(res){
if(res.data.error_code==0 && res.data.reason){
console.log(res.data.reason)
res.data.reason.IHCList.forEach((item,index) => {
//console.log(res.data.reason);
item.SEND_TIME = format(item.SEND_TIME)
});
res.data.reason.NGSList.forEach((item,index) => {
//console.log(res.data.reason);
item.SEND_TIME = format(item.SEND_TIME)
});
this.ihcdata = [];
this.ngsdata = [];
this.ihcdata = res.data.reason.IHCList;
this.ngsdata = res.data.reason.NGSList;
this.dialogTableVisible = true;
}
}
}
}
</script>
<style lang="stylus">
.page
width 100%
text-align center
margin-top 20px
.myrow
margin-top 30px
</style>

elementui table 分页 和 tabel 前加序列号的更多相关文章
- element-UI table分页之后保存已经勾选的标签
- 项目总结17-使用layui table分页表格
项目总结17-使用layui table分页表格总结 前言 在项目中,需要用到分页的表格来展示数据,发现layui的分页表格,是一个很好的选择:本文介绍layui table分页表格的前后端简单使用 ...
- bootstrap table分页(前后端两种方式实现)
bootstrap table分页的两种方式: 前端分页:一次性从数据库查询所有的数据,在前端进行分页(数据量小的时候或者逻辑处理不复杂的话可以使用前端分页) 服务器分页:每次只查询当前页面加载所需要 ...
- 关于【vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据】的优化
之前写的[vue + element-ui Table的数据多选,多页选择数据回显,分页记录保存选中的数据]这篇博客.功能虽然实现了相对应的功能.但是用起来很不爽.所以进行了优化. 备注:最近可能没时 ...
- vue+element-ui 实现分页(根据el-table内容变换的分页)
官方例子 官方提示: 设置layout,表示需要显示的内容,用逗号分隔,布局元素会依次显示.prev表示上一页,next为下一页,pager表示页码列表,除此以外还提供了jumper和total,si ...
- vue+elementUI实现 分页表格的单选或者多选、及禁止部分选择
一.vue+elementUI实现 分页表格前的多选 多选效果图: 代码如下: <el-table ref="multipleTable" :data="listD ...
- Table 分页处理
介绍两种table分页处理:PHP分页 和 js(jquery.table)分页. 一:jquery.table: 1:下载两个文件:table_jui.css 和 jquery.dataTables ...
- JQuery实现table分页
1.直接贴代码: ; //每页显示的记录条数 ; //显示第curPage页 var len; //总行数 var page; //总页数 $(function(){ len =$(; //去掉表头 ...
- C++在字符串前加一个L作用:
在字符串前加一个L作用: 如 L"我的字符串" 表示将ANSI字符串转换成unicode的字符串,就是每个字符占用两个字节. strlen("asd" ...
随机推荐
- 课下作业04-2String的使用方法
1.动手动脑之String.equals()方法public class StringEquals { public static void main(String[] args) { String ...
- C语言中声明和定义详解(待看。。
变量声明和变量定义 变量定义:用于为变量分配存储空间,还可为变量指定初始值.程序中,变量有且仅有一个定义. 变量声明:用于向程序表明变量的类型和名字. 定义也是声明,extern声明不是定义 定义也是 ...
- PHP RBAC权限控制,基于CI框架(版本3.1.9)
2018年11月7日更新:目前功能已做到事件级别权限控制,如:后台用户的添加操作.删除操作和保存操作等具体到事件级的操作方法有权限则展示相应的操作菜单,没权限则隐藏相应菜单或提示无权限到目前算是真正做 ...
- Linux菜鸟起飞之路【九】系统启动流程
Linux系统启动流程 BIOS -> MBR -> BootLoader -> Kernel -> init 1.打开电源后,计算机从主板的BIOS中读取其中存储的程序.这 ...
- 【线程池】ExecutorService与quartz搭配出现的问题
问题描述: 使用quartz定时推送微信公众号模板消息,一分钟推送一次,定时器里面使用了一个ExecutorService线程池,大小为5个. 批量获取数据之后,全部数据都被分配到n/5的线程池里面等 ...
- [译]The Python Tutorial#5. Data Structures
[译]The Python Tutorial#Data Structures 5.1 Data Structures 本章节详细介绍之前介绍过的一些内容,并且也会介绍一些新的内容. 5.1 More ...
- matplotlib学习记录 六
# 绘制多数据条形图 # 假设你知道了列表a中电影分别在2017-09-14(b_14),2017-09-15(b_15), # 2017-09-16(b_16)三天的票房,为了展示列表中电影本身的票 ...
- 掌握这些Python代码技巧,编程至少快一半!
被人工智能捧红的 Python 已是一种发展完善且非常多样化的语言,其中肯定有一些你尚未发现的功能.本文或许能够让你学到一些新技巧. Python 是世界上最流行.热门的编程语言之一,原因很多,比 ...
- 多进程 multiprocessing 多线程Threading 线程池和进程池concurrent.futures
multiprocessing.procsess 定义一个函数 def func():pass 在if __name__=="__main__":中实例化 p = process( ...
- The 2018 ACM-ICPC Chinese Collegiate Programming Contest Moving On
Firdaws and Fatinah are living in a country with nn cities, numbered from 11 to nn.Each city has a r ...