<template>
|
<div class="userList">
|
<!-- <div class="headerTitle">运营管理》我的待办</div>-->
|
<header>
|
<div class="headerContent">
|
<div class="search">
|
<span>姓名:</span>
|
<el-input placeholder="请输入姓名" v-model="context"></el-input>
|
<span style="margin-left: 10px;">报警时间:</span>
|
<el-date-picker v-model="alarmTime" type="daterange" align="right" unlink-panels range-separator="至"
|
start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
|
</el-date-picker>
|
|
<!-- 按钮区域 -->
|
<div class="main-btns">
|
<div class="main-btns-left">
|
<!-- <el-button icon="el-icon-download">下载图片</el-button>-->
|
<el-button icon="el-icon-folder" @click="exportTableData">导出</el-button>
|
<!-- </div>
|
<div class="main-btns-right"> -->
|
<el-button icon="el-icon-search" @click="setTableData">查询</el-button>
|
<el-button icon="el-icon-delete-solid" @click="handleReset">重置</el-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
</header>
|
<main>
|
<div class="main-content">
|
<!-- 数据展示 -->
|
<el-table border stripe ref="multipleTable" :header-cell-style="{
|
background: '#F5F5F5',
|
'font-weight': '650',
|
'line-height': '45px'
|
}" :row-class-name="tableRowClassName" :data="list" style="width: 100%">
|
<el-table-column label="序号" type="index" width="80px">
|
</el-table-column>
|
<el-table-column prop="name" label="姓名" min-width="8">
|
</el-table-column>
|
<el-table-column prop="taskCount" label="任务总数" min-width="10">
|
</el-table-column>
|
<el-table-column prop="finishCount" label="已完成数量" min-width="10">
|
</el-table-column>
|
<el-table-column prop="notFinishCount" label="未完成数量" min-width="10">
|
</el-table-column>
|
<el-table-column prop="finishRadio" label="完成率" min-width="10">
|
<template slot-scope="{ row }">{{ fun(row.finishRadio * 100) }}%</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<!-- tools -->
|
<div class="tools">
|
<div class="funs"></div>
|
<div class="pagination">
|
<el-pagination background :current-page="currentPage" layout="prev, pager, next" :total="totalNum"
|
:page-size="pageSize" @current-change="changeCurrentPage" @prev-click="handlePrev"
|
@next-click="handleNext">
|
</el-pagination>
|
</div>
|
</div>
|
</main>
|
</div>
|
</template>
|
|
<script>
|
|
import basecase from "@/api/operate/basecase";
|
export default {
|
|
data() {
|
return {
|
context: "",
|
alarmTime: [],
|
list: [],
|
totalNum: 0,
|
pageSize: 10,
|
currentPage: 1,
|
pickerOptions: {
|
shortcuts: [{
|
text: '最近一周',
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
picker.$emit('pick', [start, end]);
|
}
|
}, {
|
text: '最近一个月',
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
picker.$emit('pick', [start, end]);
|
}
|
}, {
|
text: '最近三个月',
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
picker.$emit('pick', [start, end]);
|
}
|
}]
|
},
|
};
|
},
|
created() {
|
this.setTableData();
|
},
|
methods: {
|
// 设置tableData
|
setTableData() {
|
const { currentPage, pageSize, context } = this;
|
basecase.getWorkOrder({
|
currentPage,
|
pageSize,
|
keyword: context,
|
startTime: this.alarmTime[0],
|
endTime: this.alarmTime[1],
|
}).then((res) => {
|
this.list = res.records;
|
this.totalNum = res.total;
|
});
|
},
|
exportTableData() {
|
const { context } = this;
|
basecase.exportWorkOrder({
|
keyword: context,
|
startTime: this.alarmTime[0],
|
endTime: this.alarmTime[1],
|
}).then((res) => {
|
this.$message.success('操作成功');
|
let time = new Date()
|
let deathdate = time.toLocaleDateString()
|
const blob = new Blob([res.data], {
|
type: "application/vnd.ms-excel;charset=utf-8",
|
});
|
if (window.navigator.msSaveBlob) {
|
window.navigator.msSaveBlob(blob, deathdate + "工单数据" + ".xlsx");
|
} else {
|
const url = window.URL.createObjectURL(blob);
|
const link = document.createElement("a");
|
link.style.display = "none";
|
link.href = url;
|
link.download = deathdate + "工单数据" + ".xlsx";
|
document.body.appendChild(link);
|
link.click();
|
document.body.removeChild(link);
|
}
|
})
|
.catch(err => this.$message.error(err))
|
},
|
handleReset() {
|
this.currentPage = 1;
|
this.pageSize = 10;
|
this.context = "";
|
this.alarmTime = ["", ""];
|
this.setTableData()
|
},
|
// 设置表格斑马纹
|
tableRowClassName({ row, rowIndex }) {
|
if ((rowIndex + 1) % 2 === 0) {
|
return "warning-row";
|
} else {
|
return "success-row";
|
}
|
},
|
fun(val) {
|
return Number(val).toFixed(2);
|
},
|
handleStateChange(e) {
|
this.setTableData();
|
},
|
// 当前页改变触发事件
|
changeCurrentPage(page) {
|
this.currentPage = page;
|
this.setTableData();
|
},
|
// 上一页点击事件
|
handlePrev(page) {
|
this.currentPage = page;
|
this.setTableData();
|
},
|
// 下一页点击事件
|
handleNext(page) {
|
this.currentPage = page;
|
this.setTableData();
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.userList {
|
text-align: left;
|
padding: 10px 20px;
|
// color: #4b9bb7;
|
border: 1px solid #ccc;
|
|
.headerTitle {
|
line-height: 40px;
|
}
|
|
header {
|
//background-color: white;
|
|
.headerContent {
|
padding: 0;
|
display: flex;
|
line-height: 40px;
|
justify-content: space-between;
|
align-items: center;
|
|
.search {
|
display: flex;
|
justify-content: flex-start;
|
|
span {
|
text-align: right;
|
}
|
|
.el-input {
|
flex: 2;
|
color: #1d3f57;
|
|
&::v-deep .el-input__inner {
|
background-color: #fff;
|
//border: 1px solid #17324c;
|
}
|
}
|
}
|
}
|
|
&::v-deep .el-dialog__header,
|
&::v-deep .el-dialog__body {
|
// background-color: #06122c;
|
}
|
|
&::v-deep .el-dialog__header {
|
display: flex;
|
align-items: center;
|
background-color: #fff;
|
padding: 20px;
|
line-height: 60px;
|
}
|
|
&::v-deep .el-dialog__title {
|
color: #4b9bb7;
|
}
|
|
&::v-deep .el-dialog__close {
|
width: 20px;
|
height: 20px;
|
}
|
|
&::v-deep .el-dialog__body {
|
padding: 0;
|
}
|
}
|
}
|
|
main {
|
background-color: #ffffff;
|
margin-top: 20px;
|
padding-bottom: 50px;
|
|
.mainTitle {
|
line-height: 60px;
|
}
|
|
.main-btns {
|
display: flex;
|
justify-content: space-between;
|
// line-height: 60px;
|
padding: 0 20px;
|
|
.el-button {
|
background-color: #2f91ec;
|
//border: 1px solid #17324c;
|
color: #ffffff;
|
}
|
}
|
|
.el-table {
|
// color: #4b9bb7;
|
}
|
|
.tools {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
//padding: 0 20px;
|
|
.funs-sp {
|
border: 1px solid #dcdfe6;
|
}
|
|
.funs {
|
display: flex;
|
|
.funsItem {
|
line-height: 28px;
|
display: flex;
|
align-items: center;
|
border-radius: 4px;
|
font-size: 12px;
|
margin-left: 10px;
|
|
.el-checkbox {
|
width: 80px;
|
padding: 0 10px;
|
}
|
|
&::v-deep .el-input__inner {
|
border: none;
|
// background-color: #09152f;
|
}
|
}
|
}
|
}
|
}
|
</style>
|