| | |
| | | <el-tree |
| | | ref="deptTree" |
| | | :data="deptTree" |
| | | :check-strictly="false" |
| | | :default-checked-keys="user.deptIdsArr" |
| | | show-checkbox |
| | | accordion |
| | |
| | | }) |
| | | }, |
| | | setUser(val) { |
| | | setTimeout(() => { |
| | | this.filterDate(val) |
| | | }, 1000) |
| | | }, |
| | | filterDate(val) { |
| | | var this_ = this |
| | | this.user = { ...val } |
| | | var deptIdArrStr = [] |
| | | this.user.deptIds.split(',').forEach(element => { |
| | | const thisNode = this_.$refs.deptTree.getNode(element) // 获取当前节点 |
| | | if (thisNode.childNodes.length === 0) { |
| | | deptIdArrStr.push(thisNode.data.id) |
| | | return |
| | | } |
| | | }) |
| | | |
| | | this.user.deptIds && (this.user.deptIdsArr = deptIdArrStr) |
| | | this.user.deptIds && (this.user.deptIdsArr = this.user.deptIds.split(',')) |
| | | }, |
| | | close() { |
| | | this.$emit('close') |
| | |
| | | if (valid) { |
| | | this.buttonLoading = true |
| | | this.user.roleId = this.user.roleId.join(',') |
| | | this.user.deptIds = this.$refs.deptTree.getCheckedKeys().concat(this.$refs.deptTree.getHalfCheckedKeys()) |
| | | this.user.deptIds = this.$refs.deptTree.getCheckedKeys() |
| | | if (!this.user.userId) { |
| | | // create |
| | | this.$post('system/user', { ...this.user }).then(() => { |