OpenDoor.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content">
  6. <div class="vongi-opendoor">
  7. <div class="flew-items">
  8. <div class="mui-col-xs-3">
  9. <div class="vongi-opendoor-img">
  10. <img :src="person_data.faceImageUrl" />
  11. </div>
  12. {{person_popedom.personRoleName}}
  13. </div>
  14. <div class="mui-col-xs-9 mui-media-body">
  15. {{person_popedom.companyName}}
  16. <h5 v-text="person_popedom.deptName"></h5>
  17. </div>
  18. </div>
  19. <div class="vongi-yuan vongi-yuan1"></div>
  20. <div class="vongi-yuan vongi-yuan2"></div>
  21. </div>
  22. <div class="vongi-opendoor-bottom">
  23. <div v-for="(item,index) in doorList" class="flew-sp">
  24. {{item.name}}
  25. <button :disabled="!item.isOnline" class="mui-btn mui-btn-primary" @click="open(item.id)">开门</button>
  26. </div>
  27. </div>
  28. </div>
  29. <loading :visible="isLoading"></loading>
  30. </div>
  31. </template>
  32. <script>
  33. import * as API_Device from '@/apis/Common/device'
  34. import Common from '$project/components/Common.vue'
  35. import Loading from '$project/components/Loading.vue'
  36. import TopHeader from '$project/components/TopHeader.vue'
  37. import {
  38. mapGetters,
  39. mapMutations
  40. } from 'vuex'
  41. export default {
  42. name: 'CommonDeviceOpenDoor',
  43. components: {
  44. Common,
  45. Loading,
  46. TopHeader
  47. },
  48. data() {
  49. return {
  50. pageTitle: '手机开门',
  51. doorList: [],
  52. isLoading: false,
  53. onNum: 0,
  54. offNum: 0,
  55. }
  56. },
  57. created() {},
  58. methods: {
  59. //获取列表
  60. getDoorList() {
  61. this.isLoading = true;
  62. API_Device.getDoorList().then(response => {
  63. this.isLoading = false;
  64. this.doorList = response;
  65. }).catch(error => {
  66. this.isLoading = false;
  67. mui.toast(error);
  68. })
  69. },
  70. //开门
  71. open(id) {
  72. var _this = this;
  73. var btnArray = ['否', '是'];
  74. mui.confirm('确认开门?', '提示', btnArray, function(e) {
  75. if (e.index == 1) {
  76. _this.openDoor(id);
  77. }
  78. })
  79. },
  80. //开门操作
  81. openDoor(id) {
  82. this.isLoading = true;
  83. API_Device.openDoor(id).then(response => {
  84. this.isLoading = false;
  85. mui.toast('开门成功');
  86. }).catch(error => {
  87. this.isLoading = false;
  88. mui.toast(error);
  89. })
  90. },
  91. asynCallBack() {
  92. },
  93. },
  94. mounted() {
  95. //获取列表
  96. this.getDoorList();
  97. },
  98. destroyed() {},
  99. computed: {
  100. ...mapGetters({
  101. openId: 'wx_openid',
  102. token: 'token',
  103. person_data: 'person_data',
  104. person_popedom: 'person_popedom',
  105. })
  106. }
  107. }
  108. </script>
  109. <style scoped src="$project/assets/css/xpgj.css"></style>
  110. <style scoped>
  111. </style>