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
e11438b3
Commit
e11438b3
authored
Nov 21, 2024
by
彭俊龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
站点选择器增加可配置站点可选范围属性
parent
71a6fd4a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
3 deletions
+112
-3
process.js
src/apis/process.js
+12
-0
settings.js
src/core/FormDesigner/config/settings.js
+9
-0
index.js
src/core/widgets/select/ComboBox/index.js
+12
-2
index.js
src/core/widgets/settings/groupBase/SiteSelect/index.js
+75
-0
index.less
src/core/widgets/settings/groupBase/SiteSelect/index.less
+0
-0
index.js
src/core/widgets/settings/groupBase/index.js
+4
-1
No files found.
src/apis/process.js
View file @
e11438b3
...
...
@@ -100,6 +100,18 @@ export function getStationListByUserID(id, isAll) {
});
}
// 站点选择器查询
export
function
getSiteTree
()
{
return
request
({
// headers: {
// 'Civ-Site': window?.globalConfig?.userInfo?.site
// },
url
:
`PandaOMS/OMS/UserCenter/GetSiteTree?node=-1`
,
method
:
'get'
,
});
}
//自动计算字符串转化
export
function
getFormFieldAnalysisDtos
(
data
)
{
return
request
({
...
...
src/core/FormDesigner/config/settings.js
View file @
e11438b3
...
...
@@ -978,6 +978,15 @@ const baseWidgets = [
widget
:
'SourceType'
,
default
:
'手动输入'
,
},
siteSelect
:
{
title
:
'站点选择范围'
,
name
:
'站点选择范围'
,
type
:
'array'
,
widget
:
'SiteSelect'
,
default
:
[],
hidden
:
"{{formData.sourceType != '站点'}}"
,
dependencies
:
[
'sourceType'
],
},
options
:
{
title
:
''
,
name
:
'选项'
,
...
...
src/core/widgets/select/ComboBox/index.js
View file @
e11438b3
...
...
@@ -24,7 +24,8 @@ const ComboBox = (props) => {
isMySite
,
isSearch
,
isStoreID
,
color
color
,
siteSelect
}
=
schema
const
[
dictionaryList
,
setDictionaryList
]
=
useState
([])
const
[
tableData
,
setTableData
]
=
useState
([])
...
...
@@ -58,7 +59,16 @@ const ComboBox = (props) => {
case
'表数据'
:
return
Array
.
isArray
(
tableData
)
?
tableData
:
[]
case
'站点'
:
return
Array
.
isArray
(
site
)
?
site
:
[]
if
(
Array
.
isArray
(
site
)){
if
(
siteSelect
&&
siteSelect
.
length
>
0
){
let
stationIds
=
siteSelect
.
map
(
s
=>
s
+
''
)
return
site
.
filter
(
s
=>
stationIds
.
includes
(
s
.
stationID
))
}
else
{
return
site
;
}
}
else
{
return
[]
}
default
:
return
[]
}
...
...
src/core/widgets/settings/groupBase/SiteSelect/index.js
0 → 100644
View file @
e11438b3
import
React
,
{
useState
,
useMemo
,
useEffect
}
from
'react'
import
{
Select
,
message
,
Tag
,
options
,
TreeSelect
}
from
'antd'
import
{
getSiteTree
,
getStationIDListByUserID
}
from
'../../../../../apis/process'
const
SiteSelect
=
props
=>
{
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
value
,
onChange
,
schema
,
addons
}
=
props
const
{
placeholder
,
disabled
,
formDisabled
,
sourceType
,
options
,
dictionary
,
tableName
,
fieldName
,
presetValue
,
isMultiple
,
isEdit
,
isMySite
,
isSearch
,
isStoreID
,
color
}
=
schema
const
{
SHOW_PARENT
}
=
TreeSelect
;
const
[
siteTree
,
setSiteTree
]
=
useState
([]);
useEffect
(()
=>
{
getStation
();
},
[])
const
getStation
=
async
()
=>
{
const
{
code
,
data
,
msg
}
=
await
getSiteTree
()
if
(
code
===
0
)
{
if
(
Array
.
isArray
(
data
.
list
))
{
const
sites
=
mapTree
(
data
.
list
);
console
.
log
(
sites
,
'树形结构数据'
);
setSiteTree
(
sites
);
}
else
{
setSiteTree
([])
}
}
else
{
message
.
error
(
msg
)
}
}
const
mapTree
=
(
sites
=
[])
=>
{
let
list
=
[];
sites
.
forEach
(
site
=>
{
list
.
push
({
title
:
site
.
text
,
key
:
site
.
id
,
value
:
site
.
id
,
children
:
site
.
children
&&
site
.
children
.
length
>
0
?
mapTree
(
site
.
children
)
:
[]
})
})
return
list
;
}
const
tProps
=
{
allowClear
:
true
,
treeData
:
siteTree
,
onChange
,
value
,
treeCheckable
:
true
,
showCheckedStrategy
:
TreeSelect
.
SHOW_ALL
,
placeholder
:
'配置站点选择范围'
,
style
:
{
width
:
'100%'
,
},
};
return
<
TreeSelect
{...
tProps
}
/>
;
}
export
default
SiteSelect
\ No newline at end of file
src/core/widgets/settings/groupBase/SiteSelect/index.less
0 → 100644
View file @
e11438b3
src/core/widgets/settings/groupBase/index.js
View file @
e11438b3
...
...
@@ -12,6 +12,7 @@ import HiddenCondition from './HiddenCondition'
import
SwitchDefault
from
'./SwitchDefault'
import
RichTextDefault
from
'./RichTextDefault'
import
IsHidden
from
'./IsHidden'
import
SiteSelect
from
'./SiteSelect'
import
IsText
from
'./IsText'
const
groupBase
=
{
...
...
@@ -29,7 +30,8 @@ const groupBase = {
RichTextDefault
,
IsHidden
,
IsText
,
FollowFieldHide
FollowFieldHide
,
SiteSelect
}
export
default
groupBase
\ No newline at end of file
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