fix: 修复雪花算法ID精度丢失问题

main
zhongwenkai 1 week ago
parent 6c723087c0
commit 208778df3f

@ -2,8 +2,8 @@ import request from '@/config/axios'
// ERP 产品分类 VO // ERP 产品分类 VO
export interface ProductCategoryVO { export interface ProductCategoryVO {
id: number // 分类编号 id?: number | string // 分类编号
parentId: number // 父分类编号 parentId?: number | string // 父分类编号
name: string // 分类名称 name: string // 分类名称
code: string // 分类编码 code: string // 分类编码
sort: number // 分类排序 sort: number // 分类排序
@ -34,7 +34,7 @@ export const ProductCategoryApi = {
}, },
// 查询产品分类详情 // 查询产品分类详情
getProductCategory: async (id: number) => { getProductCategory: async (id: number | string) => {
return await request.get({ url: `/erp/product-category/get?id=` + id }) return await request.get({ url: `/erp/product-category/get?id=` + id })
}, },
@ -49,7 +49,7 @@ export const ProductCategoryApi = {
}, },
// 删除产品分类 // 删除产品分类
deleteProductCategory: async (id: number) => { deleteProductCategory: async (id: number | string) => {
return await request.delete({ url: `/erp/product-category/delete?id=` + id }) return await request.delete({ url: `/erp/product-category/delete?id=` + id })
}, },

@ -2,16 +2,16 @@ import request from '@/config/axios'
// ERP 产品 VO // ERP 产品 VO
export interface ProductVO { export interface ProductVO {
id: number // 产品编号 id?: number | string // 产品编号
name: string // 产品名称 name: string // 产品名称
barCode: string // 产品条码 barCode: string // 产品条码
isCode?: boolean isCode?: boolean
qrcodeUrl?: string qrcodeUrl?: string
templateJson?: string | any templateJson?: string | any
categoryId: number // 产品类型编号 categoryId?: number | string // 产品类型编号
subCategoryId: number // 产品类型子类编号 subCategoryId?: number | string // 产品类型子类编号
subCategoryName: string // 产品类型子类名称 subCategoryName: string // 产品类型子类名称
unitId: number // 单位编号 unitId?: number | string // 单位编号
unitName?: string // 单位名字 unitName?: string // 单位名字
status: number // 产品状态 status: number // 产品状态
standard: string // 产品规格 standard: string // 产品规格
@ -23,19 +23,19 @@ export interface ProductVO {
minPrice: number // 最低价格,单位:元 minPrice: number // 最低价格,单位:元
deviceIds?: string // 关联设备ID列表 deviceIds?: string // 关联设备ID列表
moldIds?: string // 关联模具ID列表 moldIds?: string // 关联模具ID列表
devices?: { id: number; name: string }[] // 关联设备列表 devices?: { id: number | string; name: string }[] // 关联设备列表
molds?: { id: number; name: string }[] // 关联模具列表 molds?: { id: number | string; name: string }[] // 关联模具列表
deviceList?: any[] deviceList?: any[]
moldList?: any[] moldList?: any[]
} }
export interface ErpProductCategoryProcessRouteItemRespVO { export interface ErpProductCategoryProcessRouteItemRespVO {
id?: number id?: number | string
categoryId?: number categoryId?: number | string
processRouteId?: number processRouteId?: number | string
processRouteItemId?: number processRouteItemId?: number | string
sort?: number sort?: number
processParameterId?: number processParameterId?: number | string
processParameterCode?: string processParameterCode?: string
processParameterName?: string processParameterName?: string
remark?: string remark?: string
@ -44,8 +44,8 @@ export interface ErpProductCategoryProcessRouteItemRespVO {
} }
export interface ErpProductProcessRouteRespVO { export interface ErpProductProcessRouteRespVO {
productId?: number productId?: number | string
processRouteId?: number processRouteId?: number | string
processRouteName?: string processRouteName?: string
processRouteItems?: ErpProductCategoryProcessRouteItemRespVO[] processRouteItems?: ErpProductCategoryProcessRouteItemRespVO[]
} }
@ -83,7 +83,7 @@ export const ProductApi = {
}, },
// 查询产品详情 // 查询产品详情
getProduct: async (id: number) => { getProduct: async (id: number | string) => {
return await request.get({ url: `/erp/product/get?id=` + id }) return await request.get({ url: `/erp/product/get?id=` + id })
}, },
@ -98,14 +98,14 @@ export const ProductApi = {
}, },
// 刷新产品二维码 // 刷新产品二维码
regenerateCode: async (id: number, code: string) => { regenerateCode: async (id: number | string, code: string) => {
return await request.post({ return await request.post({
url: `/erp/product/regenerate-code?id=${id}&code=${encodeURIComponent(code)}` url: `/erp/product/regenerate-code?id=${id}&code=${encodeURIComponent(code)}`
}) })
}, },
// 删除产品 // 删除产品
deleteProduct: async (id: number) => { deleteProduct: async (id: number | string) => {
return await request.delete({ url: `/erp/product/delete?id=` + id }) return await request.delete({ url: `/erp/product/delete?id=` + id })
}, },

@ -199,7 +199,7 @@ watch(() => operateFormData.deviceId, async (deviceId) => {
displayTopCategory.value = detail?.topCategoryName || '' displayTopCategory.value = detail?.topCategoryName || ''
// fallback: 线 // fallback: 线
if (!displayTopCategory.value && detail?.deviceLine != null && deviceLineTree.value.length) { if (!displayTopCategory.value && detail?.deviceLine != null && deviceLineTree.value.length) {
const lineId = Number(detail.deviceLine) const lineId = String(detail.deviceLine)
const containsId = (nodes: DeviceLineTreeVO[] | undefined, id: number): boolean => { const containsId = (nodes: DeviceLineTreeVO[] | undefined, id: number): boolean => {
if (!nodes) return false if (!nodes) return false
return nodes.some((n) => n.id === id || containsId(n.children, id)) return nodes.some((n) => n.id === id || containsId(n.children, id))

@ -526,7 +526,7 @@ const message = useMessage()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const MoldListComp = defineAsyncComponent(() => import('../components/MoldList.vue') as any) const MoldListComp = defineAsyncComponent(() => import('../components/MoldList.vue') as any)
const brandId = computed(() => Number(route.params.id)) const brandId = computed(() => String(route.params.id || ''))
const detailLoading = ref(false) const detailLoading = ref(false)
const detailData = ref<(MoldBrandVO & Record<string, any>) | null>(null) const detailData = ref<(MoldBrandVO & Record<string, any>) | null>(null)
const childMolds = ref<any[]>([]) const childMolds = ref<any[]>([])
@ -871,7 +871,7 @@ const getChildMolds = async () => {
const collectByChildMolds = async (worker: (moldId: number) => Promise<any>, mergeList = true) => { const collectByChildMolds = async (worker: (moldId: number) => Promise<any>, mergeList = true) => {
const molds = childMolds.value.length ? childMolds.value : await getChildMolds() const molds = childMolds.value.length ? childMolds.value : await getChildMolds()
const ids = molds.map((item) => Number(item.id)).filter(Boolean) const ids = molds.map((item) => String(item.id)).filter(Boolean)
if (!ids.length) return [] if (!ids.length) return []
const results = await Promise.all(ids.map((id) => worker(id).catch(() => []))) const results = await Promise.all(ids.map((id) => worker(id).catch(() => [])))
return mergeList ? results.flat() : results return mergeList ? results.flat() : results

@ -520,7 +520,7 @@ const repairGroups = computed<RepairHistoryGroup[]>(() => {
}) })
const fetchRepairHistory = async () => { const fetchRepairHistory = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) return if (!id) return
const params: any = { moldId: id } const params: any = { moldId: id }
if (repairDateRange.value && repairDateRange.value.length === 2) { if (repairDateRange.value && repairDateRange.value.length === 2) {
@ -532,7 +532,7 @@ const fetchRepairHistory = async () => {
} }
const handleQueryRepair = async () => { const handleQueryRepair = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -541,7 +541,7 @@ const handleQueryRepair = async () => {
} }
const handleResetRepair = async () => { const handleResetRepair = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -551,7 +551,7 @@ const handleResetRepair = async () => {
} }
const handleExportRepair = async () => { const handleExportRepair = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -571,7 +571,7 @@ const handleExportRepair = async () => {
} }
const fetchMaintainHistory = async () => { const fetchMaintainHistory = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) return if (!id) return
const params: any = { moldId: id } const params: any = { moldId: id }
if (maintainDateRange.value && maintainDateRange.value.length === 2) { if (maintainDateRange.value && maintainDateRange.value.length === 2) {
@ -583,7 +583,7 @@ const fetchMaintainHistory = async () => {
} }
const handleQueryMaintain = async () => { const handleQueryMaintain = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -592,7 +592,7 @@ const handleQueryMaintain = async () => {
} }
const handleResetMaintain = async () => { const handleResetMaintain = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -602,7 +602,7 @@ const handleResetMaintain = async () => {
} }
const handleExportMaintain = async () => { const handleExportMaintain = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -622,7 +622,7 @@ const handleExportMaintain = async () => {
} }
const fetchInspectionHistory = async () => { const fetchInspectionHistory = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) return if (!id) return
const params: any = { moldId: id } const params: any = { moldId: id }
if (inspectionDateRange.value && inspectionDateRange.value.length === 2) { if (inspectionDateRange.value && inspectionDateRange.value.length === 2) {
@ -634,7 +634,7 @@ const fetchInspectionHistory = async () => {
} }
const handleQueryInspection = async () => { const handleQueryInspection = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -643,7 +643,7 @@ const handleQueryInspection = async () => {
} }
const handleResetInspection = async () => { const handleResetInspection = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -653,7 +653,7 @@ const handleResetInspection = async () => {
} }
const handleExportInspection = async () => { const handleExportInspection = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
return return
@ -677,7 +677,7 @@ const close = () => {
} }
const getDetail = async () => { const getDetail = async () => {
const id = Number(route.params.id) const id = String(route.params.id || '')
if (!id) { if (!id) {
message.error('参数错误,模具不能为空') message.error('参数错误,模具不能为空')
close() close()

@ -441,9 +441,9 @@ onMounted(async () => {
// //
const { operateType: queryOperateType, moldId: queryMoldId } = route.query const { operateType: queryOperateType, moldId: queryMoldId } = route.query
if (queryOperateType && queryMoldId) { if (queryOperateType && queryMoldId) {
const moldRow = list.value.find((item) => item.id === Number(queryMoldId)) const moldRow = list.value.find((item) => String(item.id) === String(queryMoldId))
if (moldRow) { if (moldRow) {
await openOperateForm(Number(queryOperateType), moldRow) await openOperateForm(String(queryOperateType), moldRow)
} }
// query // query
push({ path: route.path }) push({ path: route.path })

@ -258,10 +258,10 @@ const selectedProcessRouteId = ref<string | number | undefined>()
const selectedProcessRouteRow = ref<ProcessRouteVO | undefined>() const selectedProcessRouteRow = ref<ProcessRouteVO | undefined>()
const processRouteDisplayName = computed(() => { const processRouteDisplayName = computed(() => {
if (!formData.value.processRouteId) return '' if (formData.value.processRouteId == null) return ''
return formData.value.processRouteName || String(formData.value.processRouteId) return formData.value.processRouteName || String(formData.value.processRouteId)
}) })
const isProductType = computed(() => Number(formData.value.type) === 1) const isProductType = computed(() => String(formData.value.type) === '1')
const isEnabledProcessRoute = (row?: ProcessRouteVO) => { const isEnabledProcessRoute = (row?: ProcessRouteVO) => {
if (!row) return false if (!row) return false
@ -270,7 +270,7 @@ const isEnabledProcessRoute = (row?: ProcessRouteVO) => {
} }
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number, defaultData?: any) => { const open = async (type: string, id?: string | number, defaultData?: any) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
@ -352,9 +352,9 @@ const handleTypeChange = async () => {
} }
const syncProcessRouteName = async () => { const syncProcessRouteName = async () => {
if (!formData.value.processRouteId || formData.value.processRouteName) return if (formData.value.processRouteId == null || formData.value.processRouteName) return
try { try {
const data = await ProcessRouteApi.getProcessRoute(Number(formData.value.processRouteId)) const data = await ProcessRouteApi.getProcessRoute(formData.value.processRouteId)
formData.value.processRouteName = data?.name formData.value.processRouteName = data?.name
} catch {} } catch {}
} }
@ -378,9 +378,9 @@ const getProcessRouteList = async () => {
const openProcessRouteDialog = async () => { const openProcessRouteDialog = async () => {
selectedProcessRouteId.value = undefined selectedProcessRouteId.value = undefined
selectedProcessRouteRow.value = undefined selectedProcessRouteRow.value = undefined
if (formData.value.processRouteId) { if (formData.value.processRouteId != null) {
try { try {
const data = await ProcessRouteApi.getProcessRoute(Number(formData.value.processRouteId)) const data = await ProcessRouteApi.getProcessRoute(formData.value.processRouteId)
if (isEnabledProcessRoute(data)) { if (isEnabledProcessRoute(data)) {
selectedProcessRouteId.value = formData.value.processRouteId selectedProcessRouteId.value = formData.value.processRouteId
selectedProcessRouteRow.value = data selectedProcessRouteRow.value = data

@ -435,10 +435,10 @@ const formData = ref({
salePrice: undefined, salePrice: undefined,
minPrice: undefined, minPrice: undefined,
safetyNumber: undefined, safetyNumber: undefined,
devices: [] as { id: number; name: string }[], devices: [] as { id: string | number; name: string }[],
molds: [] as { id: number; name: string }[], molds: [] as { id: string | number; name: string }[],
packagingSchemes: [] as { packagingSchemeId: number | undefined; defaultStatus: number }[], packagingSchemes: [] as { packagingSchemeId: string | number | undefined; defaultStatus: number }[],
suppliers: [] as { supplierId: number | undefined; defaultStatus: number }[], suppliers: [] as { supplierId: string | number | undefined; defaultStatus: number }[],
fragileFlag: undefined as number | undefined, fragileFlag: undefined as number | undefined,
purchaseCycle: undefined as number | undefined, purchaseCycle: undefined as number | undefined,
brand: undefined as string | undefined, brand: undefined as string | undefined,
@ -450,13 +450,13 @@ const formData = ref({
}) })
const selectedDeviceRows = ref<any[]>([]) const selectedDeviceRows = ref<any[]>([])
const selectedMoldRows = ref<any[]>([]) const selectedMoldRows = ref<any[]>([])
const findCategoryNameById = (id: number | undefined, tree: any[]): string => { const findCategoryNameById = (id: string | number | undefined, tree: any[]): string => {
if (!id || !Array.isArray(tree) || !tree.length) return '' if (id == null || !Array.isArray(tree) || !tree.length) return ''
const queue = [...tree] const queue = [...tree]
while (queue.length) { while (queue.length) {
const node = queue.shift() const node = queue.shift()
if (!node) continue if (!node) continue
if (Number(node.id) === Number(id)) { if (String(node.id) === String(id)) {
return String(node.name || node.label || '') return String(node.name || node.label || '')
} }
if (Array.isArray(node.children) && node.children.length) { if (Array.isArray(node.children) && node.children.length) {
@ -467,7 +467,7 @@ const findCategoryNameById = (id: number | undefined, tree: any[]): string => {
} }
const selectedCategoryName = computed(() => findCategoryNameById(formData.value.categoryId as any, categoryList.value)) const selectedCategoryName = computed(() => findCategoryNameById(formData.value.categoryId as any, categoryList.value))
const isProductCategory = computed(() => selectedCategoryName.value === '产品') const isProductCategory = computed(() => selectedCategoryName.value === '产品')
const getRelationName = (item: Record<string, any>, nameKeys: string[], fallbackPrefix: string, id: number) => { const getRelationName = (item: Record<string, any>, nameKeys: string[], fallbackPrefix: string, id: string | number) => {
for (const key of nameKeys) { for (const key of nameKeys) {
const value = item[key] const value = item[key]
if (value !== undefined && value !== null && String(value).trim() !== '') { if (value !== undefined && value !== null && String(value).trim() !== '') {
@ -481,11 +481,10 @@ const normalizeRelationList = (
fallbackRows: any[] | undefined, fallbackRows: any[] | undefined,
nameKeys: string[], nameKeys: string[],
fallbackPrefix: string fallbackPrefix: string
): { id: number; name: string }[] => { ): { id: string | number; name: string }[] => {
const fallbackMap = new Map<number, string>() const fallbackMap = new Map<string | number, string>()
; (fallbackRows || []).forEach((row) => { ; (fallbackRows || []).forEach((row) => {
const id = Number(row?.id) const id = String(row?.id)
if (!Number.isFinite(id)) return
fallbackMap.set(id, getRelationName(row, nameKeys, fallbackPrefix, id)) fallbackMap.set(id, getRelationName(row, nameKeys, fallbackPrefix, id))
}) })
const parseArray = (source: unknown): any[] => { const parseArray = (source: unknown): any[] => {
@ -505,30 +504,31 @@ const normalizeRelationList = (
return parseArray(value) return parseArray(value)
.map((item) => { .map((item) => {
if (typeof item === 'object' && item !== null) { if (typeof item === 'object' && item !== null) {
const id = Number((item as any).id) const rawId = (item as any).id
if (!Number.isFinite(id)) return undefined if (rawId == null) return undefined
const id = rawId
return { return {
id, id,
name: getRelationName(item as any, nameKeys, fallbackPrefix, id) name: getRelationName(item as any, nameKeys, fallbackPrefix, id)
} }
} }
const id = Number(item) const rawId = String(item).trim()
if (!Number.isFinite(id)) return undefined if (!rawId) return undefined
return { return {
id, id: rawId,
name: fallbackMap.get(id) || `${fallbackPrefix}ID:${id}` name: fallbackMap.get(rawId) || `${fallbackPrefix}ID:${rawId}`
} }
}) })
.filter((item): item is { id: number; name: string } => Boolean(item)) .filter((item): item is { id: string | number; name: string } => Boolean(item))
} }
const toDeviceRows = (devices: { id: number; name: string }[]) => { const toDeviceRows = (devices: { id: string | number; name: string }[]) => {
return devices.map((item) => ({ return devices.map((item) => ({
id: item.id, id: item.id,
deviceName: item.name, deviceName: item.name,
name: item.name name: item.name
})) }))
} }
const toMoldRows = (molds: { id: number; name: string }[]) => { const toMoldRows = (molds: { id: string | number; name: string }[]) => {
return molds.map((item) => ({ return molds.map((item) => ({
id: item.id, id: item.id,
name: item.name name: item.name
@ -565,7 +565,7 @@ const fetchDeviceLedgerPage = (params: Record<string, any>) => {
} }
const openDeviceSelectDialog = () => { const openDeviceSelectDialog = () => {
const rows = selectedDeviceRows.value.length const rows = selectedDeviceRows.value.length
? selectedDeviceRows.value.map((item) => ({ ...item, id: Number(item.id) })) ? selectedDeviceRows.value.map((item) => ({ ...item, id: String(item.id) }))
: toDeviceRows(formData.value.devices) : toDeviceRows(formData.value.devices)
deviceSelectDialogRef.value?.open(rows) deviceSelectDialogRef.value?.open(rows)
} }
@ -578,27 +578,25 @@ const openMoldSelectDialog = () => {
const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => {
formData.value.devices = payload.rows formData.value.devices = payload.rows
.map((item) => { .map((item) => {
const id = Number(item.id) const id = String(item.id)
if (!Number.isFinite(id)) return undefined
return { return {
id, id,
name: item.deviceName || item.name || item.code || `设备ID:${id}` name: item.deviceName || item.name || item.code || `设备ID:${id}`
} }
}) })
.filter((item): item is { id: number; name: string } => Boolean(item)) .filter((item): item is { id: string | number; name: string } => Boolean(item))
selectedDeviceRows.value = payload.rows selectedDeviceRows.value = payload.rows
} }
const handleMoldSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { const handleMoldSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => {
formData.value.molds = payload.rows formData.value.molds = payload.rows
.map((item) => { .map((item) => {
const id = Number(item.id) const id = String(item.id)
if (!Number.isFinite(id)) return undefined
return { return {
id, id,
name: item.name || item.code || `模具ID:${id}` name: item.name || item.code || `模具ID:${id}`
} }
}) })
.filter((item): item is { id: number; name: string } => Boolean(item)) .filter((item): item is { id: string | number; name: string } => Boolean(item))
selectedMoldRows.value = payload.rows selectedMoldRows.value = payload.rows
} }
const validateBarCode = (_rule, value, callback) => { const validateBarCode = (_rule, value, callback) => {
@ -935,7 +933,7 @@ const supplierList = ref<any[]>([])
let openRequestId = 0 let openRequestId = 0
const open = async (type: string, id?: number) => { const open = async (type: string, id?: string | number) => {
const currentOpenId = ++openRequestId const currentOpenId = ++openRequestId
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
@ -1114,8 +1112,8 @@ const handleQrcodeRefreshSuccess = async (data: any) => {
formData.value.barCode = productData?.barCode ?? formData.value.barCode formData.value.barCode = productData?.barCode ?? formData.value.barCode
} }
const buildRelationIdListString = (list: { id: number; name: string }[]) => { const buildRelationIdListString = (list: { id: string | number; name: string }[]) => {
return list.map((item) => Number(item.id)).filter((id) => Number.isFinite(id)) return list.map((item) => String(item.id)).filter((id) => id !== '')
} }
const getDefaultPackagingSchemeId = () => { const getDefaultPackagingSchemeId = () => {

@ -673,10 +673,10 @@ async function fillProductStockAreaInfo(stockList) {
const warehouse = await WarehouseApi.getWarehouse(warehouseId) const warehouse = await WarehouseApi.getWarehouse(warehouseId)
const areaList = warehouse?.areaList || [] const areaList = warehouse?.areaList || []
stockList stockList
.filter((item) => Number(getStockWarehouseId(item)) === Number(warehouseId)) .filter((item) => String(getStockWarehouseId(item)) === String(warehouseId))
.forEach((item) => { .forEach((item) => {
const area = areaList.find( const area = areaList.find(
(areaItem) => Number(areaItem.id) === Number(getStockAreaId(item)) (areaItem) => String(areaItem.id) === String(getStockAreaId(item))
) )
if (!area) return if (!area) return
item.areaCode = area.areaCode item.areaCode = area.areaCode
@ -714,7 +714,7 @@ function getFromWarehouseOptions(row) {
function getFromAreaOptions(row) { function getFromAreaOptions(row) {
if (!row.fromWarehouseId) return [] if (!row.fromWarehouseId) return []
const areaOptions = (row.productStockList || []).filter( const areaOptions = (row.productStockList || []).filter(
(item) => Number(getStockWarehouseId(item)) === Number(row.fromWarehouseId) (item) => Number(getStockWarehouseId(item)) === String(row.fromWarehouseId)
) )
return appendOptionIfMissing( return appendOptionIfMissing(
areaOptions, areaOptions,
@ -753,7 +753,7 @@ function getToAreaOptions(row) {
const areaOptions = const areaOptions =
Array.isArray(row.toAreaList) && row.toAreaList.length > 0 Array.isArray(row.toAreaList) && row.toAreaList.length > 0
? row.toAreaList ? row.toAreaList
: warehouseList.value.find((item) => Number(item.id) === Number(row.toWarehouseId)) : warehouseList.value.find((item) => String(item.id) === String(row.toWarehouseId))
?.areaList || [] ?.areaList || []
return appendOptionIfMissing( return appendOptionIfMissing(
areaOptions, areaOptions,
@ -780,7 +780,7 @@ async function setStockCount(row) {
const stock = row.productStockList.find( const stock = row.productStockList.find(
(item) => (item) =>
Number(getStockWarehouseId(item)) === Number(row.fromWarehouseId) && Number(getStockWarehouseId(item)) === Number(row.fromWarehouseId) &&
Number(getStockAreaId(item)) === Number(row.fromAreaId) Number(getStockAreaId(item)) === String(row.fromAreaId)
) )
row.stockCount = stock ? getStockCount(stock) : 0 row.stockCount = stock ? getStockCount(stock) : 0
} }

@ -654,7 +654,7 @@ const applyPalletDetail = async (data: PalletVO) => {
const handleQrcodeRefreshSuccess = async () => { const handleQrcodeRefreshSuccess = async () => {
if (!formData.value.id) return if (!formData.value.id) return
const data = await PalletApi.getPallet(Number(formData.value.id)) const data = await PalletApi.getPallet(String(formData.value.id))
await applyPalletDetail(data) await applyPalletDetail(data)
} }
@ -695,7 +695,7 @@ const hydrateSelectedWarehouseArea = async () => {
const hydrateSelectedProduct = async () => { const hydrateSelectedProduct = async () => {
selectedProduct.value = undefined selectedProduct.value = undefined
if (!formData.value.productId) return if (!formData.value.productId) return
selectedProduct.value = await ProductApi.getProduct(Number(formData.value.productId)) selectedProduct.value = await ProductApi.getProduct(String(formData.value.productId))
} }
const getProductTableList = async () => { const getProductTableList = async () => {

@ -155,7 +155,7 @@ const getList = async () => {
if (!recipeId.value) return if (!recipeId.value) return
loading.value = true loading.value = true
try { try {
const data = await RecipePointApi.getRecipePointList(Number(recipeId.value)) const data = await RecipePointApi.getRecipePointList(String(recipeId.value))
setPageData(data) setPageData(data)
} finally { } finally {
loading.value = false loading.value = false

@ -398,7 +398,7 @@ const handleRead = async (row: RecipePlanDetailVO) => {
handleRowClick(row) handleRowClick(row)
const recipeName = row?.recipeName const recipeName = row?.recipeName
const { hasDeviceRecords, hasManualRecords } = await checkRecipeRecords(recipeId) const { hasDeviceRecords, hasManualRecords } = await checkRecipeRecords(recipeId)
const data = await RecipePointApi.getRecipePointList(Number(recipeId)) const data = await RecipePointApi.getRecipePointList(String(recipeId))
if (!data?.length) { if (!data?.length) {
await message.confirm( await message.confirm(
`${t('RecipeManagement.RecipeLibrary.readDeviceConfirmMessage')}(${t('RecipeManagement.RecipeLibrary.readDialogOverwriteTip')})` `${t('RecipeManagement.RecipeLibrary.readDeviceConfirmMessage')}(${t('RecipeManagement.RecipeLibrary.readDialogOverwriteTip')})`

@ -287,9 +287,9 @@ const buildTreeFromApi = (orgs: ApiTreeOrg[]): DeviceTreeNode[] => {
const normalizeOrg = (org: any): ApiTreeOrg => { const normalizeOrg = (org: any): ApiTreeOrg => {
const children = Array.isArray(org?.children) ? org.children.map(normalizeOrg) : undefined const children = Array.isArray(org?.children) ? org.children.map(normalizeOrg) : undefined
const equipments = Array.isArray(org?.equipments) ? org.equipments : undefined const equipments = Array.isArray(org?.equipments) ? org.equipments : undefined
const parentId = typeof org?.parentId === 'number' ? org.parentId : Number(org?.parentId ?? 0) || 0 const parentId = org?.parentId ?? 0
return { return {
id: Number(org?.id ?? 0) || 0, id: org?.id ?? 0,
name: String(org?.name ?? ''), name: String(org?.name ?? ''),
orgClass: org?.orgClass ? String(org.orgClass) : undefined, orgClass: org?.orgClass ? String(org.orgClass) : undefined,
parentId, parentId,

@ -155,7 +155,7 @@ onMounted(() => {
close() close()
return return
} }
customerId.value = params.id as unknown as number customerId.value = params.id as unknown as string
getCustomer() getCustomer()
}) })
</script> </script>

@ -428,7 +428,7 @@ const selectedCaiJiRows = ref<any[]>([])
const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => {
formData.value.devices = payload.rows formData.value.devices = payload.rows
.map((item) => { .map((item) => {
const id = Number(item.id) const id = String(item.id)
if (!Number.isFinite(id)) return undefined if (!Number.isFinite(id)) return undefined
return { return {
id, id,
@ -438,7 +438,7 @@ const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: an
.filter((item): item is { id: number; name: string } => Boolean(item)) .filter((item): item is { id: number; name: string } => Boolean(item))
selectedDeviceRows.value = payload.rows selectedDeviceRows.value = payload.rows
formData.value.machineId = payload.ids.join(',') formData.value.machineId = payload.ids.join(',')
ids.value = payload.ids.map((id) => Number(id)) ids.value = payload.ids.map((id) => String(id))
} }
/*打开关联设备*/ /*打开关联设备*/
const openCriticalComponentDialog = async () => { const openCriticalComponentDialog = async () => {

@ -347,7 +347,7 @@ const updatePlanTableMaxHeight = async () => {
const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap
planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight))) planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight)))
} }
const inspectableMap = reactive<Record<number, boolean | undefined>>({}) const inspectableMap = reactive<Record<string, boolean | undefined>>({})
type LineChangeRouteItem = PlanProcessRouteItemVO & { type LineChangeRouteItem = PlanProcessRouteItemVO & {
planProcessRouteItemId?: number | string planProcessRouteItemId?: number | string
originalDeviceId?: number | string originalDeviceId?: number | string
@ -669,7 +669,7 @@ const openZjTaskForm = (row: PlanVO) => {
const refreshInspectableMap = async (rows: PlanVO[]) => { const refreshInspectableMap = async (rows: PlanVO[]) => {
const ids = rows const ids = rows
.filter((row) => row?.id && String(row.status) === '6') .filter((row) => row?.id && String(row.status) === '6')
.map((row) => row.id as number) .map((row) => row.id as string)
const idSet = new Set(ids) const idSet = new Set(ids)
for (const key of Object.keys(inspectableMap)) { for (const key of Object.keys(inspectableMap)) {
const id = Number(key) const id = Number(key)

@ -386,7 +386,7 @@ const hydrateCustomerName = async () => {
const customerId = formData.value.customerId const customerId = formData.value.customerId
if (!customerId || formData.value.customerName) return if (!customerId || formData.value.customerName) return
try { try {
const customer = await CustomerApi.getCustomer(Number(customerId)) const customer = await CustomerApi.getCustomer(String(customerId))
formData.value.customerName = getCustomerName(customer) formData.value.customerName = getCustomerName(customer)
} catch {} } catch {}
} }

@ -297,7 +297,7 @@ const handleDelete = async (id: number) => {
} }
const handleSelectionChange = (rows: ZjTaskVO[]) => { const handleSelectionChange = (rows: ZjTaskVO[]) => {
selectedIds.value = (rows.map((row) => row.id).filter((id) => id !== undefined && id !== null) as number[]) selectedIds.value = (rows.map((row) => row.id).filter((id) => id !== undefined && id !== null) as string[])
} }
const handleBatchCancel = async () => { const handleBatchCancel = async () => {

Loading…
Cancel
Save