Commit 67212c07 authored by 前端-许佳敏's avatar 前端-许佳敏

feat:新增采购订单,销售订单批量归档逻辑

parent a604c3c8
import React from 'react'
import React, { useRef } from 'react'
import { history } from 'umi'
import { Card, Button, Space, Dropdown, Menu } from 'antd'
import { Card, Button, Space, Dropdown, Menu, message } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
......@@ -12,6 +12,9 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { FORM_FILTER_PATH } from '@/formSchema/const'
import Submit from '@/components/NiceForm/components/Submit'
import { DatePicker } from '@formily/antd-components'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants'
import { useHttpRequest } from '@/hooks/useHttpRequest'
// 待归档订单
......@@ -25,15 +28,38 @@ const fetchTableData = async (params) => {
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const {
columns
columns,
ref,
rowSelection,
rowSelectionCtl
} = useSelfTable()
const { run, loading } = useHttpRequest(PublicApi.postOrderFiledOrderAddAll)
const handleSubmitBatch = async () => {
if (rowSelectionCtl.selectRow.length === 0) {
message.error('请先勾选订单')
return ;
}
const canBitch = !rowSelectionCtl.selectRow.some(v => v.purchaseOrderInteriorState !== PurchaseOrderInsideWorkState.FILLING_ORDER)
if (canBitch) {
const { code } = await run({ids: rowSelectionCtl.selectedRowKeys})
if (code === 1000) {
rowSelectionCtl.setSelectRow([])
rowSelectionCtl.setSelectedRowKeys([])
ref.current.reload()
}
} else {
message.error('只能批量提交内部状态为待确认归档的订单')
}
}
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
rowSelection={rowSelection}
columns={columns}
rowKey={'orderNo'}
currentRef={ref}
rowKey={'id'}
formilyLayouts={{
justify: 'space-between'
}}
......@@ -53,6 +79,18 @@ const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
DateRangePicker: DatePicker.RangePicker,
Submit
}
},
layouts: {
order: 2,
span: 16
}
}}
formilyChilds={{
children: <Space>
<Button onClick={handleSubmitBatch} loading={loading}>批量提交审核</Button>
</Space>,
layouts: {
span: 8
}
}}
/>
......
......@@ -12,7 +12,7 @@ export const tableListSchema: ISchema = {
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: '请输入订单编号',
align: 'flex-start',
align: 'flex-end',
},
},
[FORM_FILTER_PATH]: {
......@@ -21,7 +21,7 @@ export const tableListSchema: ISchema = {
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
marginLeft: 20
}
},
properties: {
......
......@@ -33,7 +33,7 @@ const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
rowSelection,
rowSelectionCtl
} = useSelfTable()
const { run, loading } = useHttpRequest(PublicApi.postOrderSubmittedReviewOrderOneAll)
const { run, loading } = useHttpRequest(PublicApi.postOrderOfOrdersToBeFiledAll)
const handleSubmitBatch = async () => {
if (rowSelectionCtl.selectRow.length === 0) {
......
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