Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
田翔
xform
Commits
12c6e778
Commit
12c6e778
authored
Jun 08, 2023
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 下拉站点选择器默认选择第一个
parent
d7864ca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
index.js
src/core/widgets/select/ComboBox/index.js
+22
-15
No files found.
src/core/widgets/select/ComboBox/index.js
View file @
12c6e778
...
@@ -17,10 +17,13 @@ const ComboBox = (props) => {
...
@@ -17,10 +17,13 @@ const ComboBox = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
addons
)
{
if
(
addons
)
{
addons
.
setValue
(
addons
.
dataPath
,
presetValue
||
''
)
addons
.
setValue
(
addons
.
dataPath
,
presetValue
||
''
)
if
(
sourceType
===
'站点'
)
{
getStation
(
presetValue
)
}
}
else
{
}
else
{
onChange
(
presetValue
||
''
)
onChange
(
presetValue
||
''
)
}
}
},
[
presetValue
])
},
[
presetValue
,
sourceType
,
isMultiple
])
const
valueShow
=
useMemo
(()
=>
{
const
valueShow
=
useMemo
(()
=>
{
if
(
isMultiple
||
isEdit
)
{
if
(
isMultiple
||
isEdit
)
{
...
@@ -75,6 +78,22 @@ const ComboBox = (props) => {
...
@@ -75,6 +78,22 @@ const ComboBox = (props) => {
}
}
}
}
const
getStation
=
async
(
presetValue
)
=>
{
const
{
code
,
data
,
msg
}
=
await
getStationIDListByUserID
(
userID
,
!
isMySite
)
if
(
code
===
0
)
{
if
(
Array
.
isArray
(
data
))
{
setSite
(
data
)
if
(
!
presetValue
)
{
onChange
(
data
[
0
][
isStoreID
?
'stationID'
:
'stationName'
])
}
}
else
{
setSite
([])
}
}
else
{
message
.
error
(
msg
)
}
}
const
onFocus
=
async
()
=>
{
const
onFocus
=
async
()
=>
{
if
(
addons
)
{
if
(
addons
)
{
if
(
sourceType
===
'数据字典'
)
{
if
(
sourceType
===
'数据字典'
)
{
...
@@ -104,18 +123,6 @@ const ComboBox = (props) => {
...
@@ -104,18 +123,6 @@ const ComboBox = (props) => {
message
.
error
(
msg
)
message
.
error
(
msg
)
}
}
}
}
if
(
sourceType
===
'站点'
)
{
const
{
code
,
data
,
msg
}
=
await
getStationIDListByUserID
(
userID
,
!
isMySite
)
if
(
code
===
0
)
{
if
(
Array
.
isArray
(
data
))
{
setSite
(
data
)
}
else
{
setSite
([])
}
}
else
{
message
.
error
(
msg
)
}
}
}
}
}
}
...
@@ -137,8 +144,8 @@ const ComboBox = (props) => {
...
@@ -137,8 +144,8 @@ const ComboBox = (props) => {
event
.
preventDefault
()
event
.
preventDefault
()
event
.
stopPropagation
()
event
.
stopPropagation
()
}
}
if
(
!
color
)
{
if
(
!
color
)
{
return
label
return
label
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment