<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 分页注意事项的更多相关文章

  1. element ui 分页记忆checked

    <el-table :data="tableData" border ref="multipleTableChannel" @selection-chan ...

  2. vue2.0+Element UI 表格前端分页和后端分页

    之前写过一篇博客,当时对element ui框架还不太了解,分页组件用 html + css 自己写的,比较麻烦,而且只提到了后端分页 (见 https://www.cnblogs.com/zdd20 ...

  3. vue2.0 + Element UI + axios实现表格分页

    注:本文分页组件用原生 html + css 实现,element-ui里有专门的分页组件可以不用自己写,详情见另一篇博客:https://www.cnblogs.com/zdd2017/p/1115 ...

  4. element UI 饿了么 UI 分页 按钮不显示的问题

    https://blog.csdn.net/sinat_37255207/article/details/88914235 一个很坑的 深坑  element UI 的 按钮 不显示的深坑 <e ...

  5. element UI table 过滤 筛选问题

    一.问提描述    使用elementUI table 官方筛选案例,发现筛选不是服务器端筛选,而是浏览器端对每一页进行单独筛选. 如何在服务器端筛选? 二.查询Element UI 官网table组 ...

  6. Element UI样式无法修改解决方法。

    最近在做的项目中要用到Element UI组件来写,非常方便,但毕竟Element UI是有它自己的默认样式的,并不是客户所要求的,但就在我想要修改样式时遇到了棘手的问题. 如何引入和使用 Eleme ...

  7. Vue + Element UI 实现权限管理系统 前端篇(十一):第三方图标库

    使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...

  8. Vue + Element UI 实现权限管理系统(第三方图标库)

    使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...

  9. vue + element ui 实现实现动态渲染表格

    前言:之前需要做一个页面,能够通过表名动态渲染出不同的表格,这里记录一下.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9786326.html 网站地址:我的 ...

  10. vue-cli 3.0 豆瓣api接口使用element做分页

    记录自己的学习 大佬绕道谢谢! 豆瓣即将上映接口:https://api.douban.com/v2/movie/coming_soon 本地跨域问题 看我之前的文章:https://www.cnbl ...

随机推荐

  1. redis在windows平台安装和启动

    官网: https://redis.io/ 中文网站:http://www.redis.net.cn/ 一.下载windows版本的redis 官网没有提供windows版本的下载,只有linux版本 ...

  2. 关于Git提交规范

    自古至今,无规矩不成方圆. Git提交也有其规范,业内做的比较好的,比较具有参考价值的就是Angular的提交. Angular提交规范: <type>(<scope>): & ...

  3. mysql.sock问题

    Can't connect to local MySQL server through socket '/tmp/mysql.sock' 上述提示可能在启动mysql时遇到,即在/tmp/mysql. ...

  4. java连接数据库增删改查公共方法

    package dao; import java.io.IOException; import java.sql.CallableStatement; import java.sql.Connecti ...

  5. TCP Congestion Control

    TCP Congestion Control Congestion occurs when total arrival rate from all packet flows exceeds R ove ...

  6. 应对STM32 Cortex-M3 Hard Fault异常

    STM32 Cortex-M3 Hard Fault Hard fault (硬错误,也有译为硬件错误的)是在STM32(如无特别说明,这里的STM32指的是Cortex-M3的核)上编写程序中所产生 ...

  7. JS异步编程 (1)

    JS异步编程 (1) 1.1 什么叫异步 异步(async)是相对于同步(sync)而言的,很好理解. 同步就是一件事一件事的执行.只有前一个任务执行完毕,才能执行后一个任务.而异步比如: setTi ...

  8. 工具 | Axure基础操作 No.1

    Axure作为一款热门的原型设计工具,是产品汪必备的一个技能.对于我个人来说,虽然更加喜欢墨刀这种小清新并且易用的网页版轻量级工具. 我在这里进行一些简单操作的动图,方便和我一样刚入门的同学容易看得明 ...

  9. Swift_属性

    Swift_属性 点击查看源码 class DataImporter { var fileName = "data.txt" init() { print("初始化&qu ...

  10. BufPay.com 个人收款接口 接入步骤

    作为独立开发者产品需要收款是非常麻烦的,注册公司维护成本太高,市面上各种收款工具要么手续费太高,要么到账很慢,体验很不好. 看到 「BufPay.com 个人收款」 这个收款工具,挺有意思的.原理是监 ...