|
@ -844,79 +844,171 @@ const onBlur = async (field, e) => { |
|
|
|
|
|
|
|
|
let formSchemaObj = formSchema.value.find((item) => item.field == field)?.componentProps |
|
|
let formSchemaObj = formSchema.value.find((item) => item.field == field)?.componentProps |
|
|
if (formSchemaObj?.enterSearch) { |
|
|
if (formSchemaObj?.enterSearch) { |
|
|
if (formSchemaObj.verificationPage) { |
|
|
if (formSchemaObj.searchPage) { |
|
|
let searchCondition1 = formSchema.value.find((item) => item.field == field).componentProps |
|
|
//获取data.ts参数信息 |
|
|
.searchCondition //获取data.ts参数信息 |
|
|
let searchCondition = |
|
|
let verificationParams = formSchema.value.find((item) => item.field == field).componentProps |
|
|
formSchema.value.find((item) => item.field == field)?.componentProps?.searchCondition || [] |
|
|
.verificationParams //获取失去焦点参数信息 |
|
|
//获取失去焦点参数信息 |
|
|
|
|
|
let verificationParams = |
|
|
|
|
|
formSchema.value.find((item) => item.field == field)?.componentProps?.verificationParams || |
|
|
|
|
|
[] |
|
|
console.log('走新方法啦') |
|
|
console.log('走新方法啦') |
|
|
|
|
|
searchCondition = [...searchCondition, ...verificationParams] |
|
|
if (e && isString(e)) { |
|
|
if (e && isString(e)) { |
|
|
let setV = {} |
|
|
let setV = {} |
|
|
setV[field] = '' |
|
|
setV[field] = '' |
|
|
let params = {} |
|
|
let params = {} |
|
|
// 循环参数设置参数为key:value格式 |
|
|
// 循环参数设置参数为key:value格式 |
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
// if (searchCondition1 && searchCondition1.length > 0) { |
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
// for (let i = 0; i < searchCondition1.length; i++) { |
|
|
if (searchCondition1[i].isMainValue) { |
|
|
// searchCondition1[i].isSearch = true |
|
|
params[searchCondition1[i].key] = formRef.value.formModel[searchCondition1[i].value] |
|
|
// if (searchCondition1[i].isMainValue) { |
|
|
? formRef.value.formModel[searchCondition1[i].value] |
|
|
// params[searchCondition1[i].key] = formRef.value.formModel[searchCondition1[i].value] |
|
|
|
|
|
// ? formRef.value.formModel[searchCondition1[i].value] |
|
|
|
|
|
// : props.detailData |
|
|
|
|
|
// ? props.detailData[searchCondition1[i].value] |
|
|
|
|
|
// : '' |
|
|
|
|
|
// // 是否含有空参数情况 |
|
|
|
|
|
// let isNull = false |
|
|
|
|
|
// if (params[searchCondition1[i].key] == '' || params[searchCondition1[i].key] == undefined) { |
|
|
|
|
|
// isNull = true |
|
|
|
|
|
// } |
|
|
|
|
|
// if (isNull) { |
|
|
|
|
|
// message.warning( |
|
|
|
|
|
// searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
|
|
|
// ) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } else { |
|
|
|
|
|
// // 扩展 转换为筛选条件进行查询 |
|
|
|
|
|
// if (searchCondition1[i].isSearch) { |
|
|
|
|
|
// if (searchCondition1[i].isFormModel) { |
|
|
|
|
|
// //用formModel中的值 |
|
|
|
|
|
// if (searchCondition1[i].required) { |
|
|
|
|
|
// if ( |
|
|
|
|
|
// formRef.value.formModel[searchCondition1[i].value] == '' || |
|
|
|
|
|
// formRef.value.formModel[searchCondition1[i].value] == undefined |
|
|
|
|
|
// ) { |
|
|
|
|
|
// message.warning( |
|
|
|
|
|
// searchCondition1[i].message |
|
|
|
|
|
// ? searchCondition1[i].message |
|
|
|
|
|
// : '前置条件未选择!' |
|
|
|
|
|
// ) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
|
|
// } else { |
|
|
|
|
|
// params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// 判断查询条件中,是否存在指向主表的数据 |
|
|
|
|
|
const _searchCondition = {} |
|
|
|
|
|
if (searchCondition && searchCondition.length > 0) { |
|
|
|
|
|
// 转换筛选条件所需 |
|
|
|
|
|
let filters: any[] = [] |
|
|
|
|
|
for (var i = 0; i < searchCondition.length; i++) { |
|
|
|
|
|
// searchCondition.forEach((item) => { |
|
|
|
|
|
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
|
|
|
|
|
if (searchCondition[i].isMainValue) { |
|
|
|
|
|
_searchCondition[searchCondition[i].key] = formRef.value.formModel[ |
|
|
|
|
|
searchCondition[i].value |
|
|
|
|
|
] |
|
|
|
|
|
? formRef.value.formModel[searchCondition[i].value] |
|
|
: props.detailData |
|
|
: props.detailData |
|
|
? props.detailData[searchCondition1[i].value] |
|
|
? props.detailData[searchCondition[i].value] |
|
|
|
|
|
: // : row |
|
|
|
|
|
// ? row[searchCondition[i].value] |
|
|
|
|
|
e |
|
|
|
|
|
? e.trim() |
|
|
: '' |
|
|
: '' |
|
|
// 是否含有空参数情况 |
|
|
// 是否含有空参数情况 |
|
|
let isNull = false |
|
|
let isNull = false |
|
|
if (params[searchCondition1[i].key] == '' || params[searchCondition1[i].key] == undefined) { |
|
|
if ( |
|
|
|
|
|
_searchCondition[searchCondition[i].key] == '' || |
|
|
|
|
|
_searchCondition[searchCondition[i].key] == undefined |
|
|
|
|
|
) { |
|
|
isNull = true |
|
|
isNull = true |
|
|
} |
|
|
} |
|
|
if (isNull) { |
|
|
if (isNull) { |
|
|
message.warning( |
|
|
message.warning( |
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
) |
|
|
) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} |
|
|
|
|
|
// else if (searchCondition[i].isTableRowValue) { |
|
|
|
|
|
// if (searchCondition[i].required) { |
|
|
|
|
|
// if (row[searchCondition[i].value] == '' || row[searchCondition[i].value] == undefined) { |
|
|
|
|
|
// message.warning( |
|
|
|
|
|
// searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
|
|
// ) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// row[searchCondition[i].value] |
|
|
|
|
|
// //查询当前table表数据的值 |
|
|
|
|
|
// _searchCondition[searchCondition[i].key] = row[searchCondition[i].value] |
|
|
|
|
|
// } |
|
|
|
|
|
else { |
|
|
// 扩展 转换为筛选条件进行查询 |
|
|
// 扩展 转换为筛选条件进行查询 |
|
|
if (searchCondition1[i].isSearch) { |
|
|
if (searchCondition[i].isSearch) { |
|
|
if (searchCondition1[i].isFormModel) { |
|
|
if (searchCondition[i].isFormModel) { |
|
|
//用formModel中的值 |
|
|
//用formModel中的值 |
|
|
if (searchCondition1[i].required) { |
|
|
if (searchCondition[i].required) { |
|
|
if ( |
|
|
if ( |
|
|
formRef.value.formModel[searchCondition1[i].value] == '' || |
|
|
formRef.value.formModel[searchCondition[i].value] == '' || |
|
|
formRef.value.formModel[searchCondition1[i].value] == undefined |
|
|
formRef.value.formModel[searchCondition[i].value] == undefined |
|
|
) { |
|
|
) { |
|
|
message.warning( |
|
|
message.warning( |
|
|
searchCondition1[i].message |
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
? searchCondition1[i].message |
|
|
|
|
|
: '前置条件未选择!' |
|
|
|
|
|
) |
|
|
) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action, |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: formRef.value.formModel[searchCondition[i].value] |
|
|
|
|
|
? formRef.value.formModel[searchCondition[i].value] |
|
|
|
|
|
: e.trim() |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action, |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: searchCondition[i].value |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (filters.length > 0) { |
|
|
// 循环参数设置参数为key:value格式 |
|
|
_searchCondition.isSearch = true |
|
|
if (verificationParams && verificationParams.length > 0) { |
|
|
_searchCondition.filters = filters |
|
|
for (let i = 0; i < verificationParams.length; i++) { |
|
|
|
|
|
params[verificationParams[i].key] = e?.trim() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
console.log(333,params) |
|
|
let obj = { |
|
|
|
|
|
by: 'ASC', |
|
|
|
|
|
pageNo: 1, |
|
|
|
|
|
pageSize: 20 |
|
|
|
|
|
} |
|
|
|
|
|
params = { ..._searchCondition, ...obj } |
|
|
|
|
|
// console.log(333,params) |
|
|
if (!formSchemaObj?.multiple && e.indexOf(',') > -1) { |
|
|
if (!formSchemaObj?.multiple && e.indexOf(',') > -1) { |
|
|
message.alert('该输入框只能输入一条数据') |
|
|
message.alert('该输入框只能输入一条数据') |
|
|
formRef.value.setValues(setV) |
|
|
formRef.value.setValues(setV) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
await formSchemaObj.verificationPage(params).then((res) => { |
|
|
await formSchemaObj.searchPage(params).then((res) => { |
|
|
let arr1 = e.split(',') |
|
|
let arr1 = e.split(',') |
|
|
let list = ref([]) |
|
|
let list = ref([]) |
|
|
list.value = res |
|
|
list.value = res.list |
|
|
console.log(222, list.value) |
|
|
|
|
|
if (list.value?.length == 0) { |
|
|
if (list.value?.length == 0) { |
|
|
message.alert('暂无数据') |
|
|
message.alert('暂无数据') |
|
|
formRef.value.setValues(setV) |
|
|
formRef.value.setValues(setV) |
|
@ -932,19 +1024,7 @@ const onBlur = async (field, e) => { |
|
|
formRef.value.setValues(setV) |
|
|
formRef.value.setValues(setV) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// emit('searchTableSuccess', formField, searchField, list.value, formRef.value, 'form') |
|
|
|
|
|
// callback(list.value) |
|
|
|
|
|
}) |
|
|
}) |
|
|
// emit( |
|
|
|
|
|
// 'onBlur', |
|
|
|
|
|
// field, |
|
|
|
|
|
// e, |
|
|
|
|
|
// formSchemaObj.componentProps.searchField, |
|
|
|
|
|
// formSchemaObj, |
|
|
|
|
|
// formRef.value, |
|
|
|
|
|
// 'form', |
|
|
|
|
|
// obj |
|
|
|
|
|
// ) |
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if ( |
|
|
if ( |
|
|