|
@@ -62,7 +62,7 @@
|
|
|
<!-- 学校名称,显示 school.name -->
|
|
|
<a>{{ school.name }}</a>
|
|
|
<a style="color: gray;font-size: 13px;margin: 0px"> - {{ school.orgName ? school.orgName :
|
|
|
- '暂无组织'}}</a>
|
|
|
+ '暂无组织' }}</a>
|
|
|
</label>
|
|
|
<!-- 单选框,使用 v-model 绑定到一个变量 -->
|
|
|
<input type="radio" class="checkbox_input_org" name="school_selection" :value="school.id"
|
|
@@ -309,6 +309,32 @@
|
|
|
<el-button type="primary" @click="ajax_add_org">确认</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 设置角色弹窗 -->
|
|
|
+ <el-dialog title="设置角色" class="table" :visible.sync="set_role_dialog" :before-close="close_set_role" width="700px">
|
|
|
+ <div class="el_dialog_org_content" style="height: none;">
|
|
|
+ <form class="el-form">
|
|
|
+ <div class="el-form-item">
|
|
|
+ <label class="el-form-item__label" style="width: 100px">角色</label>
|
|
|
+ <div class="el-form-item__content" style="margin-left: 5px">
|
|
|
+ <span>
|
|
|
+ <div class="add_input el-input el-input--suffix">
|
|
|
+ <el-select v-model="roleVal" placeholder="请选择角色" class="custom-select" filterable>
|
|
|
+ <el-option v-for="(role, index) in roleArray" :key="index" :label="role.label" :value="role.label">
|
|
|
+ {{ role.label }}
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- 按钮区域 -->
|
|
|
+ <div slot="footer" class="el-dialog__footer">
|
|
|
+ <el-button @click="close_set_role">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="roleConfirm">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<!-- 内容区域 -->
|
|
|
<div class="content">
|
|
|
<!-- 按钮区域 -->
|
|
@@ -355,10 +381,11 @@
|
|
|
v-if="row.state == 0">启用</el-button>
|
|
|
|
|
|
<!-- 管理员操作按钮,只有当 row.type === 1 时才显示 -->
|
|
|
- <el-button v-if="row.type === 1 && row.state == 1" link type="text" size="small"
|
|
|
+ <!-- <el-button v-if="row.type === 1 && row.state == 1" link type="text" size="small"
|
|
|
@click="ajax_admin(row.userid, row.role, row.type)">
|
|
|
{{ row.role === 1 ? "取消管理员" : "设置管理员" }}
|
|
|
- </el-button>
|
|
|
+ </el-button> -->
|
|
|
+ <el-button link type="text" size="small" @click="setRole(row)">设置角色</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -400,6 +427,8 @@ export default {
|
|
|
isTableUseVisible: false,
|
|
|
//新增组织
|
|
|
add_org_dialog: false,
|
|
|
+ //设置角色
|
|
|
+ set_role_dialog: false,
|
|
|
//新增组织的变量定义
|
|
|
orgName: "", // 组织名称
|
|
|
u_create: "", // 创建人
|
|
@@ -476,10 +505,12 @@ export default {
|
|
|
s_name: "",
|
|
|
s_username: "",
|
|
|
checkRole: "",
|
|
|
+ roleVal: "",
|
|
|
roleArray: [
|
|
|
{ value: "1", label: "老师" },
|
|
|
{ value: "2", label: "学生" },
|
|
|
{ value: "3", label: "管理员" },
|
|
|
+ { value: "4", label: "集团管理员" },
|
|
|
],
|
|
|
opUser: {},
|
|
|
person: {
|
|
@@ -499,7 +530,13 @@ export default {
|
|
|
if (row.type == 2) {
|
|
|
return "学生";
|
|
|
} else if (row.type == 1) {
|
|
|
- return row.role == 1 ? "管理员" : "老师";
|
|
|
+ if (row.role == 0 && row.rrole == 0) {
|
|
|
+ return "老师";
|
|
|
+ } else if (row.role == 1 && row.rrole == 0) {
|
|
|
+ return "管理员";
|
|
|
+ } else if (row.role == 1 && row.rrole == 1) {
|
|
|
+ return "集团管理员";
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
},
|
|
@@ -570,6 +607,36 @@ export default {
|
|
|
this.add_org_dialog = false;
|
|
|
this.add_school_dialog = false;
|
|
|
},
|
|
|
+ //设置角色关闭
|
|
|
+ close_set_role() {
|
|
|
+ this.set_role_dialog = false;
|
|
|
+ },
|
|
|
+ roleConfirm() {
|
|
|
+ // 发送 AJAX 请求
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "setRole", // 调用存储过程的名称
|
|
|
+ id: this.check_user_id, // 将传入的userid设置为 u_id
|
|
|
+ u_role: this.roleVal,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.$ajax
|
|
|
+ .post(API_CONFIG.baseUrl, params)
|
|
|
+ .then(() => {
|
|
|
+ // 提示操作成功
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "设置成功!",
|
|
|
+ });
|
|
|
+ this.set_role_dialog = false; // 关闭对话框
|
|
|
+ this.getData();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ // 处理失败的响应
|
|
|
+ this.$message.error("设置失败");
|
|
|
+ console.error("请求失败,错误信息:", err); // 打印详细错误信息
|
|
|
+ });
|
|
|
+ },
|
|
|
showType(type) {
|
|
|
this.type = type;
|
|
|
this.currentPage = 1;
|
|
@@ -606,6 +673,7 @@ export default {
|
|
|
.post(API_CONFIG.baseUrl, params)
|
|
|
.then((res) => {
|
|
|
// 假设 res.data[0] 是返回的用户数据数组
|
|
|
+ console.log("you", res.data)
|
|
|
const users = res.data[0].map((user) => ({
|
|
|
company_name: user.org_name || "暂无", // 组织名称
|
|
|
company_number: user.school_name || "暂无", // 学校名称
|
|
@@ -613,6 +681,7 @@ export default {
|
|
|
account: user.account_name || "暂无", // 账户
|
|
|
userid: user.user_id,
|
|
|
role: user.admin_role || 0, // 角色,假设 1 为管理员,0 为普通用户
|
|
|
+ rrole: user.rrole || 0, // 角色,假设 1 为集团管理员,0 为普通用户
|
|
|
school: user.s_id,
|
|
|
org: user.org,
|
|
|
type: user.usertype,
|
|
@@ -624,11 +693,12 @@ export default {
|
|
|
|
|
|
// this.tableData = Array(this.pageSize * (this.currentPage - 1)).fill(null).concat(users);
|
|
|
this.tableData = users;
|
|
|
+ console.log("you", res.data);
|
|
|
this.total = res.data[0][0].total_count;
|
|
|
this.tableData_stop = res.data[2][0].num;
|
|
|
this.tableData_start = res.data[1][0].num;
|
|
|
this.tableLoading = false;
|
|
|
- console.log("you", res.data);
|
|
|
+
|
|
|
|
|
|
})
|
|
|
.catch((err) => {
|
|
@@ -688,6 +758,14 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ setRole(row) {
|
|
|
+ // 弹出设置角色的对话框
|
|
|
+ this.set_role_dialog = true;
|
|
|
+ this.roleVal = this.roleType(row)
|
|
|
+ this.check_user_id = row.userid; // 将选中的用户ID存储到check_user_id中
|
|
|
+ console.log(row);
|
|
|
+
|
|
|
+ },
|
|
|
//设置管理员
|
|
|
ajax_admin(userid, role) {
|
|
|
// 判断用户的角色,弹出相应的提示
|
|
@@ -1638,9 +1716,11 @@ export default {
|
|
|
position: relative;
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
-.input_tip{
|
|
|
+
|
|
|
+.input_tip {
|
|
|
margin: 0 49px;
|
|
|
}
|
|
|
+
|
|
|
.el-dialog {
|
|
|
position: relative;
|
|
|
margin: 0;
|