unusual.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <div class="nowTime">非工作情况统计</div>
  6. </el-col>
  7. <!--列表-->
  8. <el-table
  9. :data="list"
  10. highlight-current-row
  11. v-loading="listLoading"
  12. :height="tableHeight"
  13. style="width: 100%;"
  14. >
  15. <el-table-column type="index" width="60"></el-table-column>
  16. <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
  17. <el-table-column label="行为">
  18. <template slot-scope="scope">{{converType(scope.row.type)}}</template>
  19. </el-table-column>
  20. <el-table-column prop="time" label="时间" width="180" sortable></el-table-column>
  21. <el-table-column prop="date" label="日期" width="180" sortable></el-table-column>
  22. </el-table>
  23. <!--工具条-->
  24. <el-col :span="24" class="toolbar">
  25. <el-pagination
  26. @size-change="handleSizeChange"
  27. @current-change="handleCurrentChange"
  28. :page-sizes="[20 , 50 , 80 , 100]"
  29. :page-size="20"
  30. layout="total, sizes, prev, pager, next"
  31. :total="total"
  32. style="float:right;"
  33. ></el-pagination>
  34. </el-col>
  35. </section>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. user: JSON.parse(sessionStorage.getItem("user")),
  42. tableHeight: 0,
  43. listLoading: false,
  44. total: 0,
  45. page: 1,
  46. size: 20,
  47. list: []
  48. };
  49. },
  50. methods: {
  51. //获取异常信息
  52. getDevianceList() {
  53. this.listLoading = true;
  54. this.http.post(
  55. this.port.time.listDeviance,
  56. { pageIndex: this.page, pageSize: this.size },
  57. res => {
  58. this.listLoading = false;
  59. if (res.code == "ok") {
  60. this.list = res.data.records;
  61. this.total = res.data.total;
  62. } else {
  63. this.$message({
  64. message: res.msg,
  65. type: "error"
  66. });
  67. }
  68. },
  69. error => {
  70. this.listLoading = false;
  71. this.$message({
  72. message: error,
  73. type: "error"
  74. });
  75. }
  76. );
  77. },
  78. //分页
  79. handleCurrentChange(val) {
  80. this.page = val;
  81. this.getDevianceList();
  82. },
  83. handleSizeChange(val) {
  84. this.size = val;
  85. this.getDevianceList();
  86. },
  87. //类型枚举转换
  88. converType(type) {
  89. switch (type) {
  90. case 0:
  91. return "编程";
  92. case 1:
  93. return "查资料";
  94. case 2:
  95. return "看文档";
  96. case 3:
  97. return "做设计";
  98. case 4:
  99. return "美工";
  100. case 5:
  101. return "运营";
  102. case 6:
  103. return "看小说";
  104. case 7:
  105. return "打游戏";
  106. case 8:
  107. return "听音乐";
  108. default:
  109. return "未知";
  110. }
  111. }
  112. },
  113. created() {
  114. let height = window.innerHeight;
  115. this.tableHeight = height - 195;
  116. const that = this;
  117. window.onresize = function temp() {
  118. that.tableHeight = window.innerHeight - 195;
  119. };
  120. },
  121. mounted() {
  122. this.getDevianceList();
  123. }
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .nowTime {
  128. height: 35px;
  129. line-height: 28px;
  130. font-size: 18px;
  131. color: #333;
  132. margin-left: 10px;
  133. i {
  134. margin-right: 10px;
  135. }
  136. }
  137. </style>