remoteOpen.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!-- 远程开门 -->
  2. <template>
  3. <view id="empowerOpen">
  4. <view class="page-one" v-if="pageType==1">
  5. <view class="header">
  6. <view class="header-n">
  7. <input class="header-l" type="text" @change="subNameChange()" v-model="getData.searchValue" placeholder="实验室名称">
  8. <view class="header-r" v-if="getData.searchValue" @click="clearSearch()" >
  9. <img src="@/pages/images/clear.png" />
  10. </view>
  11. </view>
  12. </view>
  13. <view class="list">
  14. <view class="list-li" v-for="(item,index) in dataList">
  15. <view class="list-li-l">{{item.subName}}({{item.roomNum}})</view>
  16. <view class="list-li-r" @click="openClick(item)">开门</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="success" v-if="successVisible">
  21. <view class="null-box" @click="closeTip()"></view>
  22. <view class="panel">
  23. <img class="panel-t" v-if="authorizeStatus==1" src="@/pages/images/icon_kcxq_cg.png" />
  24. <img class="panel-t" v-if="authorizeStatus==2" src="@/pages/images/icon_kcxq_sb.png" />
  25. <view class="panel-m">{{authorizeStatus==1?'开门成功':'开门失败'}}</view>
  26. <view class="panel-b">({{count}}S)</view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. config
  34. } from '@/api/request/config.js'
  35. import {
  36. systemSubjectGetAppSubject,
  37. laboratoryApplyRemoteOpenLock,
  38. } from '@/pages_manage/api/index.js'
  39. export default {
  40. components: {
  41. },
  42. data() {
  43. return {
  44. pageType: 1,
  45. baseUrl: config.base_url,
  46. getData: {
  47. searchValue: '',
  48. adminId: uni.getStorageSync('userId'),
  49. },
  50. newData: {
  51. },
  52. addForm:{
  53. },
  54. dataList:[],
  55. authorizeStatus:2,//1成功 2失败
  56. successVisible: false,
  57. timer: null,
  58. count: '',
  59. }
  60. },
  61. onLoad(option) {
  62. },
  63. onShow() {
  64. },
  65. mounted() {
  66. this.systemSubjectGetAppSubject();
  67. },
  68. methods: {
  69. //开门
  70. async openClick(row){
  71. let self = this;
  72. let obj={
  73. labId:row.subId,
  74. }
  75. const {
  76. data
  77. } = await laboratoryApplyRemoteOpenLock(obj);
  78. if (data.code == 200) {
  79. this.$set(this, 'authorizeStatus', 1)
  80. this.$set(this, 'successVisible', true)
  81. this.getCode();
  82. }else{
  83. this.$set(this, 'authorizeStatus', 2)
  84. this.$set(this, 'successVisible', true)
  85. this.getCode();
  86. }
  87. },
  88. //获取实验室
  89. async systemSubjectGetAppSubject() {
  90. let self = this;
  91. const {
  92. data
  93. } = await systemSubjectGetAppSubject(this.getData);
  94. if (data.code == 200) {
  95. this.dataList = data.data;
  96. }
  97. },
  98. //实验室搜索
  99. subNameChange() {
  100. this.systemSubjectGetAppSubject();
  101. },
  102. //实验室搜索框清除
  103. clearSearch(){
  104. this.getData.searchValue='';
  105. this.systemSubjectGetAppSubject();
  106. },
  107. cancelClick(){
  108. },
  109. submitForm(){
  110. this.$set(this,'successVisible',true)
  111. this.getCode();
  112. },
  113. //关闭弹框倒计时
  114. getCode() {
  115. let self=this;
  116. const TIME_COUNT = 3;
  117. if (!this.timer) {
  118. this.count = TIME_COUNT;
  119. this.show = false;
  120. this.timer = setInterval(() => {
  121. if (this.count > 0 && this.count <= TIME_COUNT) {
  122. this.count -= 1;
  123. } else {
  124. self.successVisible=false;
  125. clearInterval(this.timer);
  126. this.timer = null;
  127. }
  128. }, 1000);
  129. }
  130. },
  131. closeTip() {
  132. this.$set(this, 'successVisible', false)
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang="stylus" scoped>
  138. #empowerOpen {
  139. .page-one {
  140. .header {
  141. width: 749rpx;
  142. height: 120rpx;
  143. background: #FFFFFF;
  144. padding: 20rpx 30rpx;
  145. box-sizing: border-box;
  146. border-bottom: 1rpx solid #D8D8D8;
  147. .header-n{
  148. position: relative;
  149. width: 690rpx;
  150. height: 80rpx;
  151. border-radius: 10rpx 10rpx 10rpx 10rpx;
  152. border: 1rpx solid #E0E0E0;
  153. padding-left: 20rpx;
  154. box-sizing: border-box;
  155. .header-l {
  156. width: 590rpx;
  157. height: 80rpx;
  158. }
  159. .header-r{
  160. position: absolute;
  161. top: 0rpx;
  162. right: 0rpx;
  163. width: 68rpx;
  164. height: 80rpx;
  165. >img{
  166. width: 24rpx;
  167. height: 24rpx;
  168. margin-top: 24rpx;
  169. margin-left: 24rpx;
  170. }
  171. }
  172. }
  173. }
  174. .list {
  175. padding: 0 30rpx;
  176. box-sizing: border-box;
  177. background: #fff;
  178. .list-li {
  179. height: 90rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. border-bottom: 1rpx solid #D8D8D8;
  184. .list-li-l {
  185. flex: 1;
  186. font-family: PingFang SC, PingFang SC;
  187. font-weight: 400;
  188. font-size: 30rpx;
  189. color: #333333;
  190. line-height: 42rpx;
  191. }
  192. .list-li-r {
  193. font-family: PingFang SC, PingFang SC;
  194. font-weight: 400;
  195. font-size: 28rpx;
  196. color: #0183FA;
  197. line-height: 39rpx;
  198. }
  199. }
  200. .list-li:last-child{
  201. border-bottom: none;
  202. }
  203. }
  204. }
  205. .success {
  206. height: 100%;
  207. width: 100%;
  208. position: fixed;
  209. top: 0;
  210. display: flex;
  211. flex-direction: column;
  212. z-index: 10;
  213. background: rgba(0, 0, 0, 0.2);
  214. .null-box {
  215. flex: 1;
  216. }
  217. .panel {
  218. width: 550rpx;
  219. height: 255rpx;
  220. background: #FFFFFF;
  221. border-radius: 20rpx 20rpx 20rpx 20rpx;
  222. position: absolute;
  223. top: 320rpx;
  224. left: 100rpx;
  225. display: flex;
  226. flex-direction: column;
  227. align-items: center;
  228. .panel-t{
  229. width: 80rpx;
  230. height: 80rpx;
  231. margin: 40rpx 0 18rpx 0;
  232. }
  233. .panel-m{
  234. font-family: PingFang SC, PingFang SC;
  235. font-weight: 400;
  236. font-size: 30rpx;
  237. color: #3D3D3D;
  238. line-height: 42rpx;
  239. margin-bottom: 8rpx;
  240. }
  241. .panel-b{
  242. font-family: PingFang SC, PingFang SC;
  243. font-weight: 400;
  244. font-size: 30rpx;
  245. color: #999999;
  246. line-height: 42rpx;
  247. }
  248. }
  249. }
  250. }
  251. </style>