index.vue 7.2 KB

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