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 e97f31e9
authored
May 22, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: gengxin
1 parent
084e35e7
Pipeline
#210
for
e97f31e9
failed
in 0 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
23 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/selectDatePicker.vue
apps/web/venus-usedcar-quality/src/views/car-detail/index.vue
apps/web/venus-usedcar-quality/src/api/modules/inspect-report/template.ts
View file @
e97f31e
...
...
@@ -225,17 +225,55 @@ function isKeyedSelectInteractionType(interactionType: string | undefined): bool
return
KEYED_SELECT_INTERACTION_TYPES
.
has
(
interactionType
);
}
/**
date_picker:validationRules.datePattern 长度 > 8 时为年月日,否则年月
*/
function
getDatePickerFormat
(
node
:
InspectionNode
):
"year-month"
|
"year-month-day"
{
/**
读取叶子节点 validationRules.datePattern
*/
export
function
getInspectionNodeDatePattern
(
node
:
{
validationRules
?:
string
}):
string
{
try
{
const
rules
=
JSON
.
parse
(
node
.
validationRules
||
"{}"
)
as
{
datePattern
?:
string
};
if
(
rules
.
datePattern
&&
rules
.
datePattern
.
length
>
8
)
{
return
"year-month-day"
;
}
return
(
(
JSON
.
parse
(
node
.
validationRules
||
"{}"
)
as
{
datePattern
?:
string
}).
datePattern
?.
trim
()
??
""
);
}
catch
{
/* ignore */
return
""
;
}
}
/** 是否需要选「日」:pattern 含 dd,或长度 > 8(如 yyyy-MM-dd);无 pattern 时默认完整日期 */
export
function
requiresDatePickerDayColumn
(
datePattern
?:
string
):
boolean
{
const
p
=
String
(
datePattern
??
""
).
trim
();
if
(
!
p
)
return
true
;
if
(
/dd/i
.
test
(
p
))
return
true
;
return
p
.
length
>
8
;
}
/** date_picker 展示/提交格式:年月日 yyyy-MM-dd 或年月 yyyy-MM */
export
function
getDatePickerFormat
(
node
:
InspectionNode
):
"year-month"
|
"year-month-day"
{
return
requiresDatePickerDayColumn
(
getInspectionNodeDatePattern
(
node
))
?
"year-month-day"
:
"year-month"
;
}
/** van-date-picker columns-type */
export
function
getDatePickerColumnsType
(
node
:
{
validationRules
?:
string
}):
(
"year"
|
"month"
|
"day"
)[]
{
return
requiresDatePickerDayColumn
(
getInspectionNodeDatePattern
(
node
))
?
[
"year"
,
"month"
,
"day"
]
:
[
"year"
,
"month"
];
}
/** 保存前将 date_picker 值规范为接口要求的格式 */
export
function
formatInspectionDateSubmitValue
(
value
:
string
|
number
|
undefined
,
node
:
InspectionNode
):
string
{
const
raw
=
String
(
value
??
""
).
trim
();
if
(
!
raw
)
return
""
;
if
(
!
requiresDatePickerDayColumn
(
getInspectionNodeDatePattern
(
node
)))
{
const
parts
=
raw
.
split
(
"-"
).
filter
(
Boolean
);
if
(
parts
.
length
>=
2
)
{
return
`
${
parts
[
0
]}
-
${
String
(
parts
[
1
]).
padStart
(
2
,
"0"
)}
`
;
}
return
raw
;
}
return
"year-month"
;
return
normalizeInspectionDateDefault
(
raw
,
node
)
;
}
/** 将模板/接口日期(含 ISO、斜杠、紧凑数字)规范为 date_picker 展示格式 */
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
View file @
e97f31e
<
script
setup
lang=
"ts"
>
import
type
{
CustomizeFormValidateResult
}
from
"@/types/views/car-detail"
;
import
{
formatInspectionDateSubmitValue
,
getInspectionLeafInputInitial
,
getInspectionLeafSelectInitial
,
type
InspectionNode
,
...
...
@@ -99,9 +100,13 @@ function setSubmitData() {
const
inputList
=
[
"text_input"
,
"textarea_input"
,
"number_input"
,
"date_picker"
];
const
dropdownList
=
[
"dropdown"
,
"radio_button_select"
];
if
(
inputList
.
includes
(
item
.
interactionType
)
&&
item
.
value
!=
null
&&
item
.
value
!==
""
)
{
const
valueText
=
item
.
interactionType
===
"date_picker"
?
formatInspectionDateSubmitValue
(
item
.
value
,
item
as
InspectionNode
)
:
String
(
item
.
value
??
""
);
const
pushData
=
{
id
:
item
.
id
,
valueText
:
item
.
value
||
""
,
valueText
,
valueKey
:
""
,
interactionType
:
item
.
interactionType
,
};
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDatePicker.vue
View file @
e97f31e
<
script
setup
lang=
"ts"
>
import
{
computed
,
onMounted
,
ref
}
from
"vue"
;
import
{
formatInspectionDateSubmitValue
,
getDatePickerColumnsType
}
from
"@api"
;
import
{
computed
,
onMounted
,
ref
,
watch
}
from
"vue"
;
const
props
=
defineProps
({
item
:
{
...
...
@@ -17,24 +18,24 @@ const displayValue = computed({
get
:
()
=>
String
(
props
.
item
.
value
??
""
),
set
:
(
v
:
string
)
=>
emit
(
"update"
,
v
),
});
const
columnsType
=
ref
([
"year"
,
"month"
,
"day"
]);
const
columnsType
=
ref
<
(
"year"
|
"month"
|
"day"
)[]
>
([
"year"
,
"month"
,
"day"
]);
const
showPicker
=
ref
(
false
);
const
pickerValue
=
ref
([]);
// 页面加载时初始化数据
function
syncColumnsType
()
{
columnsType
.
value
=
getDatePickerColumnsType
(
props
.
item
);
}
onMounted
(()
=>
{
initData
();
syncColumnsType
();
});
// 初始化数据
function
initData
()
{
const
validationRules
=
JSON
.
parse
(
props
.
item
.
validationRules
||
"{}"
);
if
(
validationRules
.
datePattern
&&
validationRules
.
datePattern
.
length
>
8
)
{
columnsType
.
value
=
[
"year"
,
"month"
,
"day"
];
}
else
{
columnsType
.
value
=
[
"year"
,
"month"
];
watch
(
()
=>
props
.
item
?.
validationRules
,
()
=>
{
syncColumnsType
();
}
}
);
function
clampPickerParts
(
parts
:
(
number
|
string
)[]):
(
number
|
string
)[]
{
const
year
=
Number
(
parts
[
0
]);
...
...
@@ -76,7 +77,7 @@ function onConfirm() {
if
(
pickerValue
.
value
.
length
>
0
)
{
const
clamped
=
clampPickerParts
(
pickerValue
.
value
);
pickerValue
.
value
=
clamped
;
picker
=
clamped
.
join
(
"-"
);
picker
=
formatInspectionDateSubmitValue
(
clamped
.
join
(
"-"
),
props
.
item
);
}
showPicker
.
value
=
false
;
emit
(
"update"
,
picker
);
...
...
apps/web/venus-usedcar-quality/src/views/car-detail/index.vue
View file @
e97f31e
...
...
@@ -68,6 +68,7 @@
class=
"inspect-card inspect-card--subtabs"
>
<!-- 二级项 Tab:仅当子节点为分组(nodeType=2)等多级结构时展示;叶子直挂大项时不展示 -->
<div
v-if=
"activeBigModule?.hasSecondaryTabs === true"
ref=
"subtabRowRef"
class=
"subtab-row"
>
<div
v-for=
"subTab in activeBigModule?.subTabs"
:key=
"subTab.key"
...
...
@@ -180,7 +181,7 @@
<
script
setup
lang=
"ts"
>
import
type
{
BigModule
}
from
"@/types/views/car-detail"
;
import
{
onMounted
,
ref
,
watch
}
from
"vue"
;
import
{
nextTick
,
onMounted
,
ref
,
watch
}
from
"vue"
;
import
{
useRoute
}
from
"vue-router"
;
import
customizeForm
from
"@/components/CustomizeForm/Index.vue"
;
...
...
@@ -224,6 +225,39 @@ const {
onOpenModulePicker
,
}
=
modules
;
const
subtabRowRef
=
ref
<
HTMLElement
|
null
>
(
null
);
/** 下一步 / 上一步 / 检测评分返回等程序切换二级 Tab 时,将当前项滚入横向可视区 */
function
scrollActiveSubTabIntoView
()
{
void
nextTick
(()
=>
{
void
nextTick
(()
=>
{
const
row
=
subtabRowRef
.
value
;
if
(
!
row
||
activeBigModule
.
value
?.
hasSecondaryTabs
!==
true
)
return
;
const
activeEl
=
row
.
querySelector
<
HTMLElement
>
(
".subtab-item.active"
);
activeEl
?.
scrollIntoView
({
behavior
:
"smooth"
,
block
:
"nearest"
,
inline
:
"center"
,
});
});
});
}
watch
(
[
activeSubKey
,
activeBigKey
],
()
=>
{
if
(
loading
.
value
||
activeBigKey
.
value
===
SCORE_BIG_KEY
)
return
;
scrollActiveSubTabIntoView
();
},
{
flush
:
"post"
}
);
watch
(
loading
,
(
isLoading
)
=>
{
if
(
!
isLoading
)
{
scrollActiveSubTabIntoView
();
}
});
/** 弹窗内待确认的模块 key,打开时与当前 active 同步 */
const
pendingModuleKey
=
ref
<
number
|
string
>
(
""
);
...
...
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