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 ...
随机推荐
- Bootstrap Multiselect
Getting Started Link the Required Files First, the jQuery library needs to be included. Then Twitter ...
- 4.30-5.1cf补题
//yy:拒绝转载!!! 悄悄告诉你,做题累了,去打两把斗地主就能恢复了喔~~~ //yy:可是我不会斗地主吖("'▽'") ~~~那就听两遍小苹果嘛~~~ 五一假期除了花时间建模 ...
- (一)自定义ImageView,初步实现多点触控、自由缩放
真心佩服那些一直专注于技术共享的大神们,正是因为他们无私的分享精神,我才能每天都有进步.近日又算是仔细学了android的自定义控件技术,跟着大神的脚步实现了一个自定义的ImageView.里面涉及到 ...
- 字符串匹配KMP算法(转自阮一峰)
转自 http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html 字符串匹配是计算 ...
- web.xml中Listener的作用
Servlet的监听器Listener,它是实现了javax.servlet.ServletContextListener 接口的服务器端程序,它也是随web应用的启动而启动,只初始化一次,随web应 ...
- Entity Framework——性能测试
内容提要 一.对EF框架的性能测试 增.删.改,查测试及性能优化 二.使用sql执行 增.删.改,查测试 三.对以上两种方式对比分析 一 对EF框架的测试 1插入操作测试 测试代码(关键部分) Lis ...
- Qgis里的查询过滤
查询过虑实现方式 通过给getFeatures()传递 QgsFeatureRequest对象,实现数据的过虑,下边是一个查询的例子: request = QgsFeatureRequest() re ...
- LwIP协议栈开发嵌入式网络的三种方法分析
LwIP协议栈开发嵌入式网络的三种方法分析 摘要 轻量级的TCP/IP协议栈LwIP,提供了三种应用程序设计方法,且很容易被移植到多任务的操作系统中.本文结合μC/OS-II这一实时操作系统,以 ...
- write函数过程解析
write函数作为用户向终端或者文件进行写数据的重要函数,有着重要的作用. |------| |---------| |---------| |----------| | wri ...
- Reading Notes : 180211 概述计算机
读书<计算机组成原理> <鸟哥的Linux私房菜 基础篇> 本章介绍电子计算机概念以及发展历史和发展趋势,内容摘自<计算机组成原理> <鸟哥的Linux私房 ...