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 e4801039
authored
Mar 24, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 车辆检测自定义组件
1 parent
d8f0fabd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
159 additions
and
74 deletions
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/buttonSelect.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/customizeUploadFile.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
apps/web/venus-usedcar-quality/src/views/car-detail/index.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
View file @
e480103
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
"vue"
;
import
{
ref
,
watch
}
from
"vue"
;
import
selectDatePicker
from
"@/components/customizeForm/selectDatePicker.vue"
;
import
selectDropdown
from
"@/components/customizeForm/selectDropdown.vue"
;
...
...
@@ -7,80 +7,146 @@ import buttonSelect from "@/components/customizeForm/buttonSelect.vue";
import
customizeUploadFile
from
"@/components/customizeForm/customizeUploadFile.vue"
;
// 获取父组件传递的model
const
props
=
defineProps
({
model
:
{
type
:
Array
,
default
:
()
=>
[],
},
// 获取父组件传递数据
const
props
=
withDefaults
(
defineProps
<
{
leafNodes
?:
[];
bigModuleLabel
?:
string
;
subTabLabel
?:
string
;
allowNoStructure
?:
boolean
;
}
>
(),
{
leafNodes
:
()
=>
[],
bigModuleLabel
:
""
,
subTabLabel
:
""
,
allowNoStructure
:
false
,
});
const
columnsList
=
ref
([]);
watch
(()
=>
props
.
leafNodes
,
(
nodes
)
=>
{
columnsList
.
value
=
nodes
||
[];
console
.
log
(
'111111111111111111111111111111111666'
,
columnsList
.
value
);
},
{
immediate
:
true
,
deep
:
true
});
const
resultStatus
=
ref
(
false
);
const
form
=
ref
({});
const
rules
=
ref
({});
async
function
validate
()
{
console
.
log
(
'111111111111111111111columnsList.value'
,
columnsList
.
value
);
let
dataList
:
never
[]
=
[];
columnsList
.
value
.
forEach
((
item
:
any
)
=>
{
let
itemData
:
any
=
{};
const
modelList
=
[
'text_input'
,
'textarea_input'
,
'number_input'
,
'date_picker'
];
if
(
modelList
.
includes
(
item
.
interactionType
))
{
itemData
=
{
id
:
item
.
id
,
valueText
:
item
.
value
||
''
,
valueKey
:
item
.
value
||
''
,
interactionType
:
item
.
interactionType
,
remark
:
item
.
remark
||
''
,
}
}
else
if
(
item
.
interactionType
==
'dropdown'
)
{
itemData
=
{
id
:
item
.
id
,
valueText
:
item
.
valueText
||
''
,
valueKey
:
item
.
valueKey
||
''
,
interactionType
:
item
.
interactionType
,
remark
:
item
.
remark
||
''
,
}
}
else
{
itemData
=
{
id
:
item
.
id
,
valueText
:
item
.
valueText
||
''
,
valueKey
:
item
.
valueKey
||
''
,
interactionType
:
item
.
interactionType
,
remark
:
item
.
remark
||
''
,
}
}
// if (item.interactionType == 'image_upload' || item.interactionType == 'video_upload') {
// } else {
// itemData = {
// id: item.id,//值ID
// valueText: item.nodeName,//值内容(统一存储:文本/数字
// valueKey: item.value,//值对应的key
// interactionType: item.interactionType,//交互类型,复合类型取子集
// valueSeq: '',//值序号,同一结果多条值时递
// remark: item.remark || '',//备注内容
// }
// }
dataList
.
push
(
itemData
);
});
let
nodesData
=
{
nodeId
:
columnsList
.
value
[
0
].
parentId
||
''
,
//节点 ID(inspection_node_version.nodeId,叶子节点)
nodeName
:
props
.
subTabLabel
,
//节点名称(快照)
resultStatus
:
resultStatus
.
value
?
3
:
1
,
//结果状态:1-正常,2-故障,3-无此结构
remark
:
''
,
//备注
data
:
dataList
,
}
console
.
log
(
'22222222222222222222222222222'
,
nodesData
);
return
{
data
:
formList
.
value
,
data
:
nodesData
,
message
:
"操作成功"
,
success
:
true
,
};
}
const
formList
=
ref
([
{
interactionType
:
"image_upload"
,
required
:
1
,
nodeName
:
"是否一手车"
,
placeholder
:
"请选择"
,
value
:
""
,
maxCount
:
50
,
}
]);
function
getValidationRules
(
item
:
any
)
{
return
JSON
.
parse
(
item
.
validationRules
||
'{}'
);
}
defineExpose
({
validate
,
});
</
script
>
<
template
>
<div>
<van-form
ref=
"customizeFormRef"
:model=
"form"
:rules=
"rules"
>
<div
class=
"formTitle"
>
<div>
车辆信息
</div>
<div
class=
"formRadio"
>
<van-radio-group
direction=
"horizontal"
>
<van-radio
name=
"1"
icon-size=
"14px"
>
<span
class=
"radioText"
>
无此结构
</span>
</van-radio>
</van-radio-group>
<div>
{{
subTabLabel
}}
</div>
<div
v-if=
"allowNoStructure"
class=
"formRadio"
@
click=
"resultStatus = !resultStatus"
>
<van-icon
v-if=
"!resultStatus"
name=
"circle"
size=
"14"
color=
"#666666"
/>
<van-icon
v-if=
"resultStatus"
name=
"checked"
size=
"14"
color=
"#185EFE"
/>
<span
class=
"radioText"
>
无此结构
</span>
</div>
</div>
<div
v-for=
"(item, index) in
form
List"
:key=
"index"
class=
"customizeList"
:class=
"
{ 'border-bottom': index
<
formList
.
length
-
1
}"
>
<div
v-for=
"(item, index) in
columns
List"
:key=
"index"
class=
"customizeList"
:class=
"
{ 'border-bottom': index
<
columnsList
.
length
-
1
&&
item
.
interactionType
!=
'
image_upload
'
}"
>
<!-- 文本输入框 -->
<div
v-if=
"item.interactionType == 'text_input'"
>
<van-field
v-model=
"item.value"
clearable
:label=
"item.nodeName"
:maxlength=
"item.maxCount"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
/>
<van-field
v-model=
"item.value"
clearable
:label=
"item.nodeName"
:maxlength=
"getValidationRules(item).maxLength || 120"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
/>
</div>
<!-- 长文本输入框 -->
<div
v-if=
"item.interactionType == 'textarea_input'"
>
<van-field
v-model=
"item.value"
autosize
:label=
"item.nodeName"
:maxlength=
"item.maxCount"
clearable
:
placeholder=
"item.placeholder"
:required=
"item.required === 1"
rows=
"2"
show-word-limit
type=
"textarea"
/>
<van-field
v-model=
"item.value"
autosize
:label=
"item.nodeName"
:
maxlength=
"getValidationRules(item).maxLength || 120"
clearable
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
rows=
"2"
show-word-limit
type=
"textarea"
/>
</div>
<!-- 数字输入框 -->
<div
v-if=
"item.interactionType == 'number_input'"
>
<van-field
v-model=
"item.value"
:label=
"item.nodeName"
clearable
:maxlength=
"item.maxCount"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
type=
"number"
/>
<van-field
v-model=
"item.value"
:label=
"item.nodeName"
clearable
:maxlength=
"getValidationRules(item).maxLength || 120"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
type=
"number"
/>
</div>
<!-- 单选框 -->
...
...
@@ -141,6 +207,7 @@ defineExpose({
.radioText
{
color
:
#666666
;
font-size
:
12px
;
padding-left
:
4px
;
}
.customizeList
{
...
...
@@ -148,6 +215,11 @@ defineExpose({
float
:
left
;
}
.customizeList50
{
width
:
50%
;
float
:
left
;
}
.border-bottom
{
border-bottom
:
1px
solid
#e6ebf5
;
}
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/buttonSelect.vue
View file @
e480103
...
...
@@ -7,26 +7,22 @@ const props = defineProps({
default
:
()
=>
{
},
},
});
const
emit
=
defineEmits
([
"update"
]);
const
pickerValue
=
ref
([]);
const
columnsList
=
ref
([
{
label
:
'精品'
,
value
:
'1'
},
{
label
:
'瑕疵'
,
value
:
'2'
},
{
label
:
'重大'
,
value
:
'3'
},
{
label
:
'精品'
,
value
:
'5'
},
{
label
:
'瑕疵'
,
value
:
'6'
},
{
label
:
'重大'
,
value
:
'7'
},
{
label
:
'瑕疵'
,
value
:
'8'
},
{
label
:
'钣金修复'
,
value
:
'9'
}
])
// 计算属性
// const columnsList = computed(() => {
// return columns;
// });
const
columnsList
=
computed
(()
=>
{
const
optionsList
=
JSON
.
parse
(
props
.
item
.
options
||
'[]'
).
map
(
item
=>
{
const
valueList
=
(
item
||
''
).
split
(
'-'
);
return
{
text
:
valueList
[
1
]
||
''
,
value
:
valueList
[
0
]
||
''
,
};
});
return
optionsList
;
});
function
handleBut
(
item
:
{
value
:
string
})
{
if
(
pickerValue
.
value
.
includes
(
item
.
value
))
{
...
...
@@ -34,8 +30,8 @@ function handleBut(item: { value: string }) {
}
else
{
pickerValue
.
value
.
push
(
item
.
value
);
}
props
.
item
.
value
=
pickerValue
.
value
.
join
(
','
);
emit
(
"update"
,
pickerValue
.
value
.
join
(
','
));
//
props.item.value = pickerValue.value.join(',');
//
emit("update", pickerValue.value.join(','));
}
</
script
>
...
...
@@ -49,7 +45,7 @@ function handleBut(item: { value: string }) {
<div
class=
"selectList"
>
<div
v-for=
"(item, index) in columnsList"
:key=
"index"
@
click=
"handleBut(item)"
class=
"selectBut"
:class=
"
{ 'pitchOn': pickerValue.includes(item.value) }">
{{
item
.
label
}}
{{
item
.
text
}}
<div
v-if=
"pickerValue.includes(item.value)"
class=
"pitchImg"
></div>
</div>
</div>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/customizeUploadFile.vue
View file @
e480103
...
...
@@ -22,6 +22,11 @@ function pickFile() {
fileInputRef
.
value
?.
click
();
}
// 计算属性
const
validationRules
=
computed
(()
=>
{
return
JSON
.
parse
(
props
.
item
.
validationRules
||
'{}'
);
});
async
function
onFileChange
(
ev
:
Event
)
{
const
input
=
ev
.
target
as
HTMLInputElement
;
const
file
=
input
.
files
?.[
0
];
...
...
@@ -61,12 +66,13 @@ function updateData() {
<span
v-if=
"item.required === 1"
class=
"isRequired"
>
*
</span>
<span>
{{
item
.
nodeName
}}
</span>
</div>
<div
class=
"titleTip"
>
有损伤请拍摄图片,无损伤请忽略
</div>
<div
v-if=
"validationRules.maxCount && validationRules.maxCount.length > 1"
class=
"titleTip"
>
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input
ref=
"fileInputRef"
accept=
"image/*"
class=
"hidden-input"
type=
"file"
@
change=
"onFileChange"
>
<div
class=
"uploadPage"
>
<div
class=
"uploadBox"
@
click=
"pickFile"
>
<div
v-if=
"(validationRules.maxCount || 3) > pickerValue.length"
class=
"uploadBox"
@
click=
"pickFile"
>
<van-icon
name=
"plus"
size=
"24"
color=
"#999999"
class=
"plusBox"
/>
<div
class=
"uploadTxt"
>
添加照片
</div>
</div>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
View file @
e480103
...
...
@@ -12,24 +12,25 @@ const emit = defineEmits(["update"]);
const
showPicker
=
ref
(
false
);
const
pickerValue
=
ref
([]);
const
columns
=
[
{
text
:
"杭州"
,
value
:
"杭州"
},
{
text
:
"宁波"
,
value
:
"宁波"
},
{
text
:
"温州"
,
value
:
"温州"
},
{
text
:
"绍兴"
,
value
:
"绍兴"
},
{
text
:
"湖州"
,
value
:
"湖州"
},
];
// 计算属性
const
columnsList
=
computed
(()
=>
{
return
columns
;
const
optionsList
=
JSON
.
parse
(
props
.
item
.
options
||
'[]'
).
map
(
item
=>
{
const
valueList
=
(
item
||
''
).
split
(
'-'
);
return
{
text
:
valueList
[
1
]
||
''
,
value
:
valueList
[
0
]
||
''
,
};
});
return
optionsList
;
});
function
onConfirm
()
{
const
picker
=
pickerValue
.
value
&&
pickerValue
.
value
.
length
>
0
?
pickerValue
.
value
[
0
]
:
""
;
showPicker
.
value
=
false
;
props
.
item
.
value
=
picker
;
const
ObjectItem
=
columnsList
.
value
.
find
(
item
=>
item
.
value
==
picker
);
props
.
item
.
valueText
=
ObjectItem
.
text
||
''
;
props
.
item
.
valueKey
=
ObjectItem
.
value
||
''
;
props
.
item
.
value
=
picker
||
''
;
emit
(
"update"
,
picker
);
}
...
...
@@ -37,7 +38,7 @@ function onConfirm() {
<
template
>
<div>
<van-field
v-model=
"item.value"
clearable
is-link
:label=
"item.nodeName"
name=
"datePicker"
<van-field
v-model=
"item.value
Text
"
clearable
is-link
:label=
"item.nodeName"
name=
"datePicker"
:placeholder=
"item.placeholder"
readonly
:required=
"item.required === 1"
@
click=
"showPicker = true"
/>
<van-popup
v-model:show=
"showPicker"
destroy-on-close
position=
"bottom"
>
<van-picker
v-model=
"pickerValue"
:columns=
"columnsList"
:title=
"item.nodeName"
@
cancel=
"showPicker = false"
...
...
apps/web/venus-usedcar-quality/src/views/car-detail/index.vue
View file @
e480103
...
...
@@ -79,11 +79,12 @@
</div>
<!-- 中间滚动内容区:当前二级项 childrenNodes(已解析默认值) -->
<div
class=
"inspect-content"
>
<InspectSubModuleContent
ref=
"inspectSubContentRef"
<div>
<customizeForm
ref=
"customizeFormRef"
:big-module-label=
"activeBigModule?.label"
:active-sub-tab=
"activeBigModule"
:leaf-nodes=
"currentLeafNodes"
:sub-tab-label=
"activeSubTab?.label"
/>
<!--
<InspectSubModuleContent
ref=
"inspectSubContentRef"
:big-module-label=
"activeBigModule?.label"
:leaf-nodes=
"currentLeafNodes"
:sub-tab-label=
"activeSubTab?.label"
/>
:sub-tab-label=
"activeSubTab?.label"
/>
-->
</div>
</div>
</div>
...
...
@@ -118,7 +119,7 @@
:loading=
"submitting"
round
type=
"primary"
@
click=
"
on
Next"
>
@
click=
"
handle
Next"
>
{{
remainingSubTabCount
===
1
?
"提交检测内容"
:
"下一步"
}}
</van-button>
</
template
>
...
...
@@ -163,6 +164,8 @@ import { showToast } from "vant";
import
InspectSubModuleContent
from
"./components/InspectSubModuleContent.vue"
;
import
ScoreForm
from
"./components/ScoreForm.vue"
;
import
customizeForm
from
"@/components/customizeForm/Index.vue"
;
// ===== 常量 =====
/** 检测评分大项的固定 key(非接口返回,手动追加至大项末尾) */
const
SCORE_BIG_KEY
=
"__score_big__"
;
...
...
@@ -399,6 +402,13 @@ function advanceInspectionStep() {
}
const
customizeFormRef
=
ref
();
async
function
handleNext
()
{
const
res
=
await
customizeFormRef
.
value
.
validate
();
console
.
log
(
'111111111111111111111111111111'
,
res
);
}
/** 下一步:校验当前叶子 → 保存 → 前进 */
async
function
onNext
()
{
if
(
submitting
.
value
)
return
;
...
...
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