Browse Source

用户管理-高级查询方案,没录入查询内容时,提示信息,而不是一串报错信息(优化建议)

danch 3 days ago
parent
commit
e601820e75

+ 12 - 1
jeecgboot-vue3/src/components/Lttc/BaseService/LTTCBaseServiceAdvancedSearch.vue

@@ -411,7 +411,7 @@ const filteredList = computed(() => {
 const handleSearch = () => {
   // console.log("filteredList");
   // console.log(filteredList.value);
-  emit('update:searchedConditions', queries.value)
+  emit('update:searchedConditions', filterQueries(queries.value))
   emit('update:searchedData', filteredList.value);
 };
 
@@ -576,10 +576,21 @@ const truncateText = (text: string): string => {
   return result;
 };
 
+/**
+ * 判断是否为当前激活的查询条件
+ * @param index
+ */
 function isActive(index) {
   return activeIndex.value === index;
 }
 
+/**
+ * 过滤有空值的查询条件
+ * @param queries
+ */
+function filterQueries(queries) {
+  return queries.filter(query => query.column && query.condition && query.term && query.mode);
+}
 // 在组件挂载时加载选中的查询条件
 onMounted(() => {
   loadQuery();