|
@@ -12,7 +12,7 @@
|
|
|
<scroll-view scroll-y @scrolltolower="scrollGet" class="list">
|
|
|
<view class="list-li" v-for="(item,index) in dataList">
|
|
|
<view class="list-li-l">{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</view>
|
|
|
- <view class="list-li-r" @click="openButton(item)">
|
|
|
+ <view class="list-li-r" @click="laboratoryGreenhouseDoorList(item)">
|
|
|
<view class="null-p"></view>
|
|
|
<view>开门</view>
|
|
|
<view class="null-p"></view>
|
|
@@ -44,7 +44,9 @@
|
|
|
systemSubjectGetAppSubjectByLogin,
|
|
|
laboratoryApplyRemoteOpenLock,
|
|
|
applyRemoteOpenLockConfirm,
|
|
|
- laboratoryLabOpenLockLogUpdateLockData
|
|
|
+ laboratoryLabOpenLockLogUpdateLockData,
|
|
|
+ laboratoryGreenhouseDoorList,
|
|
|
+ laboratoryGreenhouseOpenDoorByDeviceId
|
|
|
} from '@/pages_manage/api/index.js'
|
|
|
export default {
|
|
|
components: {
|
|
@@ -105,7 +107,103 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //开门
|
|
|
+ //查询实验室门锁列表
|
|
|
+ async laboratoryGreenhouseDoorList(item) {
|
|
|
+ let self = this;
|
|
|
+ let obj = {
|
|
|
+ subId: item.subId,
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await laboratoryGreenhouseDoorList(obj);
|
|
|
+ if (data.code == 200) {
|
|
|
+ if(data.data[0]){
|
|
|
+ if(!data.data[1]){
|
|
|
+ //只返回1条数据时
|
|
|
+ if(data.data[0].code == 'hikAccess'){
|
|
|
+ self.laboratoryGreenhouseOpenDoorByDeviceId(data.data[0].id);
|
|
|
+ }else{
|
|
|
+ self.openClick(item)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //返回多条数据时
|
|
|
+ let list = [];
|
|
|
+ for(let i=0;i<data.data.length;i++){
|
|
|
+ list.push(data.data[i].deviceName)
|
|
|
+ }
|
|
|
+ uni.showActionSheet({
|
|
|
+ itemList: list,
|
|
|
+ success: function(res) {
|
|
|
+ if(data.data[res.tapIndex].code == 'hikAccess'){
|
|
|
+ self.laboratoryGreenhouseOpenDoorByDeviceId(data.data[res.tapIndex].id);
|
|
|
+ }else{
|
|
|
+ self.openClick(item)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function(res) {
|
|
|
+ // console.log(res.errMsg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ mask: true,
|
|
|
+ icon: "none",
|
|
|
+ position: "center",
|
|
|
+ title: '未找到实验室门锁,请联系管理员',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //新开门
|
|
|
+ async laboratoryGreenhouseOpenDoorByDeviceId(id){
|
|
|
+ let self = this;
|
|
|
+ let obj = {
|
|
|
+ id: id,
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await laboratoryGreenhouseOpenDoorByDeviceId(obj);
|
|
|
+ if (data.code == 200) {
|
|
|
+ if(data.data){
|
|
|
+ this.$set(this, 'authorizeStatus', 1)
|
|
|
+ this.$set(this, 'successVisible', true)
|
|
|
+ const TIME_COUNT = 5;
|
|
|
+ if (!self.timer) {
|
|
|
+ self.count = TIME_COUNT;
|
|
|
+ self.show = false;
|
|
|
+ self.timer = setInterval(() => {
|
|
|
+ if (self.count > 0 && self.count <= TIME_COUNT) {
|
|
|
+ self.count -= 1;
|
|
|
+ } else {
|
|
|
+ self.successVisible = false;
|
|
|
+ clearInterval(self.timer);
|
|
|
+ self.timer = null;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$set(this, 'authorizeStatus', 2)
|
|
|
+ this.$set(this, 'successVisible', true)
|
|
|
+ const TIME_COUNT = 3;
|
|
|
+ if (!this.timer) {
|
|
|
+ this.count = TIME_COUNT;
|
|
|
+ this.show = false;
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ if (this.count > 0 && this.count <= TIME_COUNT) {
|
|
|
+ this.count -= 1;
|
|
|
+ } else {
|
|
|
+ self.successVisible = false;
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //旧开门(电子信息牌开门)
|
|
|
async openClick(row) {
|
|
|
let self = this;
|
|
|
let obj = {
|