Commit a4932e02 by xinla

选择人员组件,添加禁用节点功能参数:disabledValues

1 parent 5a862e5b
......@@ -33,6 +33,11 @@ export default {
return val.every((e) => e.userId && e.name)
},
},
// 禁止选中的节点
disabledValues: {
type: Array,
default: () => [],
},
destroyOnClose: Boolean,
},
data() {
......@@ -49,7 +54,7 @@ export default {
this.userList = []
} else {
value.forEach((i) => {
const id = this.isOnlyLeaf ? i.userId : i.userId || i.id
const id = i.userId || i.id
if (id) {
checkedUserList.push(i)
}
......@@ -60,9 +65,7 @@ export default {
Pvisible(val) {
val &&
this.$refs.tree &&
this.$refs.tree.setCheckedKeys(
this.defaultValues.map((e) => (this.isOnlyLeaf ? e.userId : e.userId || e.id))
)
this.$refs.tree.setCheckedKeys(this.defaultValues.map((e) => e.userId || e.id))
},
},
computed: {
......@@ -75,12 +78,15 @@ export default {
},
},
defaultProps() {
let isOnlyLeaf = this.isOnlyLeaf
let that = this
return {
label: 'name',
children: 'children',
disabled(data, node) {
return isOnlyLeaf && data.isParty
return (
(that.isOnlyLeaf && data.isParty) ||
that.disabledValues.some((e) => e == (data.userId || data.id))
)
},
isLeaf(data, node) {
return !data.id
......
......@@ -130,6 +130,14 @@
:isOnlyLeaf="true"
:isSigleSelect="selectUserData.isSigleSelect"
:defaultValues="selectUserData.type == 1 ? queryUser : addMemberForm.users"
:disabledValues="
selectUserData.type == 1
? queryUser
: list
.map((e) => e.userId)
.join()
.split(',')
"
destroyOnClose
@success="submitSelectUser"
></SelectUser>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!