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
13bb554c
Commit
13bb554c
authored
May 09, 2023
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 增加其他操作的功能
parent
5c3f3727
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
203 additions
and
44 deletions
+203
-44
process.js
src/apis/process.js
+16
-0
index.js
src/core/Account/components/SearchGroup/index.js
+125
-43
index.js
src/core/Account/index.js
+62
-1
No files found.
src/apis/process.js
View file @
13bb554c
...
...
@@ -268,6 +268,22 @@ export function DeleteTableDataInfo(data) {
});
}
//导出数据
export
function
ExportAccountData
({
accountName
,
ids
,
exportAll
})
{
return
request
({
url
:
`
${
BASEURL
}
/ExportAccountData?accountName=
${
accountName
}
&ids=
${
ids
}
&exportAll=
${
exportAll
}
`
,
method
:
'get'
,
});
}
//导出模板
export
function
ExportAccountModel
({
accountName
,
exportAll
})
{
return
request
({
url
:
`
${
BASEURL
}
/ExportAccountData?accountName=
${
accountName
}
&exportAll=
${
exportAll
}
`
,
method
:
'get'
,
});
}
//获取数据字典
export
function
GetDataDictionaryList
(
params
)
{
return
request
({
...
...
src/core/Account/components/SearchGroup/index.js
View file @
13bb554c
import
React
,
{
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
,
forwardRef
,
useImperativeHandle
}
from
'react'
;
import
{
Row
,
DatePicker
,
Select
,
Button
,
Input
,
Tooltip
,
Space
,
Popconfirm
,
message
,
Upload
,
ConfigProvider
,
Modal
,
Image
,
Dropdown
,
Menu
,
Popover
,
Form
,
}
from
'antd'
;
import
'dayjs/locale/zh-cn'
;
import
locale
from
'antd/es/date-picker/locale/zh_CN'
;
import
{
SnippetsOutlined
,
PlusOutlined
,
FormOutlined
,
DeleteOutlined
,
ImportOutlined
,
ExportOutlined
,
FileZipOutlined
,
FileImageOutlined
,
CustomerServiceOutlined
,
VideoCameraOutlined
,
ExclamationCircleOutlined
,
QuestionCircleOutlined
,
EditOutlined
,
DownOutlined
,
}
from
'@ant-design/icons'
;
import
styles
from
'./search.less'
;
import
moment
from
'moment'
;
import
React
,
{
useMemo
,
useState
,
forwardRef
,
useImperativeHandle
}
from
'react'
import
{
Row
,
DatePicker
,
Select
,
Button
,
Input
,
message
,
Upload
,
Dropdown
,
Menu
,
Form
}
from
'antd'
import
'dayjs/locale/zh-cn'
import
locale
from
'antd/es/date-picker/locale/zh_CN'
import
{
PlusOutlined
,
DeleteOutlined
,
ImportOutlined
,
ExportOutlined
,
QuestionCircleOutlined
,
EditOutlined
,
DownOutlined
}
from
'@ant-design/icons'
import
styles
from
'./search.less'
import
moment
from
'moment'
const
{
Search
}
=
Input
;
const
{
RangePicker
}
=
DatePicker
;
const
{
Option
}
=
Select
;
const
dateFormat
=
'YYYY-MM-DD'
;
const
SearchGroup
=
forwardRef
((
props
,
ref
)
=>
{
...
...
@@ -154,6 +120,112 @@ const SearchGroup = forwardRef((props, ref) => {
};
},
[])
const
uploadProps
=
{
action
:
`
${
window
.
location
.
origin
}${
'/PandaWorkFlow/WorkFlow/AccountManage/ImportAccountData'
}
`
,
multiple
:
false
,
showUploadList
:
false
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
,
},
withCredentials
:
true
,
customRequest
({
action
,
file
,
headers
,
withCredentials
})
{
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
);
const
_data
=
{
accountName
};
if
(
checkName
)
{
_data
.
checkName
=
checkName
;
}
// 默认开启检查全部字段
_data
.
isCheck
=
true
;
importAccountData
(
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
,
},
},
{
...
_data
},
formData
,
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
'导入成功!'
);
getAccountData
();
}
else
{
message
.
warning
(
res
.
msg
);
}
});
},
};
const
otherMenu
=
[
{
label
:
(
<
Upload
{...
uploadProps
}
>
<
Button
style
=
{{
width
:
'170px'
,
textAlign
:
'left'
}}
size
=
'middle'
icon
=
{
<
ImportOutlined
/>
}
type
=
'text'
>
导入
<
/Button
>
<
/Upload
>
),
key
:
'uploadBtn'
,
},
{
label
:
(
<
Button
style
=
{{
width
:
'100%'
,
textAlign
:
'left'
}}
size
=
'middle'
type
=
'text'
onClick
=
{()
=>
btnsClick
(
'导出模板'
)}
icon
=
{
<
ExportOutlined
/>
}
>
导出模板
<
/Button
>
),
key
:
'导出模板'
,
},
{
label
:
(
<
Button
style
=
{{
width
:
'100%'
,
textAlign
:
'left'
}}
size
=
'middle'
type
=
'text'
onClick
=
{()
=>
btnsClick
(
'导出全字段模板'
)}
icon
=
{
<
ExportOutlined
/>
}
>
导出全字段模板
<
QuestionCircleOutlined
style
=
{{
fontSize
:
10
}}
title
=
'导出整张台账表字段'
/>
<
/Button
>
),
key
:
'导出全字段模板'
,
},
{
label
:
(
<
Button
style
=
{{
width
:
'100%'
,
textAlign
:
'left'
}}
size
=
'middle'
type
=
'text'
onClick
=
{()
=>
btnsClick
(
'导出数据'
)}
icon
=
{
<
ExportOutlined
/>
}
>
导出数据
<
/Button
>
),
key
:
'导出数据'
,
},
{
label
:
(
<
Button
style
=
{{
width
:
'100%'
,
textAlign
:
'left'
}}
size
=
'middle'
type
=
'text'
onClick
=
{()
=>
btnsClick
(
'导出全字段数据'
)}
icon
=
{
<
ExportOutlined
/>
}
>
导出全字段数据
<
QuestionCircleOutlined
style
=
{{
fontSize
:
10
,
color
:
'red'
}}
title
=
'导出整张表全字段数据,数据量大时可能导致崩溃,请按需谨慎使用!'
/>
<
/Button
>
),
key
:
'导出全字段数据'
,
}
]
const
batchMenu
=
[
{
label
:
(
...
...
@@ -183,7 +255,7 @@ const SearchGroup = forwardRef((props, ref) => {
),
key
:
'批量修改'
,
}
]
;
]
const
onSearch
=
e
=>
{
setQueryInfo
({
...
queryInfo
,
info
:
e
});
...
...
@@ -229,7 +301,6 @@ const SearchGroup = forwardRef((props, ref) => {
ranges
=
{{
...
rangerOptions
}}
format
=
{
formatterStr
}
style
=
{{
width
:
300
}}
// onChange={dateChange}
/
>
<
/Form.Item
>
)
:
null
...
...
@@ -255,6 +326,17 @@ const SearchGroup = forwardRef((props, ref) => {
{
/* 按钮区域 */
}
<
div
className
=
{
styles
.
controlRowRight
}
>
<
div
className
=
{
styles
.
controlBtns
}
>
{
!
readOnly
?
(
<
Dropdown
.
Button
style
=
{{
marginLeft
:
'20px'
}}
icon
=
{
<
DownOutlined
/>
}
overlay
=
{
<
Menu
items
=
{
otherMenu
}
/>
}
>
其他操作
<
/Dropdown.Button
>
)
:
null
}
{
!
readOnly
?
(
<
Dropdown
.
Button
...
...
src/core/Account/index.js
View file @
13bb554c
...
...
@@ -8,11 +8,12 @@ import BatchEdit from './components/BatchEdit'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
,
GetTableDataInfo
,
EditTableDataInfo
,
SaveTableDataInfo
,
DeleteTableDataInfo
,
ExportAccountData
,
ExportAccountModel
,
}
from
'../../apis/process'
import
{
isJson
,
isObject
}
from
'../../utils/index'
import
FormRender
from
'../FormRender'
...
...
@@ -105,6 +106,66 @@ const Account = (props) => {
}
batchEditRef
.
current
.
open
({
accountTable
:
accountName
,
id
:
keys
.
join
(
','
),
})
}
if
([
'导出数据'
,
'导出全字段数据'
].
includes
(
type
))
{
exportData
({
exportAll
:
type
===
'导出全字段数据'
})
}
if
([
'导出模板'
,
'导出全字段模板'
].
includes
(
type
))
{
exportTemplate
({
exportAll
:
type
===
'导出全字段模板'
})
}
}
const
exportData
=
({
exportAll
})
=>
{
Modal
.
confirm
({
icon
:
<
ExclamationCircleOutlined
/>
,
content
:
keys
.
length
>
0
?
`共选择
${
keys
.
length
}
条数据,确定要导出吗`
:
'确定要导出全部数据吗?'
,
onOk
:
async
()
=>
{
return
await
new
Promise
(
async
(
resolve
,
reject
)
=>
{
let
res
=
await
ExportAccountData
({
accountName
:
accountName
,
ids
:
keys
.
join
(
','
),
exportAll
})
if
(
res
&&
res
.
code
===
-
1
)
{
message
.
error
(
res
.
msg
)
reject
()
}
else
{
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
]))
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
target
=
'_blank'
a
.
download
=
'数据文件.xls'
a
.
click
()
a
.
remove
()
resolve
()
}
})
},
okText
:
'确定'
,
cancelText
:
'取消'
,
})
}
const
exportTemplate
=
({
exportAll
})
=>
{
Modal
.
confirm
({
icon
:
<
ExclamationCircleOutlined
/>
,
content
:
keys
.
length
>
0
?
`共选择
${
keys
.
length
}
条数据,确定要导出吗`
:
'确定要导出全部数据吗?'
,
onOk
:
async
()
=>
{
return
await
new
Promise
(
async
(
resolve
,
reject
)
=>
{
let
res
=
await
ExportAccountModel
({
accountName
:
accountName
,
exportAll
})
if
(
res
&&
res
.
code
===
-
1
)
{
message
.
error
(
res
.
msg
)
reject
()
}
else
{
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
]))
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
target
=
'_blank'
a
.
download
=
'数据文件.xls'
a
.
click
()
a
.
remove
()
resolve
()
}
})
},
okText
:
'确定'
,
cancelText
:
'取消'
,
})
}
const
saveClick
=
(
addField
,
formJson
,
values
,
type
)
=>
{
...
...
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