statistics.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item>
  7. <el-date-picker
  8. v-model="date"
  9. :editable="false"
  10. format="yyyy-MM-dd"
  11. value-format="yyyy-MM-dd"
  12. @change="getList"
  13. :clearable="false"
  14. type="date"
  15. placeholder="选择日期"
  16. ></el-date-picker>
  17. </el-form-item>
  18. <!-- <el-form-item style="float:right;">
  19. <el-link type="primary" :underline="false" @click="handleAdd">异常申请</el-link>
  20. </el-form-item> -->
  21. </el-form>
  22. </el-col>
  23. <!--列表-->
  24. <el-table
  25. :data="list"
  26. highlight-current-row
  27. v-loading="listLoading"
  28. :height="tableHeight"
  29. style="width: 100%;"
  30. >
  31. <el-table-column type="index" width="60"></el-table-column>
  32. <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
  33. <el-table-column prop="phone" label="手机" width="180"></el-table-column>
  34. <!-- 这里数胡乱写进去的 后续需要重新约定数字代表的意义 -->
  35. <el-table-column prop="statistics[0]" label="编程"></el-table-column>
  36. <el-table-column prop="statistics[1]" label="设计" sortable></el-table-column>
  37. <el-table-column prop="statistics[2]" label="办公" sortable></el-table-column>
  38. <el-table-column prop="statistics[3]" label="娱乐" sortable></el-table-column>
  39. <el-table-column prop="statistics[4]" label="浏览" sortable></el-table-column>
  40. <el-table-column prop="sum" label="总时长" width="180" sortable></el-table-column>
  41. </el-table>
  42. <!--工具条-->
  43. <el-col :span="24" class="toolbar">
  44. <el-pagination
  45. @size-change="handleSizeChange"
  46. @current-change="handleCurrentChange"
  47. :page-sizes="[20 , 50 , 80 , 100]"
  48. :page-size="20"
  49. layout="total, sizes, prev, pager, next"
  50. :total="total"
  51. style="float:right;"
  52. ></el-pagination>
  53. </el-col>
  54. <!--新增界面-->
  55. <el-dialog
  56. title="异常申请列表"
  57. v-if="addFormVisible"
  58. :visible.sync="addFormVisible"
  59. :close-on-click-modal="false"
  60. customClass="customWidth"
  61. >
  62. <el-table
  63. :data="list"
  64. highlight-current-row
  65. v-loading="listLoading"
  66. height="400"
  67. style="width: 100%;"
  68. >
  69. <el-table-column type="index" width="60"></el-table-column>
  70. <el-table-column prop="projectName" label="姓名" width="140" sortable></el-table-column>
  71. <el-table-column prop="indate" label="工作时长" width="100" sortable></el-table-column>
  72. <el-table-column prop="indate" label="异常原因" width="180" sortable></el-table-column>
  73. <el-table-column prop="indate" label="时间" sortable></el-table-column>
  74. </el-table>
  75. <div slot="footer" class="dialog-footer">
  76. <el-button @click.native="addFormVisible = false">取消</el-button>
  77. </div>
  78. </el-dialog>
  79. </section>
  80. </template>
  81. <script>
  82. import util from "../../common/js/util";
  83. export default {
  84. data() {
  85. return {
  86. user: JSON.parse(sessionStorage.getItem("user")),
  87. date: null,
  88. tableHeight: 0,
  89. listLoading: false,
  90. total: 0,
  91. page: 1,
  92. size: 20,
  93. list: [],
  94. addFormVisible: false,
  95. addLoading: false
  96. };
  97. },
  98. methods: {
  99. //分页
  100. handleCurrentChange(val) {
  101. this.page = val;
  102. this.getList();
  103. },
  104. handleSizeChange(val) {
  105. this.size = val;
  106. this.getList();
  107. },
  108. //获取统计列表
  109. getList() {
  110. this.listLoading = true;
  111. this.http.post(
  112. this.port.time.listStatistics,
  113. {
  114. date: this.date
  115. },
  116. res => {
  117. this.listLoading = false;
  118. if (res.code == "ok") {
  119. this.list = res.data;
  120. } else {
  121. this.$message({
  122. message: res.msg,
  123. type: "error"
  124. });
  125. }
  126. },
  127. error => {
  128. this.listLoading = false;
  129. this.$message({
  130. message: error,
  131. type: "error"
  132. });
  133. }
  134. );
  135. },
  136. //显示新增界面
  137. handleAdd() {
  138. this.getUnusual();
  139. this.addFormVisible = true;
  140. },
  141. //获取异常列表
  142. getUnusual() {}
  143. },
  144. created() {
  145. let height = window.innerHeight;
  146. this.tableHeight = height - 195;
  147. const that = this;
  148. window.onresize = function temp() {
  149. that.tableHeight = window.innerHeight - 195;
  150. };
  151. },
  152. mounted() {
  153. //第一次处理时间
  154. let tempDate = new Date();
  155. this.date =
  156. tempDate.getFullYear() +
  157. "-" +
  158. (tempDate.getMonth() + 1) +
  159. "-" +
  160. tempDate.getDate();
  161. this.getList();
  162. }
  163. };
  164. </script>
  165. <style lang="scss" scoped>
  166. </style>