From 65cc63674e0721e060eebe6231d3abfe2616e1a1 Mon Sep 17 00:00:00 2001 From: luo Date: Tue, 8 Sep 2026 14:33:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BasicInfoCard.vue | 50 +++++++++++++++---- .../asset-management/device-list/index.vue | 33 ++++++++---- .../iot-card-management/index.vue | 48 +++++++++++------- 3 files changed, 93 insertions(+), 38 deletions(-) diff --git a/src/views/asset-management/asset-information/components/BasicInfoCard.vue b/src/views/asset-management/asset-information/components/BasicInfoCard.vue index 6f0b136..ce6b5ec 100644 --- a/src/views/asset-management/asset-information/components/BasicInfoCard.vue +++ b/src/views/asset-management/asset-information/components/BasicInfoCard.vue @@ -118,13 +118,13 @@ label="实名时间" label-class-name="asset-label asset-label--realname-time" >{{ - cardInfo?.real_name_at ? formatDateTime(cardInfo.real_name_at) : '-' + cardInfo?.real_name_at ? formatAssetInfoTime(cardInfo.real_name_at) : '-' }} {{ formatDateTime(cardInfo?.last_real_name_check_at) || '-' }}{{ formatAssetInfoTime(cardInfo?.last_real_name_check_at) }} {{ formatDateTime(cardInfo?.last_card_status_check_at) || '-' }}{{ formatAssetInfoTime(cardInfo?.last_card_status_check_at) }} {{ formatDateTime(cardInfo?.last_data_check_at) || '-' }}{{ formatAssetInfoTime(cardInfo?.last_data_check_at) }} {{ selectedDeviceStatusCard?.real_name_at - ? formatDateTime(selectedDeviceStatusCard.real_name_at) + ? formatAssetInfoTime(selectedDeviceStatusCard.real_name_at) : '-' }} @@ -467,7 +467,11 @@
实名时间 - {{ bindingCard.real_name_at ? formatDateTime(bindingCard.real_name_at) : '-' }} + {{ + bindingCard.real_name_at + ? formatAssetInfoTime(bindingCard.real_name_at) + : '-' + }}
@@ -995,19 +999,19 @@ { key: 'realname', label: '实名同步时间', - value: formatDateTime(props.cardInfo?.last_real_name_check_at) || '-', + value: formatAssetInfoTime(props.cardInfo?.last_real_name_check_at), icon: 'realname-sync' }, { key: 'cardSync', label: '卡状态同步时间', - value: formatDateTime(props.cardInfo?.last_card_status_check_at) || '-', + value: formatAssetInfoTime(props.cardInfo?.last_card_status_check_at), icon: 'card-sync' }, { key: 'trafficSync', label: '流量同步时间', - value: formatDateTime(props.cardInfo?.last_data_check_at) || '-', + value: formatAssetInfoTime(props.cardInfo?.last_data_check_at), icon: 'traffic-sync' }, { @@ -1140,6 +1144,34 @@ return formatDataSize(value) } + /** + * 接口中的这几项时间以其原始文本为基准直接加 8 小时;时区后缀不参与换算。 + * 例如 2026-08-06T11:54:26.693382+08:00 显示为 2026-08-06 19:54:26。 + */ + const formatAssetInfoTime = (value?: string | null) => { + if (!value?.trim()) return '-' + + const timeText = value.trim() + const match = timeText.match( + /^(\d{4})-(\d{2})-(\d{2})(?:T|\s)(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/i + ) + if (!match) return '-' + + const [, year, month, day, hours, minutes, seconds = '00'] = match + const date = new Date( + Date.UTC( + Number(year), + Number(month) - 1, + Number(day), + Number(hours) + 8, + Number(minutes), + Number(seconds) + ) + ) + + return formatDateTime(date) + } + // 处理轮询开关变化 const handlePollingChange = (value: string | number | boolean) => { emit('update:pollingEnabled', Boolean(value)) diff --git a/src/views/asset-management/device-list/index.vue b/src/views/asset-management/device-list/index.vue index 1eb0f8e..7655a89 100644 --- a/src/views/asset-management/device-list/index.vue +++ b/src/views/asset-management/device-list/index.vue @@ -238,7 +238,10 @@ {{ selectedDevices.length }} - + 设备ID列表 设备号范围 筛选条件 @@ -736,7 +739,10 @@ - + 设备号列表 筛选条件 @@ -842,7 +848,10 @@ - + 设备号列表 筛选条件 @@ -1355,7 +1364,7 @@ // 搜索表单 const searchForm = reactive>({ ...initialSearchState }) - // 搜索批次号(用于搜索表单) + // 批次号仅在用户切换至筛选条件或输入批次号搜索时加载。 const loadSearchBatchNoOptions = async (batchNo?: string) => { try { const params: any = { @@ -1374,11 +1383,14 @@ } } - // 搜索批次号 const handleSearchBatchNo = (query: string) => { - if (query) { - loadSearchBatchNoOptions(query) - } else { + loadSearchBatchNoOptions(query || undefined) + } + + const handleDeviceBatchSelectionTypeChange = ( + selectionType: string | number | boolean | undefined + ) => { + if (selectionType === DeviceSelectionType.FILTER) { loadSearchBatchNoOptions() } } @@ -2517,7 +2529,6 @@ resetEnterpriseDeviceAuthorizeForm() await Promise.all([ handleSearchEnterprise(), - loadSearchBatchNoOptions(), loadTopLevelShopCascadeOptions() ]) enterpriseDeviceAuthorizeDialogVisible.value = true @@ -2526,7 +2537,7 @@ const showEnterpriseDeviceRecallDialog = async () => { resetEnterpriseDeviceRecallForm() - await Promise.all([handleSearchEnterprise(), loadSearchBatchNoOptions()]) + await handleSearchEnterprise() enterpriseDeviceRecallDialogVisible.value = true enterpriseDeviceRecallFormRef.value?.clearValidate() } @@ -2667,7 +2678,7 @@ selection_type: selectedDevices.value.length > 0 ? DeviceSelectionType.LIST : DeviceSelectionType.FILTER }) - await Promise.all([loadPackageSeriesList(), loadSearchBatchNoOptions()]) + await loadPackageSeriesList() seriesBindingDialogVisible.value = true seriesBindingFormRef.value?.clearValidate() } diff --git a/src/views/asset-management/iot-card-management/index.vue b/src/views/asset-management/iot-card-management/index.vue index 27d7d4f..7492da4 100644 --- a/src/views/asset-management/iot-card-management/index.vue +++ b/src/views/asset-management/iot-card-management/index.vue @@ -119,7 +119,10 @@ /> - + ICCID列表 号段范围 筛选条件 @@ -246,7 +249,10 @@ > - + ICCID列表 号段范围 筛选条件 @@ -415,7 +421,10 @@ - + ICCID列表 号段范围 筛选条件 @@ -568,7 +577,10 @@ - + ICCID列表 号段范围 筛选条件 @@ -739,7 +751,10 @@ label-width="100" > - + ICCID列表 号段范围 筛选条件 @@ -1338,10 +1353,9 @@ } } - // 批量分配对话框批次号选项 + // 批次号仅在用户切换至筛选条件时加载;避免弹窗打开即请求导入任务列表。 const allocateBatchNoOptions = ref([]) - // 加载批量分配对话框批次号选项 const loadAllocateBatchNoOptions = async (batchNo?: string) => { try { const params: any = { @@ -1360,11 +1374,14 @@ } } - // 搜索批量分配对话框批次号 const handleSearchAllocateBatchNo = (query: string) => { - if (query) { - loadAllocateBatchNoOptions(query) - } else { + loadAllocateBatchNoOptions(query || undefined) + } + + const handleCardBatchSelectionTypeChange = ( + selectionType: string | number | boolean | undefined + ) => { + if (selectionType === CardSelectionType.FILTER) { loadAllocateBatchNoOptions() } } @@ -2481,7 +2498,6 @@ remark: '' }) loadAllocateCarrierOptions() - loadAllocateBatchNoOptions() if (allocateFormRef.value) { allocateFormRef.value.resetFields() } @@ -2507,7 +2523,6 @@ recallFormRef.value.resetFields() } loadAllocateCarrierOptions() - loadAllocateBatchNoOptions() } // 关闭批量分配对话框 @@ -2677,7 +2692,6 @@ await Promise.all([ handleSearchEnterprise(), loadAllocateCarrierOptions(), - loadAllocateBatchNoOptions(), loadTopLevelShopCascadeOptions() ]) enterpriseCardAuthorizeDialogVisible.value = true @@ -2688,8 +2702,7 @@ resetEnterpriseCardRecallForm() await Promise.all([ handleSearchEnterprise(), - loadAllocateCarrierOptions(), - loadAllocateBatchNoOptions() + loadAllocateCarrierOptions() ]) enterpriseCardRecallDialogVisible.value = true enterpriseCardRecallFormRef.value?.clearValidate() @@ -2812,8 +2825,7 @@ }) await Promise.all([ loadPackageSeriesList(), - loadAllocateCarrierOptions(), - loadAllocateBatchNoOptions() + loadAllocateCarrierOptions() ]) seriesBindingDialogVisible.value = true seriesBindingFormRef.value?.clearValidate()