From 208778df3f775617eabebf936f419532dc4bd6be Mon Sep 17 00:00:00 2001 From: zhongwenkai <3478244299@qq.com> Date: Fri, 17 Jul 2026 09:55:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=9B=AA=E8=8A=B1?= =?UTF-8?q?=E7=AE=97=E6=B3=95ID=E7=B2=BE=E5=BA=A6=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/erp/product/category/index.ts | 8 +-- src/api/erp/product/product/index.ts | 32 +++++----- .../erp/mold/components/MoldOperateView.vue | 2 +- src/views/erp/mold/detail/brand.vue | 4 +- src/views/erp/mold/detail/index.vue | 26 ++++---- src/views/erp/mold/index.vue | 4 +- .../product/category/ProductCategoryForm.vue | 14 ++--- src/views/erp/product/product/ProductForm.vue | 60 +++++++++---------- .../move/components/StockMoveItemForm.vue | 10 ++-- src/views/erp/stock/pallet/PalletForm.vue | 4 +- .../components/FormulaLibraryReadDialog.vue | 2 +- src/views/formula/formulaLibrary/index.vue | 2 +- src/views/iot/deviceParamAnalysis/index.vue | 4 +- src/views/mes/customer/detail/index.vue | 2 +- .../mes/organization/OrganizationForm.vue | 4 +- src/views/mes/plan/index.vue | 4 +- src/views/mes/task/TaskForm.vue | 2 +- src/views/mes/zjTask/index.vue | 2 +- 18 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/api/erp/product/category/index.ts b/src/api/erp/product/category/index.ts index 21b9b525..242171e1 100644 --- a/src/api/erp/product/category/index.ts +++ b/src/api/erp/product/category/index.ts @@ -2,8 +2,8 @@ import request from '@/config/axios' // ERP 产品分类 VO export interface ProductCategoryVO { - id: number // 分类编号 - parentId: number // 父分类编号 + id?: number | string // 分类编号 + parentId?: number | string // 父分类编号 name: string // 分类名称 code: string // 分类编码 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 }) }, @@ -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 }) }, diff --git a/src/api/erp/product/product/index.ts b/src/api/erp/product/product/index.ts index 968978f0..2d11b8db 100644 --- a/src/api/erp/product/product/index.ts +++ b/src/api/erp/product/product/index.ts @@ -2,16 +2,16 @@ import request from '@/config/axios' // ERP 产品 VO export interface ProductVO { - id: number // 产品编号 + id?: number | string // 产品编号 name: string // 产品名称 barCode: string // 产品条码 isCode?: boolean qrcodeUrl?: string templateJson?: string | any - categoryId: number // 产品类型编号 - subCategoryId: number // 产品类型子类编号 + categoryId?: number | string // 产品类型编号 + subCategoryId?: number | string // 产品类型子类编号 subCategoryName: string // 产品类型子类名称 - unitId: number // 单位编号 + unitId?: number | string // 单位编号 unitName?: string // 单位名字 status: number // 产品状态 standard: string // 产品规格 @@ -23,19 +23,19 @@ export interface ProductVO { minPrice: number // 最低价格,单位:元 deviceIds?: string // 关联设备ID列表 moldIds?: string // 关联模具ID列表 - devices?: { id: number; name: string }[] // 关联设备列表 - molds?: { id: number; name: string }[] // 关联模具列表 + devices?: { id: number | string; name: string }[] // 关联设备列表 + molds?: { id: number | string; name: string }[] // 关联模具列表 deviceList?: any[] moldList?: any[] } export interface ErpProductCategoryProcessRouteItemRespVO { - id?: number - categoryId?: number - processRouteId?: number - processRouteItemId?: number + id?: number | string + categoryId?: number | string + processRouteId?: number | string + processRouteItemId?: number | string sort?: number - processParameterId?: number + processParameterId?: number | string processParameterCode?: string processParameterName?: string remark?: string @@ -44,8 +44,8 @@ export interface ErpProductCategoryProcessRouteItemRespVO { } export interface ErpProductProcessRouteRespVO { - productId?: number - processRouteId?: number + productId?: number | string + processRouteId?: number | string processRouteName?: string 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 }) }, @@ -98,14 +98,14 @@ export const ProductApi = { }, // 刷新产品二维码 - regenerateCode: async (id: number, code: string) => { + regenerateCode: async (id: number | string, code: string) => { return await request.post({ 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 }) }, diff --git a/src/views/erp/mold/components/MoldOperateView.vue b/src/views/erp/mold/components/MoldOperateView.vue index 44176854..aeed9f70 100644 --- a/src/views/erp/mold/components/MoldOperateView.vue +++ b/src/views/erp/mold/components/MoldOperateView.vue @@ -199,7 +199,7 @@ watch(() => operateFormData.deviceId, async (deviceId) => { displayTopCategory.value = detail?.topCategoryName || '' // fallback: 用产线树匹配根节点名称 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 => { if (!nodes) return false return nodes.some((n) => n.id === id || containsId(n.children, id)) diff --git a/src/views/erp/mold/detail/brand.vue b/src/views/erp/mold/detail/brand.vue index 222ec53c..7fa8f749 100644 --- a/src/views/erp/mold/detail/brand.vue +++ b/src/views/erp/mold/detail/brand.vue @@ -526,7 +526,7 @@ const message = useMessage() const route = useRoute() const router = useRouter() 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 detailData = ref<(MoldBrandVO & Record) | null>(null) const childMolds = ref([]) @@ -871,7 +871,7 @@ const getChildMolds = async () => { const collectByChildMolds = async (worker: (moldId: number) => Promise, mergeList = true) => { 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 [] const results = await Promise.all(ids.map((id) => worker(id).catch(() => []))) return mergeList ? results.flat() : results diff --git a/src/views/erp/mold/detail/index.vue b/src/views/erp/mold/detail/index.vue index 2166f63a..3960bc32 100644 --- a/src/views/erp/mold/detail/index.vue +++ b/src/views/erp/mold/detail/index.vue @@ -520,7 +520,7 @@ const repairGroups = computed(() => { }) const fetchRepairHistory = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) return const params: any = { moldId: id } if (repairDateRange.value && repairDateRange.value.length === 2) { @@ -532,7 +532,7 @@ const fetchRepairHistory = async () => { } const handleQueryRepair = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -541,7 +541,7 @@ const handleQueryRepair = async () => { } const handleResetRepair = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -551,7 +551,7 @@ const handleResetRepair = async () => { } const handleExportRepair = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -571,7 +571,7 @@ const handleExportRepair = async () => { } const fetchMaintainHistory = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) return const params: any = { moldId: id } if (maintainDateRange.value && maintainDateRange.value.length === 2) { @@ -583,7 +583,7 @@ const fetchMaintainHistory = async () => { } const handleQueryMaintain = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -592,7 +592,7 @@ const handleQueryMaintain = async () => { } const handleResetMaintain = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -602,7 +602,7 @@ const handleResetMaintain = async () => { } const handleExportMaintain = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -622,7 +622,7 @@ const handleExportMaintain = async () => { } const fetchInspectionHistory = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) return const params: any = { moldId: id } if (inspectionDateRange.value && inspectionDateRange.value.length === 2) { @@ -634,7 +634,7 @@ const fetchInspectionHistory = async () => { } const handleQueryInspection = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -643,7 +643,7 @@ const handleQueryInspection = async () => { } const handleResetInspection = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -653,7 +653,7 @@ const handleResetInspection = async () => { } const handleExportInspection = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') return @@ -677,7 +677,7 @@ const close = () => { } const getDetail = async () => { - const id = Number(route.params.id) + const id = String(route.params.id || '') if (!id) { message.error('参数错误,模具不能为空') close() diff --git a/src/views/erp/mold/index.vue b/src/views/erp/mold/index.vue index 4c4b2e6b..776a03dd 100644 --- a/src/views/erp/mold/index.vue +++ b/src/views/erp/mold/index.vue @@ -441,9 +441,9 @@ onMounted(async () => { // 从详情页跳转过来,自动打开上下模操作 const { operateType: queryOperateType, moldId: queryMoldId } = route.query 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) { - await openOperateForm(Number(queryOperateType), moldRow) + await openOperateForm(String(queryOperateType), moldRow) } // 清除 query 参数,避免刷新重复触发 push({ path: route.path }) diff --git a/src/views/erp/product/category/ProductCategoryForm.vue b/src/views/erp/product/category/ProductCategoryForm.vue index b2a1b38d..eb4f55f3 100644 --- a/src/views/erp/product/category/ProductCategoryForm.vue +++ b/src/views/erp/product/category/ProductCategoryForm.vue @@ -258,10 +258,10 @@ const selectedProcessRouteId = ref() const selectedProcessRouteRow = ref() const processRouteDisplayName = computed(() => { - if (!formData.value.processRouteId) return '' + if (formData.value.processRouteId == null) return '' 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) => { 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 dialogTitle.value = t('action.' + type) formType.value = type @@ -352,9 +352,9 @@ const handleTypeChange = async () => { } const syncProcessRouteName = async () => { - if (!formData.value.processRouteId || formData.value.processRouteName) return + if (formData.value.processRouteId == null || formData.value.processRouteName) return try { - const data = await ProcessRouteApi.getProcessRoute(Number(formData.value.processRouteId)) + const data = await ProcessRouteApi.getProcessRoute(formData.value.processRouteId) formData.value.processRouteName = data?.name } catch {} } @@ -378,9 +378,9 @@ const getProcessRouteList = async () => { const openProcessRouteDialog = async () => { selectedProcessRouteId.value = undefined selectedProcessRouteRow.value = undefined - if (formData.value.processRouteId) { + if (formData.value.processRouteId != null) { try { - const data = await ProcessRouteApi.getProcessRoute(Number(formData.value.processRouteId)) + const data = await ProcessRouteApi.getProcessRoute(formData.value.processRouteId) if (isEnabledProcessRoute(data)) { selectedProcessRouteId.value = formData.value.processRouteId selectedProcessRouteRow.value = data diff --git a/src/views/erp/product/product/ProductForm.vue b/src/views/erp/product/product/ProductForm.vue index 060d7243..18002e42 100644 --- a/src/views/erp/product/product/ProductForm.vue +++ b/src/views/erp/product/product/ProductForm.vue @@ -435,10 +435,10 @@ const formData = ref({ salePrice: undefined, minPrice: undefined, safetyNumber: undefined, - devices: [] as { id: number; name: string }[], - molds: [] as { id: number; name: string }[], - packagingSchemes: [] as { packagingSchemeId: number | undefined; defaultStatus: number }[], - suppliers: [] as { supplierId: number | undefined; defaultStatus: number }[], + devices: [] as { id: string | number; name: string }[], + molds: [] as { id: string | number; name: string }[], + packagingSchemes: [] as { packagingSchemeId: string | number | undefined; defaultStatus: number }[], + suppliers: [] as { supplierId: string | number | undefined; defaultStatus: number }[], fragileFlag: undefined as number | undefined, purchaseCycle: undefined as number | undefined, brand: undefined as string | undefined, @@ -450,13 +450,13 @@ const formData = ref({ }) const selectedDeviceRows = ref([]) const selectedMoldRows = ref([]) -const findCategoryNameById = (id: number | undefined, tree: any[]): string => { - if (!id || !Array.isArray(tree) || !tree.length) return '' +const findCategoryNameById = (id: string | number | undefined, tree: any[]): string => { + if (id == null || !Array.isArray(tree) || !tree.length) return '' const queue = [...tree] while (queue.length) { const node = queue.shift() if (!node) continue - if (Number(node.id) === Number(id)) { + if (String(node.id) === String(id)) { return String(node.name || node.label || '') } 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 isProductCategory = computed(() => selectedCategoryName.value === '产品') -const getRelationName = (item: Record, nameKeys: string[], fallbackPrefix: string, id: number) => { +const getRelationName = (item: Record, nameKeys: string[], fallbackPrefix: string, id: string | number) => { for (const key of nameKeys) { const value = item[key] if (value !== undefined && value !== null && String(value).trim() !== '') { @@ -481,11 +481,10 @@ const normalizeRelationList = ( fallbackRows: any[] | undefined, nameKeys: string[], fallbackPrefix: string -): { id: number; name: string }[] => { - const fallbackMap = new Map() +): { id: string | number; name: string }[] => { + const fallbackMap = new Map() ; (fallbackRows || []).forEach((row) => { - const id = Number(row?.id) - if (!Number.isFinite(id)) return + const id = String(row?.id) fallbackMap.set(id, getRelationName(row, nameKeys, fallbackPrefix, id)) }) const parseArray = (source: unknown): any[] => { @@ -505,30 +504,31 @@ const normalizeRelationList = ( return parseArray(value) .map((item) => { if (typeof item === 'object' && item !== null) { - const id = Number((item as any).id) - if (!Number.isFinite(id)) return undefined + const rawId = (item as any).id + if (rawId == null) return undefined + const id = rawId return { id, name: getRelationName(item as any, nameKeys, fallbackPrefix, id) } } - const id = Number(item) - if (!Number.isFinite(id)) return undefined + const rawId = String(item).trim() + if (!rawId) return undefined return { - id, - name: fallbackMap.get(id) || `${fallbackPrefix}ID:${id}` + id: rawId, + 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) => ({ id: item.id, deviceName: item.name, name: item.name })) } -const toMoldRows = (molds: { id: number; name: string }[]) => { +const toMoldRows = (molds: { id: string | number; name: string }[]) => { return molds.map((item) => ({ id: item.id, name: item.name @@ -565,7 +565,7 @@ const fetchDeviceLedgerPage = (params: Record) => { } const openDeviceSelectDialog = () => { 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) deviceSelectDialogRef.value?.open(rows) } @@ -578,27 +578,25 @@ const openMoldSelectDialog = () => { const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { formData.value.devices = payload.rows .map((item) => { - const id = Number(item.id) - if (!Number.isFinite(id)) return undefined + const id = String(item.id) return { 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 } const handleMoldSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { formData.value.molds = payload.rows .map((item) => { - const id = Number(item.id) - if (!Number.isFinite(id)) return undefined + const id = String(item.id) return { 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 } const validateBarCode = (_rule, value, callback) => { @@ -935,7 +933,7 @@ const supplierList = ref([]) let openRequestId = 0 -const open = async (type: string, id?: number) => { +const open = async (type: string, id?: string | number) => { const currentOpenId = ++openRequestId dialogTitle.value = t('action.' + type) formType.value = type @@ -1114,8 +1112,8 @@ const handleQrcodeRefreshSuccess = async (data: any) => { formData.value.barCode = productData?.barCode ?? formData.value.barCode } -const buildRelationIdListString = (list: { id: number; name: string }[]) => { - return list.map((item) => Number(item.id)).filter((id) => Number.isFinite(id)) +const buildRelationIdListString = (list: { id: string | number; name: string }[]) => { + return list.map((item) => String(item.id)).filter((id) => id !== '') } const getDefaultPackagingSchemeId = () => { diff --git a/src/views/erp/stock/move/components/StockMoveItemForm.vue b/src/views/erp/stock/move/components/StockMoveItemForm.vue index a48e1b66..fbb49718 100644 --- a/src/views/erp/stock/move/components/StockMoveItemForm.vue +++ b/src/views/erp/stock/move/components/StockMoveItemForm.vue @@ -673,10 +673,10 @@ async function fillProductStockAreaInfo(stockList) { const warehouse = await WarehouseApi.getWarehouse(warehouseId) const areaList = warehouse?.areaList || [] stockList - .filter((item) => Number(getStockWarehouseId(item)) === Number(warehouseId)) + .filter((item) => String(getStockWarehouseId(item)) === String(warehouseId)) .forEach((item) => { const area = areaList.find( - (areaItem) => Number(areaItem.id) === Number(getStockAreaId(item)) + (areaItem) => String(areaItem.id) === String(getStockAreaId(item)) ) if (!area) return item.areaCode = area.areaCode @@ -714,7 +714,7 @@ function getFromWarehouseOptions(row) { function getFromAreaOptions(row) { if (!row.fromWarehouseId) return [] const areaOptions = (row.productStockList || []).filter( - (item) => Number(getStockWarehouseId(item)) === Number(row.fromWarehouseId) + (item) => Number(getStockWarehouseId(item)) === String(row.fromWarehouseId) ) return appendOptionIfMissing( areaOptions, @@ -753,7 +753,7 @@ function getToAreaOptions(row) { const areaOptions = Array.isArray(row.toAreaList) && row.toAreaList.length > 0 ? row.toAreaList - : warehouseList.value.find((item) => Number(item.id) === Number(row.toWarehouseId)) + : warehouseList.value.find((item) => String(item.id) === String(row.toWarehouseId)) ?.areaList || [] return appendOptionIfMissing( areaOptions, @@ -780,7 +780,7 @@ async function setStockCount(row) { const stock = row.productStockList.find( (item) => Number(getStockWarehouseId(item)) === Number(row.fromWarehouseId) && - Number(getStockAreaId(item)) === Number(row.fromAreaId) + Number(getStockAreaId(item)) === String(row.fromAreaId) ) row.stockCount = stock ? getStockCount(stock) : 0 } diff --git a/src/views/erp/stock/pallet/PalletForm.vue b/src/views/erp/stock/pallet/PalletForm.vue index c4cbe272..a19ac512 100644 --- a/src/views/erp/stock/pallet/PalletForm.vue +++ b/src/views/erp/stock/pallet/PalletForm.vue @@ -654,7 +654,7 @@ const applyPalletDetail = async (data: PalletVO) => { const handleQrcodeRefreshSuccess = async () => { 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) } @@ -695,7 +695,7 @@ const hydrateSelectedWarehouseArea = async () => { const hydrateSelectedProduct = async () => { selectedProduct.value = undefined 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 () => { diff --git a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue index 696e9f2c..7efcc011 100644 --- a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue +++ b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue @@ -155,7 +155,7 @@ const getList = async () => { if (!recipeId.value) return loading.value = true try { - const data = await RecipePointApi.getRecipePointList(Number(recipeId.value)) + const data = await RecipePointApi.getRecipePointList(String(recipeId.value)) setPageData(data) } finally { loading.value = false diff --git a/src/views/formula/formulaLibrary/index.vue b/src/views/formula/formulaLibrary/index.vue index 72f8e926..cdb3a399 100644 --- a/src/views/formula/formulaLibrary/index.vue +++ b/src/views/formula/formulaLibrary/index.vue @@ -398,7 +398,7 @@ const handleRead = async (row: RecipePlanDetailVO) => { handleRowClick(row) const recipeName = row?.recipeName const { hasDeviceRecords, hasManualRecords } = await checkRecipeRecords(recipeId) - const data = await RecipePointApi.getRecipePointList(Number(recipeId)) + const data = await RecipePointApi.getRecipePointList(String(recipeId)) if (!data?.length) { await message.confirm( `${t('RecipeManagement.RecipeLibrary.readDeviceConfirmMessage')}(${t('RecipeManagement.RecipeLibrary.readDialogOverwriteTip')})` diff --git a/src/views/iot/deviceParamAnalysis/index.vue b/src/views/iot/deviceParamAnalysis/index.vue index e04dc2d4..2572db67 100644 --- a/src/views/iot/deviceParamAnalysis/index.vue +++ b/src/views/iot/deviceParamAnalysis/index.vue @@ -287,9 +287,9 @@ const buildTreeFromApi = (orgs: ApiTreeOrg[]): DeviceTreeNode[] => { const normalizeOrg = (org: any): ApiTreeOrg => { const children = Array.isArray(org?.children) ? org.children.map(normalizeOrg) : 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 { - id: Number(org?.id ?? 0) || 0, + id: org?.id ?? 0, name: String(org?.name ?? ''), orgClass: org?.orgClass ? String(org.orgClass) : undefined, parentId, diff --git a/src/views/mes/customer/detail/index.vue b/src/views/mes/customer/detail/index.vue index f53766d0..ae25cef2 100644 --- a/src/views/mes/customer/detail/index.vue +++ b/src/views/mes/customer/detail/index.vue @@ -155,7 +155,7 @@ onMounted(() => { close() return } - customerId.value = params.id as unknown as number + customerId.value = params.id as unknown as string getCustomer() }) diff --git a/src/views/mes/organization/OrganizationForm.vue b/src/views/mes/organization/OrganizationForm.vue index 9c11c945..4f559b2d 100644 --- a/src/views/mes/organization/OrganizationForm.vue +++ b/src/views/mes/organization/OrganizationForm.vue @@ -428,7 +428,7 @@ const selectedCaiJiRows = ref([]) const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => { formData.value.devices = payload.rows .map((item) => { - const id = Number(item.id) + const id = String(item.id) if (!Number.isFinite(id)) return undefined return { id, @@ -438,7 +438,7 @@ const handleDeviceSelectConfirm = (payload: { ids: (number | string)[]; rows: an .filter((item): item is { id: number; name: string } => Boolean(item)) selectedDeviceRows.value = payload.rows 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 () => { diff --git a/src/views/mes/plan/index.vue b/src/views/mes/plan/index.vue index ba3cef6d..a9ed4aa1 100644 --- a/src/views/mes/plan/index.vue +++ b/src/views/mes/plan/index.vue @@ -347,7 +347,7 @@ const updatePlanTableMaxHeight = async () => { const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight))) } -const inspectableMap = reactive>({}) +const inspectableMap = reactive>({}) type LineChangeRouteItem = PlanProcessRouteItemVO & { planProcessRouteItemId?: number | string originalDeviceId?: number | string @@ -669,7 +669,7 @@ const openZjTaskForm = (row: PlanVO) => { const refreshInspectableMap = async (rows: PlanVO[]) => { const ids = rows .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) for (const key of Object.keys(inspectableMap)) { const id = Number(key) diff --git a/src/views/mes/task/TaskForm.vue b/src/views/mes/task/TaskForm.vue index 98b5b57c..3a33cc90 100644 --- a/src/views/mes/task/TaskForm.vue +++ b/src/views/mes/task/TaskForm.vue @@ -386,7 +386,7 @@ const hydrateCustomerName = async () => { const customerId = formData.value.customerId if (!customerId || formData.value.customerName) return try { - const customer = await CustomerApi.getCustomer(Number(customerId)) + const customer = await CustomerApi.getCustomer(String(customerId)) formData.value.customerName = getCustomerName(customer) } catch {} } diff --git a/src/views/mes/zjTask/index.vue b/src/views/mes/zjTask/index.vue index 3fff1238..ee367407 100644 --- a/src/views/mes/zjTask/index.vue +++ b/src/views/mes/zjTask/index.vue @@ -297,7 +297,7 @@ const handleDelete = async (id: number) => { } 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 () => {