|
@@ -111,7 +111,7 @@
|
|
|
<div class="item-box">
|
|
|
<el-form-item label="开门方式:" label-width="100px"
|
|
|
:prop="'cabinetDoorModelList.'+ index +'.unlockingMethod'" :rules="rules.unlockingMethod">
|
|
|
- <el-select v-model="item.unlockingMethod" placeholder="请选择开门方式" @change="unlockingMethodChange(item)" style="width: 460px">
|
|
|
+ <el-select v-model="item.unlockingMethod" placeholder="请选择开门方式" @change="unlockingMethodChange(index)" style="width: 460px">
|
|
|
<el-option
|
|
|
v-for="item in openOptions"
|
|
|
:key="item.value"
|
|
@@ -124,7 +124,7 @@
|
|
|
<div class="item-box" v-if="item.unlockingMethod == 2">
|
|
|
<el-form-item label="智能锁:" label-width="100px"
|
|
|
:prop="'cabinetDoorModelList.'+ index +'.cabinetLockList'" :rules="rules.cabinetLockList">
|
|
|
- <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="lockChange(item)" :multiple-limit='2' style="width: 460px">
|
|
|
+ <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="(val)=>lockChange(index,val)" :multiple-limit='2' style="width: 460px">
|
|
|
<el-option
|
|
|
v-for="item in lockOptions"
|
|
|
:key="item.lockId"
|
|
@@ -138,7 +138,7 @@
|
|
|
<div class="item-box" v-if="item.unlockingMethod == 3" style="display: flex;">
|
|
|
<el-form-item label="钥匙柜:" label-width="100px"
|
|
|
:prop="'cabinetDoorModelList.'+ index +'.cabinetLockList'" :rules="rules.cabinetLockList">
|
|
|
- <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="cabinetLockChange(item)" :multiple-limit='1' style="width: 180px">
|
|
|
+ <el-select v-model="item.cabinetLockList" multiple placeholder="请选择" @change="(val)=>cabinetLockChange(index,val)" :multiple-limit='1' style="width: 180px">
|
|
|
<el-option
|
|
|
v-for="item in keyCabinetOptions"
|
|
|
:key="item.lockId"
|
|
@@ -200,7 +200,7 @@
|
|
|
openOptions:[
|
|
|
{label:'无锁',value:'1'},
|
|
|
{label:'智能锁',value:'2'},
|
|
|
- {label:'钥匙柜',value:'3'},
|
|
|
+ // {label:'钥匙柜',value:'3'},
|
|
|
],
|
|
|
lockOptions:[],
|
|
|
keyCabinetOptions:[
|
|
@@ -410,6 +410,13 @@
|
|
|
},
|
|
|
//学院选中
|
|
|
deptChange(){
|
|
|
+ this.$set(this.newData,'subId','');
|
|
|
+ this.$set(this,'userOptions',[]);
|
|
|
+ this.newData.cabinetDoorModelList.forEach((item)=>{
|
|
|
+ item.cabinetLockList = [];
|
|
|
+ item.cabinetLockListArr = [];
|
|
|
+ item.cabinetAdminModelList = [];
|
|
|
+ })
|
|
|
for (let i=0;i<this.deptOptions.length;i++){
|
|
|
if (this.newData.deptId==this.deptOptions[i].deptId){
|
|
|
this.$set(this.newData, 'deptName', this.deptOptions[i].deptName)
|
|
@@ -430,6 +437,11 @@
|
|
|
},
|
|
|
//实验室选中
|
|
|
subChange(){
|
|
|
+ this.newData.cabinetDoorModelList.forEach((item)=>{
|
|
|
+ item.cabinetLockList = [];
|
|
|
+ item.cabinetLockListArr = [];
|
|
|
+ item.cabinetAdminModelList = [];
|
|
|
+ })
|
|
|
this.adminAndSafeFun();
|
|
|
this.iotDeviceFindByType(this.newData.subId);
|
|
|
},
|
|
@@ -497,45 +509,53 @@
|
|
|
}
|
|
|
},
|
|
|
//开门方式切换
|
|
|
- unlockingMethodChange(data){
|
|
|
- data.cabinetLockList=[];
|
|
|
+ unlockingMethodChange(index){
|
|
|
+ this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockList',[]);
|
|
|
+ this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',[]);
|
|
|
},
|
|
|
//查询智能锁列表
|
|
|
iotDeviceFindByType(subId){
|
|
|
iotDeviceFindByType({subjectId:subId,typeKeyList:['cabinetLock']}).then(response => {
|
|
|
- if (response.data[0]){
|
|
|
- let list=[];
|
|
|
- response.data.forEach(function(item) {
|
|
|
- list.push({lockName:item.deviceName,lockId:item.id,lockNum:item.deviceNo})
|
|
|
- })
|
|
|
- this.$set(this, 'lockOptions', list)
|
|
|
- }
|
|
|
+ let list=[];
|
|
|
+ response.data.forEach(function(item) {
|
|
|
+ list.push({lockName:item.deviceName,lockId:item.id,lockNum:item.deviceNo})
|
|
|
+ })
|
|
|
+ this.$set(this, 'lockOptions', list)
|
|
|
});
|
|
|
},
|
|
|
//智能锁选中触发
|
|
|
- lockChange(data){
|
|
|
- let list=[];//智能锁临时存储
|
|
|
- for (let i=0;i<data.cabinetLockList.length;i++){
|
|
|
- for (let b=0;b<this.lockOptions.length;b++){
|
|
|
- if (data.cabinetLockList[i]==this.lockOptions[b].lockId){
|
|
|
- list.push({lockName:this.lockOptions[b].lockName,lockId:this.lockOptions[b].lockId,lockNum:this.lockOptions[b].lockNum})
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- data.cabinetLockListArr=list;
|
|
|
- this.$forceUpdate()
|
|
|
+ lockChange(index,val){
|
|
|
+ let self = this;
|
|
|
+ let list=[];
|
|
|
+ val.forEach((item)=>{
|
|
|
+ self.lockOptions.forEach((minItem)=>{
|
|
|
+ if(item == minItem.lockId){
|
|
|
+ list.push({
|
|
|
+ lockName:minItem.lockName,
|
|
|
+ lockId:minItem.lockId,
|
|
|
+ lockNum:minItem.lockNum
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',list);
|
|
|
},
|
|
|
//钥匙柜选中触发
|
|
|
- cabinetLockChange(data){
|
|
|
- let list=[];//钥匙柜临时存储
|
|
|
- for (let i=0;i<data.cabinetLockList.length;i++){
|
|
|
- for (let b=0;b<this.keyCabinetOptions.length;b++){
|
|
|
- if (data.cabinetLockList[i]==this.keyCabinetOptions[b].lockId){
|
|
|
- list.push({lockName:this.keyCabinetOptions[b].lockName,lockId:this.keyCabinetOptions[b].lockId,lockNum:this.keyCabinetOptions[b].lockNum})
|
|
|
+ cabinetLockChange(index,val){
|
|
|
+ let self = this;
|
|
|
+ let list=[];
|
|
|
+ val.forEach((item)=>{
|
|
|
+ self.keyCabinetOptions.forEach((minItem)=>{
|
|
|
+ if(item == minItem.lockId){
|
|
|
+ list.push({
|
|
|
+ lockName:minItem.lockName,
|
|
|
+ lockId:minItem.lockId,
|
|
|
+ lockNum:minItem.lockNum
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- data.cabinetLockListArr=list;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.$set(this.newData.cabinetDoorModelList[index],'cabinetLockListArr',list);
|
|
|
},
|
|
|
|
|
|
//添加柜门
|