|
@@ -5,7 +5,6 @@
|
|
element-loading-text="请稍后..."
|
|
element-loading-text="请稍后..."
|
|
>
|
|
>
|
|
<div class="part-box">
|
|
<div class="part-box">
|
|
- <h2 class="part-box-title">用户管理</h2>
|
|
|
|
<!-- 搜索 -->
|
|
<!-- 搜索 -->
|
|
<el-form class="part-filter-form" inline :model="searchForm">
|
|
<el-form class="part-filter-form" inline :model="searchForm">
|
|
<el-form-item v-if="isSuperAdmin" label="学校">
|
|
<el-form-item v-if="isSuperAdmin" label="学校">
|
|
@@ -25,12 +24,16 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item v-if="!onlySubjectTeacher" label="角色">
|
|
<el-form-item v-if="!onlySubjectTeacher" label="角色">
|
|
- <el-select v-model="searchForm.roleId" clearable placeholder="请选择">
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="searchForm.roleCode"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
v-for="item in roleList4Search"
|
|
v-for="item in roleList4Search"
|
|
- :key="item.roleId"
|
|
|
|
- :label="item.roleName"
|
|
|
|
- :value="item.roleId"
|
|
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.code"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -339,18 +342,18 @@
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="角色" prop="roleId">
|
|
|
|
|
|
+ <el-form-item label="角色" prop="role">
|
|
<el-select
|
|
<el-select
|
|
- v-model="userForm.roleId"
|
|
|
|
|
|
+ v-model="userForm.role"
|
|
class="dialog-input-width"
|
|
class="dialog-input-width"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in roleList4InsertOrUpdateWithoutSuperAdmin"
|
|
v-for="item in roleList4InsertOrUpdateWithoutSuperAdmin"
|
|
- :key="item.roleId"
|
|
|
|
- :label="item.roleName"
|
|
|
|
- :value="item.roleId"
|
|
|
|
- :disabled="roleDis(item.roleCode)"
|
|
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.code"
|
|
|
|
+ :disabled="roleDis(item.code)"
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -431,19 +434,19 @@
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="角色" prop="roleId">
|
|
|
|
|
|
+ <el-form-item label="角色" prop="role">
|
|
<el-select
|
|
<el-select
|
|
- v-model="userForm.roleId"
|
|
|
|
|
|
+ v-model="userForm.role"
|
|
class="dialog-input-width"
|
|
class="dialog-input-width"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
:disabled="rowIsSuperAdmin"
|
|
:disabled="rowIsSuperAdmin"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
- v-for="item in roleList4InsertOrUpdate"
|
|
|
|
- :key="item.roleId"
|
|
|
|
- :label="item.roleName"
|
|
|
|
- :disabled="roleDis(item.roleCode)"
|
|
|
|
- :value="item.roleId"
|
|
|
|
|
|
+ v-for="item in roleList4InsertOrUpdateWithoutSuperAdmin"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.code"
|
|
|
|
+ :disabled="roleDis(item.code)"
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -529,7 +532,8 @@ export default {
|
|
loading: false,
|
|
loading: false,
|
|
orgLoading4InsertOrUpdate: false,
|
|
orgLoading4InsertOrUpdate: false,
|
|
roleList4Search: [],
|
|
roleList4Search: [],
|
|
- roleList4InsertOrUpdate: [],
|
|
|
|
|
|
+ roleList4InsertOrUpdateWithoutSuperAdmin: [],
|
|
|
|
+ // roleList4InsertOrUpdate: [],
|
|
rootOrgList: [],
|
|
rootOrgList: [],
|
|
orgList4InsertOrUpdate: [],
|
|
orgList4InsertOrUpdate: [],
|
|
searchForm: {
|
|
searchForm: {
|
|
@@ -538,7 +542,7 @@ export default {
|
|
loginName: "",
|
|
loginName: "",
|
|
enable: "",
|
|
enable: "",
|
|
rootOrgId: "",
|
|
rootOrgId: "",
|
|
- roleId: "",
|
|
|
|
|
|
+ roleCode: "",
|
|
},
|
|
},
|
|
userForm: {
|
|
userForm: {
|
|
id: null,
|
|
id: null,
|
|
@@ -549,7 +553,7 @@ export default {
|
|
enable: true,
|
|
enable: true,
|
|
rootOrgId: null,
|
|
rootOrgId: null,
|
|
orgId: null,
|
|
orgId: null,
|
|
- roleId: null,
|
|
|
|
|
|
+ role: null,
|
|
},
|
|
},
|
|
enableStr: "true",
|
|
enableStr: "true",
|
|
|
|
|
|
@@ -619,7 +623,7 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
orgId: [],
|
|
orgId: [],
|
|
- roleId: [
|
|
|
|
|
|
+ roleCode: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
validator: validateRoles,
|
|
validator: validateRoles,
|
|
@@ -648,32 +652,26 @@ export default {
|
|
noBatchSelected() {
|
|
noBatchSelected() {
|
|
return this.selectedUserIds.length === 0;
|
|
return this.selectedUserIds.length === 0;
|
|
},
|
|
},
|
|
- roleList4InsertOrUpdateWithoutSuperAdmin() {
|
|
|
|
- return this.roleList4InsertOrUpdate.filter(
|
|
|
|
- (item) => item.roleCode != "SUPER_ADMIN"
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
|
|
+ // roleList4InsertOrUpdateWithoutSuperAdmin() {
|
|
|
|
+ // return this.roleList4InsertOrUpdate.filter(
|
|
|
|
+ // (item) => item.roleCode != "SUPER_ADMIN"
|
|
|
|
+ // );
|
|
|
|
+ // },
|
|
isSubjectTeacher() {
|
|
isSubjectTeacher() {
|
|
- return this.user.roleList.some(
|
|
|
|
- (role) => role.roleCode == "SUBJECT_TEACHER"
|
|
|
|
- );
|
|
|
|
|
|
+ return this.user.role === "SUBJECT_TEACHER";
|
|
},
|
|
},
|
|
onlySubjectTeacher() {
|
|
onlySubjectTeacher() {
|
|
if (this.isAdmin) {
|
|
if (this.isAdmin) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
- return this.user.roleList.some(
|
|
|
|
- (role) => role.roleCode == "SUBJECT_TEACHER"
|
|
|
|
- );
|
|
|
|
|
|
+ return this.user.role === "SUBJECT_TEACHER";
|
|
}
|
|
}
|
|
},
|
|
},
|
|
isSuperAdmin() {
|
|
isSuperAdmin() {
|
|
- return this.user.roleList.some((role) => role.roleCode == "SUPER_ADMIN");
|
|
|
|
|
|
+ return this.user.role === "SUPER_ADMIN";
|
|
},
|
|
},
|
|
isAdmin() {
|
|
isAdmin() {
|
|
- return this.user.roleList.some(
|
|
|
|
- (role) => role.roleCode == "SUPER_ADMIN" || role.roleCode == "ADMIN"
|
|
|
|
- );
|
|
|
|
|
|
+ return this.user.role === "SUPER_ADMIN" || this.user.role === "ADMIN";
|
|
},
|
|
},
|
|
rootSchoolSelect() {
|
|
rootSchoolSelect() {
|
|
let rootSchools = [];
|
|
let rootSchools = [];
|
|
@@ -694,11 +692,12 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
roleDis(code) {
|
|
roleDis(code) {
|
|
- if (this.onlySubjectTeacher && code != "ASSIGN_TEACHER") {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.onlySubjectTeacher && code != "ASSIGN_TEACHER") {
|
|
|
|
+ // return true;
|
|
|
|
+ // } else {
|
|
|
|
+ // return false;
|
|
|
|
+ // }
|
|
|
|
+ return this.onlySubjectTeacher && code != "ASSIGN_TEACHER";
|
|
},
|
|
},
|
|
//导入
|
|
//导入
|
|
importUser() {
|
|
importUser() {
|
|
@@ -728,7 +727,7 @@ export default {
|
|
},
|
|
},
|
|
resetEcsFormSearch() {
|
|
resetEcsFormSearch() {
|
|
this.searchForm = Object.assign(this.searchForm, {
|
|
this.searchForm = Object.assign(this.searchForm, {
|
|
- roleId: "",
|
|
|
|
|
|
+ roleCode: "",
|
|
courseId: "",
|
|
courseId: "",
|
|
loginName: "",
|
|
loginName: "",
|
|
name: "",
|
|
name: "",
|
|
@@ -748,26 +747,25 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
rootOrgChanged4Search() {
|
|
rootOrgChanged4Search() {
|
|
- var url =
|
|
|
|
- QUESTION_API +
|
|
|
|
- "/rolePrivilege/getRoles?includeSuperAdmin=" +
|
|
|
|
- true +
|
|
|
|
- "&rootOrgId=" +
|
|
|
|
- this.searchForm.rootOrgId;
|
|
|
|
- this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
- this.roleList4Search = response.data;
|
|
|
|
- });
|
|
|
|
|
|
+ // var url =
|
|
|
|
+ // QUESTION_API +
|
|
|
|
+ // "/rolePrivilege/getRoles?includeSuperAdmin=" +
|
|
|
|
+ // true +
|
|
|
|
+ // "&rootOrgId=" +
|
|
|
|
+ // this.searchForm.rootOrgId;
|
|
|
|
+ // this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
+ // this.roleList4Search = response.data;
|
|
|
|
+ // });
|
|
},
|
|
},
|
|
rootOrgChanged4InsertOrUpdate() {
|
|
rootOrgChanged4InsertOrUpdate() {
|
|
- this.orgList4InsertOrUpdate = [];
|
|
|
|
-
|
|
|
|
- var url =
|
|
|
|
- QUESTION_API +
|
|
|
|
- "/rolePrivilege/getRoles?rootOrgId=" +
|
|
|
|
- this.userForm.rootOrgId;
|
|
|
|
- this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
- this.roleList4InsertOrUpdate = response.data;
|
|
|
|
- });
|
|
|
|
|
|
+ // this.orgList4InsertOrUpdate = [];
|
|
|
|
+ // var url =
|
|
|
|
+ // QUESTION_API +
|
|
|
|
+ // "/rolePrivilege/getRoles?rootOrgId=" +
|
|
|
|
+ // this.userForm.rootOrgId;
|
|
|
|
+ // this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
+ // this.roleList4InsertOrUpdate = response.data;
|
|
|
|
+ // });
|
|
},
|
|
},
|
|
getOrgList4InsertOrUpdate(query) {
|
|
getOrgList4InsertOrUpdate(query) {
|
|
this.orgLoading4InsertOrUpdate = true;
|
|
this.orgLoading4InsertOrUpdate = true;
|
|
@@ -860,7 +858,7 @@ export default {
|
|
this.userForm.loginName = "";
|
|
this.userForm.loginName = "";
|
|
this.userForm.password = "";
|
|
this.userForm.password = "";
|
|
this.userForm.phoneNumber = "";
|
|
this.userForm.phoneNumber = "";
|
|
- this.userForm.roleId = null;
|
|
|
|
|
|
+ this.userForm.role = null;
|
|
this.userForm.orgId = null;
|
|
this.userForm.orgId = null;
|
|
this.enableStr = "true";
|
|
this.enableStr = "true";
|
|
this.orgList4InsertOrUpdate = [];
|
|
this.orgList4InsertOrUpdate = [];
|
|
@@ -876,7 +874,7 @@ export default {
|
|
|
|
|
|
this.updateDialog = true;
|
|
this.updateDialog = true;
|
|
this.userForm.id = row.id;
|
|
this.userForm.id = row.id;
|
|
- this.userForm.roleId = row.roleIds[0];
|
|
|
|
|
|
+ this.userForm.role = row.role;
|
|
this.userForm.name = row.name;
|
|
this.userForm.name = row.name;
|
|
this.userForm.loginName = row.loginName;
|
|
this.userForm.loginName = row.loginName;
|
|
this.enableStr = row.enable ? "true" : "false";
|
|
this.enableStr = row.enable ? "true" : "false";
|
|
@@ -1097,18 +1095,18 @@ export default {
|
|
this.userForm.rootOrgId = this.user.rootOrgId;
|
|
this.userForm.rootOrgId = this.user.rootOrgId;
|
|
|
|
|
|
var url1 = QUESTION_API + "/org/getRootOrgList";
|
|
var url1 = QUESTION_API + "/org/getRootOrgList";
|
|
- var url2 =
|
|
|
|
- QUESTION_API +
|
|
|
|
- "/rolePrivilege/getRoles?includeSuperAdmin=true&rootOrgId=" +
|
|
|
|
- this.user.rootOrgId;
|
|
|
|
|
|
+ var url2 = QUESTION_API + "/rolePrivilege/getRoles?all=true";
|
|
|
|
+ var url3 = QUESTION_API + "/rolePrivilege/getRoles";
|
|
|
|
|
|
Promise.all([
|
|
Promise.all([
|
|
this.$httpWithMsg.get(url1),
|
|
this.$httpWithMsg.get(url1),
|
|
this.$httpWithMsg.post(url2),
|
|
this.$httpWithMsg.post(url2),
|
|
- ]).then(([resp1, resp2]) => {
|
|
|
|
|
|
+ this.$httpWithMsg.post(url3),
|
|
|
|
+ ]).then(([resp1, resp2, resp3]) => {
|
|
this.rootOrgList = resp1.data;
|
|
this.rootOrgList = resp1.data;
|
|
this.roleList4Search = resp2.data;
|
|
this.roleList4Search = resp2.data;
|
|
- this.roleList4InsertOrUpdate = resp2.data;
|
|
|
|
|
|
+ // this.roleList4InsertOrUpdate = resp2.data;
|
|
|
|
+ this.roleList4InsertOrUpdateWithoutSuperAdmin = resp3.data;
|
|
|
|
|
|
const cacheInfo = window.sessionStorage.getItem("userPageCache");
|
|
const cacheInfo = window.sessionStorage.getItem("userPageCache");
|
|
if (cacheInfo) {
|
|
if (cacheInfo) {
|
|
@@ -1124,40 +1122,22 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
initPrivileges() {
|
|
initPrivileges() {
|
|
- let params = new URLSearchParams();
|
|
|
|
- params.append(
|
|
|
|
- "privilegeCodes",
|
|
|
|
- Object.keys(this.rolePrivileges).toString()
|
|
|
|
- );
|
|
|
|
- var url = QUESTION_API + "/rolePrivilege/checkPrivileges?" + params;
|
|
|
|
- this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
- this.rolePrivileges = response.data;
|
|
|
|
- });
|
|
|
|
|
|
+ // let params = new URLSearchParams();
|
|
|
|
+ // params.append(
|
|
|
|
+ // "privilegeCodes",
|
|
|
|
+ // Object.keys(this.rolePrivileges).toString()
|
|
|
|
+ // );
|
|
|
|
+ // var url = QUESTION_API + "/rolePrivilege/checkPrivileges?" + params;
|
|
|
|
+ // this.$httpWithMsg.post(url).then((response) => {
|
|
|
|
+ // this.rolePrivileges = response.data;
|
|
|
|
+ // });
|
|
this.getCourses4Search("");
|
|
this.getCourses4Search("");
|
|
},
|
|
},
|
|
showUserDataRuleSetting(row) {
|
|
showUserDataRuleSetting(row) {
|
|
- let roleCodes = row.roleCodes;
|
|
|
|
-
|
|
|
|
- for (let n = 0; n < roleCodes.length; n++) {
|
|
|
|
- let roleCode = roleCodes[n];
|
|
|
|
- if (roleCode == "SUPER_ADMIN" || roleCode == "ADMIN") {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
|
|
+ return !["SUPER_ADMIN", "ADMIN"].includes(row.role);
|
|
},
|
|
},
|
|
showBtn(row) {
|
|
showBtn(row) {
|
|
- let roleCodes = row.roleCodes;
|
|
|
|
-
|
|
|
|
- for (let n = 0; n < roleCodes.length; n++) {
|
|
|
|
- let roleCode = roleCodes[n];
|
|
|
|
- if (roleCode == "SUPER_ADMIN") {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
|
|
+ return !["SUPER_ADMIN"].includes(row.role);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|