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
3ef4d574
Commit
3ef4d574
authored
Apr 26, 2023
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 增加只读参数传递
parent
91621f11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
111 deletions
+47
-111
index.js
src/core/Account/components/SearchGroup/index.js
+15
-91
index.js
src/core/Account/index.js
+32
-20
No files found.
src/core/Account/components/SearchGroup/index.js
View file @
3ef4d574
...
...
@@ -47,15 +47,13 @@ const { Option } = Select;
const
dateFormat
=
'YYYY-MM-DD'
;
const
SearchGroup
=
forwardRef
((
props
,
ref
)
=>
{
useImperativeHandle
(
ref
,
()
=>
({
getQueryInfo
,
}));
const
{
readOnly
}
=
props
const
[
form
]
=
Form
.
useForm
();
// const {
// fieldSearch
// } = props.params;
const
[
showPicker
,
setShowPicker
]
=
useState
(
true
);
const
[
dateArray
,
setDateArray
]
=
useState
([
// moment(moment().format('YYYY-MM-DD 00:00:00')).subtract(1, 'years'),
...
...
@@ -229,55 +227,15 @@ const SearchGroup = forwardRef((props, ref) => {
)
:
(
''
)}
{
/* {filterColumnsList.map((item, index) => (
<Form.Item key={item.name + index} label={item.alias} className={styles.noMarginBottom}>
<Select
size='middle'
defaultValue='全部'
onChange={e => storeFilterListValue(e, item.name)}
style={{ width: 120 }}
>
{item.list.map(obj => (
<Option key={obj} value={obj}>
{obj}
</Option>
))}
</Select>
</Form.Item>
))} */
}
<
Form
.
Item
label
=
{
'快捷搜索'
}
name
=
"info"
className
=
{
styles
.
noMarginBottom
}
>
{
/* {searchKey && fieldSearch ? <Select
style={{ maxWidth: '112px' }}
placeholder='请选择字段'
showArrow
showSearch
allowClear
onSelect={e => setSearchKey(e)}
defaultValue={searchKey}
>
{accountConfig?.searchFieldGroup?.slice(
1,
-1,
).split(',').map(v => <Select.Option key={v} value={v}>{v}</Select.Option>)}
</Select> : null} */
}
<
Search
// title={`请输入${accountConfig?.searchFieldGroup?.slice(
// 1,
// -1,
// ) || ''}搜索`}
size
=
"middle"
// placeholder={`请输入${accountConfig?.searchFieldGroup?.slice(
// 1,
// -1,
// ) || ''}搜索`}
style
=
{{
width
:
320
,
verticalAlign
:
'middle'
,
marginLeft
:
'10px'
,
}}
placeholder
=
"请输入值"
// value={searchValues}
// onChange={e => setSearchValues(e.target.value)}
onSearch
=
{
onSearch
}
/
>
<
/Form.Item
>
...
...
@@ -285,54 +243,20 @@ const SearchGroup = forwardRef((props, ref) => {
<
/Form
>
{
/* 按钮区域 */
}
<
div
className
=
{
styles
.
controlRowRight
}
>
{
/* {
state !== 'special' ? <Dropdown.Button type={permission.includes('addBtn') ? '' : 'primary'} icon={<DownOutlined />}
overlay={menu}>其他操作</Dropdown.Button> : ''
}
{
bulkButton ? <Dropdown.Button style={{ "marginLeft": "20px" }} type={permission.includes('addBtn') ? '' : 'primary'} icon={<DownOutlined />}
overlay={batchMenu}>批量操作</Dropdown.Button> : ''
} */
}
<
div
className
=
{
styles
.
controlBtns
}
>
{
/* {permission.includes('editBtn') && !bulkButton ? (
<Button
type="primary" ghost
size='middle'
onClick={() => bulkEditing()}
icon={<EditOutlined />}
style={{ marginLeft: 20 }}
>
批量修改
</Button>
) : (
''
)} */
}
{
/* {permission.includes('deleteBtn') && !bulkButton ? (
<Button
type='primary' ghost
size='middle'
onClick={() => deleteInBatch()}
icon={<DeleteOutlined />}
style={{ marginLeft: 20 }}
>
批量删除
</Button>
) : (
''
)} */
}
{
/* {permission.includes('addBtn') ? ( */
}
<
Button
type
=
"primary"
size
=
"middle"
onClick
=
{()
=>
btnsClick
(
'添加'
)}
icon
=
{
<
PlusOutlined
/>
}
style
=
{{
marginLeft
:
20
}}
>
添加
<
/Button
>
{
/* ) : (
''
)} */
}
{
!
readOnly
?
(
<
Button
type
=
"primary"
size
=
"middle"
onClick
=
{()
=>
btnsClick
(
'添加'
)}
icon
=
{
<
PlusOutlined
/>
}
style
=
{{
marginLeft
:
20
}}
>
添加
<
/Button
>
)
:
null
}
<
/div
>
<
/div
>
<
/Row
>
...
...
src/core/Account/index.js
View file @
3ef4d574
...
...
@@ -37,7 +37,7 @@ const getFileInfo = (formJson) => {
const
Account
=
(
props
)
=>
{
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
accountName
}
=
props
const
{
accountName
,
readOnly
}
=
props
const
[
detailShow
,
setDetailShow
]
=
useState
(
false
)
const
[
params
,
setParams
]
=
useState
({
userID
:
userID
,
...
...
@@ -65,9 +65,7 @@ const Account = (props) => {
const
getColumnSearchProps
=
(
dataIndex
)
=>
({
filterDropdown
:
({
setSelectedKeys
,
selectedKeys
,
confirm
,
clearFilters
,
close
})
=>
(
<
div
style
=
{{
padding
:
8
,
}}
style
=
{{
padding
:
8
}}
onKeyDown
=
{(
e
)
=>
e
.
stopPropagation
()}
>
<
Input
...
...
@@ -136,6 +134,31 @@ const Account = (props) => {
return
array
},
[
config
])
const
btns
=
useMemo
(()
=>
{
if
(
readOnly
)
{
return
[
{
title
:
'详情'
,
icon
:
<
IconPack
.
XiangQing
/>
,
},
]
}
return
[
{
title
:
'详情'
,
icon
:
<
IconPack
.
XiangQing
/>
,
},
{
title
:
'编辑'
,
icon
:
<
IconPack
.
BianJi
/>
,
},
{
title
:
'删除'
,
icon
:
<
IconPack
.
ShanChu
/>
,
}
]
},
[
readOnly
])
const
columns
=
useMemo
(()
=>
{
return
[
{
...
...
@@ -149,24 +172,10 @@ const Account = (props) => {
...
fileColumns
,
{
title
:
'操作'
,
width
:
12
0
,
width
:
btns
.
length
*
35
+
3
0
,
align
:
'center'
,
fixed
:
'right'
,
render
:
(
r
)
=>
{
let
btns
=
[
{
title
:
'详情'
,
icon
:
<
IconPack
.
XiangQing
/>
,
},
{
title
:
'编辑'
,
icon
:
<
IconPack
.
BianJi
/>
,
},
{
title
:
'删除'
,
icon
:
<
IconPack
.
ShanChu
/>
,
}
]
return
(
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
}}
>
{
...
...
@@ -174,6 +183,7 @@ const Account = (props) => {
if
(
v
.
title
===
'删除'
)
{
return
(
<
Popconfirm
key
=
{
v
.
title
}
title
=
'确定要删除数据吗?'
onConfirm
=
{()
=>
btnsClick
(
v
.
title
,
r
.
ID
)}
okText
=
'确定'
...
...
@@ -190,6 +200,7 @@ const Account = (props) => {
}
return
(
<
Button
key
=
{
v
.
title
}
type
=
'link'
title
=
{
v
.
title
}
icon
=
{
v
.
icon
}
...
...
@@ -205,7 +216,7 @@ const Account = (props) => {
}
}
]
},
[
fileColumns
])
},
[
btns
,
fileColumns
])
const
btnsClick
=
async
(
type
,
id
)
=>
{
const
{
addFieldGroup
,
editFieldGroup
,
formJson
}
=
config
...
...
@@ -356,6 +367,7 @@ const Account = (props) => {
<
SearchGroup
onChange
=
{
search
}
btnsClick
=
{
btnsClick
}
readOnly
=
{
readOnly
}
/
>
<
/div
>
<
div
className
=
{
styles
.
bottom
}
>
...
...
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