修改成员时角色项为必填

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

View File

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

View File

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

View File

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

View File

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