|
|
@ -742,15 +742,14 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS |
|
|
|
|
|
|
|
// 根据下方输入框失去焦点校验信息
|
|
|
|
export const getListByBottonInput = async (headerItem, val, row, routeName, formRef, detailData, tableData, callback) => { |
|
|
|
let tableFormSchemaObj = headerItem?.tableForm |
|
|
|
const tableFormSchemaObj = headerItem?.tableForm |
|
|
|
console.log(333, tableFormSchemaObj) |
|
|
|
if (tableFormSchemaObj.searchPage && tableFormSchemaObj.verificationParams) { |
|
|
|
if (!val) return; |
|
|
|
let params = ref({}) |
|
|
|
let list = ref([]) |
|
|
|
console.log(3344) |
|
|
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
|
let verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
|
|
|
|
const params = ref({}) |
|
|
|
const list = ref([]) |
|
|
|
const searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
|
const verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
|
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
@ -813,7 +812,6 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(999, verificationParams) |
|
|
|
if (verificationParams && verificationParams.length > 0) { |
|
|
|
for (let i = 0; i < verificationParams.length; i++) { |
|
|
|
console.log(54565, verificationParams[i].key) |
|
|
@ -821,23 +819,10 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form |
|
|
|
params.value[verificationParams[i].key1] = val |
|
|
|
} |
|
|
|
} |
|
|
|
await tableFormSchemaObj.verificationPage(params.value).then(async (res) => { |
|
|
|
list.value = res ? res : [] |
|
|
|
let arr1 = val.split(',').map(item => item.trim()) |
|
|
|
if (arr1.length != res.length) { |
|
|
|
let arr2 = res.map((item) => item[headerItem.tableForm.searchField]) |
|
|
|
let str = [ |
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
].join(',') |
|
|
|
console.log(arr1.filter((item) => arr2.includes(item))) |
|
|
|
console.log(22, str) |
|
|
|
if (str) { |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
let repeatCode = [] |
|
|
|
const arr1 = val.split(',').map(item => item.trim()) |
|
|
|
// 判断代码是否存在
|
|
|
|
if (!headerItem?.tableForm.isRepeat) { |
|
|
|
const repeatCode = [] |
|
|
|
if (tableData.length > 0) { |
|
|
|
tableData.forEach((item) => { |
|
|
|
const findIndex = arr1.findIndex(valItem => valItem == item[headerItem.field]) |
|
|
@ -851,15 +836,31 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form |
|
|
|
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log(list.value) |
|
|
|
} |
|
|
|
await tableFormSchemaObj.verificationPage(params.value).then(async (res) => { |
|
|
|
list.value = res ? res : [] |
|
|
|
if (arr1.length != res.length) { |
|
|
|
const arr2 = res.map((item) => item[headerItem.tableForm.searchField]) |
|
|
|
const str = [ |
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
].join(',') |
|
|
|
console.log(arr1.filter((item) => arr2.includes(item))) |
|
|
|
console.log(22, str) |
|
|
|
if (str) { |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
callback(list.value) |
|
|
|
}) |
|
|
|
return |
|
|
|
} else { |
|
|
|
let pageApi = ref() |
|
|
|
let params = ref({}) |
|
|
|
let list = ref([]) |
|
|
|
let field = 'itemCode' |
|
|
|
const pageApi = ref() |
|
|
|
const params = ref({}) |
|
|
|
const list = ref([]) |
|
|
|
const field = 'itemCode' |
|
|
|
// scp采购订单
|
|
|
|
if (!val) return; |
|
|
|
|
|
|
@ -904,17 +905,17 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form |
|
|
|
|
|
|
|
await pageApi.value(params.value).then(async (res) => { |
|
|
|
list.value = res ? res : [] |
|
|
|
let arr1 = val.split(',').map(item => item.trim()) |
|
|
|
const arr1 = val.split(',').map(item => item.trim()) |
|
|
|
if (arr1.length != res.length) { |
|
|
|
let arr2 = res.map((item) => item[field]) |
|
|
|
let str = [ |
|
|
|
const arr2 = res.map((item) => item[field]) |
|
|
|
const str = [ |
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
].join(',') |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
return |
|
|
|
} else { |
|
|
|
let repeatCode = [] |
|
|
|
const repeatCode = [] |
|
|
|
if (tableData.length > 0) { |
|
|
|
tableData.forEach((item) => { |
|
|
|
const findIndex = arr1.findIndex(valItem => valItem == item[field]) |
|
|
|