|
|
|
@ -306,21 +306,29 @@ export function useDataSource(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 配置高级查询参数固定格式
|
|
|
|
|
console.log(opt.advanced)
|
|
|
|
|
opt.advanced?.conditions.forEach(item => {
|
|
|
|
|
let obj = {
|
|
|
|
|
Key: '',
|
|
|
|
|
Value: null
|
|
|
|
|
Value: {
|
|
|
|
|
ConditionalList: []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
obj['Key'] = item.logicalOperator
|
|
|
|
|
if (item?.conditions) {
|
|
|
|
|
item.conditions.forEach(row => {
|
|
|
|
|
// 只有当查询条件字段和筛选符都有值的时候才行(不然后台报错)
|
|
|
|
|
if (row.field && row.value) {
|
|
|
|
|
obj.Value = {
|
|
|
|
|
FieldName: row.field,
|
|
|
|
|
FieldValue: row.value,
|
|
|
|
|
ConditionalType: row.operator
|
|
|
|
|
}
|
|
|
|
|
// 将id替换成Name支持输入框模糊查询(看后期要不要改成外键下拉形式)
|
|
|
|
|
const field = replaceEndChar(row.field, 'Id', 'Name')
|
|
|
|
|
obj.Value.ConditionalList.push({
|
|
|
|
|
Key: 0,
|
|
|
|
|
Value: {
|
|
|
|
|
FieldName: field,
|
|
|
|
|
FieldValue: row.value,
|
|
|
|
|
ConditionalType: row.operator
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -328,6 +336,7 @@ export function useDataSource(
|
|
|
|
|
ap.Value.ConditionalList.push(obj)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log(ap)
|
|
|
|
|
if (ap.Value.ConditionalList.length) {
|
|
|
|
|
params['advancedSearchParams'] = { ConditionalList: [ap] }
|
|
|
|
|
} else {
|
|
|
|
@ -394,7 +403,11 @@ export function useDataSource(
|
|
|
|
|
setLoading(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建正则表达式匹配目标字符在末尾的情况
|
|
|
|
|
function replaceEndChar(str, target, replacement) {
|
|
|
|
|
const pattern = new RegExp(target + '$')
|
|
|
|
|
return str.replace(pattern, replacement)
|
|
|
|
|
}
|
|
|
|
|
function setTableData<T = Recordable>(values: T[]) {
|
|
|
|
|
dataSourceRef.value = values
|
|
|
|
|
}
|
|
|
|
|