fix: BOM搜索子件名称+自动搜索防抖

This commit is contained in:
DXC
2026-05-21 17:41:14 +08:00
parent baaaf7799a
commit d119bebe94
2 changed files with 28 additions and 4 deletions

View File

@ -240,7 +240,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed, nextTick } from 'vue'
import { ref, reactive, onMounted, computed, nextTick, watch } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox, FormInstance, FormRules } from 'element-plus'
import { Plus, Search, EditPen } from '@element-plus/icons-vue'
@ -289,6 +289,15 @@ const activeCategories = ref([]) // 默认全部展开
const searchKeyword = ref('')
const childSearchKeyword = ref('')
// ★ 自动搜索:输入后 500ms 防抖触发搜索(无需回车)
watch(searchKeyword, (val) => {
// 防抖:延迟 500ms 执行,避免频繁请求
clearTimeout((window as any)._bomSearchTimer)
;(window as any)._bomSearchTimer = setTimeout(() => {
fetchBomList()
}, 500)
})
// ============================================================
// 【改造】分页 + 远程搜索相关状态
// ============================================================