Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 81238a41
authored
May 19, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 修复bug
1 parent
cb4805c3
Pipeline
#208
for
81238a41
failed
in 0 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
412 additions
and
144 deletions
apps/web/venus-usedcar-quality/src/api/modules/inspect-report/template.ts
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/radioSelect.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDatePicker.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
apps/web/venus-usedcar-quality/src/views/car-detail/components/ScoreForm.vue
apps/web/venus-usedcar-quality/src/views/car-detail/composables/useInspectModules.ts
apps/web/venus-usedcar-quality/src/views/car-detail/composables/useInspectSubmit.ts
apps/web/venus-usedcar-quality/src/views/car-list/index.vue
apps/web/venus-usedcar-quality/src/views/home/index.vue
apps/web/venus-usedcar-quality/src/api/modules/inspect-report/template.ts
View file @
81238a4
...
...
@@ -86,6 +86,72 @@ export interface InspectionScoreVO {
skeletonLevel
?:
null
|
string
;
}
const
SCORE_RATING_LEVELS
=
new
Set
([
"A"
,
"B"
,
"C"
,
"D"
]);
/** 从 `getInspectionChildren(-1)` 响应中解析 `inspectionScoreVO` */
export
function
extractInspectionScoreVO
(
raw
:
InspectionChildrenData
):
InspectionScoreVO
|
null
{
if
(
!
raw
||
typeof
raw
!==
"object"
)
{
return
null
;
}
if
(
Array
.
isArray
(
raw
))
{
for
(
const
item
of
raw
)
{
if
(
!
item
||
typeof
item
!==
"object"
)
continue
;
const
vo
=
(
item
as
{
inspectionScoreVO
?:
unknown
}).
inspectionScoreVO
;
if
(
vo
&&
typeof
vo
===
"object"
)
{
return
vo
as
InspectionScoreVO
;
}
}
return
null
;
}
const
vo
=
raw
.
inspectionScoreVO
;
if
(
!
vo
||
typeof
vo
!==
"object"
)
{
return
null
;
}
return
vo
;
}
/** 与 ScoreForm.validate 必填项一致:评分已保存且可回显时视为已填完 */
export
function
isInspectionScoreVOFilled
(
vo
:
InspectionScoreVO
|
null
|
undefined
):
boolean
{
if
(
!
vo
)
return
false
;
const
appearanceBasis
=
String
(
vo
.
exteriorComment
??
""
).
trim
();
const
frameRating
=
String
(
vo
.
skeletonLevel
??
""
)
.
trim
()
.
toUpperCase
();
const
frameBasis
=
String
(
vo
.
skeletonComment
??
""
).
trim
();
const
interiorRating
=
String
(
vo
.
interiorLevel
??
""
)
.
trim
()
.
toUpperCase
();
const
interiorBasis
=
String
(
vo
.
interiorComment
??
""
).
trim
();
const
overallRating
=
String
(
vo
.
overallComment
??
""
).
trim
();
return
(
appearanceBasis
.
length
>
0
&&
SCORE_RATING_LEVELS
.
has
(
frameRating
)
&&
frameBasis
.
length
>
0
&&
SCORE_RATING_LEVELS
.
has
(
interiorRating
)
&&
interiorBasis
.
length
>
0
&&
overallRating
.
length
>
0
);
}
function
isCompletedFlagFieldDone
(
flag
:
unknown
):
boolean
{
return
flag
===
1
||
String
(
flag
??
""
)
===
"1"
;
}
function
isInspectionVoCompleted
(
vo
:
InspectionResultVO
|
undefined
):
boolean
{
return
vo
?.
completedFlag
===
1
||
String
(
vo
?.
completedFlag
??
""
)
===
"1"
;
}
/** 检测评分大项是否已完成:root.completedFlag / inspectionResultVO / 已保存的 inspectionScoreVO */
export
function
resolveScoreModuleCompletedFlag
(
scoreRoot
:
InspectionNode
|
undefined
,
scoreVo
:
InspectionScoreVO
|
null
|
undefined
):
0
|
1
{
if
(
isCompletedFlagFieldDone
(
scoreRoot
?.
completedFlag
))
return
1
;
if
(
isInspectionVoCompleted
(
scoreRoot
?.
inspectionResultVO
))
return
1
;
if
(
isInspectionScoreVOFilled
(
scoreVo
))
return
1
;
return
0
;
}
/**
* `getInspectionChildren` 响应:
* - 普通节点:节点数组;
...
...
@@ -160,7 +226,7 @@ function isKeyedSelectInteractionType(interactionType: string | undefined): bool
}
/** 将模板默认值如 `2-私户` 按首个 `-` 拆成 key / 展示文案 */
function
parseKeyedSelectDefault
(
raw
:
string
):
{
valueKey
:
string
;
valueText
:
string
}
{
export
function
parseKeyedSelectDefault
(
raw
:
string
):
{
valueKey
:
string
;
valueText
:
string
}
{
const
i
=
raw
.
indexOf
(
"-"
);
if
(
i
===
-
1
)
{
return
{
valueKey
:
""
,
valueText
:
raw
};
...
...
@@ -183,7 +249,7 @@ export function resolveInspectionNodeInitialValueTexts(
):
string
[]
{
if
(
!
hasDefaultValueFlag
(
node
))
return
[];
const
type
=
node
.
defaultType
;
const
type
=
Number
(
node
.
defaultType
)
;
if
(
type
===
1
)
{
return
[
node
.
defaultValue
??
""
];
}
...
...
@@ -206,6 +272,71 @@ export function resolveInspectionNodeInitialValueTexts(
return
[];
}
/** 从 options 字符串(如 `["5-国五"]`)中按 key 或文案反查选项 */
function
resolveSelectKeyFromOptions
(
options
:
string
|
undefined
,
valueKey
:
string
,
valueText
:
string
):
{
valueKey
:
string
;
valueText
:
string
}
{
if
(
valueKey
||
!
valueText
||
!
options
)
{
return
{
valueKey
,
valueText
};
}
try
{
const
opts
=
JSON
.
parse
(
options
)
as
string
[];
for
(
const
opt
of
opts
)
{
const
parts
=
String
(
opt
??
""
).
split
(
"-"
);
const
k
=
parts
[
0
]
??
""
;
const
t
=
parts
[
1
]
??
""
;
if
(
t
===
valueText
||
k
===
valueText
||
String
(
opt
)
===
valueText
)
{
return
{
valueKey
:
k
,
valueText
:
t
||
valueText
};
}
}
}
catch
{
/* ignore invalid options */
}
return
{
valueKey
,
valueText
};
}
/**
* 叶子节点下拉/单选类控件的初始 valueKey / valueText(检测结果、apply 写入字段、resolvedInitialValue)
*/
export
function
getInspectionLeafSelectInitial
(
node
:
InspectionNode
):
{
value
:
string
;
valueKey
:
string
;
valueText
:
string
;
}
{
const
empty
=
{
value
:
""
,
valueKey
:
""
,
valueText
:
""
};
const
list
=
node
.
inspectionResultVO
?.
inspectionValueList
;
if
(
list
?.
length
)
{
const
first
=
list
[
0
];
let
valueKey
=
String
(
first
?.
valueKey
??
""
);
let
valueText
=
String
(
first
?.
valueText
??
""
);
({
valueKey
,
valueText
}
=
resolveSelectKeyFromOptions
(
node
.
options
,
valueKey
,
valueText
));
if
(
valueKey
||
valueText
)
{
return
{
value
:
valueKey
,
valueKey
,
valueText
};
}
}
let
valueKey
=
String
(
node
.
valueKey
??
node
.
value
??
""
);
let
valueText
=
String
(
node
.
valueText
??
""
);
({
valueKey
,
valueText
}
=
resolveSelectKeyFromOptions
(
node
.
options
,
valueKey
,
valueText
));
if
(
valueKey
||
valueText
)
{
return
{
value
:
valueKey
,
valueKey
,
valueText
};
}
const
raw
=
node
.
resolvedInitialValue
;
if
(
raw
)
{
let
parsed
=
parseKeyedSelectDefault
(
String
(
raw
));
({
valueKey
,
valueText
}
=
resolveSelectKeyFromOptions
(
node
.
options
,
parsed
.
valueKey
,
parsed
.
valueText
));
if
(
valueKey
||
valueText
)
{
return
{
value
:
valueKey
,
valueKey
,
valueText
};
}
}
return
empty
;
}
function
buildInspectionResultVOFromDefaults
(
node
:
InspectionNode
,
valueTexts
:
string
[]):
InspectionResultVO
{
const
keyed
=
isKeyedSelectInteractionType
(
node
.
interactionType
);
const
inspectionValueList
:
InspectionValueItem
[]
=
valueTexts
.
map
((
raw
,
index
)
=>
{
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
View file @
81238a4
<
script
setup
lang=
"ts"
>
import
type
{
CustomizeFormValidateResult
}
from
"@/types/views/car-detail"
;
import
type
{
InspectionNode
,
InspectionTemplateDefaultData
}
from
"@api"
;
import
{
getInspectionLeafSelectInitial
,
type
InspectionNode
,
type
InspectionTemplateDefaultData
,
}
from
"@api"
;
import
{
ref
,
watch
}
from
"vue"
;
...
...
@@ -43,13 +47,42 @@ const rules = ref({});
// 加载中
const
pageLoading
=
ref
(
false
);
watch
(()
=>
props
.
leafNodes
,
(
nodes
)
=>
{
pageLoading
.
value
=
true
;
columnsList
.
value
=
(
nodes
||
[]).
map
((
item
)
=>
({
const
SELECT_INTERACTION_TYPES
=
new
Set
([
"dropdown"
,
"radio_button_select"
]);
function
getValueText
(
item
:
InspectionNode
)
{
let
valueText
=
""
;
if
(
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
if
(
inspectionValueList
&&
inspectionValueList
.
length
>
0
)
{
const
inputList
=
[
"text_input"
,
"textarea_input"
,
"number_input"
,
"date_picker"
];
if
(
inputList
.
includes
(
String
(
item
.
interactionType
??
""
)))
{
valueText
=
inspectionValueList
[
0
]?.
valueText
||
""
;
}
}
}
return
valueText
;
}
function
mapLeafNodeToColumnRow
(
item
:
InspectionNode
):
InspectionColumnRow
{
const
row
:
InspectionColumnRow
=
{
...
item
,
resultStatus
:
item
?.
inspectionResultVO
?.
resultStatus
==
3
?
true
:
false
,
value
:
getValueText
(
item
),
}))
as
InspectionColumnRow
[];
value
:
""
,
};
if
(
SELECT_INTERACTION_TYPES
.
has
(
String
(
item
.
interactionType
??
""
)))
{
const
{
value
,
valueKey
,
valueText
}
=
getInspectionLeafSelectInitial
(
item
);
row
.
value
=
value
;
row
.
valueKey
=
valueKey
;
row
.
valueText
=
valueText
;
return
row
;
}
row
.
value
=
getValueText
(
item
);
return
row
;
}
watch
(()
=>
props
.
leafNodes
,
(
nodes
)
=>
{
pageLoading
.
value
=
true
;
columnsList
.
value
=
(
nodes
||
[]).
map
((
item
)
=>
mapLeafNodeToColumnRow
(
item
))
as
InspectionColumnRow
[];
console
.
log
(
'leafNodes'
,
columnsList
.
value
);
...
...
@@ -65,20 +98,6 @@ onMounted(() => {
},
1200
);
});
function
getValueText
(
item
:
any
)
{
let
valueText
=
""
;
if
(
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
if
(
inspectionValueList
&&
inspectionValueList
.
length
>
0
)
{
const
inputList
=
[
"text_input"
,
"textarea_input"
,
"number_input"
,
"date_picker"
];
if
(
inputList
.
includes
(
item
.
interactionType
))
{
valueText
=
inspectionValueList
[
0
].
valueText
||
""
;
}
}
}
return
valueText
;
}
// 提交数据
function
setSubmitData
()
{
const
returnData
:
{
...
...
@@ -283,7 +302,7 @@ defineExpose({
<van-form
ref=
"customizeFormRef"
:model=
"form"
:rules=
"rules"
>
<div
v-for=
"(item, index) in columnsList"
:key=
"index"
class=
"customizeList"
:class=
"
{
<div
v-for=
"(item, index) in columnsList"
:key=
"i
tem.id ?? i
ndex"
class=
"customizeList"
:class=
"
{
'border-bottom': (index
< columnsList
.
length
-
1
&&
item
.
interactionType
!=
'
image_upload
')
||
item
.
interactionType =
=
'
textarea_input
',
'
customizeList50
'
:
setImgWidth
(
item
)
}"
>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/radioSelect.vue
View file @
81238a4
<
script
setup
lang=
"ts"
>
import
{
getInspectionLeafSelectInitial
}
from
"@api"
;
import
{
computed
,
onMounted
,
ref
}
from
"vue"
;
const
props
=
defineProps
({
...
...
@@ -16,15 +17,9 @@ onMounted(() => {
initData
();
});
// 初始化数据
function
initData
()
{
pickerValue
.
value
=
""
;
if
(
props
?.
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
props
?.
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
if
(
inspectionValueList
&&
inspectionValueList
.
length
>
0
)
{
pickerValue
.
value
=
inspectionValueList
[
0
].
valueKey
||
""
;
}
}
const
{
valueKey
}
=
getInspectionLeafSelectInitial
(
props
.
item
);
pickerValue
.
value
=
valueKey
;
}
// 计算属性
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDatePicker.vue
View file @
81238a4
...
...
@@ -10,6 +10,9 @@ const props = defineProps({
const
emit
=
defineEmits
([
"update"
]);
/** 日期选择最早可选:1990-01-01(年月模式为 1990-01) */
const
MIN_PICKER_DATE
=
new
Date
(
1990
,
0
,
1
);
const
displayValue
=
computed
({
get
:
()
=>
String
(
props
.
item
.
value
??
""
),
set
:
(
v
:
string
)
=>
emit
(
"update"
,
v
),
...
...
@@ -33,29 +36,47 @@ function initData() {
}
}
function
clampPickerParts
(
parts
:
(
number
|
string
)[]):
(
number
|
string
)[]
{
const
year
=
Number
(
parts
[
0
]);
const
month
=
Number
(
parts
[
1
]
??
1
);
const
day
=
Number
(
parts
[
2
]
??
1
);
const
clampedYear
=
Math
.
max
(
year
,
MIN_PICKER_DATE
.
getFullYear
());
const
clampedMonth
=
clampedYear
===
MIN_PICKER_DATE
.
getFullYear
()
?
Math
.
max
(
month
,
MIN_PICKER_DATE
.
getMonth
()
+
1
)
:
month
;
if
(
columnsType
.
value
.
length
===
2
)
{
return
[
clampedYear
,
clampedMonth
];
}
const
clampedDay
=
clampedYear
===
MIN_PICKER_DATE
.
getFullYear
()
&&
clampedMonth
===
MIN_PICKER_DATE
.
getMonth
()
+
1
?
Math
.
max
(
day
,
MIN_PICKER_DATE
.
getDate
())
:
day
;
return
[
clampedYear
,
clampedMonth
,
clampedDay
];
}
function
handleShowPicker
()
{
showPicker
.
value
=
true
;
if
(
!
props
.
item
.
value
)
{
const
date
=
new
Date
();
if
(
columnsType
.
value
.
length
===
2
)
{
pickerValue
.
value
=
[
date
.
getFullYear
(),
date
.
getMonth
()
+
1
];
}
else
{
pickerValue
.
value
=
[
date
.
getFullYear
(),
date
.
getMonth
()
+
1
,
date
.
getDate
()];
}
const
parts
=
columnsType
.
value
.
length
===
2
?
[
date
.
getFullYear
(),
date
.
getMonth
()
+
1
]
:
[
date
.
getFullYear
(),
date
.
getMonth
()
+
1
,
date
.
getDate
()];
pickerValue
.
value
=
clampPickerParts
(
parts
);
}
else
{
const
dateArr
=
props
.
item
.
value
.
split
(
"-"
);
if
(
columnsType
.
value
.
length
===
2
)
{
pickerValue
.
value
=
[
dateArr
[
0
],
dateArr
[
1
]];
}
else
{
pickerValue
.
value
=
dateArr
;
}
const
dateArr
=
props
.
item
.
value
.
split
(
"-"
).
map
((
v
)
=>
Number
(
v
)
||
v
);
pickerValue
.
value
=
clampPickerParts
(
dateArr
);
}
}
function
onConfirm
()
{
let
picker
=
""
;
if
(
pickerValue
.
value
.
length
>
0
)
{
picker
=
pickerValue
.
value
.
join
(
"-"
);
const
clamped
=
clampPickerParts
(
pickerValue
.
value
);
pickerValue
.
value
=
clamped
;
picker
=
clamped
.
join
(
"-"
);
}
showPicker
.
value
=
false
;
emit
(
"update"
,
picker
);
...
...
@@ -77,8 +98,14 @@ function getLabelWidth(nodeName: string) {
:placeholder=
"item.placeholder"
readonly
:required=
"item.required === 1"
@
click=
"handleShowPicker"
input-align=
"right"
:label-width=
"getLabelWidth(item.nodeName) + 'px'"
/>
<van-popup
v-model:show=
"showPicker"
destroy-on-close
position=
"bottom"
teleport=
"#vant-portal-host"
>
<van-date-picker
v-model=
"pickerValue"
:columns-type=
"columnsType"
:title=
"item.nodeName"
@
cancel=
"showPicker = false"
@
confirm=
"onConfirm"
/>
<van-date-picker
v-model=
"pickerValue"
:columns-type=
"columnsType"
:min-date=
"MIN_PICKER_DATE"
:title=
"item.nodeName"
@
cancel=
"showPicker = false"
@
confirm=
"onConfirm"
/>
</van-popup>
</div>
</
template
>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
View file @
81238a4
<
script
setup
lang=
"ts"
>
import
{
computed
,
onMounted
,
ref
}
from
"vue"
;
import
{
getInspectionLeafSelectInitial
}
from
"@api"
;
import
{
computed
,
onMounted
,
ref
,
watch
}
from
"vue"
;
const
props
=
defineProps
({
item
:
{
...
...
@@ -8,13 +9,13 @@ const props = defineProps({
},
carTypeList
:
{
type
:
Array
,
default
:
()
=>
{}
,
default
:
()
=>
[]
,
},
});
const
emit
=
defineEmits
([
"update"
]);
const
showPicker
=
ref
(
false
);
const
pickerValue
=
ref
([]);
const
pickerValue
=
ref
<
string
[]
>
([]);
const
displayValueText
=
computed
({
get
:
()
=>
String
(
props
.
item
.
valueText
??
""
),
...
...
@@ -31,27 +32,8 @@ const displayValueText = computed({
},
});
// 页面加载时初始化数据
onMounted
(()
=>
{
initData
();
});
// 初始化数据
function
initData
()
{
pickerValue
.
value
=
[];
if
(
props
?.
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
props
?.
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
if
(
inspectionValueList
&&
inspectionValueList
.
length
>
0
&&
inspectionValueList
[
0
].
valueKey
)
{
pickerValue
.
value
=
[
inspectionValueList
[
0
].
valueKey
];
}
}
onConfirm
();
}
// 计算属性
const
columnsList
=
computed
(()
=>
{
const
optionsList
=
JSON
.
parse
(
props
.
item
.
options
||
"[]"
).
map
(
item
=>
{
const
optionsList
=
JSON
.
parse
(
props
.
item
.
options
||
"[]"
).
map
(
(
item
:
string
)
=>
{
const
valueList
=
(
item
||
""
).
split
(
"-"
);
return
{
text
:
valueList
[
1
]
||
""
,
...
...
@@ -61,50 +43,119 @@ const columnsList = computed(() => {
return
props
.
item
.
nodeName
===
"车型"
?
props
.
carTypeList
:
optionsList
;
});
function
emitSelection
(
value
:
string
,
valueText
:
string
,
valueKey
:
string
)
{
const
item
=
props
.
item
as
{
value
?:
string
;
valueKey
?:
string
;
valueText
?:
string
};
if
(
String
(
item
?.
value
??
""
)
===
value
&&
String
(
item
?.
valueText
??
""
)
===
valueText
&&
String
(
item
?.
valueKey
??
""
)
===
valueKey
)
{
return
;
}
emit
(
"update"
,
{
value
,
valueText
,
valueKey
});
}
function
findColumn
(
valueKey
:
string
,
valueText
:
string
)
{
const
cols
=
columnsList
.
value
as
{
text
?:
string
;
value
?:
string
}[];
if
(
valueKey
)
{
const
byKey
=
cols
.
find
((
col
)
=>
col
.
value
===
valueKey
);
if
(
byKey
)
return
byKey
;
}
if
(
valueText
)
{
return
cols
.
find
((
col
)
=>
col
.
text
===
valueText
||
col
.
value
===
valueText
);
}
return
undefined
;
}
/** 从 VO / 节点字段 / resolvedInitialValue 回显,无有效选中时不 emit 空值 */
function
initData
()
{
const
{
valueKey
,
valueText
}
=
getInspectionLeafSelectInitial
(
props
.
item
);
if
(
!
valueKey
&&
!
valueText
)
{
pickerValue
.
value
=
[];
return
;
}
const
selected
=
findColumn
(
valueKey
,
valueText
);
if
(
selected
?.
value
!==
undefined
&&
selected
.
value
!==
""
)
{
pickerValue
.
value
=
[
String
(
selected
.
value
)];
emitSelection
(
String
(
selected
.
value
),
String
(
selected
.
text
??
""
),
String
(
selected
.
value
));
return
;
}
pickerValue
.
value
=
valueKey
?
[
valueKey
]
:
[];
emitSelection
(
valueKey
,
valueText
,
valueKey
||
valueText
);
}
onMounted
(()
=>
{
initData
();
});
watch
(
()
=>
props
.
carTypeList
,
()
=>
{
if
(
props
.
item
?.
nodeName
===
"车型"
)
{
initData
();
}
}
);
function
onConfirm
()
{
const
picker
=
pickerValue
.
value
&&
pickerValue
.
value
.
length
>
0
?
pickerValue
.
value
[
0
]
:
""
;
const
picker
=
pickerValue
.
value
&&
pickerValue
.
value
.
length
>
0
?
pickerValue
.
value
[
0
]
:
""
;
showPicker
.
value
=
false
;
const
selected
=
columnsList
.
value
.
find
((
col
)
=>
col
.
value
===
picker
)
||
{};
emit
(
"update"
,
{
value
:
selected
.
value
||
""
,
valueText
:
selected
.
text
||
""
,
valueKey
:
selected
.
value
||
""
,
});
if
(
!
picker
)
{
const
{
valueKey
,
valueText
}
=
getInspectionLeafSelectInitial
(
props
.
item
);
if
(
valueKey
||
valueText
)
{
return
;
}
emitSelection
(
""
,
""
,
""
);
return
;
}
const
selected
=
(
columnsList
.
value
as
{
text
?:
string
;
value
?:
string
}[]).
find
((
col
)
=>
col
.
value
===
picker
)
||
{};
emitSelection
(
String
(
selected
.
value
??
""
),
String
(
selected
.
text
??
""
),
String
(
selected
.
value
??
""
));
}
function
getLabelWidth
(
nodeName
:
string
)
{
let
widtPx
=
76
;
if
(
nodeName
.
length
>
4
)
{
widtPx
=
widtPx
+
(
(
nodeName
.
length
-
4
)
*
12
)
;
widtPx
=
widtPx
+
(
nodeName
.
length
-
4
)
*
12
;
}
return
widtPx
;
}
</
script
>
<
template
>
<div>
<van-field
v-model=
"displayValueText"
clearable
is-link
:label=
"item.nodeName"
name=
"datePicker"
:placeholder=
"item.placeholder"
readonly
:required=
"item.required === 1"
@
click=
"showPicker = true"
input-align=
"right"
:label-width=
"getLabelWidth(item.nodeName) + 'px'"
/>
<van-popup
v-model:show=
"showPicker"
destroy-on-close
position=
"bottom"
teleport=
"#vant-portal-host"
>
<van-picker
v-model=
"pickerValue"
:columns=
"columnsList"
:title=
"item.nodeName"
@
cancel=
"showPicker = false"
@
confirm=
"onConfirm"
/>
</van-popup>
</div>
<div>
<van-field
v-model=
"displayValueText"
clearable
is-link
:label=
"item.nodeName"
name=
"datePicker"
:placeholder=
"item.placeholder"
readonly
:required=
"item.required === 1"
input-align=
"right"
:label-width=
"getLabelWidth(item.nodeName) + 'px'"
@
click=
"showPicker = true"
/>
<van-popup
v-model:show=
"showPicker"
destroy-on-close
position=
"bottom"
teleport=
"#vant-portal-host"
>
<van-picker
v-model=
"pickerValue"
:columns=
"columnsList"
:title=
"item.nodeName"
@
cancel=
"showPicker = false"
@
confirm=
"onConfirm"
/>
</van-popup>
</div>
</
template
>
<
style
lang=
"scss"
scoped
></
style
>
apps/web/venus-usedcar-quality/src/views/car-detail/components/ScoreForm.vue
View file @
81238a4
...
...
@@ -184,11 +184,7 @@
<
script
setup
lang=
"ts"
>
import
type
{
ScoreRatingOption
}
from
"@/types/views/car-detail"
;
import
type
{
CompleteInspectionParams
,
InspectionChildrenData
,
InspectionScoreVO
,
}
from
"@api"
;
import
type
{
CompleteInspectionParams
,
InspectionScoreVO
}
from
"@api"
;
import
type
{
RatingGuideConfig
}
from
"./rating-guide-content"
;
...
...
@@ -197,7 +193,7 @@ import { reactive, ref, watch } from "vue";
import
ratingSelectedCheckImg
from
"@/assets/image/rating-selected-check.png"
;
import
systemTipImg
from
"@/assets/image/system-tip.png"
;
import
{
SCORE_RATING_OPTIONS
as
RATING_OPTIONS
}
from
"@/types/views/car-detail"
;
import
{
getInspectionChildren
}
from
"@api"
;
import
{
extractInspectionScoreVO
,
getInspectionChildren
}
from
"@api"
;
import
{
isRequestFailureAlreadyHandled
}
from
"@utils/request"
;
import
{
showToast
}
from
"vant"
;
...
...
@@ -242,28 +238,6 @@ function onRatingGuideShow(v: boolean) {
ratingGuideOpen
.
value
=
v
;
}
function
extractInspectionScoreVO
(
raw
:
InspectionChildrenData
):
InspectionScoreVO
|
null
{
if
(
!
raw
||
typeof
raw
!==
"object"
)
{
return
null
;
}
/** `rootNodeId === -1` 时接口常返回 `[{ id: -1, inspectionScoreVO: {...}, ... }]`,与单对象两种形态 */
if
(
Array
.
isArray
(
raw
))
{
for
(
const
item
of
raw
)
{
if
(
!
item
||
typeof
item
!==
"object"
)
continue
;
const
vo
=
(
item
as
{
inspectionScoreVO
?:
unknown
}).
inspectionScoreVO
;
if
(
vo
&&
typeof
vo
===
"object"
)
{
return
vo
as
InspectionScoreVO
;
}
}
return
null
;
}
const
vo
=
raw
.
inspectionScoreVO
;
if
(
!
vo
||
typeof
vo
!==
"object"
)
{
return
null
;
}
return
vo
;
}
function
scoreFieldToNumber
(
value
:
unknown
,
fallback
=
0
):
number
{
if
(
value
===
null
||
value
===
undefined
||
value
===
""
)
{
return
fallback
;
...
...
apps/web/venus-usedcar-quality/src/views/car-detail/composables/useInspectModules.ts
View file @
81238a4
...
...
@@ -7,9 +7,11 @@ import { computed, ref } from "vue";
import
{
applyResolvedInitialValuesToLeafNodes
,
extractInspectionScoreVO
,
getInspectionChildren
,
getInspectionRootNodes
,
getInspectionTemplateDefault
,
resolveScoreModuleCompletedFlag
,
}
from
"@api"
;
import
{
isRequestFailureAlreadyHandled
}
from
"@utils/request"
;
import
{
showToast
}
from
"vant"
;
...
...
@@ -146,6 +148,15 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
const
scoreRoot
=
rootNodes
.
find
((
root
)
=>
String
(
root
.
id
)
===
"-1"
);
const
inspectionRoots
=
rootNodes
.
filter
((
root
)
=>
String
(
root
.
id
)
!==
"-1"
);
let
scoreVo
=
null
;
try
{
const
scoreRaw
=
await
getInspectionChildren
(
-
1
,
taskId
.
value
);
scoreVo
=
extractInspectionScoreVO
(
scoreRaw
);
}
catch
(
error
)
{
console
.
error
(
"刷新检测评分完成状态失败:"
,
error
);
}
const
scoreCompletedFlag
=
resolveScoreModuleCompletedFlag
(
scoreRoot
,
scoreVo
);
const
refreshedInspectionModules
:
BigModule
[]
=
inspectionRoots
.
map
((
root
)
=>
{
const
prev
=
oldByKey
.
get
(
String
(
root
.
id
));
return
{
...
...
@@ -162,7 +173,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
const
scoreModule
:
BigModule
=
{
key
:
SCORE_BIG_KEY
,
label
:
"检测评分"
,
completedFlag
:
score
Root
?.
completedFlag
as
0
|
1
|
string
|
undefined
,
completedFlag
:
score
CompletedFlag
,
subTabs
:
prevScore
?.
subTabs
??
[],
hasSecondaryTabs
:
prevScore
?.
hasSecondaryTabs
,
secondaryProgress
:
prevScore
?.
secondaryProgress
,
...
...
@@ -386,6 +397,7 @@ export function useInspectModules(route: RouteLocationNormalizedLoaded) {
switchToUncompletedInspectionNode
,
advanceInspectionStep
,
onOpenModulePicker
,
refreshBigModulesFromRootNodes
,
};
}
...
...
apps/web/venus-usedcar-quality/src/views/car-detail/composables/useInspectSubmit.ts
View file @
81238a4
...
...
@@ -212,6 +212,7 @@ export function useInspectSubmit(
inspectionScoreFormRef
.
value
.
getCompleteInspectionPayload
(
modules
.
taskId
.
value
)
);
if
(
result
&&
hasCompleteInspectionUncompletedHint
(
result
))
{
await
modules
.
refreshBigModulesFromRootNodes
();
const
target
=
getCompleteInspectionUncompletedNavigateTarget
(
result
);
const
name
=
target
?.
toastName
;
const
nid
=
target
?.
nodeId
;
...
...
apps/web/venus-usedcar-quality/src/views/car-list/index.vue
View file @
81238a4
<
script
setup
lang=
"ts"
>
import
type
{
ReportItem
}
from
"@/types/views/car-list"
;
import
{
computed
,
onActivated
,
ref
,
watch
}
from
"vue"
;
import
{
computed
,
onActivated
,
ref
}
from
"vue"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
getInspectReportPage
}
from
"@/api/modules/inspect-report"
;
...
...
@@ -9,7 +9,9 @@ import PageTop from "@/components/PageTop.vue";
const
router
=
useRouter
();
const
keyword
=
ref
(
""
);
const
keywordInput
=
ref
(
""
);
/** 点击「搜索」后生效的查询词 */
const
searchKeyword
=
ref
(
""
);
const
refreshing
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
finished
=
ref
(
false
);
...
...
@@ -85,7 +87,7 @@ async function fillMore() {
const res = await getInspectReportPage({
size: pageSize,
page: currentPage.value,
keyword:
keyword.value.trim()
|| undefined,
keyword:
searchKeyword.value
|| undefined,
});
const next = (res.content ?? []).map((x: unknown) => mapReportItem(x as Record<string, unknown>));
...
...
@@ -112,6 +114,15 @@ async function onRefresh() {
}
}
function onSearch() {
searchKeyword.value = keywordInput.value.trim();
void onRefresh();
}
function onClearKeyword() {
keywordInput.value = "";
}
/** 检测报告列表:查看报告优先使用行内 h5Url,否则进站内报告页 */
function onViewReport(item: ReportItem) {
const url = item.h5Url?.trim();
...
...
@@ -124,9 +135,6 @@ function onViewReport(item: ReportItem) {
}
}
watch([keyword], () => {
void onRefresh();
});
onActivated(() => {
// keepAlive: true 下首次进入与从子页返回都会触发;勿再在 setup 末尾调用 onRefresh,否则会并发两次 fillMore、第一页重复追加
...
...
@@ -144,22 +152,26 @@ onActivated(() => {
color=
"#969799"
name=
"search"
size=
"16"
/>
<input
v-model=
"keyword"
<input
v-model=
"keyword
Input
"
autocomplete=
"off"
class=
"round-search__input"
enterkeyhint=
"search"
placeholder=
"搜索报告号、车牌号、车型名称"
type=
"search"
/>
<button
v-show=
"keyword"
<button
v-show=
"keyword
Input
"
aria-label=
"清除"
class=
"round-search__clear"
type=
"button"
@
click=
"
keyword = ''
"
>
@
click=
"
onClearKeyword
"
>
<van-icon
color=
"#c8c9cc"
name=
"clear"
size=
"18"
/>
</button>
</div>
<button
class=
"round-search__submit"
type=
"button"
@
click=
"onSearch"
>
搜索
</button>
</div>
</div>
</PageTop>
...
...
@@ -246,6 +258,7 @@ onActivated(() => {
.round-search
{
display
:
flex
;
gap
:
8px
;
align-items
:
center
;
box-sizing
:
border-box
;
padding
:
0
;
...
...
@@ -308,6 +321,20 @@ onActivated(() => {
border
:
0
;
}
.round-search__submit
{
flex-shrink
:
0
;
height
:
34px
;
padding
:
0
14px
;
font-size
:
14px
;
font-weight
:
500
;
line-height
:
34px
;
color
:
#fff
;
cursor
:
pointer
;
background
:
#185efe
;
border
:
0
;
border-radius
:
999px
;
}
.list-wrap
{
flex
:
1
;
padding
:
12px
12px
calc
(
12px
+
env
(
safe-area-inset-bottom
));
...
...
apps/web/venus-usedcar-quality/src/views/home/index.vue
View file @
81238a4
...
...
@@ -10,7 +10,9 @@ import PageTop from "@/components/PageTop.vue";
import
WorkOrderStatusTags
from
"@/components/WorkOrderStatusTags.vue"
;
import
searchIcon
from
"@assets/image/searchIcon.png"
;
const
keyword
=
ref
(
""
);
const
keywordInput
=
ref
(
""
);
/** 点击「搜索」后生效的查询词 */
const
searchKeyword
=
ref
(
""
);
const
activeStatus
=
ref
<
WorkOrderStatus
>
(
1
);
const
refreshing
=
ref
(
false
);
const
loading
=
ref
(
false
);
...
...
@@ -111,7 +113,7 @@ async function fillMore() {
size
:
pageSize
,
page
:
currentPage
.
value
,
status
:
activeStatus
.
value
,
keyword
:
keyword
.
value
.
trim
()
,
keyword
:
searchKeyword
.
value
,
});
const
next
=
(
res
.
content
??
[]).
map
((
item
:
unknown
)
=>
mapWorkOrderItem
(
item
as
unknown
as
Record
<
string
,
unknown
>
)
...
...
@@ -147,9 +149,19 @@ async function onRefresh() {
}
}
function
onSearch
()
{
searchKeyword
.
value
=
keywordInput
.
value
.
trim
();
void
onRefresh
();
}
function
onClearKeyword
()
{
keywordInput
.
value
=
""
;
}
function
onStatusChange
(
status
:
WorkOrderStatus
)
{
activeStatus
.
value
=
status
;
keyword
.
value
=
""
;
keywordInput
.
value
=
""
;
searchKeyword
.
value
=
""
;
}
function
startCheck
(
item
:
WorkOrderItem
)
{
...
...
@@ -260,7 +272,7 @@ function getCardActions(item: WorkOrderItem): CardAction[] {
/** 底部操作区统一拦冒泡,避免点到按钮与卡片间隙时仍触发整张卡的 viewWorkOrder */
function
stopCardFooterBubbling
()
{}
watch
(
[
keyword
,
activeStatus
]
,
()
=>
{
watch
(
activeStatus
,
()
=>
{
void
onRefresh
();
});
...
...
@@ -289,22 +301,26 @@ void onRefresh();
aria-hidden=
"true"
class=
"round-search__icon"
:src=
"searchIcon"
/>
<input
v-model=
"keyword"
<input
v-model=
"keyword
Input
"
autocomplete=
"off"
class=
"round-search__input"
enterkeyhint=
"search"
placeholder=
"搜索车牌号、VIN码、车型名称"
type=
"search"
/>
<button
v-show=
"keyword"
<button
v-show=
"keyword
Input
"
aria-label=
"清除"
class=
"round-search__clear"
type=
"button"
@
click=
"
keyword = ''
"
>
@
click=
"
onClearKeyword
"
>
<van-icon
color=
"#c8c9cc"
name=
"clear"
size=
"18"
/>
</button>
</div>
<button
class=
"round-search__submit"
type=
"button"
@
click=
"onSearch"
>
搜索
</button>
</div>
</div>
</PageTop>
...
...
@@ -464,6 +480,7 @@ void onRefresh();
.round-search
{
display
:
flex
;
gap
:
8px
;
align-items
:
center
;
box-sizing
:
border-box
;
padding
:
0
;
...
...
@@ -528,6 +545,20 @@ void onRefresh();
border
:
0
;
}
.round-search__submit
{
flex-shrink
:
0
;
height
:
34px
;
padding
:
0
14px
;
font-size
:
14px
;
font-weight
:
500
;
line-height
:
34px
;
color
:
#fff
;
cursor
:
pointer
;
background
:
#185efe
;
border
:
0
;
border-radius
:
999px
;
}
.list-wrap
{
flex
:
1
;
padding
:
12px
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment