修改成员时角色项为必填

This commit is contained in:
shiziyuan9527 2020-06-04 15:27:14 +08:00
parent 54f2fdf3ea
commit 03787d12c8
5 changed files with 52 additions and 32 deletions

View File

@ -78,7 +78,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option
v-for="item in form.allroles"
@ -175,7 +175,7 @@
// 使
this.$set(this.form, 'roleIds', roleIds);
},
updateOrgMember() {
updateOrgMember(formName) {
let param = {
id: this.form.id,
name: this.form.name,
@ -184,11 +184,15 @@
roleIds: this.form.roleIds,
organizationId: this.currentUser().lastOrganizationId
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.result = this.$post("/organization/member/update", param, () => {
this.$success(this.$t('commons.modify_success'));
this.updateVisible = false;
this.initTableData();
});
}
})
},
del(row) {
this.$confirm(this.$t('member.remove_member'), '', {

View File

@ -125,7 +125,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
@ -366,7 +366,7 @@
this.$info(this.$t('commons.remove_cancel'));
});
},
updateOrgMember() {
updateOrgMember(formName) {
let param = {
id: this.memberForm.id,
name: this.memberForm.name,
@ -375,11 +375,15 @@
roleIds: this.memberForm.roleIds,
workspaceId: this.currentWorkspaceRow.id
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.result = this.$post("/workspace/member/update", param, () => {
this.$success(this.$t('commons.modify_success'));
this.dialogWsMemberUpdateVisible = false;
this.cellClick(this.currentWorkspaceRow);
});
}
})
},
buildPagePath(path) {
return path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize;

View File

@ -145,7 +145,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
@ -427,7 +427,7 @@
}
});
},
updateOrgMember() {
updateOrgMember(formName) {
let param = {
id: this.memberForm.id,
name: this.memberForm.name,
@ -436,11 +436,15 @@
roleIds: this.memberForm.roleIds,
organizationId: this.currentRow.id
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.result = this.$post("/organization/member/update", param, () => {
this.$success(this.$t('commons.modify_success'));
this.dialogOrgMemberUpdateVisible = false;
this.cellClick(this.currentRow);
});
}
});
},
}

View File

@ -164,7 +164,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
@ -405,7 +405,7 @@
this.$info(this.$t('commons.remove_cancel'));
});
},
updateWorkspaceMember() {
updateWorkspaceMember(formName) {
let param = {
id: this.memberForm.id,
name: this.memberForm.name,
@ -414,11 +414,15 @@
roleIds: this.memberForm.roleIds,
workspaceId: this.currentWorkspaceRow.id
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.result = this.$post("/workspace/member/update", param, () => {
this.$success(this.$t('commons.modify_success'));
this.dialogWsMemberUpdateVisible = false;
this.cellClick(this.currentWorkspaceRow);
});
}
});
},
},
data() {

View File

@ -79,7 +79,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option
v-for="item in form.allroles"
@ -197,7 +197,7 @@
// 使
this.$set(this.form, 'roleIds', roleIds);
},
updateWorkspaceMember() {
updateWorkspaceMember(formName) {
let param = {
id: this.form.id,
name: this.form.name,
@ -206,11 +206,15 @@
roleIds: this.form.roleIds,
workspaceId: this.currentUser().lastWorkspaceId
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.result = this.$post("/workspace/member/update", param, () => {
this.$success(this.$t('commons.modify_success'));
this.updateVisible = false;
this.initTableData();
});
}
});
},
create() {
this.form = {};