|
@@ -2,7 +2,7 @@
|
|
<el-dialog
|
|
<el-dialog
|
|
class="select-user-dialog"
|
|
class="select-user-dialog"
|
|
:visible.sync="modalIsShow"
|
|
:visible.sync="modalIsShow"
|
|
- title="添加成员"
|
|
|
|
|
|
+ title="添加用户"
|
|
top="10px"
|
|
top="10px"
|
|
width="600px"
|
|
width="600px"
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
@@ -59,6 +59,9 @@
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+ <p v-show="!selectValid" class="tips-info tips-error">
|
|
|
|
+ 选择用户数不能超过{{ userLimitCount }}
|
|
|
|
+ </p>
|
|
|
|
|
|
<div slot="footer">
|
|
<div slot="footer">
|
|
<el-button type="primary" @click="submit">确认</el-button>
|
|
<el-button type="primary" @click="submit">确认</el-button>
|
|
@@ -93,6 +96,7 @@ export default {
|
|
userList: [],
|
|
userList: [],
|
|
selectedUsers: [],
|
|
selectedUsers: [],
|
|
selectedUserIds: [],
|
|
selectedUserIds: [],
|
|
|
|
+ selectValid: true,
|
|
defaultProps: {
|
|
defaultProps: {
|
|
children: "children",
|
|
children: "children",
|
|
label: "name"
|
|
label: "name"
|
|
@@ -167,12 +171,16 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ checkValid() {
|
|
|
|
+ this.selectValid = this.selectedUsers.length <= this.userLimitCount;
|
|
|
|
+ },
|
|
visibleChange() {
|
|
visibleChange() {
|
|
this.filterLabel = "";
|
|
this.filterLabel = "";
|
|
this.labelChange();
|
|
this.labelChange();
|
|
this.selectedUsers = this.users;
|
|
this.selectedUsers = this.users;
|
|
this.selectedUserIds = this.users.map(item => item.id);
|
|
this.selectedUserIds = this.users.map(item => item.id);
|
|
this.$refs.UserTree.setCheckedKeys(this.selectedUserIds);
|
|
this.$refs.UserTree.setCheckedKeys(this.selectedUserIds);
|
|
|
|
+ this.checkValid();
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
this.modalIsShow = false;
|
|
this.modalIsShow = false;
|
|
@@ -183,12 +191,14 @@ export default {
|
|
userChange() {
|
|
userChange() {
|
|
this.selectedUsers = this.$refs.UserTree.getCheckedNodes(true);
|
|
this.selectedUsers = this.$refs.UserTree.getCheckedNodes(true);
|
|
this.selectedUserIds = this.selectedUsers.map(item => item.id);
|
|
this.selectedUserIds = this.selectedUsers.map(item => item.id);
|
|
|
|
+ this.checkValid();
|
|
},
|
|
},
|
|
toDeleteUser(user) {
|
|
toDeleteUser(user) {
|
|
const pos = this.selectedUsers.findIndex(item => item.id === user.id);
|
|
const pos = this.selectedUsers.findIndex(item => item.id === user.id);
|
|
this.selectedUsers.splice(pos, 1);
|
|
this.selectedUsers.splice(pos, 1);
|
|
this.selectedUserIds = this.selectedUsers.map(item => item.id);
|
|
this.selectedUserIds = this.selectedUsers.map(item => item.id);
|
|
this.$refs.UserTree.setCheckedKeys(this.selectedUserIds);
|
|
this.$refs.UserTree.setCheckedKeys(this.selectedUserIds);
|
|
|
|
+ this.checkValid();
|
|
},
|
|
},
|
|
submit() {
|
|
submit() {
|
|
if (!this.selectedUsers.length) {
|
|
if (!this.selectedUsers.length) {
|
|
@@ -196,10 +206,7 @@ export default {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (this.selectedUsers.length > this.userLimitCount) {
|
|
|
|
- this.$message.error(`选择用户数不能超过${this.userLimitCount}`);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ if (!this.selectValid) return;
|
|
|
|
|
|
this.$emit(
|
|
this.$emit(
|
|
"modified",
|
|
"modified",
|