Commit 55bc792d authored by 前端-许佳敏's avatar 前端-许佳敏

待审核订单批量提交体验优化

parent 02ac76a9
......@@ -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) => {
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment