修改人员选择的限制

This commit is contained in:
qq787203167
2022-06-10 11:25:08 +08:00
parent 996b87ab94
commit 95e71593ff
2 changed files with 44 additions and 7 deletions
@@ -132,7 +132,7 @@
this.treeVisible = false
},
handleSubmit() {
if (this.userIds && this.userIds.length > 0) {
// if (this.userIds && this.userIds.length > 0) {
if (this.isSingleChoice) {
if (this.userIds.length > 1) {
this.$message.warning(this.$t('onlyOnePersonCanBeSelected'))
@@ -145,9 +145,9 @@
this.$emit('change', this.query.db_field_name, userIds.join(','))
this.visible = false
this.treeVisible = false
} else {
this.$message.warning(this.$t('pleaseSelectPersonFirst'))
}
// } else {
// this.$message.warning(this.$t('pleaseSelectPersonFirst'))
// }
},
indexclick(event) {
this.$emit('input', event.target.value)
+40 -3
View File
@@ -56,6 +56,8 @@
userIds: [],
departId: '',
defaultExpandedKeys: [],
content: [],
userName: [],
submitLoading: false,
visibleTree: false
}
@@ -66,6 +68,8 @@
methods: {
getPush(data) {
this.tableKey = data
this.userName = []
this.content = []
this.searchModel = ''
this.visible = true
this.visibleTree = false
@@ -95,7 +99,7 @@
handleSubmit() {
let query = {
id: this.tableKey,
createBy: this.userIds.join(','),
createBy: this.userName.join(',')
}
this.submitLoading = true
this.confirmLoading = true
@@ -152,8 +156,41 @@
}
})
},
checkChange(e) {
checkChange(e, info) {
this.userIds = e
this.userName = []
if (info.checkedNodes && info.checkedNodes.length > 0) {
info.checkedNodes.forEach(res => {
if (res.data.props.dataRef.key) {
this.content.push({
id: res.data.props.dataRef.key,
title: res.data.props.dataRef.title
})
} else {
this.content.push({
id: res.data.props.id,
title: res.data.props.title
})
}
})
}
if (this.content && this.content.length > 0) {
for (let i = 0; i < this.content.length; i++) {
for (let j = i + 1; j < this.content.length; j++) {
if (this.content[i].id == this.content[j].id) {
this.content.splice(j, 1)
j--
}
}
}
this.userIds.forEach(res => {
this.content.forEach(val => {
if (res == val.id) {
this.userName.push(val.title)
}
})
})
}
}
}
}
@@ -181,7 +218,7 @@
.drawer-bootom-button {
position: absolute;
bottom: 0;
z-index:100;
z-index: 100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;