Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
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
ReactWeb5
wisdom-components
Commits
af143764
Commit
af143764
authored
Apr 24, 2024
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: 设备树 筛选字段在多设备时不生效,可配置默认选中筛选
parent
2d0211d5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
30 deletions
+60
-30
proxy.js
config/proxy.js
+15
-0
index.js
packages/extend-components/EC_DeviceTreeGroup/src/index.js
+45
-30
No files found.
config/proxy.js
View file @
af143764
/*
* @Title:
* @Author: hongmye
* @Date: 2023-09-28 17:01:39
*/
const
proxyURL
=
process
.
env
.
PANDA_ENV_PROXY
||
'http://192.168.8.28:8911'
;
let
exUrl
=
''
;
if
(
proxyURL
.
includes
(
proxyURL
.
toLowerCase
().
includes
(
'https'
)))
{
...
...
@@ -50,4 +55,14 @@ export default {
'/PandaWater'
:
'/PandaWater'
,
},
},
'/PandaWorkFlow'
:
{
target
:
proxyURL
,
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
},
pathRewrite
:
{
'/PandaWorkFlow'
:
'/PandaWorkFlow'
,
},
},
};
packages/extend-components/EC_DeviceTreeGroup/src/index.js
View file @
af143764
...
...
@@ -95,12 +95,21 @@ const DeviceTree = (props) => {
classField
=
''
,
customerName
=
''
,
}
=
props
;
const
deviceArr
=
deviceTypes
?
deviceTypes
.
split
(
','
)
:
[];
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
prefixCls
=
getPrefixCls
(
'ec-device-tree-group'
);
const
cusProps
=
_
.
pick
(
props
,
[
'onSelect'
,
'onCheck'
,
'selectable'
,
'checkable'
]);
const
{
onSelect
,
onCheck
,
keepChecked
,
singleType
=
false
,
selectable
,
checkable
,
filterName
}
=
props
;
const
{
onSelect
,
onCheck
,
keepChecked
,
singleType
=
false
,
selectable
,
checkable
,
filterName
,
filterValue
,
}
=
props
;
const
[
data
,
setData
]
=
useState
([]);
const
[{
pageIndex
,
pageSize
},
setPagination
]
=
useState
({
...
...
@@ -111,7 +120,7 @@ const DeviceTree = (props) => {
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
hasMore
,
setHasMore
]
=
useState
(
true
);
const
[
filterFieldEntries
,
setFilterFieldEntries
]
=
useState
([]);
// "筛选字段"可选列表
const
[
filter
Value
,
setFilterValue
]
=
useState
(
''
);
const
[
filter
FieldValue
,
setFilterFieldValue
]
=
useState
(
filterValue
||
''
);
const
ref
=
useRef
();
const
dataRef
=
useRef
({
...
...
@@ -126,7 +135,7 @@ const DeviceTree = (props) => {
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
([]);
useEffect
(()
=>
{
if
(
filterName
)
{
if
(
filterName
&&
deviceArr
.
length
===
1
)
{
let
device
=
deviceTypes
.
split
(
','
)[
0
];
GetFieldValueFromTable
({
tableName
:
'设备_台账_'
+
device
,
...
...
@@ -144,7 +153,7 @@ const DeviceTree = (props) => {
},
[
filterName
]);
const
requestQuery
=
useMemo
(()
=>
{
return
{
const
qurey
=
{
deviceTypes
,
pageIndex
,
pageSize
,
...
...
@@ -156,13 +165,18 @@ const DeviceTree = (props) => {
classField
,
direction
,
customerName
,
queryWhereParams
:
[{
};
if
(
deviceArr
.
length
===
1
)
{
qurey
.
queryWhereParams
=
[
{
column
:
filterName
,
isString
:
true
,
matchingRule
:
"等于"
,
columnValue
:
filterValue
}]
};
matchingRule
:
'等于'
,
columnValue
:
filterFieldValue
,
},
];
}
return
qurey
;
},
[
customerName
,
deviceTypes
,
...
...
@@ -173,7 +187,7 @@ const DeviceTree = (props) => {
searchs
,
sortFields
,
classField
,
filterValue
,
filter
Field
Value
,
]);
useEffect
(()
=>
{
...
...
@@ -221,8 +235,8 @@ const DeviceTree = (props) => {
},
[
loading
,
pageIndex
,
pageSize
,
hasMore
]);
const
onChangeFilter
=
(
val
)
=>
{
setFilterValue
(
val
?
val
:
''
);
}
setFilter
Field
Value
(
val
?
val
:
''
);
}
;
const
onSearch
=
useCallback
(
(
value
)
=>
{
...
...
@@ -276,26 +290,25 @@ const DeviceTree = (props) => {
return
(
<
div
className
=
{
classNames
(
prefixCls
,
'wkt-scroll-light'
)}
>
{
filterName
?
{
filterName
&&
deviceArr
.
length
===
1
&&
!
filterValue
?
(
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
,
marginBottom
:
'10px'
}}
>
<
div
>
{
filterName
}
:
<
/div
>
<
Select
style
=
{{
width
:
140
}}
placeholder
=
""
onChange
=
{
onChangeFilter
}
allowClear
=
{
true
}
>
<
Select
style
=
{{
width
:
140
}}
placeholder
=
""
onChange
=
{
onChangeFilter
}
allowClear
=
{
true
}
>
{
filterFieldEntries
.
map
((
item
)
=>
(
<
Option
key
=
{
item
}
>
{
item
}
<
/
Option
>
<
Select
.
Option
key
=
{
item
}
>
{
item
}
<
/Select.
Option
>
))}
<
/Select
>
<
/div
>
:
''
}
)
:
(
''
)}
<
Input
.
Search
placeholder
=
"搜索设备名称"
onSearch
=
{
onSearch
}
allowClear
/>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-tree-wrap`
,
'wkt-scroll-light-plus'
)}
style
=
{{
height
:
filterName
?
'calc(100% - 90px)'
:
'calc(100% - 48px)'
}}
ref
=
{
ref
}
>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-tree-wrap`
,
'wkt-scroll-light-plus'
)}
style
=
{{
height
:
filterName
?
'calc(100% - 90px)'
:
'calc(100% - 48px)'
}}
ref
=
{
ref
}
>
{
/* <Spin spinning={loading}> */
}
{
loading
||
(
data
&&
data
.
length
)
?
(
<
Skeleton
loading
=
{
loading
}
active
>
...
...
@@ -312,7 +325,6 @@ const DeviceTree = (props) => {
onSelect
=
{
handleSelect
}
/
>
<
/Skeleton
>
)
:
(
<
PandaEmpty
/>
)}
...
...
@@ -333,10 +345,10 @@ DeviceTree.defaultProps = {
selectable
:
false
,
checkable
:
false
,
keepChecked
:
false
,
onSelect
:
()
=>
{
},
onCheck
:
()
=>
{
},
setDeviceList
:
()
=>
{
},
setSearchStr
:
()
=>
{
},
onSelect
:
()
=>
{},
onCheck
:
()
=>
{},
setDeviceList
:
()
=>
{},
setSearchStr
:
()
=>
{},
};
DeviceTree
.
propTypes
=
{
...
...
@@ -354,6 +366,9 @@ DeviceTree.propTypes = {
onCheck
:
PropTypes
.
func
,
setDeviceList
:
PropTypes
.
func
,
setSearchStr
:
PropTypes
.
func
,
filterName
:
PropTypes
.
string
,
// 筛选字段,只有一个设备类型时有效
filterValue
:
PropTypes
.
string
,
// 筛选字段默认值 ,有值时,不显示下拉
};
export
default
DeviceTree
;
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