|
@@ -8,7 +8,7 @@
|
|
|
<!-- 学习名称组织名称表单区域 -->
|
|
|
<el-dialog :visible.sync="isOrgFormVisible" :before-close="close_table" custom-class="table" width="920px">
|
|
|
<!-- 自定义头部 -->
|
|
|
- <div class="el_header">
|
|
|
+ <div class="el_header" style=" width: 104.6%;height: 80px;text-align: center;background: #454545;margin-top: -60px;float: left;margin-left: -20px;">
|
|
|
<span class="el_title">移动选择</span>
|
|
|
<button type="button" aria-label="Close" class="el_close" @click="form_clost">
|
|
|
<i></i>
|
|
@@ -16,22 +16,21 @@
|
|
|
</div>
|
|
|
<!-- 搜索框区域 -->
|
|
|
<div class="input-container">
|
|
|
- <input type="text" v-model="searchQuery" placeholder="搜索学校" class="table_find" @keyup.enter="ajax_school_name(searchQuery)" />
|
|
|
- <i class="el-icon-search" @click="ajax_school_name(searchQuery)"></i>
|
|
|
+ <input type="text" v-model="searchQuery" placeholder="搜索学校" class="table_find" @keyup.enter="ajax_school_name(searchQuery, school.type)" />
|
|
|
+ <i class="el-icon-search" @click="ajax_school_name(searchQuery, school.type)"></i>
|
|
|
<el-form :model="school" ref="form" style="float: left;margin-left: 10px;width: 200px;height: 30px;margin-top: 1px;">
|
|
|
- <el-select v-model="school.type" placeholder="请选择组织" class="custom-select" @change="ajax_org_type(school.type)">
|
|
|
+ <el-select v-model="school.type" placeholder="请选择组织" class="custom-select">
|
|
|
<!-- 动态生成 <el-option> -->
|
|
|
<el-option
|
|
|
v-for="(org, index) in organizations"
|
|
|
:key="index"
|
|
|
- :label="org.name"
|
|
|
- :value="org.id">
|
|
|
+ :label="org.name"
|
|
|
+ :value="org.id">
|
|
|
{{ org.name }}
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
-
|
|
|
<div class="table_down">
|
|
|
<div v-if="cn_org">
|
|
|
<div class="checkbox-container">
|
|
@@ -42,58 +41,213 @@
|
|
|
<!-- 学校名称,显示 school.name -->
|
|
|
<a>{{ school.name }}</a>
|
|
|
</label>
|
|
|
- <!-- 复选框 -->
|
|
|
- <input type="checkbox" class="checkbox_input_org">
|
|
|
+ <!-- 单选框,使用 v-model 绑定到一个变量 -->
|
|
|
+ <input type="radio" class="checkbox_input_org" name="school_selection" :value="school.name" v-model="selectedSchool">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<!-- 按钮区域 -->
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="isOrgFormVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary">新增学校</el-button>
|
|
|
- <el-button type="primary">新增组织</el-button>
|
|
|
- <el-button type="primary">确认移动</el-button>
|
|
|
+ <el-button type="primary" @click="add_school_dialog = true">新增学校</el-button>
|
|
|
+ <el-button type="primary" @click="add_org_dialog = true">新增组织</el-button>
|
|
|
+ <el-button type="primary" @click="ajax_confirm">确认移动</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <!-- 姓名与账户名称 -->
|
|
|
- <div v-if="isTableUseVisible" class="add_account">
|
|
|
- <div class="el-dialog__header">
|
|
|
- <span class="el-dialog__title">添加账户</span>
|
|
|
- <button type="button" aria-label="Close" class="el-dialog__headerbtn" @click="form_clost">
|
|
|
- <i class="el-dialog__close el-icon el-icon-close"></i>
|
|
|
- </button>
|
|
|
+ <!-- 新增账户弹窗 -->
|
|
|
+ <el-dialog :visible.sync="isTableUseVisible" :before-close="close_table" custom-class="add_account" width="700px">
|
|
|
+ <!-- 自定义头部 -->
|
|
|
+ <div class="el_header">
|
|
|
+ <span class="el_title">新增账户</span>
|
|
|
+ <i @click="form_clost"></i>
|
|
|
</div>
|
|
|
- <!-- 内容区域 -->
|
|
|
- <div class="el-dialog__body">
|
|
|
- <el-form ref="form" :model="form" label-width="80px">
|
|
|
- <el-form-item label="活动名称">
|
|
|
- <el-input v-model="form.name" placeholder="请输入姓名" class="form_input"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="账户名称">
|
|
|
- <el-input v-model="form.account" type="text" placeholder="请输入账户名称" class="form_input"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属组织">
|
|
|
- <el-select v-model="form.organization" placeholder="请选择组织">
|
|
|
- <el-option label="组织1"></el-option>
|
|
|
- <el-option label="组织2"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属学校">
|
|
|
- <el-select v-model="form.school" placeholder="请选择学校">
|
|
|
- <el-option label="学校1"></el-option>
|
|
|
- <el-option label="学校2"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="form_tool">
|
|
|
- <el-button type="primary">确认</el-button>
|
|
|
- <el-button>取消</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <div class="el-dialog__body">
|
|
|
+ <form data-v-3a331e10="" class="el-form">
|
|
|
+ <div data-v-3a331e10="" 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 data-v-3a331e10="">
|
|
|
+ <div data-v-3a331e10="" class="add_input el-input el-input--suffix">
|
|
|
+ <input type="text" autocomplete="off" placeholder="请输入学生姓名" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div data-v-3a331e10="" 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 data-v-3a331e10="">
|
|
|
+ <div data-v-3a331e10="" class="add_input el-input el-input--suffix">
|
|
|
+ <input type="text" autocomplete="off" placeholder="请输入学生姓名" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div data-v-3a331e10="" class="el-form-item">
|
|
|
+ <label class="el-form-item__label" style="width: 100px;">选择组织</label>
|
|
|
+ <div class="el-form-item__content" style="margin-left: 5px;">
|
|
|
+ <el-select v-model="school.type" placeholder="请选择组织" class="custom-select">
|
|
|
+ <!-- 动态生成 <el-option> -->
|
|
|
+ <el-option :value="1">组织1</el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div data-v-3a331e10="" class="el-form-item">
|
|
|
+ <label class="el-form-item__label" style="width: 100px;">选择学校</label>
|
|
|
+ <div class="el-form-item__content" style="margin-left: 5px;">
|
|
|
+ <el-select v-model="school.type" placeholder="请选择" class="custom-select">
|
|
|
+ <!-- 动态生成 <el-option> -->
|
|
|
+ <el-option :value="1">学校1</el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
+ <!-- 按钮区域 -->
|
|
|
+ <div slot="footer" class="el-dialog__footer">
|
|
|
+ <el-button @click="isTableUseVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 新增学校弹窗 -->
|
|
|
+ <el-dialog :visible.sync="add_school_dialog" :before-close="close_add_school" custom-class="add_account" width="700px">
|
|
|
+ <!-- 自定义头部 -->
|
|
|
+ <div class="el_header">
|
|
|
+ <span class="el_title">新增学校</span>
|
|
|
+ <i @click="form_clost"></i>
|
|
|
+ </div>
|
|
|
+ <div class="el_dialog_school_content">
|
|
|
+ <form class="el-form">
|
|
|
+ <!-- 学校名称 -->
|
|
|
+ <div class="el-form-item" style="margin-top: 15px;">
|
|
|
+ <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">
|
|
|
+ <input v-model="sch_name" type="text" autocomplete="off" placeholder="学校名称" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 地区 -->
|
|
|
+ <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">
|
|
|
+ <input v-model="region" type="text" autocomplete="off" placeholder="请输入地区" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 学校编码 -->
|
|
|
+ <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">
|
|
|
+ <input v-model="schoolCode" type="text" autocomplete="off" placeholder="请输入编码" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 学校类型 -->
|
|
|
+ <div class="el-form-item">
|
|
|
+ <div class="el-form-item__content" style="margin-left: 100px;">
|
|
|
+ <span>
|
|
|
+ <el-radio v-model="schoolType" label="1">普通学校</el-radio>
|
|
|
+ <el-radio v-model="schoolType" label="2">协同学校</el-radio>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 登录权限 -->
|
|
|
+ <div class="el-form-item">
|
|
|
+ <div class="el-form-item__content" style="margin-left: 100px;">
|
|
|
+ <span>
|
|
|
+ <el-radio v-model="loginPermission" label="1">允许登录</el-radio>
|
|
|
+ <el-radio v-model="loginPermission" label="2">不可登录</el-radio>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 上级组织 -->
|
|
|
+ <div class="el-form-item">
|
|
|
+ <label class="el-form-item__label" style="width: 100px;">上级组织</label>
|
|
|
+ <div class="el-form-item__content" style="margin-left: 100px;">
|
|
|
+ <span>
|
|
|
+ <div class="add_input el-input el-input--suffix">
|
|
|
+ <el-form :model="school" ref="form" style="float: left; margin-left: 20px; width: 200px; height: 30px; margin-top: -65px;">
|
|
|
+ <el-select v-model="school.parentOrgId" placeholder="请选择组织" class="custom-select">
|
|
|
+ <el-option
|
|
|
+ v-for="(org, index) in organizations"
|
|
|
+ :key="index"
|
|
|
+ :label="org.name"
|
|
|
+ :value="org.id">
|
|
|
+ {{ org.name }}
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
+ <!-- 按钮区域 -->
|
|
|
+ <div slot="footer" class="el-dialog__footer">
|
|
|
+ <el-button @click="add_school_dialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="ajax_add_school">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 新增组织弹窗 -->
|
|
|
+ <el-dialog :visible.sync="add_org_dialog" :before-close="close_add_org" custom-class="add_account" width="700px">
|
|
|
+ <!-- 自定义头部 -->
|
|
|
+ <div class="el_header">
|
|
|
+ <span class="el_title">新增组织</span>
|
|
|
+ <i @click="form_clost"></i>
|
|
|
+ </div>
|
|
|
+ <div class="el_dialog_org_content">
|
|
|
+ <form class="el-form">
|
|
|
+ <!-- 组织名称 -->
|
|
|
+ <div class="el-form-item" style="margin-top: 15px;">
|
|
|
+ <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">
|
|
|
+ <input v-model="orgName" type="text" autocomplete="off" placeholder="组织名称" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 地区 -->
|
|
|
+ <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">
|
|
|
+ <input v-model="randomCode" type="text" autocomplete="off" placeholder="请输入随机码" class="el-input__inner">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 登录权限 -->
|
|
|
+ <div class="el-form-item">
|
|
|
+ <div class="el-form-item__content" style="margin-left: 100px;">
|
|
|
+ <span>
|
|
|
+ <el-radio v-model="radio" label="1">允许登录</el-radio>
|
|
|
+ <el-radio v-model="radio" label="2">不可登录</el-radio>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- 按钮区域 -->
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="add_org_dialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="ajax_add_org">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<!-- 内容区域 -->
|
|
|
<div class="content">
|
|
|
<!-- 按钮区域 -->
|
|
@@ -184,8 +338,25 @@ export default {
|
|
|
showCompany: false, // 默认隐藏
|
|
|
// 响应式数据
|
|
|
//移动弹窗
|
|
|
- isOrgFormVisible: true,
|
|
|
+ isOrgFormVisible: false,
|
|
|
+ //新增账户
|
|
|
isTableUseVisible: false,
|
|
|
+ //新增组织
|
|
|
+ add_org_dialog:false,
|
|
|
+ //新增组织的变量定义
|
|
|
+ orgName: '', // 组织名称
|
|
|
+ u_create: '', // 创建人
|
|
|
+ randomCode:'' ,//随机码(可以为空)
|
|
|
+ uLogin: '1', // 登录状态 (1 或 2)
|
|
|
+ radio:'1',
|
|
|
+ //新增学校参数的定义
|
|
|
+ sch_name:'', //学校名称
|
|
|
+ region:'', //地区
|
|
|
+ schoolType:'1', //学校单选框类型
|
|
|
+ schoolCode:'', //学校编码
|
|
|
+ loginPermission:"1",//是否允许登录
|
|
|
+ //学校弹窗
|
|
|
+ add_school_dialog : false,
|
|
|
isCompanyDropdownVisible: false,
|
|
|
companyListVisibility: [false, false, false],
|
|
|
open_content: true,
|
|
@@ -193,10 +364,12 @@ export default {
|
|
|
stop_content: false,
|
|
|
open: true,
|
|
|
stop: false,
|
|
|
+ // 用来存储选中的学校名称
|
|
|
+ selectedSchool: "",
|
|
|
// 启用区域分页
|
|
|
currentPage: 1, // 当前第几页
|
|
|
pageSize: 5, // 每页显示条目数
|
|
|
- // 停止区域分页
|
|
|
+ // 停止区���分页
|
|
|
down_currentPage: 1, // 当前第几页
|
|
|
down_pageSize: 5, // 每页显示的条目数
|
|
|
// 两个分页初始化状态
|
|
@@ -224,10 +397,9 @@ export default {
|
|
|
cn_school: [],
|
|
|
searchQuery: "", // 用来存储输入框的值
|
|
|
dialogVisible: true,
|
|
|
- //输入框学校分类
|
|
|
school: {
|
|
|
- type:"",
|
|
|
- },
|
|
|
+ type: '', // 选择的组织 id
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -251,6 +423,7 @@ export default {
|
|
|
// 移动关闭按钮
|
|
|
close_table() {
|
|
|
this.isOrgFormVisible = false;
|
|
|
+ this.isTableUseVisible = false;
|
|
|
},
|
|
|
// 新增账户
|
|
|
nextStep() {
|
|
@@ -260,7 +433,14 @@ export default {
|
|
|
form_clost(){
|
|
|
this.isTableUseVisible = false;
|
|
|
},
|
|
|
-
|
|
|
+ //新增组织关闭
|
|
|
+ close_add_org(){
|
|
|
+ this.add_button_content = false;
|
|
|
+ },
|
|
|
+ //新增学校关闭
|
|
|
+ close_add_school(){
|
|
|
+ this.add_school_dialog = false;
|
|
|
+ },
|
|
|
// 启用中
|
|
|
showopen() {
|
|
|
this.open_content = true;
|
|
@@ -383,230 +563,335 @@ export default {
|
|
|
console.error("请求失败,错误信息:", err); // 打印更详细的错误信息
|
|
|
});
|
|
|
},
|
|
|
- // 停用或者启用
|
|
|
- ajax__open_stop(userid) {
|
|
|
- const isOpenArea = this.open_content; // 判断是否在启用区域
|
|
|
+ // 停用或者启用
|
|
|
+ ajax__open_stop(userid) {
|
|
|
+ const isOpenArea = this.open_content; // 判断是否在启用区域
|
|
|
|
|
|
- const actionMessage = isOpenArea ? '停用该条数据' : '启用该条数据';
|
|
|
- const successMessage = isOpenArea ? '停用成功!' : '启用成功!';
|
|
|
- const cancelMessage = isOpenArea ? '已取消停用' : '已取消启用';
|
|
|
+ const actionMessage = isOpenArea ? '停用该条数据' : '启用该条数据';
|
|
|
+ const successMessage = isOpenArea ? '停用成功!' : '启用成功!';
|
|
|
+ const cancelMessage = isOpenArea ? '已取消停用' : '已取消启用';
|
|
|
|
|
|
- let params = [
|
|
|
- {
|
|
|
- functionName: "update_user_state", // 调用存储过程的名称
|
|
|
- u_id: userid, // 将传入的userid设置为 u_id
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- // 弹窗提示确认
|
|
|
- this.$confirm(`此操作将会${actionMessage}, 是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- // 在用户点击确定后,发起 AJAX 请求
|
|
|
- this.$ajax
|
|
|
- .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- console.log(res); // 打印成功响应
|
|
|
- // 提示操作成功
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: successMessage
|
|
|
- });
|
|
|
- // 调用停用和启用用户的函数
|
|
|
- this.ajax_user_stop();
|
|
|
- this.ajax_user_open();
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- // 处理失败的响应
|
|
|
- this.$message.error("处理失败");
|
|
|
- console.error("请求失败,错误信息:", err); // 打印详细错误信息
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- // 取消操作后提示
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: cancelMessage
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- //设置管理员
|
|
|
- ajax_admin(userid, role) {
|
|
|
- // 判断用户的角色,弹出相应的提示
|
|
|
- let messageContent = role === 1
|
|
|
- ? '此操作将会取消此用户的管理员状态,是否继续?'
|
|
|
- : '此操作将会设置该用户为管理员,是否继续?';
|
|
|
-
|
|
|
- // 弹窗确认操作
|
|
|
- this.$confirm(messageContent, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(() => {
|
|
|
- // 发送请求时的参数
|
|
|
- let params = [
|
|
|
- {
|
|
|
- functionName: "update_user_admin", // 存储过程的名称
|
|
|
- u_id: userid, // 用户ID
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- this.$ajax
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "update_user_state", // 调用存储过程的名称
|
|
|
+ u_id: userid, // 将传入的userid设置为 u_id
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ // 弹窗提示确认
|
|
|
+ this.$confirm(`此操作将会${actionMessage}, 是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // 在用户点击确定后,发起 AJAX 请求
|
|
|
+ this.$ajax
|
|
|
.post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- // 直接假设返回的数据格式正确,直接执行
|
|
|
- this.tableData = res.data[0].map(user => {
|
|
|
- return {
|
|
|
- company_name: user.name || '暂无',
|
|
|
- company_number: user.id || '暂无',
|
|
|
- name: user.username || '暂无',
|
|
|
- account: user.account || '暂无',
|
|
|
- role: user.role,
|
|
|
- userid: user.userid,
|
|
|
- };
|
|
|
+ .then(() => {
|
|
|
+ // 提示操作成功
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: successMessage
|
|
|
});
|
|
|
- // console.log("返回信息为:", res.data);
|
|
|
+ // 调用停用和启用用户的函数
|
|
|
this.ajax_user_stop();
|
|
|
this.ajax_user_open();
|
|
|
- // 获取返回的信息
|
|
|
- let updatedMessage = res.data[0][0].message; // 这里假设res.data[0][0]是正确的
|
|
|
- if (updatedMessage == 2) {
|
|
|
- this.$message.error("该用户不是老师类型,无法设置为管理员");
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '已成功执行!',
|
|
|
- });
|
|
|
- }
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- // 取消操作时的提示
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消操作',
|
|
|
+ .catch((err) => {
|
|
|
+ // 处理失败的响应
|
|
|
+ this.$message.error("处理失败");
|
|
|
+ console.error("请求失败,错误信息:", err); // 打印详细错误信息
|
|
|
});
|
|
|
+ }).catch(() => {
|
|
|
+ // 取消操作后提示
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: cancelMessage
|
|
|
});
|
|
|
- },
|
|
|
- // 学校查询
|
|
|
- ajax_school() {
|
|
|
- let params = [
|
|
|
- {
|
|
|
- functionName: "select_school_cn", // 调用存储过程的名称
|
|
|
- },
|
|
|
- ];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //设置管理员
|
|
|
+ ajax_admin(userid, role) {
|
|
|
+ // 判断用户的角色,弹出相应的提示
|
|
|
+ let messageContent = role === 1
|
|
|
+ ? '此操作将会取消此用户的管理员状态,是否继续?'
|
|
|
+ : '此操作将会设置该用户为管理员,是否继续?';
|
|
|
|
|
|
- this.$ajax
|
|
|
- .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- // console.log("返回的数据为:", res.data); // 检查返回的数据
|
|
|
- if (res.data && Array.isArray(res.data[0])) {
|
|
|
- // 将 name 和 org 都存入 cn_school 数组中
|
|
|
- this.cn_school = res.data[0].map(item => ({
|
|
|
- name: item.name,
|
|
|
- org: item.org
|
|
|
- }));
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$message.error("查询失败");
|
|
|
- console.error("请求失败,错误信息:", err);
|
|
|
- });
|
|
|
- },
|
|
|
- //组织查询
|
|
|
- ajax_org() {
|
|
|
+ // 弹窗确认操作
|
|
|
+ this.$confirm(messageContent, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(() => {
|
|
|
+ // 发送请求时的参数
|
|
|
let params = [
|
|
|
{
|
|
|
- functionName: "select_organization", // 调用存储过程的名称
|
|
|
+ functionName: "update_user_admin", // 存储过程的名称
|
|
|
+ u_id: userid, // 用��ID
|
|
|
},
|
|
|
];
|
|
|
|
|
|
this.$ajax
|
|
|
- .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- // console.log("返回的数据为:", res.data); // 检查返回的数据
|
|
|
- if (res.data && Array.isArray(res.data[0])) {
|
|
|
- // 使用 map() 提取所有组织名称
|
|
|
- this.organizations = res.data[0];
|
|
|
- }
|
|
|
- // console.log("返回的结果为:",this.organizations);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$message.error("查询失败");
|
|
|
- console.error("请求失败,错误信息:", err);
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then((res) => {
|
|
|
+ // 直接假设返回的数据格式正确,直接执行
|
|
|
+ this.tableData = res.data[0].map(user => {
|
|
|
+ return {
|
|
|
+ company_name: user.name || '暂无',
|
|
|
+ company_number: user.id || '暂无',
|
|
|
+ name: user.username || '暂无',
|
|
|
+ account: user.account || '暂无',
|
|
|
+ role: user.role,
|
|
|
+ userid: user.userid,
|
|
|
+ };
|
|
|
});
|
|
|
- },
|
|
|
- //关键词查询
|
|
|
- ajax_school_name(searchQuery) {
|
|
|
- console.log('搜索关键词:', searchQuery); // 打印搜索关键词
|
|
|
+ // console.log("返回信息为:", res.data);
|
|
|
+ this.ajax_user_stop();
|
|
|
+ this.ajax_user_open();
|
|
|
+ // 获取返回的信息
|
|
|
+ let updatedMessage = res.data[0][0].message; // 这里假设res.data[0][0]是正确的
|
|
|
+ if (updatedMessage == 2) {
|
|
|
+ this.$message.error("该用户不是老师类型,无法设置为管理员");
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已成功执行!',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ // 取消操作时的提示
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消操作',
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 学校查询
|
|
|
+ ajax_school() {
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "select_school_cn", // 调用存储过程的名称
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ this.$ajax
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then((res) => {
|
|
|
+ // console.log("返回的数据为:", res.data); // 检查返回的数据
|
|
|
+ if (res.data && Array.isArray(res.data[0])) {
|
|
|
+ // 将 name 和 org 都存入 cn_school 数组中
|
|
|
+ this.cn_school = res.data[0].map(item => ({
|
|
|
+ name: item.name,
|
|
|
+ org: item.org
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("查询失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //组织查询
|
|
|
+ ajax_org() {
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "select_organization", // 调用存储过程的名称
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ this.$ajax
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then((res) => {
|
|
|
+ // console.log("返回的数据为:", res.data); // 检查返回的数据
|
|
|
+ if (res.data && Array.isArray(res.data[0])) {
|
|
|
+ // 使用 map() 提取所有组织名称
|
|
|
+ this.organizations = res.data[0].map(item => ({
|
|
|
+ name: item.name,
|
|
|
+ id: item.id
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ // console.log("返回的结果为:",this.organizations);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("查询失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //关键词查询
|
|
|
+ ajax_school_name(searchQuery, orgId) {
|
|
|
+ // console.log('搜索关键词:', searchQuery); // 打印搜索关键词
|
|
|
+ // console.log('选中的组织ID:', orgId); // 打印选中的组织 ID
|
|
|
|
|
|
// 检查 searchQuery 是否为空
|
|
|
if (!searchQuery) {
|
|
|
- this.$message.warning('请输入搜索内容');
|
|
|
- return;
|
|
|
+ this.$message.warning('请输入搜索内容');
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
let params = [
|
|
|
- {
|
|
|
- functionName: "select_school_name", // 调用存储过程的名称
|
|
|
- u_name: searchQuery, // 用户输入的搜索关键词
|
|
|
- },
|
|
|
+ {
|
|
|
+ functionName: "select_school_name", // 调用存储过程的名称
|
|
|
+ u_name: searchQuery, // 用户输入的搜索关键词
|
|
|
+ u_org: orgId // 传入的组织 ID
|
|
|
+ }
|
|
|
];
|
|
|
|
|
|
this.$ajax
|
|
|
- .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- console.log('返回的学校数据:', res.data); // 打印返回的数据
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then((res) => {
|
|
|
+ // console.log('返回的学校数据:', res.data); // 打印返回的数据
|
|
|
|
|
|
- // 检查是否查询到有效数据
|
|
|
- if (res.data && Array.isArray(res.data[0]) && res.data[0].length > 0) {
|
|
|
- // 只有在查询到学校数据且数组不为空时才更新 cn_school
|
|
|
- this.cn_school = res.data[0].map(item => ({
|
|
|
- name: item.name,
|
|
|
- org: item.org
|
|
|
- }));
|
|
|
- // console.log('更新后的学校列表:', this.cn_school); // 打印更新后的学校列表
|
|
|
- // 查询成功且更新后,显示成功消息
|
|
|
- this.$message.success('成功查询到了学校');
|
|
|
- } else {
|
|
|
- // 如果没有找到匹配的学校,保持原有的 cn_school 数组内容
|
|
|
- this.$message.warning('没有找到匹配的学校');
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$message.error("查询失败");
|
|
|
- console.error("请求失败,错误信息:", err);
|
|
|
+ // 检查是否查询到有效数据
|
|
|
+ if (res.data && Array.isArray(res.data[0]) && res.data[0].length > 0) {
|
|
|
+ // 只有在查询到学校数据且数组不为空时才更新 cn_school
|
|
|
+ this.cn_school = res.data[0].map(item => ({
|
|
|
+ name: item.name,
|
|
|
+ org: item.org
|
|
|
+ }));
|
|
|
+ // 查询成功且更新后,显示成功消息
|
|
|
+ this.$message.success('成功查询到了学校');
|
|
|
+ } else {
|
|
|
+ // 如果没有找到匹配的学校,保持原有的 cn_school 数组内容
|
|
|
+ this.$message.warning('没有找到匹配的学校');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空选择框的选择状态
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // 通过清空绑定的 v-model 的值来清除选择框的选择状态
|
|
|
+ this.searchQuery = ''; // 清空搜索框内容
|
|
|
+ this.selectedSchool='';
|
|
|
});
|
|
|
-},
|
|
|
- //下拉菜单查询
|
|
|
- ajax_org_type(id) {
|
|
|
- let params = [
|
|
|
- {
|
|
|
- functionName: "select_org_school", // 调用存储过程的名称
|
|
|
- u_org: id
|
|
|
- },
|
|
|
- ];
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("查询失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //新增学校
|
|
|
+ ajax_add_school() {
|
|
|
+ // 校验学校名称是否为空
|
|
|
+ if (!this.sch_name || this.sch_name.trim() === "") {
|
|
|
+ this.$message.error("学校名称不能为空!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建请求参数
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "insert_school", // 调用存储过程的名称
|
|
|
+ u_name: this.sch_name, // 学校名称,绑定到 orgName
|
|
|
+ u_org: this.school.parentOrgId || "", // 选择的组织的 ID,绑定到 school.parentOrgId,如果没有选择则为空
|
|
|
+ u_dest: this.region || "", // 地区,绑定到 region,如果为空则传空字符串
|
|
|
+ u_type: this.schoolType || "", // 学校类型,绑定到 schoolType,如果没有选择则为空
|
|
|
+ u_code: this.schoolCode || "", // 学校编码,绑定到 schoolCode,如果为空则传空字符串
|
|
|
+ u_isLogin: this.loginPermission === '1' ? 1 : 2, // 是否允许登录,默认传 2(不允许登录)如果没有选择
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 发起请求
|
|
|
+ this.$ajax
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已成功执行!',
|
|
|
+ });
|
|
|
+ // 刷新学校列表
|
|
|
+ this.ajax_school();
|
|
|
+ // 关闭弹窗
|
|
|
+ this.add_school_dialog = false;
|
|
|
+ // 清空输入框、下拉菜单选择和单选框
|
|
|
+ this.sch_name = ''; // 清空学校名称
|
|
|
+ this.school.parentOrgId = ''; // 清空组织选择
|
|
|
+ this.region = ''; // 清空地区选择
|
|
|
+ this.schoolType = '1'; // 清空学校类型选择
|
|
|
+ this.schoolCode = ''; // 清空学校编码
|
|
|
+ this.loginPermission = '1'; // 清空登录权限的选择
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("插入失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //新增组织
|
|
|
+ ajax_add_org() {
|
|
|
+ // 获取弹窗中的输入内容
|
|
|
+ let orgName = this.orgName; // 组织名称
|
|
|
+ let randomCode = this.randomCode || ''; // 随机码(可为空)
|
|
|
+ let uLogin = this.radio; // 获取复选框选中的值(1 或 2)
|
|
|
+
|
|
|
+ // 验证组织名称不能为空
|
|
|
+ if (!orgName) {
|
|
|
+ this.$message.error("组织名称不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构造请求参数
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "insert_org", // 调用存储过程的名称
|
|
|
+ u_name: orgName, // 组织名称
|
|
|
+ u_create: "0", // u_create 固定为0
|
|
|
+ u_code: randomCode, // 随机码(可以为空)
|
|
|
+ u_login: uLogin // 登录状态
|
|
|
+ }
|
|
|
+ ];
|
|
|
|
|
|
- this.$ajax
|
|
|
- .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
- .then((res) => {
|
|
|
- if (res.data && Array.isArray(res.data[0])) {
|
|
|
- // 使用 map() 提取所有学校名称
|
|
|
- this.cn_school = res.data[0];
|
|
|
- }
|
|
|
- console.log("返回的结果为:", res.data);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$message.error("查询失败");
|
|
|
- console.error("请求失败,错误信息:", err);
|
|
|
+ // 发起请求
|
|
|
+ this.$ajax
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已成功执行!',
|
|
|
});
|
|
|
+ // 刷新组织列表
|
|
|
+ this.ajax_org();
|
|
|
+ //关闭弹窗
|
|
|
+ this.add_org_dialog = false;
|
|
|
+ // 清空输入框、下拉菜单选择和单选框
|
|
|
+ this.orgName = ''; // 清空学校名称
|
|
|
+ this.randomCode = ''; // 清空地区选择
|
|
|
+ this.uLogin = '1'; // 清空学校类型选择
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("插入失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //确认移动
|
|
|
+ ajax_confirm(userid,orgId) {
|
|
|
+ // 构造请求参数
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: "updata_user_o_s", // 调用存储过程的名称
|
|
|
+ u_id: userid, // 用户id
|
|
|
+ o_id: orgId, // 组织id
|
|
|
+ s_id: 1 // 学校id
|
|
|
}
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 发起请求
|
|
|
+ this.$ajax
|
|
|
+ .post("http://10.3.16.166:7003/api/pbl/localPost", params)
|
|
|
+ .then(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '移动成功!',
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("移动失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ });
|
|
|
},
|
|
|
+},
|
|
|
mounted() {
|
|
|
- this.ajax_user_stop(); // 如果是在启用区域,停用
|
|
|
- this.ajax_user_open(); // 如果是在停用区域,启用
|
|
|
- this.ajax_org(); // 组件创建时,立即调用 ajax_org 获取数据
|
|
|
- this.ajax_school(); // 组件创建时,立即调用 ajax_org 获取数据
|
|
|
+ this.ajax_user_stop(); // 如果是在启用区域,停用
|
|
|
+ this.ajax_user_open(); // 如果是在停用区域,启用
|
|
|
+ this.ajax_org(); // 组件创建时,立即调用 ajax_org 获取数据
|
|
|
+ this.ajax_school(); // 组件创建时,立即调用 ajax_org 获取数据
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
@@ -718,9 +1003,8 @@ body{
|
|
|
/* border: 1px solid black; */
|
|
|
}
|
|
|
/* 头部 */
|
|
|
-/* 添加账户头顶 */
|
|
|
.el_header{
|
|
|
- width: 920px;
|
|
|
+ width: 106.1%;
|
|
|
height: 80px;
|
|
|
text-align: center;
|
|
|
background: #454545;
|
|
@@ -736,7 +1020,7 @@ body{
|
|
|
/* 取消按钮样式 */
|
|
|
.el_close{
|
|
|
position: absolute;
|
|
|
- top: 20px;
|
|
|
+ top: 35px;
|
|
|
right: 20px;
|
|
|
padding: 0;
|
|
|
background: 0 0;
|
|
@@ -1009,7 +1293,7 @@ body{
|
|
|
transform: translate(-50%, -50%); /* 使其真正居中 */
|
|
|
z-index: 10; /* 设置层次更高 */
|
|
|
width: 700px;
|
|
|
- height: auto;
|
|
|
+ height: auto; /* 设置高度为自适应 */
|
|
|
border: 1px solid rgb(225, 225, 225);
|
|
|
background-color: rgb(255, 255, 255);
|
|
|
margin-top: 35vh;
|
|
@@ -1033,9 +1317,9 @@ body{
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
/* 取消按钮样式 */
|
|
|
-.el-dialog__headerbtn{
|
|
|
+::v-deep .el-dialog__headerbtn{
|
|
|
position: absolute;
|
|
|
- top: 20px;
|
|
|
+ top: 35px;
|
|
|
right: 20px;
|
|
|
padding: 0;
|
|
|
background: 0 0;
|
|
@@ -1051,9 +1335,8 @@ body{
|
|
|
.el-form {
|
|
|
float: left;
|
|
|
margin-left: 66px;
|
|
|
-}
|
|
|
-.el-form-item{
|
|
|
- float: left;
|
|
|
+ width: 60%;
|
|
|
+ /* border: 1px solid red; */
|
|
|
}
|
|
|
/* 确认跟取消区域 */
|
|
|
.form_tool{
|
|
@@ -1067,9 +1350,21 @@ body{
|
|
|
}
|
|
|
/* 添加账户的容器 */
|
|
|
.el-dialog__body {
|
|
|
- padding: 30px 25px;
|
|
|
color: #606266;
|
|
|
font-size: 14px;
|
|
|
+ height: 180px;
|
|
|
+}
|
|
|
+/* 新增组织的内容容器 */
|
|
|
+.el_dialog_org_content {
|
|
|
+ color: #606266;
|
|
|
+ font-size: 14px;
|
|
|
+ height: 120px;
|
|
|
+}
|
|
|
+/* 新增学校的内容容器 */
|
|
|
+.el_dialog_school_content {
|
|
|
+ color: #606266;
|
|
|
+ font-size: 14px;
|
|
|
+ height: 300px;
|
|
|
}
|
|
|
/* 新增学校按钮 */
|
|
|
.add_school{
|
|
@@ -1087,4 +1382,38 @@ body{
|
|
|
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
|
|
|
background-color: #f1f1f1;
|
|
|
}
|
|
|
+.el-form-item {
|
|
|
+ margin-bottom: 22px;
|
|
|
+ /* border: 1px solid black; */
|
|
|
+ float: left;
|
|
|
+}
|
|
|
+.el-form-item__label {
|
|
|
+ float: left;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #606266;
|
|
|
+ line-height: 40px;
|
|
|
+ margin-left: 20px;
|
|
|
+}
|
|
|
+.el-form-item__content {
|
|
|
+ line-height: 40px;
|
|
|
+ position: relative;
|
|
|
+ font-size: 14px;
|
|
|
+ float: left;
|
|
|
+}
|
|
|
+.el-dialog {
|
|
|
+ position: relative;
|
|
|
+ margin: 0 ;
|
|
|
+ background: #FFF;
|
|
|
+ border-radius: 2px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 50%;
|
|
|
+ height: auto;
|
|
|
+}
|
|
|
+/* 弹窗底部 */
|
|
|
+.el-dialog__footer {
|
|
|
+ padding: 40px 20px 0px;
|
|
|
+ text-align: right;
|
|
|
+ -webkit-box-sizing: border-box;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
</style>
|