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 8326c603
authored
Mar 26, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 自测问题修改
1 parent
0f60ec9b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
287 additions
and
53 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/buttonSelectAndImageUpload.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/radioSelect.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
apps/web/venus-usedcar-quality/src/components/CustomizeForm/Index.vue
View file @
8326c60
...
...
@@ -7,6 +7,8 @@ import selectDropdown from "@/components/CustomizeForm/selectDropdown.vue";
import
buttonSelect
from
"@/components/CustomizeForm/buttonSelect.vue"
;
import
radioSelect
from
"@/components/CustomizeForm/radioSelect.vue"
;
import
customizeUploadFile
from
"@/components/CustomizeForm/customizeUploadFile.vue"
;
import
buttonSelectAndImageUpload
from
"@/components/CustomizeForm/buttonSelectAndImageUpload.vue"
;
// 获取父组件传递数据
const
props
=
withDefaults
(
...
...
@@ -46,7 +48,7 @@ watch(() => props.leafNodes, (nodes) => {
console
.
log
(
'watchLeafNodes'
,
columnsList
.
value
);
setTimeout
(()
=>
{
pageLoading
.
value
=
false
;
},
1
0
00
);
},
1
2
00
);
},
{
immediate
:
true
,
deep
:
true
});
...
...
@@ -121,7 +123,36 @@ function setSubmitData() {
dataList
.
push
(
pushData
);
}
}
}
else
if
(
item
.
interactionType
==
'image_upload_and_button_select'
)
{
const
valueList
=
JSON
.
parse
(
item
.
value
||
'[]'
);
if
(
valueList
&&
valueList
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
valueList
.
length
;
i
++
)
{
const
pushData
=
{
id
:
item
.
id
,
valueText
:
valueList
[
i
].
valueText
||
''
,
valueKey
:
valueList
[
i
].
valueKey
||
''
,
interactionType
:
'button_select'
,
valueSeq
:
i
+
1
,
}
dataList
.
push
(
pushData
);
}
}
const
uploadValueList
=
JSON
.
parse
(
item
.
uploadValue
||
'[]'
);
if
(
uploadValueList
&&
uploadValueList
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
uploadValueList
.
length
;
i
++
)
{
const
pushData
=
{
id
:
item
.
id
,
valueText
:
uploadValueList
[
i
]
||
''
,
valueKey
:
''
,
interactionType
:
'image_upload'
,
valueSeq
:
i
+
1
,
}
dataList
.
push
(
pushData
);
}
}
}
// 每项都入列,便于大项/二级切换时静默保存仍能带上当前 Tab 全部叶子(未填则为空 data,仍会走保存接口)
returnData
.
push
({
nodeId
:
item
.
id
,
...
...
@@ -153,6 +184,12 @@ async function validate(): Promise<CustomizeFormValidateResult> {
success
=
false
;
message
=
message
?
message
:
title
+
item
.
nodeName
;
}
if
(
item
.
interactionType
==
'image_upload_and_button_select'
&&
!
item
.
uploadValue
)
{
success
=
false
;
message
=
message
?
message
:
'请上传图片'
;
}
});
return
{
data
:
nodesData
,
...
...
@@ -234,10 +271,8 @@ defineExpose({
<div
v-if=
"item.interactionType == 'number_input'"
>
<van-field
v-model=
"item.value"
:label=
"item.nodeName"
clearable
:maxlength=
"getValidationRules(item).maxLength || 120"
:min=
"getValidationRules(item).min || 0"
:max=
"getValidationRules(item).max || 100000"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
type=
"number"
step=
"0.01"
:min=
"getValidationRules(item).min || 0"
:max=
"getValidationRules(item).max || 100000"
:placeholder=
"item.placeholder"
:required=
"item.required === 1"
type=
"number"
step=
"0.01"
@
input=
"(e) =>
{ item.value = parseFloat(item.value)?.toFixed(getValidationRules(item).decimalDigits || 2) || '' }" />
</div>
...
...
@@ -266,6 +301,14 @@ defineExpose({
<customizeUploadFile
:item=
"item"
:value=
"item.value"
@
update=
"item.value = $event"
/>
</div>
<!-- image_upload_and_button_select -->
<div
v-if=
"item.interactionType == 'image_upload_and_button_select'"
>
<buttonSelect
:item=
"item"
:value=
"item.value"
@
update=
"item.value = $event"
/>
<div
v-if=
"item.value"
>
<buttonSelectAndImageUpload
:item=
"item"
@
update=
"item.uploadValue = $event"
/>
</div>
</div>
</div>
</van-form>
</div>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/buttonSelect.vue
View file @
8326c60
...
...
@@ -4,7 +4,7 @@ import { computed, ref } from "vue";
const
props
=
defineProps
({
item
:
{
type
:
Object
,
default
:
()
=>
{},
default
:
()
=>
{
},
},
});
const
emit
=
defineEmits
([
"update"
]);
...
...
@@ -21,13 +21,8 @@ function initData() {
pickerValue
.
value
=
[];
if
(
props
?.
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
props
?.
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
if
(
inspectionValueList
&&
inspectionValueList
.
length
>
0
&&
inspectionValueList
[
0
].
valueKey
)
{
for
(
const
element
of
inspectionValueList
)
{
if
(
element
.
valueKey
)
{
pickerValue
.
value
.
push
(
element
.
valueKey
);
}
}
for
(
const
i
of
inspectionValueList
)
{
if
(
i
.
valueText
&&
i
.
interactionType
==
"button_select"
)
{
pickerValue
.
value
.
push
(
i
.
valueKey
)
}
}
}
setupdate
();
...
...
@@ -73,22 +68,19 @@ function setupdate() {
</
script
>
<
template
>
<div
class=
"buttonSelect"
>
<div
class=
"title"
>
<span
v-if=
"item.required === 1"
class=
"isRequired"
>
*
</span>
<span>
{{
item
.
nodeName
}}
</span>
</div>
<div
class=
"selectList"
>
<div
v-for=
"(col, index) in columnsList"
:key=
"index"
class=
"selectBut"
:class=
"
{ 'pitchOn': pickerValue.includes(col.value) }"
@click="handleBut(col)">
{{
col
.
text
}}
<div
v-if=
"pickerValue.includes(col.value)"
class=
"pitchImg"
></div>
</div>
</div>
</div>
<div
class=
"buttonSelect"
>
<div
class=
"title"
>
<span
v-if=
"item.required === 1"
class=
"isRequired"
>
*
</span>
<span>
{{
item
.
nodeName
}}
</span>
</div>
<div
class=
"selectList"
>
<div
v-for=
"(col, index) in columnsList"
:key=
"index"
class=
"selectBut"
:class=
"
{ 'pitchOn': pickerValue.includes(col.value) }" @click="handleBut(col)">
{{
col
.
text
}}
<div
v-if=
"pickerValue.includes(col.value)"
class=
"pitchImg"
></div>
</div>
</div>
</div>
</
template
>
<
style
lang=
"scss"
scoped
>
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/buttonSelectAndImageUpload.vue
0 → 100644
View file @
8326c60
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
"vue"
;
import
{
uploadFile
}
from
"@/utils/upload.js"
;
import
{
showToast
}
from
"vant"
;
const
props
=
defineProps
({
item
:
{
type
:
Object
,
default
:
()
=>
{
},
},
});
const
emit
=
defineEmits
([
"update"
]);
const
uploading
=
ref
(
false
);
const
pickerValue
=
ref
([]);
const
fileInputRef
=
ref
<
HTMLInputElement
|
null
>
(
null
);
function
pickFile
()
{
fileInputRef
.
value
?.
click
();
}
// 页面加载时初始化数据
onMounted
(()
=>
{
initData
();
});
// 初始化数据
function
initData
()
{
pickerValue
.
value
=
[];
if
(
props
?.
item
?.
inspectionResultVO
)
{
const
inspectionValueList
=
props
?.
item
?.
inspectionResultVO
?.
inspectionValueList
||
[];
for
(
const
i
of
inspectionValueList
)
{
if
(
i
.
valueText
&&
i
.
interactionType
==
"image_upload"
)
{
pickerValue
.
value
.
push
(
i
.
valueText
)
}
}
}
updateData
();
}
// 计算属性
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
];
input
.
value
=
""
;
if
(
!
file
)
return
;
uploading
.
value
=
true
;
try
{
const
res
=
await
uploadFile
(
file
);
const
url
=
(
typeof
res
.
aliyunAddress
===
"string"
&&
res
.
aliyunAddress
)
||
(
typeof
res
.
url
===
"string"
&&
res
.
url
)
||
""
;
showToast
(
"上传成功"
);
pickerValue
.
value
.
push
(
url
);
updateData
();
}
catch
(
error
:
unknown
)
{
const
msg
=
error
instanceof
Error
?
error
.
message
:
String
(
error
);
showToast
(
`上传失败:
${
msg
}
`
);
}
finally
{
uploading
.
value
=
false
;
}
}
function
handleDelete
(
item
:
string
)
{
pickerValue
.
value
=
pickerValue
.
value
.
filter
((
i
)
=>
i
!==
item
);
updateData
();
}
function
updateData
()
{
if
(
pickerValue
.
value
.
length
>
0
)
{
emit
(
"update"
,
JSON
.
stringify
(
pickerValue
.
value
));
}
else
{
emit
(
"update"
,
""
);
}
}
</
script
>
<
template
>
<div
class=
"buttonSelect"
>
<div
class=
"title"
>
<div
class=
"titleContent"
>
<span
class=
"isRequired"
>
*
</span>
<span>
异常图片
</span>
</div>
<div
class=
"titleTip"
>
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input
ref=
"fileInputRef"
accept=
"image/*"
class=
"hidden-input"
type=
"file"
@
change=
"onFileChange"
>
<div
class=
"uploadPage"
>
<div
v-if=
"(validationRules.maxCount || 3) > pickerValue.length"
class=
"uploadBox"
@
click=
"pickFile"
>
<van-icon
class=
"plusBox"
color=
"#999999"
name=
"plus"
size=
"24"
/>
<div
class=
"uploadTxt"
>
添加照片
</div>
</div>
<div
v-for=
"(url, index) in pickerValue"
:key=
"index"
class=
"uploadBox"
>
<div
class=
"deleteBox"
@
click=
"handleDelete(url)"
>
<van-icon
color=
"#999999"
name=
"clear"
size=
"20"
/>
</div>
<van-image
height=
"96"
:src=
"url"
style=
"border-radius: 8px;"
width=
"96"
/>
</div>
</div>
</div>
</
template
>
<
style
lang=
"scss"
scoped
>
.buttonSelect
{
float
:
left
;
width
:
100%
;
background
:
#fff
;
}
.title
{
float
:
left
;
width
:
100%
;
padding-left
:
16px
;
margin-top
:
16px
;
margin-bottom
:
10px
;
}
.titleContent
{
float
:
left
;
width
:
100%
;
height
:
24px
;
font-size
:
14px
;
line-height
:
24px
;
color
:
#141e34
;
}
.titleTip
{
float
:
left
;
width
:
100%
;
height
:
16px
;
font-size
:
12px
;
font-weight
:
400
;
line-height
:
16px
;
color
:
#999
;
}
.isRequired
{
padding-right
:
2px
;
font-size
:
14px
;
color
:
#ee3040
;
}
.hidden-input
{
position
:
absolute
;
width
:
0
;
height
:
0
;
pointer-events
:
none
;
opacity
:
0
;
}
.uploadPage
{
float
:
left
;
width
:
calc
(
100%
-
24px
);
margin-left
:
12px
;
}
.uploadBox
{
position
:
relative
;
float
:
left
;
width
:
96px
;
height
:
96px
;
margin-right
:
12px
;
margin-bottom
:
16px
;
background
:
#f9f9f9
;
border
:
1px
solid
#ddd
;
border-radius
:
8px
;
}
.plusBox
{
float
:
left
;
margin-top
:
22px
;
margin-right
:
36px
;
margin-left
:
36px
;
}
.uploadTxt
{
float
:
left
;
width
:
100%
;
height
:
20px
;
margin-top
:
8px
;
font-size
:
12px
;
font-weight
:
400
;
line-height
:
20px
;
color
:
#999
;
text-align
:
center
;
}
.deleteBox
{
position
:
absolute
;
top
:
2px
;
right
:
2px
;
z-index
:
99
;
width
:
20px
;
height
:
20px
;
cursor
:
pointer
;
}
</
style
>
apps/web/venus-usedcar-quality/src/components/CustomizeForm/radioSelect.vue
View file @
8326c60
...
...
@@ -42,10 +42,13 @@ const columnsList = computed(() => {
function
handleBut
()
{
const
selected
=
columnsList
.
value
.
find
((
col
)
=>
col
.
value
===
pickerValue
.
value
);
const
value
=
pickerValue
.
value
||
""
;
props
.
item
.
value
=
selected
?.
value
||
""
;
props
.
item
.
valueText
=
selected
?.
text
||
""
;
props
.
item
.
valueKey
=
selected
?.
value
||
""
;
emit
(
"update"
,
{
value
,
valueText
:
selected
?.
text
??
""
,
valueKey
:
selected
?.
value
??
""
,
valueText
:
selected
?.
text
||
""
,
valueKey
:
selected
?.
value
||
""
,
});
}
...
...
apps/web/venus-usedcar-quality/src/components/CustomizeForm/selectDropdown.vue
View file @
8326c60
...
...
@@ -4,7 +4,7 @@ import { computed, ref } from "vue";
const
props
=
defineProps
({
item
:
{
type
:
Object
,
default
:
()
=>
{},
default
:
()
=>
{
},
},
});
...
...
@@ -43,6 +43,7 @@ function initData() {
}
}
onConfirm
();
console
.
log
(
'pickerValue.value2222222222222222222'
,
pickerValue
.
value
);
}
// 计算属性
...
...
@@ -61,8 +62,11 @@ function onConfirm() {
const
picker
=
pickerValue
.
value
&&
pickerValue
.
value
.
length
>
0
?
pickerValue
.
value
[
0
]
:
""
;
showPicker
.
value
=
false
;
const
selected
=
columnsList
.
value
.
find
((
col
)
=>
col
.
value
===
picker
)
||
{};
props
.
item
.
value
=
selected
.
value
||
""
;
props
.
item
.
valueText
=
selected
.
text
||
""
;
props
.
item
.
valueKey
=
selected
.
value
||
""
;
emit
(
"update"
,
{
value
:
picker
||
""
,
value
:
selected
.
value
||
""
,
valueText
:
selected
.
text
||
""
,
valueKey
:
selected
.
value
||
""
,
});
...
...
@@ -71,26 +75,14 @@ function onConfirm() {
</
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"
/>
<van-popup
v-model:show=
"showPicker"
destroy-on-close
position=
"bottom"
>
<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"
@
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"
@
confirm=
"onConfirm"
/>
</van-popup>
</div>
</
template
>
<
style
lang=
"scss"
scoped
></
style
>
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