diff --git a/src/views/basic/invWarehouse.vue b/src/views/basic/invWarehouse.vue index f5123b7..1c1019e 100644 --- a/src/views/basic/invWarehouse.vue +++ b/src/views/basic/invWarehouse.vue @@ -825,18 +825,21 @@ export default { } else { this.userFormVisible = true; getHospitalUserList().then((res) => { - this.selectUserList = this.userData; + this.selectUserList = []; this.userList = res.data; - this.userData.forEach(data => { - this.userList.forEach(user => { - if (user.id == data.userid) { - this.$refs.checkUserList.toggleRowSelection(user, true); - console.log(this.$refs.checkUserList) - } else { - this.$refs.checkUserList.toggleRowSelection(user, false); + var that = this; + that.$nextTick(() => { + if (that.$refs.checkUserList) { + that.$refs.checkUserList.clearSelection(); + } + that.userList.forEach(row => { + for (let j in that.userData) { + if (row.id == that.userData[j].userid) { + that.$refs.checkUserList.toggleRowSelection(row, true); + } } }); - }); + }) }); } }, @@ -885,14 +888,19 @@ export default { enabled: true }; getJoinBussinessType(query).then((res) => { + this.selectBussinessTypeList = []; this.bussinessTypeList = res.data.list; - this.bussinessTypeList.forEach(type => { - this.bussinessTypeData.forEach(data => { - if (type.action == data.action) { - this.$refs.typeList.toggleRowSelection(type, true); - } else { - //未匹配上取消勾选,清除数据缓存 - this.$refs.typeList.toggleRowSelection(type, false); + + var that = this; + that.$nextTick(() => { + if (that.$refs.typeList) { + that.$refs.typeList.clearSelection(); + } + that.bussinessTypeList.forEach(row => { + for (let j in that.bussinessTypeData) { + if (row.action == that.bussinessTypeData[j].action) { + that.$refs.typeList.toggleRowSelection(row, true); + } } }); });