unusual.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <div class="nowTime">{{ $t('feiGongZuoQingKuangTongJi') }}</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="$t('lable.name')" width="140" sortable></el-table-column>
  17. <el-table-column :label="$t('hangWei')">
  18. <template slot-scope="scope">{{converType(scope.row.type+1)}}</template>
  19. </el-table-column>
  20. <el-table-column :label="$t('tuPian')" width="200">
  21. <template slot-scope="scope">
  22. <el-image :src="scope.row.picUrl" :preview-src-list="getSrcList(index)">
  23. <div slot="error" class="image-slot">
  24. <el-image :src="require('../../assets/image/noPic.png')" class="image"></el-image>
  25. </div>
  26. </el-image>
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="time" :label="$t('time.times')" width="140" sortable></el-table-column>
  30. <el-table-column prop="date" :label="$t('weekDay.date')" width="140" sortable></el-table-column>
  31. </el-table>
  32. <!--工具条-->
  33. <el-col :span="24" class="toolbar">
  34. <el-pagination
  35. @size-change="handleSizeChange"
  36. @current-change="handleCurrentChange"
  37. :page-sizes="[20 , 50 , 80 , 100]"
  38. :page-size="20"
  39. layout="total, sizes, prev, pager, next"
  40. :total="total"
  41. style="float:right;"
  42. ></el-pagination>
  43. </el-col>
  44. </section>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. user: JSON.parse(sessionStorage.getItem("user")),
  51. tableHeight: 0,
  52. listLoading: false,
  53. total: 0,
  54. page: 1,
  55. size: 20,
  56. list: [],
  57. srcList: [],
  58. };
  59. },
  60. methods: {
  61. //获取异常信息
  62. getDevianceList() {
  63. this.listLoading = true;
  64. this.http.post(
  65. this.port.time.listDeviance,
  66. { pageIndex: this.page, pageSize: this.size },
  67. res => {
  68. this.listLoading = false;
  69. if (res.code == "ok") {
  70. this.list = res.data.records;
  71. this.srcList = [];
  72. for(var i in this.list) {
  73. this.srcList.push(this.list[i].picUrl)
  74. }
  75. this.total = res.data.total;
  76. } else {
  77. this.$message({
  78. message: res.msg,
  79. type: "error"
  80. });
  81. }
  82. },
  83. error => {
  84. this.listLoading = false;
  85. this.$message({
  86. message: error,
  87. type: "error"
  88. });
  89. }
  90. );
  91. },
  92. //分页
  93. handleCurrentChange(val) {
  94. this.page = val;
  95. this.getDevianceList();
  96. },
  97. handleSizeChange(val) {
  98. this.size = val;
  99. this.getDevianceList();
  100. },
  101. //类型枚举转换
  102. converType(type) {
  103. switch (type) {
  104. case 0:
  105. return this.$t('qiTaGongZuo');
  106. case 1:
  107. return this.$t('yanFa');
  108. case 2:
  109. return this.$t('shangWang');
  110. case 3:
  111. return this.$t('wenDang');
  112. case 4:
  113. return this.$t('sheJi');
  114. case 5:
  115. return this.$t('meiGong');
  116. case 6:
  117. return this.$t('yunYing');
  118. case 7:
  119. return this.$t('kanXiaoShuo');
  120. case 8:
  121. return this.$t('yingShiYuLe');
  122. case 9:
  123. return this.$t('tingYinLe');
  124. default:
  125. return this.$t('weiZhi');
  126. }
  127. },
  128. getSrcList(index) {
  129. return this.srcList.slice(index).concat(this.srcList.slice(0, index));
  130. },
  131. },
  132. created() {
  133. let height = window.innerHeight;
  134. this.tableHeight = height - 195;
  135. const that = this;
  136. window.onresize = function temp() {
  137. that.tableHeight = window.innerHeight - 195;
  138. };
  139. },
  140. mounted() {
  141. this.getDevianceList();
  142. }
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. .nowTime {
  147. height: 35px;
  148. line-height: 28px;
  149. font-size: 18px;
  150. color: #333;
  151. margin-left: 10px;
  152. i {
  153. margin-right: 10px;
  154. }
  155. }
  156. </style>