statistics.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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="120"></el-table-column>
  34. <el-table-column prop="statistics[0]" label="编程" sortable></el-table-column>
  35. <el-table-column prop="statistics[1]" label="上网" sortable></el-table-column>
  36. <el-table-column prop="statistics[5]" label="文档" sortable></el-table-column>
  37. <el-table-column prop="statistics[3]" label="设计" sortable></el-table-column>
  38. <!-- <el-table-column prop="statistics[4]" label="运营" sortable></el-table-column> -->
  39. <el-table-column prop="statistics[5]" label="娱乐" sortable></el-table-column>
  40. <el-table-column prop="statistics[6]" label="其他" sortable></el-table-column>
  41. <el-table-column prop="sum" label="总时长" sortable></el-table-column>
  42. </el-table>
  43. <!--工具条-->
  44. <el-col :span="24" class="toolbar">
  45. <el-pagination
  46. @size-change="handleSizeChange"
  47. @current-change="handleCurrentChange"
  48. :page-sizes="[20 , 50 , 80 , 100]"
  49. :page-size="20"
  50. layout="total, sizes, prev, pager, next"
  51. :total="total"
  52. style="float:right;"
  53. ></el-pagination>
  54. </el-col>
  55. <!--新增界面-->
  56. <el-dialog
  57. title="异常申请列表"
  58. v-if="addFormVisible"
  59. :visible.sync="addFormVisible"
  60. :close-on-click-modal="false"
  61. customClass="customWidth"
  62. >
  63. <el-table
  64. :data="list"
  65. highlight-current-row
  66. v-loading="listLoading"
  67. height="400"
  68. style="width: 100%;"
  69. >
  70. <el-table-column type="index" width="60"></el-table-column>
  71. <el-table-column prop="projectName" label="姓名" width="140" sortable></el-table-column>
  72. <el-table-column prop="indate" label="工作时长" width="100" sortable></el-table-column>
  73. <el-table-column prop="indate" label="异常原因" width="180" sortable></el-table-column>
  74. <el-table-column prop="indate" label="时间" sortable></el-table-column>
  75. </el-table>
  76. <div slot="footer" class="dialog-footer">
  77. <el-button @click.native="addFormVisible = false">取消</el-button>
  78. </div>
  79. </el-dialog>
  80. </section>
  81. </template>
  82. <script>
  83. import util from "../../common/js/util";
  84. export default {
  85. data() {
  86. return {
  87. user: JSON.parse(sessionStorage.getItem("user")),
  88. date: null,
  89. tableHeight: 0,
  90. listLoading: false,
  91. total: 0,
  92. page: 1,
  93. size: 20,
  94. list: [],
  95. addFormVisible: false,
  96. addLoading: false
  97. };
  98. },
  99. methods: {
  100. //分页
  101. handleCurrentChange(val) {
  102. this.page = val;
  103. this.getList();
  104. },
  105. handleSizeChange(val) {
  106. this.size = val;
  107. this.getList();
  108. },
  109. //获取统计列表
  110. getList() {
  111. this.listLoading = true;
  112. this.http.post(
  113. this.port.time.listStatistics,
  114. {
  115. date: this.date
  116. },
  117. res => {
  118. this.listLoading = false;
  119. if (res.code == "ok") {
  120. this.list = res.data;
  121. } else {
  122. this.$message({
  123. message: res.msg,
  124. type: "error"
  125. });
  126. }
  127. },
  128. error => {
  129. this.listLoading = false;
  130. this.$message({
  131. message: error,
  132. type: "error"
  133. });
  134. }
  135. );
  136. },
  137. //显示新增界面
  138. handleAdd() {
  139. this.getUnusual();
  140. this.addFormVisible = true;
  141. },
  142. //获取异常列表
  143. getUnusual() {}
  144. },
  145. created() {
  146. let height = window.innerHeight;
  147. this.tableHeight = height - 195;
  148. const that = this;
  149. window.onresize = function temp() {
  150. that.tableHeight = window.innerHeight - 195;
  151. };
  152. },
  153. mounted() {
  154. //第一次处理时间
  155. let tempDate = new Date();
  156. this.date =
  157. tempDate.getFullYear() +
  158. "-" +
  159. (tempDate.getMonth() + 1) +
  160. "-" +
  161. tempDate.getDate();
  162. this.getList();
  163. }
  164. };
  165. </script>
  166. <style lang="scss" scoped>
  167. </style>