lsc 6 months ago
parent
commit
a0ea475b3a

File diff suppressed because it is too large
+ 0 - 0
dist/css/app.a4a58358.css


+ 1 - 1
dist/index.html

@@ -36,4 +36,4 @@
         width: 100%;
         background: #e6eaf0;
         font-family: '黑体';
-      }</style><script defer="defer" src="/js/chunk-vendors.54a29291.js"></script><script defer="defer" src="/js/app.341e7a73.js"></script><link href="/css/chunk-vendors.7cfe4581.css" rel="stylesheet"><link href="/css/app.1c59bbca.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but userManage doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
+      }</style><script defer="defer" src="/js/chunk-vendors.ac8f9183.js"></script><script defer="defer" src="/js/app.aa23ca0a.js"></script><link href="/css/chunk-vendors.7cfe4581.css" rel="stylesheet"><link href="/css/app.a4a58358.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but userManage doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because it is too large
+ 0 - 0
dist/js/app.341e7a73.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/app.341e7a73.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/js/app.aa23ca0a.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/app.aa23ca0a.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-vendors.54a29291.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-vendors.ac8f9183.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-vendors.ac8f9183.js.map


+ 107 - 38
src/components/list.vue

@@ -6,6 +6,29 @@
       <div class="pub_title">账号列表</div>
       <div style="margin-left: auto">
         <!--<el-button type="primary" size="small" @click="nextStep()">新增账户</el-button> -->
+        <el-input v-model="s_name" placeholder="输入检索用户名" size="normal" clearable @input="changeOid" style="margin-right: 10px;width: 200px;"></el-input>
+        <el-input v-model="s_username" placeholder="输入检索账号" size="normal" clearable @input="changeOid" style="margin-right: 10px;width: 200px;"></el-input>
+        <el-select v-model="checkRole" placeholder="选择身份" clearable filterable @change="changeOid" style="margin-right: 10px; width: 120px">
+          <el-option v-for="item in roleArray"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+        <el-select v-model="checkOid" placeholder="选择学校" clearable filterable @change="changeOid" style="margin-right: 10px">
+          <el-option v-for="item in getSchool"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
+        <el-select v-model="checkOrg" placeholder="选择组织" clearable filterable @change="changeOrg">
+          <el-option v-for="item in organizations"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
       </div>
     </div>
     <!-- 学习名称组织名称表单区域 -->
@@ -16,7 +39,7 @@
           <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>
         </div>
-        <el-select style="margin-left: 10px;" v-model="school.OrgId" placeholder="请选择组织" class="custom-select"  @change="ajax_org_check" clearable>
+        <el-select style="margin-left: 10px;" v-model="school.OrgId" placeholder="请选择组织" class="custom-select"  @change="ajax_org_check" filterable clearable>
           <!-- 动态生成 <el-option> -->
           <el-option v-for="(org, index) in organizations"
             :key="index"
@@ -37,7 +60,7 @@
                   <a>{{ school.name }}</a>
                 </label>
               <!-- 单选框,使用 v-model 绑定到一个变量 -->
-              <input type="radio" class="checkbox_input_org" name="school_selection" :value="school.name" v-model="selectedSchool">
+              <input type="radio" class="checkbox_input_org" name="school_selection" :value="school.id" v-model="selectedSchool">
               </div>
             </div>
           </div>
@@ -165,7 +188,7 @@
             <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-select v-model="school.parentOrgId" placeholder="请选择组织" class="custom-select" filterable>
                     <el-option
                       v-for="(org, index) in organizations"
                       :key="index"
@@ -254,7 +277,7 @@
           <el-table-column  show-overflow-toolti label="操作" min-width="35" header-align="center" align="center">
             <template slot-scope="{ row }">
               <el-button link type="text" size="small" @click="ajax__open_stop(row)" v-if="row.state == 1">停用</el-button>
-              <el-button link type="text" size="small" @click="run(row.userid)" v-if="row.state == 1">移动</el-button>
+              <el-button link type="text" size="small" @click="run(row)" v-if="row.state == 1">移动</el-button>
               <el-button link type="text" size="small" @click="ajax__open_stop(row)" v-if="row.state == 0">启用</el-button>
               
               <!-- 管理员操作按钮,只有当 row.type === 1 时才显示 -->
@@ -265,7 +288,7 @@
                 size="small"
                 @click="ajax_admin(row.userid, row.role, row.type)"
               >
-                {{ row.role === 1 ? '已设置管理员' : '设置管理员' }}
+                {{ row.role === 1 ? '取消管理员' : '设置管理员' }}
               </el-button>
             </template>
           </el-table-column>
@@ -289,6 +312,7 @@
 import { API_CONFIG } from '@/common/apiConfig';
 import { addOp } from '@/api/user';
 import { mapGetters } from 'vuex';
+import { debounce } from 'lodash';
 
 export default {
   name: 'HelloWorld',
@@ -370,32 +394,42 @@ export default {
       check_user_id: "", // 存放当前选择的用户的ID
       type: 1,
       total: 0,
-      tableLoading: false
+      tableLoading: false,
+      checkOrg: '',
+      checkOid: '',
+      s_name: '',
+      s_username: '',
+      checkRole: '',
+      roleArray: [
+        { value: '1', label: '老师' },
+        { value: '2', label: '学生' },
+        { value: '3', label: '管理员' }
+      ],
+      opUser: {},
     };
   },
   computed: {
     ...mapGetters(['userid']),
-    roleType(){
-      return function(row){
-        if(row.type == 2){
-          return '学生'
-        }else if(row.type == 1){
-          if(row.role == 1){
-            return '管理员'
-          }else{
-            return '老师'
-          }
+    roleType() {
+      return function(row) {
+        if (row.type == 2) {
+          return '学生';
+        } else if (row.type == 1) {
+          return row.role == 1 ? '管理员' : '老师';
         }
-        
-      }
-    }
+      };
+    },
+    getSchool() {
+      return this.checkOrg ? this.cn_school.filter(e => e.org === this.checkOrg) : this.cn_school;
+    },
   },
   watch: {
   },
   methods: {
     // 移动按钮,将isOrgFormVisible区域显示
-    run(userid) {
-      this.check_user_id = userid;  // 将选中的userid存储到check_user_id中
+    run(row) {
+      this.opUser = row
+      this.check_user_id = row.userid;  // 将选中的userid存储到check_user_id中
       this.isOrgFormVisible = true; // 显示区域
       // console.log("选中的用户ID:", this.check_user_id); // 打印出当前的选中用户ID
     },
@@ -423,25 +457,30 @@ export default {
     showType(type){
       this.type = type;
       this.currentPage = 1;
-      this.ajax_user_open()
+      this.getData()
     },
     // 页码扩展按钮
     handlePageChange(page) {
       this.currentPage = page;
-      this.ajax_user_open()
+      this.getData()
     },
     // 表头的背景色
     headerCellStyle() {
       return { backgroundColor: '#f1f1f1' };
     },
     // 已启用
-    ajax_user_open() {
+    getData() {
       // 确认后发起请求
       this.tableLoading = true
       let params = [
         {
           functionName: API_CONFIG.ajaxstart.functionName, // 使用配置中的存储过程名称
           r_type: this.type,
+          cn: this.s_name,
+          un: this.s_username,
+          oid: this.checkOid,
+          org: this.checkOrg,
+          userType: this.checkRole,
           page: this.currentPage, // 使用当前页码
           num: this.pageSize, // 每页条目数
         },
@@ -458,6 +497,7 @@ export default {
             userid: user.user_id,
             role: user.admin_role || 0, // 角色,假设 1 为管理员,0 为普通用户
             school: user.s_id,
+            org: user.org,
             type:user.usertype,
             state: user.user_state
           }));
@@ -502,7 +542,7 @@ export default {
               message: successMessage
             });
 
-            this.ajax_user_open();
+            this.getData();
             await addOp({
               uid: this.userid,
               cid: '',
@@ -545,14 +585,20 @@ export default {
       ];
 
       this.$ajax.post(API_CONFIG.baseUrl, params)
-      .then(() => {
-        // 只有在成功执行时调用这两个函数
-        this.ajax_user_open();
-          // 如果更新成功,显示成功提示并调用 ajax_user_stop 和 ajax_user_open
+      .then(async () => {
+          // 只有在成功执行时调用这两个函数
+          this.getData();
+          // 如果更新成功,显示成功提示并调用 ajax_user_stop 和 getData
           this.$message({
             type: 'success',
             message: '已成功执行!',
           });
+          await addOp({
+            uid: this.userid,
+            cid: '',
+            type: 'user_op',
+            content: `将${userid}${role == 1 ? '取消了管理员' : '设置了管理员'}`
+          })
         }).catch((error) => {
         // 请求失败的处理
         console.error("请求失败:", error);
@@ -579,8 +625,11 @@ export default {
           // 将 name 和 org 都存入 cn_school 数组中
           this.cn_school = res.data[0].map(item => ({
             name: item.name,
-            id: item.id
+            id: item.id,
+            org: item.org
           }));
+          console.log(this.cn_school);
+          
         }
       })
       .catch((err) => {
@@ -638,7 +687,7 @@ export default {
             id: item.id
           }));
           // 查询成功且更新后,显示成功消息
-          this.$message.success('成功查询到了学校');
+          // this.$message.success('成功查询到了学校');
         } else {
           // 如果没有找到匹配的学校,保持原有的 cn_school 数组内容
           this.$message.warning('没有找到匹配的学校');
@@ -683,7 +732,7 @@ export default {
             id: item.id
           }));
           // 查询成功且更新后,显示成功消息
-          this.$message.success('成功查询到了学校');
+          // this.$message.success('成功查询到了学校');
         } else {
           // 如果没有找到匹配的学校,保持原有的 cn_school 数组内容
           this.$message.warning('没有找到匹配的学校');
@@ -721,6 +770,7 @@ export default {
         u_type: this.schoolType || "",  // 学校类型,绑定到 schoolType,如果没有选择则为空
         u_code: this.schoolCode || "",  // 学校编码,绑定到 schoolCode,如果为空则传空字符串
         u_isLogin: this.loginPermission === '1' ? 1 : 2,  // 是否允许登录,默认传 2(不允许登录)如果没有选择
+        uid: this.userid,
       }
     ];
 
@@ -767,7 +817,7 @@ export default {
       {
         functionName: API_CONFIG.ajax_add_org.functionName,  // 调用存储过程的名称
         u_name: orgName,  // 组织名称
-        u_create: "0",  // u_create 固定为0
+        u_create: this.userid,  // u_create 固定为0
         u_code: randomCode,  // 随机码(可以为空)
         u_login: uLogin  // 登录状态
       }
@@ -797,10 +847,10 @@ export default {
   //确认移动
   ajax_confirm() {
     // 获取选择的组织ID,确保 orgId 在调用之前已经定义
-    const orgId = this.school.OrgId || "";  // 如果没有选择组织,则为空字符串
+    let orgId = this.school.OrgId || "";  // 如果没有选择组织,则为空字符串
 
     // 获取选中的学校对象
-    const selectedSchoolObject = this.cn_school.find(school => school.name === this.selectedSchool);
+    const selectedSchoolObject = this.cn_school.find(school => school.id === this.selectedSchool);
 
     // 判断学校ID是否为空
     if (!selectedSchoolObject || !selectedSchoolObject.id) {
@@ -811,6 +861,10 @@ export default {
       return; // 学校ID为空时,阻止后续操作
     }
 
+    if(selectedSchoolObject.org){
+      orgId = selectedSchoolObject.org
+    }
+
     // 构造请求参数
     let params = [
       {
@@ -823,7 +877,7 @@ export default {
 
     // 发起请求
     this.$ajax.post(API_CONFIG.baseUrl, params)
-      .then(() => {
+      .then(async () => {
         this.$message({
           type: 'success',
           message: '移动成功!',
@@ -833,23 +887,38 @@ export default {
         // console.log("选择的用户id为:", this.check_user_id);
         // console.log("选择的组织id为:", orgId);
         // console.log("选择的学校id为:", selectedSchoolObject.id);
-        this.ajax_user_open();  // 刷新
+        this.getData();  // 刷新
         //清空数据
         this.school.OrgId = '';  // 清空所选组织
         // 在此之后清空选中的学校
         this.selectedSchool = null;  // 取消选择,重置单选框
         //刷新学校选择
         this.ajax_school();
+        await addOp({
+          uid: this.userid,
+          cid: '',
+          type: 'user_op',
+          content: `将${this.opUser.userid} 原组织id ${this.opUser.org ? this.opUser.org : '无'} 原学校id ${this.opUser.school}移动到 组织id ${ orgId ? orgId : '无' } 学校id ${selectedSchoolObject.id}`
+        })
       })
       .catch((err) => {
         this.$message.error("移动失败");
         console.error("请求失败,错误信息:", err);
       });
   },
+  changeOrg(){
+    this.checkOid = '';
+    this.currentPage = 1;
+    this.getData();
+  },
+  changeOid: debounce(function() {
+    this.currentPage = 1; // 重置当前页
+    this.getData(); // 调用获取数据的方法
+  }, 300),
 },
   mounted() {
       // this.ajax_user_stop();  // 如果是在启用区域,停用
-      this.ajax_user_open();  // 如果是在停用区域,启用
+      this.getData();  // 如果是在停用区域,启用
       this.ajax_org();  // 组件创建时,立即调用 ajax_org 获取数据
       this.ajax_school();  // 组件创建时,立即调用 ajax_org 获取数据
   },

Some files were not shown because too many files changed in this diff