From 6984f66da42a46e06fa7bf1e09e7a6bebaedb67f Mon Sep 17 00:00:00 2001
From: dk <1260500659@qq.com>
Date: Wed, 15 Jul 2026 13:26:02 +0800
Subject: [PATCH] =?UTF-8?q?fix(ai-report):=20=E4=BF=AE=E5=A4=8D=E6=8A=A5?=
=?UTF-8?q?=E5=91=8A=E4=BB=BB=E5=8A=A1=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6=E5=92=8C=E9=80=89=E9=A1=B9?=
=?UTF-8?q?=E5=80=BC=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/ReportTaskFormDialog.vue | 100 ++++++++++++++----
.../aireport/testReport/utils/testReport.ts | 80 ++++++++++----
.../dictData/components/dataPopup.vue | 4 +-
3 files changed, 140 insertions(+), 44 deletions(-)
diff --git a/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue b/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue
index 9770328..10d86f9 100644
--- a/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue
+++ b/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue
@@ -41,16 +41,32 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -110,7 +141,12 @@
-
+
@@ -157,7 +193,9 @@
{{ importSummary.pointCount }}
{{ importSummary.groupCount }}
- {{ importSummary.summaryFileName }}
+
+ {{ importSummary.summaryFileName }}
+
@@ -165,29 +203,37 @@
- {{ currentStep === 'done' ? '关闭' : '取消' }}
+
+ {{ currentStep === 'done' ? '关闭' : '取消' }}
+
下一步
@@ -211,7 +257,9 @@ import {
checkReportTaskLedgerPrepared,
getReportTaskErrorMessage,
normalizeReportTaskLedgerSnapshot,
+ normalizeReportTaskSelectedOptionValues,
parseReportTaskStandardIds,
+ resolveReportTaskOptionValue,
stringifyReportTaskStandardIds
} from '../utils/testReport'
@@ -432,9 +480,13 @@ const fillForm = async () => {
formModel.no = record?.no || ''
formModel.clientUnitId = record?.clientUnitId || ''
formModel.reportModelId = record?.reportModelId || ''
- formModel.createUnit = record?.createUnit || ''
+ // 关键业务节点:编辑态详情可能返回展示名称而不是字典 value,这里必须先归一化成真实 option value,避免下拉重复补项和提交时报“检测公司不存在”。
+ formModel.createUnit = resolveReportTaskOptionValue(props.companyOptions, record?.createUnit || '')
formModel.contractNumber = record?.contractNumber || ''
- formModel.standardIds = parseReportTaskStandardIds(record?.standard)
+ formModel.standardIds = normalizeReportTaskSelectedOptionValues(
+ props.standardOptions,
+ parseReportTaskStandardIds(record?.standard)
+ )
formModel.data = record?.data || '{}'
formModel.phonenumber = record?.phonenumber || ''
@@ -548,7 +600,12 @@ const submitForm = async () => {
return
}
- pushLog('info', props.mode === 'create' ? '开始提交新增任务基础信息并写入台账数据' : '开始提交编辑后的任务基础信息并更新台账数据')
+ pushLog(
+ 'info',
+ props.mode === 'create'
+ ? '开始提交新增任务基础信息并写入台账数据'
+ : '开始提交编辑后的任务基础信息并更新台账数据'
+ )
emit('submit', {
id: activeDraftId.value || formModel.id || undefined,
no: formModel.no.trim(),
@@ -891,6 +948,5 @@ const submitForm = async () => {
border-right: none;
border-bottom: 1px solid var(--el-border-color-lighter);
}
-
}
diff --git a/frontend/src/views/aireport/testReport/utils/testReport.ts b/frontend/src/views/aireport/testReport/utils/testReport.ts
index b6ff977..155ee5e 100644
--- a/frontend/src/views/aireport/testReport/utils/testReport.ts
+++ b/frontend/src/views/aireport/testReport/utils/testReport.ts
@@ -28,7 +28,10 @@ export const REPORT_TASK_STATE_OPTIONS: Array<{ label: string; value: ReportTask
{ label: '已退回', value: '04' },
{ label: '已删除', value: '05' }
]
-export const REPORT_TASK_GENERATE_STATE_MAP: Record = {
+export const REPORT_TASK_GENERATE_STATE_MAP: Record<
+ ReportTask.ReportTaskGenerateState,
+ { text: string; tagType: TagType }
+> = {
0: { text: '未生成', tagType: 'info' },
1: { text: '生成中', tagType: 'warning' },
2: { text: '已生成', tagType: 'success' }
@@ -43,11 +46,11 @@ export const REPORT_TASK_GROUP_REPORT_GENERATE_STATUS_TAG_TYPE_MAP: Record<
number,
'warning' | 'success' | 'danger' | undefined
> = {
- 0: undefined,
- 1: 'warning',
- 2: 'success',
- 3: 'danger'
- }
+ 0: undefined,
+ 1: 'warning',
+ 2: 'success',
+ 3: 'danger'
+}
export const resolveReportTaskText = (value: unknown) => {
if (value === null || value === undefined) return '-'
@@ -103,18 +106,27 @@ export const getReportTaskErrorMessage = (error: unknown, fallback: string) => {
}
export const isReportTaskExcelFileName = (fileName: string) => {
- const normalizedName = String(fileName || '').trim().toLowerCase()
+ const normalizedName = String(fileName || '')
+ .trim()
+ .toLowerCase()
return TEST_REPORT_EXCEL_EXTENSIONS.some(extension => normalizedName.endsWith(extension))
}
export const isReportTaskWordFileName = (fileName: string) => {
- const normalizedName = String(fileName || '').trim().toLowerCase()
+ const normalizedName = String(fileName || '')
+ .trim()
+ .toLowerCase()
return TEST_REPORT_WORD_EXTENSIONS.some(extension => normalizedName.endsWith(extension))
}
export const isReportTaskLedgerSummaryFileName = (fileName: string) => {
- const normalizedName = String(fileName || '').trim().toLowerCase()
- return normalizedName.includes(TEST_REPORT_LEDGER_SUMMARY_FILE_BASE_NAME.toLowerCase()) && isReportTaskExcelFileName(normalizedName)
+ const normalizedName = String(fileName || '')
+ .trim()
+ .toLowerCase()
+ return (
+ normalizedName.includes(TEST_REPORT_LEDGER_SUMMARY_FILE_BASE_NAME.toLowerCase()) &&
+ isReportTaskExcelFileName(normalizedName)
+ )
}
export const isReportTaskLedgerAttachmentFileName = (fileName: string) =>
@@ -132,10 +144,7 @@ export const normalizeReportTaskPointList = (
export const normalizeReportTaskLedgerImportResult = (
response:
- | ResultData
- | ReportTask.ReportTaskLedgerImportResult
- | null
- | undefined
+ ResultData | ReportTask.ReportTaskLedgerImportResult | null | undefined
): ReportTask.ReportTaskLedgerImportResult => {
const payload = unwrapReportTaskPayload(
response as ResultData
@@ -193,7 +202,9 @@ export const normalizeReportTaskLedgerValidateResult = (
requiredSheets: Array.isArray(payload?.requiredSheets) ? payload.requiredSheets.filter(Boolean) : [],
existingSheets: Array.isArray(payload?.existingSheets) ? payload.existingSheets.filter(Boolean) : [],
missingSheets: Array.isArray(payload?.missingSheets) ? payload.missingSheets.filter(Boolean) : [],
- orphanAttachmentNames: Array.isArray(payload?.orphanAttachmentNames) ? payload.orphanAttachmentNames.filter(Boolean) : [],
+ orphanAttachmentNames: Array.isArray(payload?.orphanAttachmentNames)
+ ? payload.orphanAttachmentNames.filter(Boolean)
+ : [],
failReasons: Array.isArray(payload?.failReasons) ? payload.failReasons.filter(Boolean) : [],
points: Array.isArray(payload?.points)
? payload.points.map(point => ({
@@ -308,9 +319,8 @@ export const getReportTaskGenerateStateText = (state?: number | null) =>
export const getReportTaskGenerateStateTagType = (state?: number | null): TagType =>
REPORT_TASK_GENERATE_STATE_MAP[state as ReportTask.ReportTaskGenerateState]?.tagType || 'info'
-export const checkReportTaskLedgerPrepared = (
- state: ReportTask.ReportTaskLedgerPreparedState | null | undefined
-) => Boolean(state?.draftId && state.hasImported && !state.pendingRevalidate)
+export const checkReportTaskLedgerPrepared = (state: ReportTask.ReportTaskLedgerPreparedState | null | undefined) =>
+ Boolean(state?.draftId && state.hasImported && !state.pendingRevalidate)
export const buildDictSelectOptions = (dictData: Dict[] = []) =>
dictData
@@ -326,6 +336,32 @@ export const buildOptionLabelMap = (options: Array<{ label: string; value: strin
return result
}, {})
+export const resolveReportTaskOptionValue = (
+ options: Array<{ label: string; value: string }>,
+ value?: string | null
+) => {
+ const text = String(value || '').trim()
+ if (!text) return ''
+
+ const matchedByValue = options.find(option => option.value === text)
+ if (matchedByValue) return matchedByValue.value
+
+ const matchedByLabel = options.find(option => option.label === text)
+ return matchedByLabel?.value || text
+}
+
+export const normalizeReportTaskSelectedOptionValues = (
+ options: Array<{ label: string; value: string }>,
+ values: string[] = []
+) =>
+ values.reduce((result, value) => {
+ const normalizedValue = resolveReportTaskOptionValue(options, value)
+ if (normalizedValue && !result.includes(normalizedValue)) {
+ result.push(normalizedValue)
+ }
+ return result
+ }, [])
+
export const parseReportTaskStandardIds = (value?: string[] | string | null) => {
if (Array.isArray(value)) {
return value.map(item => String(item).trim()).filter(Boolean)
@@ -387,7 +423,9 @@ export const checkReportTaskGroupingCompleted = (
const pointIds = pointList.map(point => String(point.id || '').trim()).filter(Boolean)
if (!pointIds.length) return false
- const groupedIds = payload.groups.flatMap(group => group.pointIds.map(pointId => String(pointId || '').trim()).filter(Boolean))
+ const groupedIds = payload.groups.flatMap(group =>
+ group.pointIds.map(pointId => String(pointId || '').trim()).filter(Boolean)
+ )
if (groupedIds.length !== pointIds.length) return false
const uniqueGroupedIds = new Set(groupedIds)
@@ -397,7 +435,9 @@ export const checkReportTaskGroupingCompleted = (
const hasInvalidPointId = Array.from(uniqueGroupedIds).some(pointId => !pointIdSet.has(pointId))
if (hasInvalidPointId) return false
- return payload.groups.every(group => Number.isInteger(group.groupNo) && group.groupNo > 0 && group.pointIds.length > 0)
+ return payload.groups.every(
+ group => Number.isInteger(group.groupNo) && group.groupNo > 0 && group.pointIds.length > 0
+ )
}
export const resolveReportTaskCreateUnitText = (
diff --git a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
index 445c1dd..fabd5f3 100644
--- a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
+++ b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
@@ -7,10 +7,10 @@
-
+
-
+