فهرست منبع

弹窗顶部跟搜索调整

huangwenhao 9 ماه پیش
والد
کامیت
9720410971
1فایلهای تغییر یافته به همراه74 افزوده شده و 25 حذف شده
  1. 74 25
      src/components/list.vue

+ 74 - 25
src/components/list.vue

@@ -8,7 +8,7 @@
     <!-- 学习名称组织名称表单区域 -->
     <el-dialog :visible.sync="isOrgFormVisible" :before-close="close_table" custom-class="table" width="920px">
       <!-- 自定义头部 -->
-      <div class="el_header" style=" width: 104.6%;height: 80px;text-align: center;background: #454545;margin-top: -60px;float: left;margin-left: -20px;">
+      <div class="el_header" style=" width: 104.6%;height: 40px;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>
@@ -18,11 +18,10 @@
       <div class="input-container">
         <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.OrgId" placeholder="请选择组织" class="custom-select">
+        <el-form :model="school" ref="form" style="float: left; margin-left: 10px; width: 200px; height: 30px; margin-top: 1px;">
+          <el-select v-model="school.OrgId" placeholder="请选择组织" class="custom-select"  @change="ajax_org_check">
             <!-- 动态生成 <el-option> -->
-            <el-option
-              v-for="(org, index) in organizations"
+            <el-option v-for="(org, index) in organizations"
               :key="index"
               :label="org.name"
               :value="org.id">
@@ -303,7 +302,7 @@
           <el-table-column show-overflow-tooltip prop="company_number" label="学校名称" width="350" header-align="center" align="center"/>
           <el-table-column show-overflow-tooltip prop="name" label="姓名" width="350" header-align="center" align="center"/>
           <el-table-column show-overflow-tooltip prop="account" label="账户" width="350" header-align="center" align="center"/>
-          <el-table-column fixed="right" label="操作" width="250" header-align="center" align="center">
+          <el-table-column label="操作" width="250" header-align="center" align="center">
             <template slot-scope="{ row }">
               <el-button link type="text" size="small" @click="ajax__open_stop(row.userid)">启用</el-button>
             </template>
@@ -442,7 +441,7 @@ export default {
     run(userid) {
       this.check_user_id = userid;  // 将选中的userid存储到check_user_id中
       this.isOrgFormVisible = true; // 显示区域
-      console.log("选中的用户ID:", this.check_user_id); // 打印出当前的选中用户ID
+      // console.log("选中的用户ID:", this.check_user_id); // 打印出当前的选中用户ID
     },
     // 移动关闭按钮
     close_table() {
@@ -546,7 +545,7 @@ export default {
           const totalCount = res.data[0][0].total_count;
           this.tableData.length=totalCount;
           // 打印映射后的用户信息
-          console.log("启用的用户信息:", res.data);
+          // console.log("启用的用户信息:", res.data);
         })
         .catch((err) => {
           // 处理失败的响应
@@ -583,7 +582,7 @@ export default {
           this.tableData_stop.length = totalCount;
 
           // 打印映射后的用户信息
-          console.log("停用的用户信息:", res.data);
+          // console.log("停用的用户信息:", res.data);
         })
         .catch((err) => {
           // 处理失败的响应
@@ -668,7 +667,7 @@ export default {
             userid: user.userid,
           };
         });
-        console.log("返回的数据为:",res.data);
+        // console.log("返回的数据为:",res.data);
         // 只有在成功执行时调用这两个函数
         this.ajax_user_stop();
         this.ajax_user_open();
@@ -773,6 +772,52 @@ export default {
           // 通过清空绑定的 v-model 的值来清除选择框的选择状态
           this.searchQuery = '';  // 清空搜索框内容
           this.selectedSchool='';
+          // // 清空下拉框的选择
+          // this.school.OrgId = null;  // 清空已选择的组织
+        });
+      })
+      .catch((err) => {
+        this.$message.error("查询失败");
+        console.error("请求失败,错误信息:", err);
+      });
+  },
+  //组织下拉菜单查询
+  ajax_org_check() {
+    // 获取选择的组织ID
+    const orgId = this.school.OrgId || "";  // 如果没有选择组织,则为空字符串
+    let params = [
+      {
+        functionName: API_CONFIG.ajax_school_name.functionName,  // 调用存储过程的名称
+        u_name: "",  // 用户输入的搜索关键词
+        u_org: orgId  // 传入的组织 ID
+      }
+    ];
+
+    this.$ajax.post(API_CONFIG.baseUrl, 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,
+            id: item.id
+          }));
+          // 查询成功且更新后,显示成功消息
+          this.$message.success('成功查询到了学校');
+        } else {
+          // 如果没有找到匹配的学校,保持原有的 cn_school 数组内容
+          this.$message.warning('没有找到匹配的学校');
+        }
+
+        // 清空选择框的选择状态
+        this.$nextTick(() => {
+          // 通过清空绑定的 v-model 的值来清除选择框的选择状态
+          this.searchQuery = '';  // 清空搜索框内容
+          this.selectedSchool='';
+          // // 清空下拉框的选择
+          // this.school.OrgId = null;  // 清空已选择的组织
         });
       })
       .catch((err) => {
@@ -907,10 +952,16 @@ export default {
         });
         this.isOrgFormVisible = false; // 隐藏区域
         // 在此之后再进行输出
-        console.log("选择的用户id为:", this.check_user_id);
-        console.log("选择的组织id为:", orgId);
-        console.log("选择的学校id为:", selectedSchoolObject.id);
-        this.ajax_user_open();  // 如果是在启用区域,停用
+        // console.log("选择的用户id为:", this.check_user_id);
+        // console.log("选择的组织id为:", orgId);
+        // console.log("选择的学校id为:", selectedSchoolObject.id);
+        this.ajax_user_open();  // 刷新
+        //清空数据
+        this.school.OrgId = '';  // 清空所选组织
+        // 在此之后清空选中的学校
+        this.selectedSchool = null;  // 取消选择,重置单选框
+        //刷新学校选择
+        this.ajax_school();
       })
       .catch((err) => {
         this.$message.error("移动失败");
@@ -1043,7 +1094,7 @@ body{
 /* 头部 */
 .el_header{
   width: 106.1%;
-  height: 80px;
+  height: 40px;
   text-align: center;
   background: #454545;
   margin-top: -60px;
@@ -1053,7 +1104,7 @@ body{
 .el_title{
   font-size: 18px !important;
   color: #fff !important;
-  line-height: 80px;
+  line-height: 40px;
 }
 /* 取消按钮样式 */
 .el_close{
@@ -1107,19 +1158,18 @@ body{
 }
 /* 输入框容器*/
 .input-container {
-  position: absolute;
   width: 90%;
   float: left;
-  margin-top: 32px;
+  margin-top: 15px;
   /* border: 1px solid red; */
 }
 /* 搜索框 */
 .table_find {
-  width: 190px; /* 设置容器的宽度 */
-  flex-grow: 1; /* 让输入框自适应宽度 */
+  width: 130px;
+  flex-grow: 1;
   height: 40px;
-  padding-right: 30px; /* 为右侧图标留出空间 */
-  padding-left: 10px; /* 可选,输入框内的左侧间距 */
+  padding-right: 50px;
+  padding-left: 10px;
   border: 1px solid rgb(189, 189, 189);
   font-size: 15px;
   outline: none;
@@ -1354,10 +1404,9 @@ body{
   font-size: 14px !important;
   color: #fff !important;
 }
-/* 取消按钮样式 */
+/* x取消按钮样式 */
 ::v-deep .el-dialog__headerbtn{
-  position: absolute;
-  top: 35px;
+  top: 10px;
   right: 20px;
   padding: 0;
   background: 0 0;