element-ui 分页注意事项
<template>
<div id="monitor">
一页显示
{{currentCount}}条
当前第
{{currentPage}}页
<jc-card style="margin-bottom: 2px;">
<div slot="header" class="clearfix">
<span style="line-height: 36px;">全局查询</span>
</div>
<div class="jc-container-table-actionBar">
<jc-form class="jc-box-table-search" :inline="true">
<jc-form-item label="记录时间">
<jc-date-picker
v-model="timePicker"
type="datetimerange"
:picker-options="trange"
placeholder="选择时间范围"
align="right">
</jc-date-picker>
</jc-form-item> <jc-form-item label="提报时间">
<jc-date-picker
v-model="sub_picker"
type="datetimerange"
:picker-options="trange"
placeholder="选择时间范围"
align="right">
</jc-date-picker>
</jc-form-item> <jc-form-item label="工单级别">
<jc-select v-model="gdForm['jibie=']" placeholder="工单级别" clearable>
<jc-option label='高' value="高"></jc-option>
<jc-option label="中" value="中"></jc-option>
<jc-option label="低" value="低"></jc-option>
</jc-select>
</jc-form-item>
<jc-form-item label="工单来源">
<jc-select v-model="gdForm['source=']" placeholder="工单来源" clearable>
<jc-option label='咚咚' value="咚咚"></jc-option>
<jc-option label="邮箱" value="邮箱"></jc-option>
<jc-option label="电话" value="电话"></jc-option>
<jc-option label="微信" value="微信"></jc-option>
</jc-select>
</jc-form-item> <jc-form-item label="工单状态">
<jc-select v-model="gdForm['zhuangtai=']" placeholder="工单状态" clearable>
<jc-option label='进行中' value="进行中"></jc-option>
<jc-option label="完成" value="完成"></jc-option>
</jc-select>
</jc-form-item> <jc-form-item label="一级分类"> <jc-select v-model="gdForm['fenlei=']" placeholder="一级分类" clearable
@change="get_second">
<jc-option
v-for="item in first_kinds"
:key="item.id"
:label="item.name"
:value="item.id">
</jc-option>
</jc-select>
</jc-form-item> <jc-form-item label="记录人">
<jc-input placeholder="记录人" v-model="gdForm['author=']"></jc-input>
</jc-form-item> <jc-form-item label="提报人">
<jc-input placeholder="查询提报人" v-model="gdForm['realName=']"></jc-input>
</jc-form-item> <jc-form-item label="受派人">
<jc-input placeholder="查询受派人" v-model="gdForm['shoupairen=']"></jc-input>
</jc-form-item> <jc-form-item>
<jc-button icon="search" @click="submitSearch" type="primary">搜索</jc-button>
</jc-form-item>
<jc-form-item>
<jc-button icon="jc-icon-my-arrow-square-down" class="jc-button--primary" @click="download">下载
</jc-button>
</jc-form-item> <jc-form-item>
<jc-badge class="mark" style="left: 20px;" :value="total"/>
</jc-form-item> </jc-form>
</div>
</jc-card> <jc-row>
<div class="jc-container-table"> <div class="jc-container-table">
<div class="jc-container-table">
<jc-table :data="gongData.data" style="width: 100%" v-loading="loading"> <jc-table-column sortable label="工单号">
<template slot-scope="scope">
<router-link :to="{name:'RecordDetail',params:{id:scope.row.id}}">{{scope.row.danhao}}
</router-link>
</template>
</jc-table-column> <jc-table-column sortable label="概要">
<template slot-scope="scope">
<span :title="scope.row.title">{{scope.row.title|sub}}</span>
</template>
</jc-table-column> <jc-table-column prop="author" sortable label="创建人">
</jc-table-column> <jc-table-column prop="kehu" sortable label="提报人">
<template slot-scope="scope">
<a :href="scope.row.kehu|addUrl" style="margin-top: 5px"><i class="icon iconfont icon-dongdong"
style="margin-top: 10px"></i></a>
<span v-if="scope.row.realName">{{scope.row.realName}}</span>
<span v-else>{{scope.row.kehu}}</span>
</template>
</jc-table-column> <jc-table-column prop="jibie" sortable label="优先级/来源">
<template slot-scope="scope">
<span :class="levelMap[scope.row.jibie]">{{scope.row.jibie}}</span>/
<span>{{scope.row.source}}</span>
</template>
</jc-table-column> <jc-table-column prop="shoupairen" sortable label="受派人">
</jc-table-column> <jc-table-column prop="is_comment" sortable label="评价/重开">
<template slot-scope="scope">
<span v-if="scope.row.is_comment==1 && scope.row.is_restart!=1">
<jc-rate
v-model="scope.row.comment_start"
show-text>
</jc-rate>
</span>
<span v-else>
<span v-if="scope.row.is_restart==1">工单重开</span>
<span v-if="scope.row.is_comment==0 && scope.row.is_restart==0">未评价</span>
<span v-if="scope.row.gong_id"></span>
<span style="color:#0055aa" v-else>未发起</span>
</span>
</template>
</jc-table-column> <jc-table-column prop="zhuangtai" sortable label="状态">
<template slot-scope="scope">
<span :class="statusMap[scope.row.zhuangtai]">{{scope.row.zhuangtai}}</span>
<jc-popover ref="popover1" placement="top-start" title="详细内容" width="400" trigger="hover">
<span v-html="scope.row.fangan"></span>
</jc-popover>
<a href="#" class="jc-icon-my-help" v-popover:popover1></a>
</template>
</jc-table-column> <jc-table-column prop="sub_time" label="提报时间" sortable></jc-table-column> <jc-table-column label="分类" sortable>
<template slot-scope="scope">
{{scope.row.fenlei}} <span style="color:#c00">/</span> {{scope.row.leixing}}<span
style="color:#c00">/</span>{{scope.row.leixing2}}
</template>
</jc-table-column> </jc-table>
<!--current-page 表示默认的选中的页面-->
<div class="jc-container-table-actionBar">
<jc-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="currentPage" :page-sizes="[10, 20, 30, 40,50]"
:page-size="currentCount"
layout="total, sizes, prev, pager, next, jumper" :total="gongData.total">
</jc-pagination> </div>
</div>
</div>
</div>
</jc-row> </div>
</template> <script>
import {getDepart, getFirstKind, getSecondKind, getThirdKind} from '../../api/index' const statusMap = {
'进行中': 'jc-status-progress',
'完成': 'jc-status-success',
} const levelMap = {
"高": "jc-status-danger",
"中": "js-status-warning",
"低": "jc-status-info"
} import {getGongdan} from '../../api/index'
import getStringTime from '../../utils/timeformat'
import timeRange from '../../utils/timerange'
import qs from 'qs'
import {mapState} from "vuex" export default {
name: "monitor",
data() {
return {
gongData: {},
loading: true,
timerange: "",
s_value: "",
s_v: "",
statusMap: statusMap,
levelMap: levelMap,
currentPage: 1,
currentCount: 50,
trange: timeRange,
author: "",
timePicker: [],
sub_picker: [],
gdForm: {
"jilu_time>=": "",
"jilu_time<=": "",
"zhuangtai=": "",
"jibie=": "",
"miaoshu=": "",
"source=": "",
"fenlei=": "",
"leixing=": "",
"leixing2=": "",
"shoupairen=": "",
"realName=": "",
"sub_time>=": "",
"sub_time<=": "",
"author=": "",
},
real_first: "",
real_second: "",
first_kinds: [{name: "", id: ""}],
second_kinds: [],
third_kinds: [],
all_kinds: [],
t: "onet",
}
},
async created() {
let data = await getGongdan();
this.gongData = data;
if (this.gongData) {
this.loading = false;
}
this.first_kinds = await getFirstKind()
},
methods: {
async handleSizeChange(val) {
this.loading = true;
let query = qs.stringify(this.gdForm);
let data = await getGongdan(1, val, query);
if (data) {
this.gongData = data;
this.loading = false;
}
this.currentCount = val;
this.currentPage = 1;
},
async handleCurrentChange(val) {
this.loading = true;
this.currentPage = val;// 先定义分页,需要写在异步请求的前面
let query = qs.stringify(this.gdForm);
let data = await getGongdan(val, this.currentCount, query);
if (data) {
this.gongData = data;
this.loading = false;
}
},
async submitSearch() {
//保证时间有值
let isTime = this.timePicker.every((item) => {
return item;
}); if (isTime) {
// 将时间对象转换时间字符串
this.gdForm['jilu_time>='] = getStringTime(this.timePicker[0]);
this.gdForm['jilu_time<='] = getStringTime(this.timePicker[1]);
} else {
this.gdForm['jilu_time>='] = "";
this.gdForm['jilu_time<='] = "";
} //确保时间范围都有值
let tiTime = this.sub_picker.every((item) => {
return item;
}); if (tiTime) {
// 将时间对象转换时间字符串
this.gdForm['sub_time>='] = getStringTime(this.sub_picker[0]);
this.gdForm['sub_time<='] = getStringTime(this.sub_picker[1]);
} else {
this.gdForm['sub_time>='] = "";
this.gdForm['sub_time<='] = "";
} this.loading = true;
let query = qs.stringify(this.gdForm);
this.gongData = await getGongdan(1, 50, query);
if (this.gongData) {
this.loading = false;
}
this.loading = false;
this.currentPage = 1;
this.currentCount = 50;
},
download() {
// 访问后端来下载数据
window.open("http://jdjk.jd.com/api/gongdan/download", "_self");
},
showDetail(id) {
this.isShowDetail = true;
},
async get_second() {
this.gdForm['leixing='] = "";
this.gdForm['leixing2='] = "";
if (this.gdForm['fenlei=']) {
//获取第二分类
let data = await getSecondKind(this.gdForm['fenlei=']);
this.second_kinds = data;
} },
async get_third() {
this.gdForm['leixing2='] = "";
if (this.gdForm['leixing=']) {
let data = await getThirdKind(this.gdForm['fenlei='], this.gdForm['leixing=']);
this.third_kinds = data;
}
}
},
filters: {
sub(val) {
return String(val).substring(0, 15) + "...";
},
addUrl(val) {
return "timline://chat/?topin=" + val;
}
},
computed: {
total() {
return this.gongData.total;
},
...mapState(['is_submit'])
},
watch: {
/**
* 如果全局的state.is_submit提交成功,则自动请求页面
* @param newVal
* @param oldVue
* @returns {Promise<void>}
*/
async is_submit(newVal, oldVue) {
console.log(newVal);
console.log(oldVue);
if (newVal > oldVue) {
this.loading = true;
let data = await getGongdan();
this.gongData = data;
if (this.gongData) {
this.loading = false;
}
}
}
}
} </script> <style scoped>
#monitor {
} .jc-container-table-actionBar {
transition: all .3s linear;
} .jc-badge {
margin-top: -7px !important;
} </style>
element-ui 分页注意事项的更多相关文章
- element ui 分页记忆checked
<el-table :data="tableData" border ref="multipleTableChannel" @selection-chan ...
- vue2.0+Element UI 表格前端分页和后端分页
之前写过一篇博客,当时对element ui框架还不太了解,分页组件用 html + css 自己写的,比较麻烦,而且只提到了后端分页 (见 https://www.cnblogs.com/zdd20 ...
- vue2.0 + Element UI + axios实现表格分页
注:本文分页组件用原生 html + css 实现,element-ui里有专门的分页组件可以不用自己写,详情见另一篇博客:https://www.cnblogs.com/zdd2017/p/1115 ...
- element UI 饿了么 UI 分页 按钮不显示的问题
https://blog.csdn.net/sinat_37255207/article/details/88914235 一个很坑的 深坑 element UI 的 按钮 不显示的深坑 <e ...
- element UI table 过滤 筛选问题
一.问提描述 使用elementUI table 官方筛选案例,发现筛选不是服务器端筛选,而是浏览器端对每一页进行单独筛选. 如何在服务器端筛选? 二.查询Element UI 官网table组 ...
- Element UI样式无法修改解决方法。
最近在做的项目中要用到Element UI组件来写,非常方便,但毕竟Element UI是有它自己的默认样式的,并不是客户所要求的,但就在我想要修改样式时遇到了棘手的问题. 如何引入和使用 Eleme ...
- Vue + Element UI 实现权限管理系统 前端篇(十一):第三方图标库
使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...
- Vue + Element UI 实现权限管理系统(第三方图标库)
使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...
- vue + element ui 实现实现动态渲染表格
前言:之前需要做一个页面,能够通过表名动态渲染出不同的表格,这里记录一下.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9786326.html 网站地址:我的 ...
- vue-cli 3.0 豆瓣api接口使用element做分页
记录自己的学习 大佬绕道谢谢! 豆瓣即将上映接口:https://api.douban.com/v2/movie/coming_soon 本地跨域问题 看我之前的文章:https://www.cnbl ...
随机推荐
- hdu-2886 Special Prime---数论推导
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2866 题目大意: 问你1到L中有多少个素数满足n^3 + p*n^2 = m^3(其中n,m为大于1 ...
- SOJ4478 Easy Problem II(模拟、栈)
Time Limit: 3000 MS Memory Limit: 131072 K Description 在数据结构中 我们学习过 栈 这种数据结构 通过栈 我们可以将1,2,3,...,n转化成 ...
- 【[HAOI2009]逆序对数列】
发现自己学了几天splay已经傻了 其实还是一个比较裸的dp的,但是还是想了一小会,还sb的wa了几次 首先这道题的状态应该很好看出,我们用\(f[i][j]\)表示在前\(i\)个数中(即\(1-i ...
- 2018 Multi-University Training Contest 4 Problem B. Harvest of Apples 【莫队+排列组合+逆元预处理技巧】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6333 Problem B. Harvest of Apples Time Limit: 4000/200 ...
- Vue中引入jquery方法 vue-cli webpack 引入jquery
在vue-cli 生成的工程中引入了jquery(模板用的webpack) 首先在package.json里的dependencies加入"jquery" : "^2.2 ...
- Java之生成Pdf并对Pdf内容操作
虽说网上有很多可以在线导出Pdf或者word或者转成png等格式的工具,但是我觉得还是得了解知道是怎么实现的.一来,在线免费转换工具,是有容量限制的,达到一定的容量时,是不能成功导出的;二来,业务需求 ...
- Hello, GitHub!
GitHub作为版本控制的软件,我决定重新系统学习这个东西,毕竟以前都是fork.clone... 1. 理解Git思维 首先呢,我一开始就被GitHub和Git两个东西搞昏了,所以有必要理解二者的关 ...
- [转]HTTP报文接口及客户端和服务器端交互原理
1. 协议 a. TCP/IP整体构架概述 TCP/IP协议并不完全符合OSI的七层参考模型.传统的开放式系统互连参考模型,是一种通信协议的7层抽象的参考模型,其中每一层执行某一特定任务.该模型的目的 ...
- DB2 编目并访问远程数据库
之后将逐步对项目上的DB2相关经验做个总结,梳理一下知识结构. 要远程操作数据库,首先要进行编目,分三个步骤: 1. 在客户端建立服务器端数据库的节点,编目远程节点. 格式如下: 1. CATALOG ...
- 高考结束了,在门头沟有没有想学php建站的。
教你简单的html 教你文章后台管理 数据库管理及备份 编程工具的使用 如何找到你要学习的内容