EnterOut.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="EnterOut">
  3. <header class="header">
  4. <el-button-group>
  5. <el-button :type="isLookOut?'primary':''" @click="lookEnter">查看出</el-button>
  6. <el-button :type="isLookOut?'':'primary'" @click="lookOut">查看入</el-button>
  7. </el-button-group>
  8. </header>
  9. <section class="section">
  10. <el-table :data="EnterOutList">
  11. <el-table-column prop="recordInfo.id" label="序号" width="120px"></el-table-column>
  12. <el-table-column prop="deviceInfo.description" label="机器名字"></el-table-column>
  13. <el-table-column prop="useInfo.name" label="出入者"></el-table-column>
  14. <el-table-column prop="useInfo.idCardNum" label="出入者身份证号"></el-table-column>
  15. <el-table-column prop="useInfo.name" label="出入者"></el-table-column>
  16. <el-table-column prop="recordInfo.updated" label="进出时间"></el-table-column>
  17. <el-table-column fixed="right" label="操作" width="200">
  18. <template slot-scope="scope">
  19. <el-button
  20. @click="look(scope.row.useInfo.imgUrl)"
  21. type="text"
  22. size="small"
  23. >查看出入者照片</el-button>
  24. </template>
  25. </el-table-column>
  26. </el-table>
  27. <el-row type="flex" justify="end">
  28. <el-col :span="8" class="pagination">
  29. <el-pagination
  30. @current-change="pageChange"
  31. background
  32. layout="prev, pager, next"
  33. :page-count="5"
  34. ></el-pagination>
  35. </el-col>
  36. </el-row>
  37. <el-dialog title="提示" center :visible.sync="showDialog" width="30%">
  38. <img class="img" :src="userImgUrl" alt="没有照片" />
  39. <span slot="footer">
  40. <el-button @click="showDialog = false">取 消</el-button>
  41. <el-button type="primary" @click="showDialog = false">确 定</el-button>
  42. </span>
  43. </el-dialog>
  44. </section>
  45. </div>
  46. </template>
  47. <script>
  48. import { mapActions } from "vuex";
  49. // 每页数据条数
  50. const pageSize = 10;
  51. // 照片根地址
  52. const userImgUrlBase = "http://121.36.134.218:88/";
  53. export default {
  54. name: "EnterOut",
  55. data() {
  56. return {
  57. EnterOutList: [],
  58. isLookOut: true,
  59. showDialog: true,
  60. userImgUrl: "",
  61. pageSize,
  62. page: 1
  63. };
  64. },
  65. created() {
  66. this.getEnterOutList();
  67. },
  68. methods: {
  69. ...mapActions(["fetch"]),
  70. getEnterOutList() {
  71. let api = this.isLookOut
  72. ? "/analyse/uface/out"
  73. : "/analyse/uface/in";
  74. let data = {
  75. pageSize: this.pageSize,
  76. page: this.page
  77. };
  78. this.fetch({
  79. api,
  80. method: "GET",
  81. data,
  82. success: res => {
  83. console.log(res);
  84. this.EnterOutList = res;
  85. },
  86. fail: err => {
  87. console.log(err);
  88. if (err.errMsg) this.$message.error(err.errMsg);
  89. else this.$message.error("服务器发生异常");
  90. }
  91. });
  92. },
  93. // 页码改变
  94. pageChange(p) {
  95. console.log(p);
  96. this.page = p;
  97. // this.getEnterOutList();
  98. },
  99. // 点击 查看出
  100. lookOut() {
  101. this.isLookOut = false;
  102. // this.getEnterOutList();
  103. },
  104. // 点击 查看入
  105. lookEnter() {
  106. this.isLookOut = true;
  107. // this.getEnterOutList();
  108. },
  109. // 查看出入者照片
  110. look(imgUrl) {
  111. console.log(imgUrl);
  112. this.userImgUrl = userImgUrlBase + imgUrl;
  113. this.showDialog = true;
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .EnterOut {
  120. .header {
  121. margin-bottom: 10px;
  122. }
  123. .section {
  124. img {
  125. width: 100%;
  126. }
  127. }
  128. }
  129. .pagination {
  130. margin-top: 20px;
  131. }
  132. </style>