Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
shenshaokai
jinfa-platform
Commits
55bc792d
Commit
55bc792d
authored
Oct 23, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
待审核订单批量提交体验优化
parent
02ac76a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
useRowSelectionTable.ts
src/hooks/useRowSelectionTable.ts
+9
-3
useSelfTable.tsx
...n/purchaseOrder/firstApprovedOrder/model/useSelfTable.tsx
+7
-3
No files found.
src/hooks/useRowSelectionTable.ts
View file @
55bc792d
...
...
@@ -15,7 +15,11 @@ interface useRowSelectionTableCtl {
interface
useRowSelectionOptions
{
type
?:
'checkbox'
|
'radio'
,
customKey
?:
string
customKey
?:
string
,
// 可通过该参数扩展多选选项
// https://ant.design/components/table-cn/#components-table-demo-row-selection
extendsSelection
?:
TableRowSelection
<
any
>
}
/**
...
...
@@ -23,7 +27,7 @@ interface useRowSelectionOptions {
* @auth xjm
*/
export
const
useRowSelectionTable
=
(
options
:
useRowSelectionOptions
=
{}):
[
TableRowSelection
<
any
>
,
useRowSelectionTableCtl
]
=>
{
const
{
type
=
'checkbox'
,
customKey
=
'id'
}
=
options
const
{
type
=
'checkbox'
,
customKey
=
'id'
,
extendsSelection
=
{}
}
=
options
const
[
selectRow
,
setSelectRow
]
=
useState
<
any
[]
>
([])
// 模态框选择的行数据
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
any
[]
>
(()
=>
[])
...
...
@@ -82,7 +86,9 @@ export const useRowSelectionTable = (options: useRowSelectionOptions = {}): [Tab
setSelectedRowKeys
(
removeRowsKeys
(
changeRows
.
map
(
v
=>
v
[
customKey
])))
setSelectRow
(
removeRows
(
changeRows
))
}
}
},
...
extendsSelection
}
const
appendSelectRow
=
(
row
)
=>
{
...
...
src/pages/transaction/purchaseOrder/firstApprovedOrder/model/useSelfTable.tsx
View file @
55bc792d
...
...
@@ -2,15 +2,19 @@ import React, { useRef } from 'react'
import
{
Button
}
from
'antd'
import
{
baseOrderListColumns
}
from
'../../constant'
import
{
history
}
from
'umi'
import
{
PublicApi
}
from
'@/services/api'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
PurchaseOrderInsideWorkState
}
from
'@/constants'
import
{
PURCHASE_ORDER_STATUS
}
from
'../../orderPreview/constant'
// 业务hooks, 待新增订单
export
const
useSelfTable
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
})
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
,
extendsSelection
:
{
getCheckboxProps
:
record
=>
({
// 不等于可提交审核的 都无法通过批量提交
disabled
:
record
.
interiorState
!==
PurchaseOrderInsideWorkState
.
ONE_LEVEL_AUDIT_ORDER
,
interiorState
:
record
.
interiorState
,
})
}})
const
handleSubmit
=
async
(
record
)
=>
{
if
(
record
.
interiorState
===
PurchaseOrderInsideWorkState
.
ONE_LEVEL_AUDIT_ORDER
)
{
...
...
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