123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <div class="nowTime">非工作情况统计</div>
- </el-col>
- <!--列表-->
- <el-table
- :data="list"
- highlight-current-row
- v-loading="listLoading"
- :height="tableHeight"
- style="width: 100%;"
- >
- <el-table-column type="index" width="60"></el-table-column>
- <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
- <el-table-column label="行为">
- <template slot-scope="scope">{{converType(scope.row.type)}}</template>
- </el-table-column>
- <el-table-column prop="time" label="时间" width="180" sortable></el-table-column>
- <el-table-column prop="date" label="日期" width="180" sortable></el-table-column>
- </el-table>
- <!--工具条-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[20 , 50 , 80 , 100]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total"
- style="float:right;"
- ></el-pagination>
- </el-col>
- </section>
- </template>
- <script>
- export default {
- data() {
- return {
- user: JSON.parse(sessionStorage.getItem("user")),
- tableHeight: 0,
- listLoading: false,
- total: 0,
- page: 1,
- size: 20,
- list: []
- };
- },
- methods: {
- //获取异常信息
- getDevianceList() {
- this.listLoading = true;
- this.http.post(
- this.port.time.listDeviance,
- { pageIndex: this.page, pageSize: this.size },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.list = res.data.records;
- this.total = res.data.total;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- //分页
- handleCurrentChange(val) {
- this.page = val;
- this.getDevianceList();
- },
- handleSizeChange(val) {
- this.size = val;
- this.getDevianceList();
- },
- //类型枚举转换
- converType(type) {
- switch (type) {
- case 0:
- return "编程";
- case 1:
- return "查资料";
- case 2:
- return "看文档";
- case 3:
- return "做设计";
- case 4:
- return "美工";
- case 5:
- return "运营";
- case 6:
- return "看小说";
- case 7:
- return "打游戏";
- case 8:
- return "听音乐";
- default:
- return "未知";
- }
- }
- },
- created() {
- let height = window.innerHeight;
- this.tableHeight = height - 195;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 195;
- };
- },
- mounted() {
- this.getDevianceList();
- }
- };
- </script>
- <style lang="scss" scoped>
- .nowTime {
- height: 35px;
- line-height: 28px;
- font-size: 18px;
- color: #333;
- margin-left: 10px;
- i {
- margin-right: 10px;
- }
- }
- </style>
|