feat:查询条件调整

This commit is contained in:
houjunxiang
2025-11-14 17:46:43 +08:00
parent 45ba9b4899
commit d3f6ad4bf6
8 changed files with 412 additions and 136 deletions

View File

@@ -330,28 +330,36 @@ function accAdd(arg1, arg2) {
// 通过配置项分组
export function groupByField(list, cupNumFieldIndex, groupKey = 'groupDictionaryBusinessKey') {
const groupMap = new Map()
// 插入“全部”项
list.unshift({ groupDictionaryBusinessKey: 'all', groupDictionaryBusinessName: '全部' })
for (const item of list) {
// 赋值杯号fieldindex
// 赋值杯号 fieldIndex
if (item.title === '杯号') {
cupNumFieldIndex.value = item.fieldIndex
}
const key = item[groupKey]
if (!key) continue // 跳过没有 group 的项(可选)
let key = item[groupKey]
// 如果没有有效 key统一归入自定义分组
if (!key) {
key = 'customParameter' // 使用固定字符串作为无 key 项的分组标识
}
// 如果该分组不存在,初始化
if (!groupMap.has(key)) {
groupMap.set(key, {
value: key,
label: item.groupDictionaryBusinessName, // 假设 title 在每个 item 中,且同组相同
label: key === 'customParameter' ? '分析项目' : item.groupDictionaryBusinessName || '未知分组',
fields: []
})
}
// 当前项(或仅需要的部分)推入 fields
// 当前项加入对应分组
groupMap.get(key).fields.push(item)
}
// 转为数组
return Array.from(groupMap.values())
}