Skip to content

Commit 5586f08

Browse files
committed
refactor:公共搜索时过滤 length 为 0 的数组数据
1 parent df31070 commit 5586f08

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

web/src/utils/baTable.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { FormInstance, TableColumnCtx } from 'element-plus'
22
import { ElNotification, dayjs } from 'element-plus'
3-
import { cloneDeep, isEmpty } from 'lodash-es'
3+
import { cloneDeep, isArray, isEmpty } from 'lodash-es'
44
import Sortable from 'sortablejs'
55
import { reactive } from 'vue'
66
import { useRoute } from 'vue-router'
@@ -598,14 +598,15 @@ export default class baTable {
598598
val = this.comSearch.form[key]
599599
}
600600

601-
if (val !== null) {
602-
comSearchData.push({
603-
field: key,
604-
val: val,
605-
operator: fieldDataTemp.operator,
606-
render: fieldDataTemp.render,
607-
})
608-
}
601+
if (val === null) continue
602+
if (isArray(val) && !val.length) continue
603+
604+
comSearchData.push({
605+
field: key,
606+
val: val,
607+
operator: fieldDataTemp.operator,
608+
render: fieldDataTemp.render,
609+
})
609610
}
610611

611612
return comSearchData

0 commit comments

Comments
 (0)