Browse Source

HL-5482 盘点计划,输入框之前可以输入多个的,现输入多个提示知恩阁输入一条

hella_online_20240829
zhang_li 3 months ago
parent
commit
167bf35ac1
  1. 157
      src/api/wms/business/inputBlur.ts
  2. 4
      src/api/wms/customer/index.ts
  3. 7
      src/api/wms/locationgroup/index.ts
  4. 5
      src/api/wms/owner/index.ts
  5. 4
      src/api/wms/supplier/index.ts
  6. 1
      src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
  7. 42
      src/views/wms/countManage/count/countPlanMain/index.vue

157
src/api/wms/business/inputBlur.ts

@ -1,19 +1,4 @@
// 获取供应商列表
import { getSupplierListByCodes, importTemplate } from '@/api/wms/supplier'
// 获取物料列表
import { getItemListByCodes } from '@/api/wms/itembasic'
// 获取供应商物料列表
import { getSupplierItemListByCodes } from '@/api/wms/supplieritem'
// 获取生产线物料
import { getProductionLineCodelistByCodes } from '@/api/wms/productionlineitem'
// 获取包装规格
import { getPackageunitListByCodes } from '@/api/wms/packageunit'
// 获取物料包装规格
import { getItemPackageunitListByCodes } from '@/api/wms/itempackage'
// 获取客户物料
import { getCustomerItemListByCodes } from '@/api/wms/customeritem'
// 获取库存余额
import { getBalanceItemListByCodes } from '@/api/wms/balance'
import { isString } from 'min-dash'
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
@ -27,13 +12,14 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
try {
if (headerItem?.tableForm?.searchPage && headerItem?.tableForm?.verificationParams) {
if (val && isString(val)) {
if (val.indexOf(',') > -1) {
if (!headerItem?.tableForm?.multiple && val.indexOf(',') > -1) {
message.alert('该输入框只能输入一条数据')
row[headerItem.field] = ''
return
}
// 校验
const params = ref({})
const params1 = ref({})
const filters: any[] = []
const searchCondition = headerItem.tableForm.searchCondition //获取data.ts参数信息
const verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
@ -41,15 +27,22 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
if (searchCondition && searchCondition.length > 0) {
for (let i = 0; i < searchCondition.length; i++) {
if (searchCondition[i].isMainValue) {
params.value[searchCondition[i].key] = formRef.formModel[
searchCondition[i].value
]
params.value[searchCondition[i].key] =
formRef.formModel[searchCondition[i].value]
? formRef.formModel[searchCondition[i].value]
: detailData
? detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
params1.value[searchCondition[i].key] =
formRef.formModel[searchCondition[i].value]
? formRef.formModel[searchCondition[i].value]
: detailData
? detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
? detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
// 是否含有空参数情况
let isNull = false
if (
@ -78,6 +71,7 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
? row[searchCondition[i].value]
: ''
})
} else if (searchCondition[i].isTableRowValue) {
if (searchCondition[i].required) {
if (row[searchCondition[i].value] == '' || row[searchCondition[i].value] == undefined) {
@ -94,6 +88,7 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
column: searchCondition[i].key,
value: row[searchCondition[i].value]
})
params1.value[searchCondition[i].key] = row[searchCondition[i].value]
} else {
// 扩展 转换为筛选条件进行查询
if (searchCondition[i].isSearch) {
@ -116,12 +111,14 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
column: searchCondition[i].key,
value: formRef.formModel[searchCondition[i].value]
})
params1.value[searchCondition[i].key] = formRef.formModel[searchCondition[i].value]
} else {
filters.push({
action: searchCondition[i].action || '==',
column: searchCondition[i].key,
value: searchCondition[i].value
})
params1.value[searchCondition[i].key] = searchCondition[i].value
}
} else {
filters.push({
@ -129,6 +126,7 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
column: searchCondition[i].key,
value: searchCondition[i].value
})
params1.value[searchCondition[i].key] = searchCondition[i].value
}
}
}
@ -146,18 +144,30 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
? formRef.formModel[verificationParams[i].value]
: val.trim()
})
verificationParams[i].key1 = verificationParams[i].key + 's'
params1.value[verificationParams[i].key1] =
formRef.formModel[verificationParams[i].value]
? formRef.formModel[verificationParams[i].value]
: val.trim()
} else {
filters.push({
action: searchCondition[i].action || '==',
column: searchCondition[i].key,
value: searchCondition[i].value
})
verificationParams[i].key1 = verificationParams[i].key + 's'
params1.value[verificationParams[i].key1] = searchCondition[i].value
}
} else {
params[verificationParams[i].key] = verificationParams[i].value
verificationParams[i].key1 = verificationParams[i].key + 's'
params1.value[verificationParams[i].key1] = verificationParams[i].value
}
}
}
console.log(params1.value)
// 判断代码是否存在
if (!headerItem?.tableForm.isRepeat) {
const seen = new Set()
@ -194,18 +204,45 @@ export const tableFormBlurVer = async (headerItem, val, row, index, routeName, f
...obj
}
const list = ref()
// 调取包装接口
await headerItem.tableForm.searchPage(params.value).then(async (res) => {
if (headerItem?.tableForm?.multiple) {
const pageApi = row.searchTable?.verificationPage ? row.searchTable?.verificationPage : headerItem.tableForm.verificationPage
await pageApi(params1.value).then(async (res) => {
const arr1 = val.split(',')
const list = ref([])
list.value = res?.length > 0 ? res : []
if (list.value?.length == 0) {
message.alert('暂无数据')
formRef.setValues(setV)
return
}
console.log(arr1)
console.log(list.value)
if (arr1.length != list.value.length) {
const arr2 = list.value.map((item) => item.code)
const str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
message.alert('代码' + str + '没有找到对应数据')
formRef.setValues(setV)
return
}
callback(list.value)
})
} else {
// 调取包装接口
await headerItem.tableForm.searchPage(params.value).then(async (res) => {
list.value = res?.list?.length > 0 ? res.list.slice(0, 1) : []
// 只查一条数据,多条数据查询默认显示不存在
if (list.value?.length == 0) {
message.alert('代码' + row[headerItem.field] + '没有找到对应数据')
row[headerItem.field] = ''
return
}
callback(list.value)
})
list.value = res?.list?.length > 0 ? res.list.slice(0, 1) : []
// 只查一条数据,多条数据查询默认显示不存在
if (list.value?.length == 0) {
message.alert('代码' + row[headerItem.field] + '没有找到对应数据')
row[headerItem.field] = ''
return
}
callback(list.value)
})
}
}
}
} catch {
@ -392,31 +429,31 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS
}
} else {
if (val && isString(val)) {
await formSchema.verificationPage({
codes:val
}).then((res) => {
const arr1 = val.split(',')
const list = ref([])
list.value = res?.length > 0 ? res : []
if (list.value?.length == 0) {
message.alert('暂无数据')
formRef.setValues(setV)
return
}
console.log(arr1)
console.log(list.value)
if (arr1.length != list.value.length) {
const arr2 = list.value.map((item) => item.code)
const str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
message.alert('代码' + str + '没有找到对应数据')
formRef.setValues(setV)
return
}
callback(list.value)
})
await formSchema.verificationPage({
codes: val
}).then((res) => {
const arr1 = val.split(',')
const list = ref([])
list.value = res?.length > 0 ? res : []
if (list.value?.length == 0) {
message.alert('暂无数据')
formRef.setValues(setV)
return
}
console.log(arr1)
console.log(list.value)
if (arr1.length != list.value.length) {
const arr2 = list.value.map((item) => item.code)
const str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
message.alert('代码' + str + '没有找到对应数据')
formRef.setValues(setV)
return
}
callback(list.value)
})
}
}
}

4
src/api/wms/customer/index.ts

@ -69,3 +69,7 @@ export const exportCustomer = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/wms/customer/get-import-template' })
}
export const getCustomerByCodes = async (params) => {
return await request.get({ url: `/wms/customer/listByCodes`, params })
}

7
src/api/wms/locationgroup/index.ts

@ -60,4 +60,9 @@ export const exportLocationgroup = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/locationgroup/get-import-template' })
}
}
// 根据code获取数据列表
export const getLocationgroupByCodes = async (params) => {
return await request.get({ url: `/wms/locationgroup/listByCodes`, params })
}

5
src/api/wms/owner/index.ts

@ -68,4 +68,9 @@ export const exportOwner = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/owner/get-import-template' })
}
// 根据code获取数据列表
export const getOwnerByCodes = async (params) => {
return await request.get({ url: `/wms/owner/listByCodes`, params })
}

4
src/api/wms/supplier/index.ts

@ -95,7 +95,7 @@ export const importTemplate = () => {
}
// 根据code获取数据列表
export const getSupplierListByCodes = async (codes: string) => {
return await request.get({ url: `/wms/supplier/listByCodes?codes=` + codes })
export const getSupplierListByCodes = async (params) => {
return await request.get({ url: `/wms/supplier/listByCodes`, params })
}

1
src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts

@ -802,6 +802,7 @@ export const CountPlanDetail = useCrudSchemas(<CrudSchema[]>([
searchTitle: '物料信息',
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
verificationPage: ItembasicApi.getItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法
searchCondition: [
{
key: 'available',

42
src/views/wms/countManage/count/countPlanMain/index.vue

@ -509,6 +509,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '货主信息'
item.componentProps.searchAllSchemas = Owner.allSchemas
item.componentProps.searchPage = OwnerApi.getOwnerPage
item.componentProps.verificationPage=OwnerApi.getOwnerByCodes
}
})
break
@ -519,6 +520,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '供应商信息'
item.componentProps.searchAllSchemas = Supplier.allSchemas
item.componentProps.searchPage = SupplierApi.getSupplierPage
item.componentProps.verificationPage=SupplierApi.getSupplierListByCodes
}
})
break
@ -529,6 +531,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '客戶信息'
item.componentProps.searchAllSchemas = Customer.allSchemas
item.componentProps.searchPage = CustomerApi.getCustomerPage
item.componentProps.verificationPage=CustomerApi.getCustomerByCodes
}
})
break
@ -569,6 +572,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '物品信息'
item.componentProps.searchAllSchemas = Itembasic.allSchemas
item.componentProps.searchPage = ItembasicApi.getItembasicPage
item.componentProps.verificationPage=ItembasicApi.getItemListByCodes
}
})
break
@ -579,6 +583,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '仓库信息'
item.componentProps.searchAllSchemas = Warehouse.allSchemas
item.componentProps.searchPage = WarehouseApi.getWarehousePage
item.componentProps.verificationPage=WarehouseApi.getWarehouseByCodes
}
})
break
@ -589,6 +594,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '库区信息'
item.componentProps.searchAllSchemas = Area.allSchemas
item.componentProps.searchPage = AreaApi.getAreaPage
item.componentProps.verificationPage=AreaApi.getAreabasicByCodes
}
})
break
@ -599,6 +605,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Locationgroup.allSchemas
item.componentProps.searchPage = LocationgroupApi.getLocationgroupPage
item.componentProps.verificationPage=LocationgroupApi.getLocationgroupByCodes
}
})
break
@ -609,6 +616,7 @@ const detailOpenForm = (type, row) => {
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Location.allSchemas
item.componentProps.searchPage = LocationApi.getLocationPage
item.componentProps.verificationPage=LocationApi.getLocationByCodes
}
})
break
@ -837,6 +845,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '货主信息'
item.componentProps.searchAllSchemas = Owner.allSchemas
item.componentProps.searchPage = OwnerApi.getOwnerPage
item.componentProps.verificationPage = OwnerApi.getOwnerByCodes
}
})
break
@ -847,6 +856,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '供应商信息'
item.componentProps.searchAllSchemas = Supplier.allSchemas
item.componentProps.searchPage = SupplierApi.getSupplierPage
item.componentProps.verificationPage = SupplierApi.getSupplierListByCodes
}
})
break
@ -857,6 +867,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '客戶信息'
item.componentProps.searchAllSchemas = Customer.allSchemas
item.componentProps.searchPage = CustomerApi.getCustomerPage
item.componentProps.verificationPage = CustomerApi.getCustomerByCodes
}
})
break
@ -897,6 +908,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '物品信息'
item.componentProps.searchAllSchemas = Itembasic.allSchemas
item.componentProps.searchPage = ItembasicApi.getItembasicPage
item.componentProps.verificationPage = ItembasicApi.getItemListByCodes
}
})
break
@ -907,6 +919,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '仓库信息'
item.componentProps.searchAllSchemas = Warehouse.allSchemas
item.componentProps.searchPage = WarehouseApi.getWarehousePage
item.componentProps.verificationPage = WarehouseApi.getWarehouseByCodes
}
})
break
@ -917,6 +930,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '库区信息'
item.componentProps.searchAllSchemas = Area.allSchemas
item.componentProps.searchPage = AreaApi.getAreaPage
item.componentProps.verificationPage = AreaApi.getAreabasicByCodes
}
})
break
@ -927,6 +941,7 @@ const selectChangeDetail = (field, val) => {
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Locationgroup.allSchemas
item.componentProps.searchPage = LocationgroupApi.getLocationgroupPage
item.componentProps.verificationPage = LocationgroupApi.getLocationgroupByCodes
}
})
break
@ -934,9 +949,10 @@ const selectChangeDetail = (field, val) => {
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '库位信息'
item.componentProps.searchTitle = '库位信息'
item.componentProps.searchAllSchemas = Location.allSchemas
item.componentProps.searchPage = LocationApi.getLocationPage
item.componentProps.verificationPage = LocationApi.getLocationByCodes
}
})
break
@ -972,7 +988,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '货主信息',
searchAllSchemas: Owner.allSchemas,
searchPage: OwnerApi.getOwnerPage
searchPage: OwnerApi.getOwnerPage,
verificationPage:ItembasicApi.getItemListByCodes
}
break
case 'SUPPLIER':
@ -980,7 +997,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '供应商信息',
searchAllSchemas: Supplier.allSchemas,
searchPage: SupplierApi.getSupplierPage
searchPage: SupplierApi.getSupplierPage,
verificationPage:SupplierApi.getSupplierListByCodes
}
break
case 'CUSTOMER':
@ -988,7 +1006,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '客戶信息',
searchAllSchemas: Customer.allSchemas,
searchPage: CustomerApi.getCustomerPage
searchPage: CustomerApi.getCustomerPage,
verificationPage:CustomerApi.getCustomerByCodes
}
break
case 'ABC':
@ -1029,7 +1048,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '物品信息',
searchAllSchemas: Itembasic.allSchemas,
searchPage: ItembasicApi.getItembasicPage
searchPage: ItembasicApi.getItembasicPage,
verificationPage:ItembasicApi.getItemListByCodes
}
break
@ -1038,7 +1058,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '仓库信息',
searchAllSchemas: Warehouse.allSchemas,
searchPage: WarehouseApi.getWarehousePage
searchPage: WarehouseApi.getWarehousePage,
verificationPage:WarehouseApi.getWarehouseByCodes
}
break
case 'AREA_CODE':
@ -1046,7 +1067,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '库区信息',
searchAllSchemas: Area.allSchemas,
searchPage: AreaApi.getAreaPage
searchPage: AreaApi.getAreaPage,
verificationPage:AreaApi.getAreabasicByCodes
}
break
case 'LOCATIONGROUP_CODE':
@ -1054,7 +1076,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '库位组信息',
searchAllSchemas: Locationgroup.allSchemas,
searchPage: LocationgroupApi.getLocationgroupPage
searchPage: LocationgroupApi.getLocationgroupPage,
verificationPage:LocationgroupApi.getLocationgroupByCodes
}
break
case 'LOCATION_CODE':
@ -1062,7 +1085,8 @@ const tableFormChange = async (field, val, row) => {
isInpuFocusShow: true,
searchTitle: '库位组信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.getLocationPage
searchPage: LocationApi.getLocationPage,
verificationPage:LocationApi.getLocationByCodes
}
break
}

Loading…
Cancel
Save