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
2e2c6966
Commit
2e2c6966
authored
Apr 27, 2023
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 台账选择器增加
parent
4aae4521
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
160 additions
and
147 deletions
+160
-147
index.js
src/core/Account/components/TablePack/index.js
+11
-5
index.less
src/core/Account/index.less
+2
-3
index.js
src/core/widgets/business/AccountSelector/index.js
+111
-106
index.less
src/core/widgets/business/AccountSelector/index.less
+36
-33
No files found.
src/core/Account/components/TablePack/index.js
View file @
2e2c6966
...
@@ -5,7 +5,7 @@ import FileView from './components/FileView'
...
@@ -5,7 +5,7 @@ import FileView from './components/FileView'
import
CoordView
from
'./components/CoordView'
import
CoordView
from
'./components/CoordView'
import
SelectView
from
'./components/SelectView'
import
SelectView
from
'./components/SelectView'
import
IconPack
from
'../../../components/IconPack'
import
IconPack
from
'../../../components/IconPack'
import
{
is
Json
,
is
Object
}
from
'../../../../utils'
import
{
isObject
}
from
'../../../../utils'
const
getFileInfo
=
(
formJson
)
=>
{
const
getFileInfo
=
(
formJson
)
=>
{
let
obj
=
{}
let
obj
=
{}
...
@@ -25,7 +25,7 @@ const getFileInfo = (formJson) => {
...
@@ -25,7 +25,7 @@ const getFileInfo = (formJson) => {
const
TablePack
=
(
props
)
=>
{
const
TablePack
=
(
props
)
=>
{
const
{
readOnly
,
config
,
loading
,
dataSource
,
tableChange
,
btnsClick
}
=
props
const
{
parent
,
readOnly
,
config
,
loading
,
dataSource
,
rowSelection
,
onRow
,
tableChange
,
btnsClick
}
=
props
const
searchInput
=
useRef
(
null
)
const
searchInput
=
useRef
(
null
)
const
handleReset
=
(
clearFilters
,
confirm
)
=>
{
const
handleReset
=
(
clearFilters
,
confirm
)
=>
{
...
@@ -103,7 +103,7 @@ const TablePack = (props) => {
...
@@ -103,7 +103,7 @@ const TablePack = (props) => {
icon
:
<
IconPack
.
ShanChu
/>
,
icon
:
<
IconPack
.
ShanChu
/>
,
}
}
]
]
},
[
readOnly
])
},
[
readOnly
,
parent
])
const
fileColumns
=
useMemo
(()
=>
{
const
fileColumns
=
useMemo
(()
=>
{
const
{
webShowFieldGroup
,
formJson
}
=
config
const
{
webShowFieldGroup
,
formJson
}
=
config
...
@@ -141,7 +141,7 @@ const TablePack = (props) => {
...
@@ -141,7 +141,7 @@ const TablePack = (props) => {
},
[
config
])
},
[
config
])
const
columns
=
useMemo
(()
=>
{
const
columns
=
useMemo
(()
=>
{
return
[
let
columns
=
[
{
{
title
:
'序号'
,
title
:
'序号'
,
dataIndex
:
'r'
,
dataIndex
:
'r'
,
...
@@ -197,7 +197,11 @@ const TablePack = (props) => {
...
@@ -197,7 +197,11 @@ const TablePack = (props) => {
}
}
}
}
]
]
},
[
btns
,
fileColumns
])
if
(
parent
===
'台账选择器'
)
{
return
fileColumns
}
return
columns
},
[
parent
,
btns
,
fileColumns
])
return
(
return
(
<
Table
<
Table
...
@@ -207,6 +211,8 @@ const TablePack = (props) => {
...
@@ -207,6 +211,8 @@ const TablePack = (props) => {
loading
=
{
loading
}
loading
=
{
loading
}
columns
=
{
columns
}
columns
=
{
columns
}
dataSource
=
{
dataSource
}
dataSource
=
{
dataSource
}
rowSelection
=
{
rowSelection
}
onRow
=
{
onRow
}
pagination
=
{
false
}
pagination
=
{
false
}
scroll
=
{{
y
:
'calc(100% - 40px)'
}}
scroll
=
{{
y
:
'calc(100% - 40px)'
}}
onChange
=
{
tableChange
}
onChange
=
{
tableChange
}
...
...
src/core/Account/index.less
View file @
2e2c6966
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
.tableRender {
.tableRender {
width: 100%;
width: 100%;
height: 100%;
height: 100%;
padding-bottom:
4
0px;
padding-bottom:
5
0px;
position: relative;
position: relative;
.content {
.content {
width: 100%;
width: 100%;
...
@@ -92,9 +92,8 @@
...
@@ -92,9 +92,8 @@
position: absolute;
position: absolute;
bottom: 0;
bottom: 0;
left: 0;
left: 0;
padding: 0 20px;
width: 100%;
width: 100%;
height:
4
0px;
height:
5
0px;
display: flex;
display: flex;
align-items: center;
align-items: center;
justify-content: space-between;
justify-content: space-between;
...
...
src/core/widgets/business/AccountSelector/index.js
View file @
2e2c6966
import
React
,
{
useState
,
use
Memo
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
use
Effect
}
from
'react'
import
{
Modal
,
Input
,
Table
,
Tooltip
,
message
}
from
'antd'
;
import
{
Input
,
message
,
Pagination
}
from
'antd'
import
{
SnippetsOutlined
}
from
'@ant-design/icons'
;
import
{
SnippetsOutlined
}
from
'@ant-design/icons'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
}
from
'../../../../apis/process'
;
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
}
from
'../../../../apis/process'
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
isJson
}
from
'../../../../utils'
;
import
{
isJson
}
from
'../../../../utils'
import
Drag
from
'../../../components/Drag'
;
import
TablePack
from
'../../../../core/Account/components/TablePack'
import
SearchGroup
from
'../../../../core/Account/components/SearchGroup'
import
Drag
from
'../../../components/Drag'
const
AccountSelector
=
(
props
)
=>
{
const
AccountSelector
=
(
props
)
=>
{
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
;
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
value
,
onChange
,
schema
,
addons
}
=
props
;
const
{
value
,
onChange
,
schema
,
addons
}
=
props
const
{
disabled
,
accountName
,
fieldshine
,
siteFilter
,
sql
,
isMultiple
,
presetValue
,
placeholder
}
=
schema
;
const
{
disabled
,
accountName
,
fieldshine
,
siteFilter
,
sql
,
isMultiple
,
presetValue
,
placeholder
}
=
schema
const
[
params
,
setParams
]
=
useState
({
info
:
''
,
total
:
0
,
pageIndex
:
1
,
pageSize
:
20
});
const
[
params
,
setParams
]
=
useState
({
const
[
loading
,
setLoading
]
=
useState
(
false
);
userID
:
userID
,
const
[
dataSource
,
setDataSource
]
=
useState
([]);
accountName
,
const
[
pageConfig
,
setPageConfig
]
=
useState
({
webShowFieldGroup
:
''
});
sortFields
:
'录入时间'
,
const
[
visible
,
setVisible
]
=
useState
(
false
);
direction
:
'desc'
,
const
[
keys
,
setKeys
]
=
useState
([]);
total
:
0
,
pageIndex
:
1
,
const
columns
=
useMemo
(()
=>
{
pageSize
:
100
const
{
webShowFieldGroup
}
=
pageConfig
;
})
let
fields
=
webShowFieldGroup
.
split
(
','
);
const
[
loading
,
setLoading
]
=
useState
(
false
)
let
array
=
[];
const
[
dataSource
,
setDataSource
]
=
useState
([])
if
(
fields
.
length
)
{
const
[
config
,
setConfig
]
=
useState
({
webShowFieldGroup
:
''
})
fields
.
forEach
(
v
=>
{
const
[
visible
,
setVisible
]
=
useState
(
false
)
if
(
v
)
{
const
[
keys
,
setKeys
]
=
useState
([])
array
.
push
({
key
:
new
Date
().
getTime
(),
title
:
v
,
dataIndex
:
v
,
width
:
120
,
ellipsis
:
true
,
render
:
(
value
,
r
)
=>
<
Tooltip
placement
=
"top"
title
=
{
value
}
>
{
value
}
<
/Tooltip
>
});
}
});
}
return
array
;
},
[
pageConfig
]);
const
onSearch
=
(
value
)
=>
{
getPageList
({
info
:
value
});
};
const
iconClick
=
()
=>
{
const
iconClick
=
()
=>
{
if
(
addons
)
{
if
(
addons
)
{
...
@@ -53,21 +38,21 @@ const AccountSelector = (props) => {
...
@@ -53,21 +38,21 @@ const AccountSelector = (props) => {
return
message
.
info
(
'请配置映射字段!'
);
return
message
.
info
(
'请配置映射字段!'
);
}
}
setVisible
(
true
);
setVisible
(
true
);
if
(
!
pageC
onfig
.
webShowFieldGroup
)
{
if
(
!
c
onfig
.
webShowFieldGroup
)
{
get
Page
Config
();
getConfig
();
}
}
get
PageList
();
get
DataSource
();
}
}
}
;
}
const
get
Page
Config
=
async
()
=>
{
const
getConfig
=
async
()
=>
{
const
{
code
,
data
}
=
await
GetAccountConfigInfo
(
accountName
);
const
{
code
,
data
}
=
await
GetAccountConfigInfo
(
accountName
);
if
(
code
==
0
)
{
if
(
code
==
0
)
{
set
PageConfig
(
data
);
set
Config
({
...
data
,
formJson
:
isJson
(
data
.
formJson
)
?
JSON
.
parse
(
data
.
formJson
)
:
{}
})
}
}
}
;
}
const
get
PageList
=
async
(
outParams
=
{})
=>
{
const
get
DataSource
=
async
(
outParams
=
{})
=>
{
let
queryWheres
=
[];
let
queryWheres
=
[];
if
(
siteFilter
)
{
if
(
siteFilter
)
{
const
{
code
,
data
}
=
await
getStationListByUserID
(...[
userID
,
false
]);
const
{
code
,
data
}
=
await
getStationListByUserID
(...[
userID
,
false
]);
...
@@ -105,15 +90,23 @@ const AccountSelector = (props) => {
...
@@ -105,15 +90,23 @@ const AccountSelector = (props) => {
message
.
error
(
msg
);
message
.
error
(
msg
);
}
}
setLoading
(
false
);
setLoading
(
false
);
};
}
const
tableChange
=
({
current
,
pageSize
})
=>
{
getPageList
({
pageIndex
:
current
,
pageSize
});
};
const
rowChange
=
(
keys
,
rows
)
=>
{
const
tableChange
=
(
page
,
filters
,
sorter
)
=>
{
setKeys
(
keys
);
let
queryWheres
=
[]
};
Object
.
keys
(
filters
).
forEach
(
k
=>
{
if
(
filters
[
k
]?.[
0
])
{
queryWheres
.
push
({
field
:
k
,
type
:
'包括'
,
value
:
filters
[
k
][
0
]
})
}
})
let
param
=
{
sortFields
:
sorter
.
order
?
sorter
.
field
:
'录入时间'
,
direction
:
sorter
.
order
!==
'ascend'
?
'desc'
:
'asc'
,
queryWheres
}
setParams
({
...
params
,
...
param
})
getDataSource
(
param
)
}
const
rowClick
=
(
row
)
=>
{
const
rowClick
=
(
row
)
=>
{
if
(
isMultiple
)
{
if
(
isMultiple
)
{
...
@@ -127,7 +120,7 @@ const AccountSelector = (props) => {
...
@@ -127,7 +120,7 @@ const AccountSelector = (props) => {
}
else
{
}
else
{
setKeys
([
row
.
ID
]);
setKeys
([
row
.
ID
]);
}
}
}
;
}
const
onOk
=
()
=>
{
const
onOk
=
()
=>
{
if
(
fieldshine
.
length
>
1
)
{
if
(
fieldshine
.
length
>
1
)
{
...
@@ -154,7 +147,16 @@ const AccountSelector = (props) => {
...
@@ -154,7 +147,16 @@ const AccountSelector = (props) => {
}
}
}
}
setVisible
(
false
);
setVisible
(
false
);
};
}
const
search
=
(
values
)
=>
{
setParams
({
...
params
,
...
values
})
getDataSource
({
...
values
})
}
const
pageChange
=
(
pageIndex
,
pageSize
)
=>
{
getDataSource
({
pageIndex
,
pageSize
})
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
addons
)
{
if
(
addons
)
{
...
@@ -162,9 +164,9 @@ const AccountSelector = (props) => {
...
@@ -162,9 +164,9 @@ const AccountSelector = (props) => {
}
else
{
}
else
{
onChange
(
presetValue
);
onChange
(
presetValue
);
}
}
},
[
presetValue
])
;
},
[
presetValue
])
const
addonAfter
=
<
SnippetsOutlined
onClick
=
{()
=>
iconClick
()}
style
=
{{
color
:
'rgba(0, 0, 0, 0.25)'
}}
/>
;
const
addonAfter
=
<
SnippetsOutlined
onClick
=
{()
=>
iconClick
()}
style
=
{{
color
:
'rgba(0, 0, 0, 0.25)'
}}
/
>
return
(
return
(
<
div
className
=
{
styles
.
AccountSelector
}
>
<
div
className
=
{
styles
.
AccountSelector
}
>
...
@@ -182,53 +184,56 @@ const AccountSelector = (props) => {
...
@@ -182,53 +184,56 @@ const AccountSelector = (props) => {
title
=
{
accountName
}
title
=
{
accountName
}
visible
=
{
visible
}
visible
=
{
visible
}
getContainer
=
{
false
}
getContainer
=
{
false
}
bodyStyle
=
{{
height
:
570
,
overflowY
:
'auto'
}}
bodyStyle
=
{{
height
:
570
,
paddingBottom
:
0
}}
>
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
className
=
{
styles
.
content
}
>
<
div
style
=
{{
lineHeight
:
'31px'
,
paddingRight
:
'10px'
}}
>
快捷搜索
:
<
/div
>
<
div
className
=
{
styles
.
top
}
>
<
Input
.
Search
<
SearchGroup
value
=
{
params
.
info
}
onChange
=
{
search
}
placeholder
=
"请输入检索内容"
readOnly
=
{
true
}
allowClear
/
>
onChange
=
{(
e
)
=>
setParams
({
...
params
,
info
:
e
.
target
.
value
})}
<
/div
>
onSearch
=
{
onSearch
}
<
div
className
=
{
styles
.
bottom
}
>
enterButton
<
TablePack
size
=
{
'middle'
}
loading
=
{
loading
}
style
=
{{
width
:
'400px'
,
marginBottom
:
'10px'
}}
readOnly
=
{
true
}
/
>
config
=
{
config
}
dataSource
=
{
dataSource
}
btnsClick
=
{()
=>
{
}}
tableChange
=
{
tableChange
}
parent
=
'台账选择器'
rowSelection
=
{{
type
:
isMultiple
&&
fieldshine
.
length
===
1
?
'checkbox'
:
'radio'
,
selectedRowKeys
:
keys
,
fixed
:
'left'
,
onChange
:
(
keys
)
=>
setKeys
(
keys
)
}}
onRow
=
{
record
=>
({
onClick
:
event
=>
{
event
.
stopPropagation
();
rowClick
(
record
);
},
})}
/
>
<
/div
>
<
div
className
=
{
styles
.
footer
}
>
<
div
className
=
{
styles
.
total
}
>
共计
{
params
.
total
}
条数据
<
/div
>
<
div
className
=
{
styles
.
pagination
}
>
<
Pagination
size
=
'small'
showQuickJumper
pageSize
=
{
params
.
pageSize
}
current
=
{
params
.
pageIndex
}
total
=
{
params
.
total
}
onChange
=
{
pageChange
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
Table
rowKey
=
{
r
=>
r
.
ID
}
loading
=
{
loading
}
bordered
size
=
"small"
scroll
=
{{
x
:
'100%'
,
y
:
400
}}
rowSelection
=
{{
type
:
isMultiple
&&
fieldshine
.
length
===
1
?
'checkbox'
:
'radio'
,
selectedRowKeys
:
keys
,
fixed
:
'left'
,
onChange
:
rowChange
}}
onRow
=
{
record
=>
({
onClick
:
event
=>
{
event
.
stopPropagation
();
rowClick
(
record
);
},
})}
pagination
=
{{
total
:
params
.
total
,
current
:
params
.
pageIndex
,
pageSize
:
params
.
pageSize
,
showTotal
:
(
total
)
=>
`共
${
total
}
条`
}}
onChange
=
{
tableChange
}
dataSource
=
{
dataSource
}
columns
=
{
columns
}
/
>
<
/Drag
>
<
/Drag
>
<
/div
>
<
/div
>
)
;
)
}
;
}
export
default
AccountSelector
;
export
default
AccountSelector
\ No newline at end of file
\ No newline at end of file
src/core/widgets/business/AccountSelector/index.less
View file @
2e2c6966
@import '~antd/es/style/themes/default.less';
@import '~antd/es/style/themes/default.less';
.AccountSelector {
.AccountSelector {
.@{ant-prefix}-table-thead {
.content {
.@{ant-prefix}-table-cell {
width: 100%;
background: white;
height: 100%;
}
position: relative;
th {
padding-bottom: 40px;
border-bottom: 2px solid #DBE7FB;
.top {
text-align: center;
width: 100%;
}
height: 50px;
}
}
.@{ant-prefix}-table-body {
.bottom {
tr {
width: 100%;
td {
height: calc(100% - 50px);
border-bottom: 1px solid #DBE7FB;
.@{ant-prefix}-table-wrapper {
border-right: 1px solid #DBE7FB;
height: 100%;
}
.@{ant-prefix}-spin-nested-loading {
}
height: 100%;
.@{ant-prefix}-table-row {
}
padding: 4px !important;
.@{ant-prefix}-spin-container {
}
height: 100%;
tr:nth-child(even) {
}
background: #F6F9FE;
.@{ant-prefix}-table {
.panda-civ-workflow-table-cell-fix-right {
height: 100%;
background-color: #F6F9FEed;
.@{ant-prefix}-table-container {
height: 100%;
}
}
}
}
}
}
&::-webkit-scrollbar {
.footer {
width: 8px;
position: absolute;
height: 8px;
bottom: 0;
}
left: 0;
&::-webkit-scrollbar-thumb {
width: 100%;
background: #c8c8c8;
height: 40px;
}
display: flex;
&::-webkit-scrollbar-track {
align-items: center;
background: #f7f4f5;
justify-content: space-between;
padding: 0 3px;
}
}
}
}
}
}
\ 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