Browse Source

BUG修复:#13420 用户管理-取消关键字搜索,不点击搜索按钮,自动刷新页面显示全部部门信息(优化建议)

GDW 3 weeks ago
parent
commit
7e19fa96cd
1 changed files with 9 additions and 2 deletions
  1. 9 2
      jeecgboot-vue3/src/views/system/user/index.vue

+ 9 - 2
jeecgboot-vue3/src/views/system/user/index.vue

@@ -5,7 +5,7 @@
         <a-card :bordered="false" style="height: 100%">
           <a-spin :spinning="loading">
             <a-input-search placeholder="按部门名称搜索…" style="margin-bottom: 10px"
-                            @search="onSearch"/>
+                            @search="onSearch" v-model:value="searchValue" />
             <!--组织机构树-->
             <template v-if="treeData.length > 0">
               <a-tree
@@ -97,7 +97,7 @@
 
 <script lang="ts" name="system-user" setup>
   //ts语法
-  import {ref, computed, unref, nextTick} from 'vue';
+  import {ref, computed, unref, nextTick, watch} from 'vue';
   import { BasicTable, TableAction, ActionItem } from '/@/components/Table';
   import UserDrawer from './UserDrawer.vue';
   import UserRecycleBinModal from './UserRecycleBinModal.vue';
@@ -159,6 +159,8 @@
   const rawData = ref<any[]>([]);
   // 高级查询参数
   const queries = ref([]);
+  //搜索值
+  const searchValue = ref('');
 
   //高级查询参数
   const dataFields = [
@@ -600,6 +602,11 @@
     padding: '0px',
   };
 
+  //监听搜索框内值的变化
+  watch(searchValue, (newVal) => {
+    onSearch(newVal);
+  });
+
 
 </script>