From 2b44edc47d57e0e9ea3f1c92841c9cd5d57e53c2 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Mon, 22 Jul 2024 10:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=94=E7=A6=BB=E9=80=80=E6=96=99=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E3=80=81=E7=94=9F=E4=BA=A7=E9=80=80=E6=96=99=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=EF=BC=8C=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E5=B7=A5=E4=BD=8D=E6=8F=90=E7=A4=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=B7=B2=E5=AD=98=E5=9C=A8=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E5=8F=AF=E4=BB=A5=E5=A4=9A=E6=AC=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E5=BA=93=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +- src/api/wms/business/inputBlur.ts | 67 ++++++++++--------- .../productionreturnRequestMain.data.ts | 1 + .../productionreturnRequestMainNo.data.ts | 1 + 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index bd3e22726..ba558fa04 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ form: { isMainValue: false // 表示查询条件不是主表的字段的值 } ], + isRepeat: true,//是否可以重复添加该条数据 // 失去焦点校验参数 verificationParams: [{ key: 'code', @@ -55,7 +56,7 @@ form: { value: '', isMainValue: false, isSearch: 'true', - isFormModel: true + isFormModel: true, }] } } diff --git a/src/api/wms/business/inputBlur.ts b/src/api/wms/business/inputBlur.ts index c72f0dec7..5e9c76105 100644 --- a/src/api/wms/business/inputBlur.ts +++ b/src/api/wms/business/inputBlur.ts @@ -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]) diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts index 17a4a832a..ab6f84822 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts @@ -628,6 +628,7 @@ export const ProductionreturnRequestDetail = useCrudSchemas(reactive