From b162e0cc2a3276adfe7b3b40738f97ba5fde8728 Mon Sep 17 00:00:00 2001 From: xiaoheiiskinder <11674173+xiaohei102908@user.noreply.gitee.com> Date: Tue, 26 Sep 2023 11:19:19 +0800 Subject: [PATCH] 0926 --- dist/index.html | 2 +- src/views/boYu/byRoom.vue | 5 +- src/views/userManagement.vue | 304 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 259 insertions(+), 52 deletions(-) diff --git a/dist/index.html b/dist/index.html index b490bac..88b1773 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1 +1 @@ -智慧公寓管理系统
\ No newline at end of file +智慧公寓管理系统
\ No newline at end of file diff --git a/src/views/boYu/byRoom.vue b/src/views/boYu/byRoom.vue index 751da21..ce44625 100644 --- a/src/views/boYu/byRoom.vue +++ b/src/views/boYu/byRoom.vue @@ -260,7 +260,6 @@ export default { // 获取泊寓房源 async getBYRoom() { let content = [] - console.log(this.form) let results = await this.getRoomList(); this.pageTotal = results.total this.tableData = results.list @@ -382,7 +381,7 @@ export default { }, // 添加设备选择房源 checkNodeOne(e) { - if (e.length < 5) { + if (e[0].length < 5) { this.$message.error('请选择房间') } else { this.form.roomId = e[e.length - 1] @@ -406,7 +405,7 @@ export default { code: "by/addDevice", data: { did: this.form.did, - roomId: this.form.roomId + roomId: this.form.roomId[0] } } httpPost(data, this.$api.sendCommand).then(res => { diff --git a/src/views/userManagement.vue b/src/views/userManagement.vue index 30af5ae..07a5c72 100644 --- a/src/views/userManagement.vue +++ b/src/views/userManagement.vue @@ -2627,7 +2627,6 @@ export default { getalllist() { var data = {}; httpGet(data, this.$api.getSiteList).then((res) => { - this.zNodes = JSON.parse(JSON.stringify(res.data.list.list)); var zNodes = JSON.parse(JSON.stringify(res.data.list.list)); var array = utils.uniqueArray(zNodes, "id"); @@ -3082,9 +3081,207 @@ export default { this.SelectedListVoucher = selectRow }, // 绑定房间 + // bindsave() { + // var SelectedListbind = this.bindSelectedList + // var infostr = JSON.parse(this.drawerRow.info); + // var fjid = []; + // var _this = this + // if (this.value2[0] == '' || this.value2[1] == '') { + // this.$message.error("请选择开始结束时间") + // return false; + // } + // if (SelectedListbind.length != 0) { + // SelectedListbind.forEach((li) => { + // var str = { + // cardId: this.drawerRow.id, + // siteId: li, + // startTime: this.value2[0], + // endTime: this.value2[1] + // }; + // var resultArr = this.AboutDevice.filter( + // (_item) => _item.roomId == li + // )[0]; + // var roomName = this.zNodes.filter(item => li === item.id) + // if (resultArr) { + // // console.log(roomName,resultArr, this.drawerRow) + // // return + // if (resultArr.imei) { + // fjid = [str]; + // if (resultArr.manufactureId == 201 || resultArr.manufactureId == 221) { + // var data = { + // lockerId: resultArr.deviceNum, + // imei: resultArr.imei, + // lockerUserId: infostr.userPassword, + // keyId: infostr.userPassword, + // role: 0, + // action: 1, + // order: 6226, + // cardName: this.drawerRow.name, + // roomName: roomName[0].name + // }; + // ICINLocker.addUserToLock(data.lockerId, data.imei, data + // .lockerUserId, data.role, data.action, data.order, data.cardName, data + // .roomName, ( + // callback) => { + // if (callback.success) { + // var locakUserdata = { + // deviceNum: resultArr.deviceNum, + // imei: resultArr.imei, + // cardId: this.drawerRow.id, + // content: JSON.stringify( + // data + // ), //operateMode:NFC-10、把人员添加到凭证-1 + // type: 26, + // serial: callback.data.serialNumber, + // startTime: moment(this.value2[0]).valueOf() / 1000, + // endTime: moment(this.value2[1]).valueOf() / 1000, + // } + // utils.sendLockUser(locakUserdata, (callbackLOCK) => { + + // }) + + // } else { + // this.$message.error(callback.msg); + // if (callback.code == 201016) { + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getcheckInList() + // this.getAboutRoom(); + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // this.$message.success("用户门锁已存在") + // } else { + // this.$message.error("添加失败") + // } + // }); + // } + // } + // }) + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getAboutRoom(); + // this.getcheckInList() + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // } else { + // this.$message.error("添加失败") + // } + // }); + // } else if (resultArr.manufactureId == 101) { + // var userstr = { + // imei: resultArr.imei, + // deviceNum: resultArr.deviceNum, + // userTelephone: infostr.userTelephone, + // userPassword: infostr.userPassword, + // password: infostr.userPassword, + // operateMode: 26, + // order: 6226, + // passwordStartTime: this.moment(this.value2[0]).format( + // "YYYYMMDDHHmmss"), + // passwordEndTime: this.moment(this.value2[1]).format("YYYYMMDDHHmmss"), + // is: false, + // cardName: this.drawerRow.name, + // roomName: roomName[0].name + // }; + // ICINLocker.LDAddUser(userstr.deviceNum, userstr.imei, userstr.userTelephone, + // userstr.userPassword, userstr.password, userstr.passwordStartTime, + // userstr.passwordEndTime, userstr.operateMode, userstr.order, userstr + // .cardName, userstr.roomName, false, (callback) => { + // if (callback.success) { + // console.log(_this.value2) + // var locakUserdata = { + // deviceNum: resultArr.deviceNum, + // imei: resultArr.imei, + // cardId: this.drawerRow.id, + // content: JSON.stringify( + // userstr + // ), //operateMode:NFC-10、把人员添加到凭证-1 + // type: 26, + // serial: callback.data.serialNumber, + // startTime: moment(_this.value2[0]).valueOf() / 1000, + // endTime: moment(_this.value2[1]).valueOf() / 1000, + // } + // utils.sendLockUser(locakUserdata, (callbackLOCK) => { + + // }) + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getAboutRoom(); + // this.getcheckInList() + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // } else { + // this.$message.error("添加失败") + // } + // }); + // } else { + // this.$message.error(callback.msg); + // } + // }) + // } else if (resultArr.manufactureId == 1201) { + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getAboutRoom(); + // this.getcheckInList() + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // } else { + // this.$message.error("添加失败") + // } + // }); + // } + // } else { + // fjid.push(str); + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getAboutRoom(); + // this.getcheckInList() + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // } else { + // this.$message.error("添加失败") + // } + // }); + // } + // } else { + // fjid.push(str); + // httpPost(fjid, this.$api.bindCard).then((res) => { + // if (res.success) { + // this.bindRoomStatus = false + // this.getAboutRoom(); + // this.getcheckInList() + // setTimeout(() => { + // this.updateRoom(); + // }, 500); + // } else { + // this.$message.error("添加失败") + // } + // }); + // this.$message.error("该房间未绑定门锁") + // } + // }); + // } else { + // this.$message.error("请选择要添加的房间") + // } + // }, bindsave() { - var SelectedListbind = this.bindSelectedList - var infostr = JSON.parse(this.drawerRow.info); + let SelectedListbind = this.bindSelectedList + let infostr = ''//JSON.parse(this.drawerRow.info); + if (typeof (this.drawerRow.info) == 'object') { + infostr = this.drawerRow.info + } else if (typeof (this.drawerRow.info) == 'string') { + infostr = JSON.parse(this.drawerRow.info) + } var fjid = []; var _this = this if (this.value2[0] == '' || this.value2[1] == '') { @@ -3092,7 +3289,7 @@ export default { return false; } if (SelectedListbind.length != 0) { - SelectedListbind.forEach((li) => { + SelectedListbind.forEach((li, index) => { var str = { cardId: this.drawerRow.id, siteId: li, @@ -3102,12 +3299,13 @@ export default { var resultArr = this.AboutDevice.filter( (_item) => _item.roomId == li )[0]; + console.log(resultArr, SelectedListbind, this.AboutDevice) var roomName = this.zNodes.filter(item => li === item.id) if (resultArr) { // console.log(roomName,resultArr, this.drawerRow) // return if (resultArr.imei) { - fjid = [str]; + fjid.push(str); if (resultArr.manufactureId == 201 || resultArr.manufactureId == 221) { var data = { lockerId: resultArr.deviceNum, @@ -3138,7 +3336,7 @@ export default { endTime: moment(this.value2[1]).valueOf() / 1000, } utils.sendLockUser(locakUserdata, (callbackLOCK) => { - + }) } else { @@ -3160,18 +3358,20 @@ export default { } } }) - httpPost(fjid, this.$api.bindCard).then((res) => { - if (res.success) { - this.bindRoomStatus = false - this.getAboutRoom(); - this.getcheckInList() - setTimeout(() => { - this.updateRoom(); - }, 500); - } else { - this.$message.error("添加失败") - } - }); + if ((SelectedListbind.length - 1) === index) { + httpPost(fjid, this.$api.bindCard).then((res) => { + if (res.success) { + this.bindRoomStatus = false + this.getAboutRoom(); + this.getcheckInList() + setTimeout(() => { + this.updateRoom(); + }, 500); + } else { + this.$message.error("添加失败") + } + }); + } } else if (resultArr.manufactureId == 101) { var userstr = { imei: resultArr.imei, @@ -3209,23 +3409,43 @@ export default { utils.sendLockUser(locakUserdata, (callbackLOCK) => { }) - httpPost(fjid, this.$api.bindCard).then((res) => { - if (res.success) { - this.bindRoomStatus = false - this.getAboutRoom(); - this.getcheckInList() - setTimeout(() => { - this.updateRoom(); - }, 500); - } else { - this.$message.error("添加失败") - } - }); - } else { - this.$message.error(callback.msg); + if ((SelectedListbind.length - 1) === index) { + httpPost(fjid, this.$api.bindCard).then((res) => { + if (res.success) { + this.bindRoomStatus = false + this.getAboutRoom(); + this.getcheckInList() + setTimeout(() => { + this.updateRoom(); + }, 500); + } else { + this.$message.error("添加失败") + } + }); + } else { + this.$message.error(callback.msg); + } } }) } else if (resultArr.manufactureId == 1201) { + if ((SelectedListbind.length - 1) === index) { + httpPost(fjid, this.$api.bindCard).then((res) => { + if (res.success) { + this.bindRoomStatus = false + this.getAboutRoom(); + this.getcheckInList() + setTimeout(() => { + this.updateRoom(); + }, 500); + } else { + this.$message.error("添加失败") + } + }); + } + } + } else { + fjid.push(str); + if ((SelectedListbind.length - 1) === index) { httpPost(fjid, this.$api.bindCard).then((res) => { if (res.success) { this.bindRoomStatus = false @@ -3239,8 +3459,10 @@ export default { } }); } - } else { - fjid.push(str); + } + } else { + fjid.push(str); + if ((SelectedListbind.length - 1) === index) { httpPost(fjid, this.$api.bindCard).then((res) => { if (res.success) { this.bindRoomStatus = false @@ -3254,20 +3476,6 @@ export default { } }); } - } else { - fjid.push(str); - httpPost(fjid, this.$api.bindCard).then((res) => { - if (res.success) { - this.bindRoomStatus = false - this.getAboutRoom(); - this.getcheckInList() - setTimeout(() => { - this.updateRoom(); - }, 500); - } else { - this.$message.error("添加失败") - } - }); this.$message.error("该房间未绑定门锁") } });