SOURCE

<template slot-scope="scope">
    <div v-if="scope.row.state">
        <span v-if="scope.row.state==='0'">关闭</span>
        <span v-else-if="scope.row.state==='1'">打开</span>
        <span v-else>获取失败</span>
    </div>
    <el-button v-else :loading="true"></el-button>
</template>

methods:{
    getTableDate(){
        queryDoorByDoorNo(parma).then(res=>{
            this.tableDate = res.data
            this.id = res.id  //取到设备Id
            this.getLockStatus()   //开锁
        })
    }

    getLockStatus(){
        doorDevStatus({maindecid:this.id}).then(res=>{
         //修改门锁的状态
            this.lockStateList = res.lockStateList
        })
    }   

}

watch:{
    lockStateList:{
        handler(newVal){
            this.$nextTick(()=>{
                for(let i=0;i<this.tabledata.length;i++){
                    this.lockStateList.map(item=>{
                        if(item.subDeviceId ===this.tabledata[i].subDeviceId){
                            this.$set(this.tableData[i],'state',item.state)
                        }

                    })
                }
            })
        }
    },
    deep:true
}
console 命令行工具 X clear

                    
>
console