Commit cafb718ce5d4b4222f34187c623335a261707aab
1 parent
53312557
feat(Invoice): 优化重新开票记录审核功能
- 重构 Audit 组件,支持多记录审核 - 新增通过和驳回按钮,提高审核灵活性 -优化审核流程,支持批量操作- 调整审核记录的展示和操作方式
Showing
4 changed files
with
161 additions
and
101 deletions
src/pages/Invoice/ReissueRecord/components/Audit.tsx
... | ... | @@ -3,12 +3,12 @@ import { postServiceInvoiceReissueAudit } from '@/services'; |
3 | 3 | import { ModalForm, ProFormText } from '@ant-design/pro-components'; |
4 | 4 | import { Button, Form, message } from 'antd'; |
5 | 5 | |
6 | -export default (recordId) => { | |
6 | +export default ({ recordIds, onClose }) => { | |
7 | 7 | const [form] = Form.useForm<{ name: string; company: string }>(); |
8 | 8 | return ( |
9 | 9 | <ModalForm |
10 | 10 | title="审核" |
11 | - trigger={<Button type="primary">审核</Button>} | |
11 | + trigger={<a type="primary">审核</a>} | |
12 | 12 | form={form} |
13 | 13 | autoFocusFirstInput |
14 | 14 | modalProps={{ |
... | ... | @@ -22,43 +22,52 @@ export default (recordId) => { |
22 | 22 | resetText: '取消', |
23 | 23 | }, |
24 | 24 | render: (props, defaultDoms) => { |
25 | - console.log('props', JSON.stringify(form.setFieldsValue)); | |
26 | 25 | return [ |
27 | - ...defaultDoms, | |
26 | + defaultDoms[0], | |
28 | 27 | <Button |
28 | + type={'primary'} | |
29 | 29 | key="ok" |
30 | 30 | onClick={async () => { |
31 | 31 | const res = await postServiceInvoiceReissueAudit({ |
32 | - body: { | |
33 | - //...values, | |
34 | - ...form.setFieldsValue, | |
35 | - recordId, | |
32 | + data: { | |
33 | + ...form.getFieldsValue(), | |
34 | + recordIds, | |
35 | + passed: false, | |
36 | 36 | }, |
37 | 37 | }); |
38 | 38 | if (res.result === RESPONSE_CODE.SUCCESS) { |
39 | 39 | message.success('提交成功'); |
40 | - return true; | |
41 | 40 | } |
42 | - return false; | |
41 | + props.submit(); | |
43 | 42 | }} |
44 | 43 | > |
45 | - ok | |
44 | + 驳回 | |
45 | + </Button>, | |
46 | + <Button | |
47 | + type={'primary'} | |
48 | + key="ok" | |
49 | + onClick={async () => { | |
50 | + const res = await postServiceInvoiceReissueAudit({ | |
51 | + data: { | |
52 | + ...form.getFieldsValue(), | |
53 | + recordIds, | |
54 | + passed: true, | |
55 | + }, | |
56 | + }); | |
57 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
58 | + message.success('提交成功'); | |
59 | + } | |
60 | + props.submit(); | |
61 | + }} | |
62 | + > | |
63 | + 通过 | |
46 | 64 | </Button>, |
47 | 65 | ]; |
48 | 66 | }, |
49 | 67 | }} |
50 | - onFinish={async (values) => { | |
51 | - const res = await postServiceInvoiceReissueAudit({ | |
52 | - body: { | |
53 | - ...values, | |
54 | - recordId, | |
55 | - }, | |
56 | - }); | |
57 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
58 | - message.success('提交成功'); | |
59 | - return true; | |
60 | - } | |
61 | - return false; | |
68 | + onFinish={async () => { | |
69 | + onClose(); | |
70 | + return true; | |
62 | 71 | }} |
63 | 72 | > |
64 | 73 | <ProFormText width="xs" name="notes" label="备注" /> | ... | ... |
src/pages/Invoice/ReissueRecord/index.tsx
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | |
1 | 2 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | 3 | import Audit from '@/pages/Invoice/ReissueRecord/components/Audit'; |
3 | 4 | import { |
4 | 5 | postServiceConstBeforeInvoicingInvoiceRecordStatus, |
6 | + postServiceInvoiceReissueRecordDelete, | |
5 | 7 | postServiceInvoiceReissueRecords, |
6 | 8 | } from '@/services'; |
7 | 9 | import { enumToSelect } from '@/utils'; |
8 | 10 | import { useModel } from '@@/exports'; |
9 | 11 | import type { ActionType, ProColumns } from '@ant-design/pro-components'; |
10 | -import { ProTable, TableDropdown } from '@ant-design/pro-components'; | |
12 | +import { ProTable } from '@ant-design/pro-components'; | |
13 | +import { message } from 'antd'; | |
11 | 14 | import { useRef } from 'react'; |
12 | 15 | |
13 | 16 | export const waitTimePromise = async (time: number = 100) => { |
... | ... | @@ -18,30 +21,10 @@ export const waitTimePromise = async (time: number = 100) => { |
18 | 21 | }); |
19 | 22 | }; |
20 | 23 | |
21 | -export const waitTime = async (time: number = 100) => { | |
22 | - await waitTimePromise(time); | |
23 | -}; | |
24 | - | |
25 | -type GithubIssueItem = { | |
26 | - url: string; | |
27 | - id: number; | |
28 | - number: number; | |
29 | - title: string; | |
30 | - labels: { | |
31 | - name: string; | |
32 | - color: string; | |
33 | - }[]; | |
34 | - state: string; | |
35 | - comments: number; | |
36 | - created_at: string; | |
37 | - updated_at: string; | |
38 | - closed_at?: string; | |
39 | -}; | |
40 | - | |
41 | 24 | export default () => { |
42 | 25 | const actionRef = useRef<ActionType>(); |
43 | 26 | const { getInvoiceFlushStatus } = useModel('enum'); |
44 | - const columns: ProColumns<GithubIssueItem>[] = [ | |
27 | + const columns: ProColumns[] = [ | |
45 | 28 | { |
46 | 29 | dataIndex: 'index', |
47 | 30 | valueType: 'indexBorder', |
... | ... | @@ -53,6 +36,7 @@ export default () => { |
53 | 36 | render: (_, record) => { |
54 | 37 | return record.invoiceNumbers?.join(','); |
55 | 38 | }, |
39 | + ellipsis: true, | |
56 | 40 | hideInSearch: true, |
57 | 41 | }, |
58 | 42 | { |
... | ... | @@ -180,29 +164,38 @@ export default () => { |
180 | 164 | title: '操作', |
181 | 165 | valueType: 'option', |
182 | 166 | key: 'option', |
183 | - render: (text, record, _, action) => [ | |
184 | - <Audit key={'audit'} recordId={record.id} />, | |
185 | - <a | |
186 | - href={record.url} | |
187 | - target="_blank" | |
188 | - rel="noopener noreferrer" | |
189 | - key="view" | |
190 | - > | |
191 | - 查看 | |
192 | - </a>, | |
193 | - <TableDropdown | |
194 | - key="actionGroup" | |
195 | - onSelect={() => action?.reload()} | |
196 | - menus={[ | |
197 | - { key: 'copy', name: '复制' }, | |
198 | - { key: 'delete', name: '删除' }, | |
199 | - ]} | |
200 | - />, | |
167 | + render: (record) => [ | |
168 | + record.paths?.includes('audit') && ( | |
169 | + <Audit | |
170 | + key={'audit'} | |
171 | + recordIds={[record.id]} | |
172 | + onClose={() => { | |
173 | + actionRef.current?.reload(); | |
174 | + }} | |
175 | + /> | |
176 | + ), | |
177 | + record.paths?.includes('audit') && ( | |
178 | + <ButtonConfirm | |
179 | + key="delete" | |
180 | + className="p-0" | |
181 | + title={'确认删除该记录?'} | |
182 | + text="删除" | |
183 | + onConfirm={async () => { | |
184 | + let res = await postServiceInvoiceReissueRecordDelete({ | |
185 | + data: { id: record.id }, | |
186 | + }); | |
187 | + if (res) { | |
188 | + message.success(res.message); | |
189 | + actionRef.current?.reload(); | |
190 | + } | |
191 | + }} | |
192 | + /> | |
193 | + ), | |
201 | 194 | ], |
202 | 195 | }, |
203 | 196 | ]; |
204 | 197 | return ( |
205 | - <ProTable<GithubIssueItem> | |
198 | + <ProTable | |
206 | 199 | columns={columns} |
207 | 200 | actionRef={actionRef} |
208 | 201 | cardBordered | ... | ... |
src/pages/Order/WarningWhitelist/index.tsx
... | ... | @@ -90,7 +90,7 @@ const WarningWhitelist = () => { |
90 | 90 | console.log(record, '5656record'); |
91 | 91 | await postServiceOrderDeleteWarningUserWhiteList({ |
92 | 92 | query: { |
93 | - orderId: record.orderId, | |
93 | + id: record.id, | |
94 | 94 | }, |
95 | 95 | }); |
96 | 96 | action?.reload(); |
... | ... | @@ -168,7 +168,7 @@ const WarningWhitelist = () => { |
168 | 168 | console.log(record.orderId, '5656idoreder'); |
169 | 169 | await postServiceOrderDeleteWarningOrderWhiteList({ |
170 | 170 | query: { |
171 | - orderId: record.orderId, | |
171 | + id: record.id, | |
172 | 172 | }, |
173 | 173 | }); |
174 | 174 | action?.reload(); | ... | ... |
src/services/request.ts
... | ... | @@ -70,6 +70,7 @@ import type { |
70 | 70 | MeasureUnitListRes, |
71 | 71 | MergeIntegralDto, |
72 | 72 | MessageQueryDTO, |
73 | + ModelAndView, | |
73 | 74 | OrderAddVO, |
74 | 75 | OrderAuditLogQueryVO, |
75 | 76 | OrderBaseInfoQueryVO, |
... | ... | @@ -3537,9 +3538,7 @@ export interface GetErrorResponse { |
3537 | 3538 | * @description |
3538 | 3539 | * OK |
3539 | 3540 | */ |
3540 | - 200: { | |
3541 | - [propertyName: string]: any; | |
3542 | - }; | |
3541 | + 200: ModelAndView; | |
3543 | 3542 | /** |
3544 | 3543 | * @description |
3545 | 3544 | * Unauthorized |
... | ... | @@ -3560,9 +3559,9 @@ export interface GetErrorResponse { |
3560 | 3559 | export type GetErrorResponseSuccess = GetErrorResponse[200]; |
3561 | 3560 | /** |
3562 | 3561 | * @description |
3563 | - * error | |
3562 | + * errorHtml | |
3564 | 3563 | * @tags basic-error-controller |
3565 | - * @produces * | |
3564 | + * @produces text/html | |
3566 | 3565 | */ |
3567 | 3566 | export const getError = /* #__PURE__ */ (() => { |
3568 | 3567 | const method = 'get'; |
... | ... | @@ -3586,9 +3585,7 @@ export interface PutErrorResponse { |
3586 | 3585 | * @description |
3587 | 3586 | * OK |
3588 | 3587 | */ |
3589 | - 200: { | |
3590 | - [propertyName: string]: any; | |
3591 | - }; | |
3588 | + 200: ModelAndView; | |
3592 | 3589 | /** |
3593 | 3590 | * @description |
3594 | 3591 | * Created |
... | ... | @@ -3614,9 +3611,9 @@ export interface PutErrorResponse { |
3614 | 3611 | export type PutErrorResponseSuccess = PutErrorResponse[200]; |
3615 | 3612 | /** |
3616 | 3613 | * @description |
3617 | - * error | |
3614 | + * errorHtml | |
3618 | 3615 | * @tags basic-error-controller |
3619 | - * @produces * | |
3616 | + * @produces text/html | |
3620 | 3617 | * @consumes application/json |
3621 | 3618 | */ |
3622 | 3619 | export const putError = /* #__PURE__ */ (() => { |
... | ... | @@ -3641,9 +3638,7 @@ export interface PostErrorResponse { |
3641 | 3638 | * @description |
3642 | 3639 | * OK |
3643 | 3640 | */ |
3644 | - 200: { | |
3645 | - [propertyName: string]: any; | |
3646 | - }; | |
3641 | + 200: ModelAndView; | |
3647 | 3642 | /** |
3648 | 3643 | * @description |
3649 | 3644 | * Created |
... | ... | @@ -3669,9 +3664,9 @@ export interface PostErrorResponse { |
3669 | 3664 | export type PostErrorResponseSuccess = PostErrorResponse[200]; |
3670 | 3665 | /** |
3671 | 3666 | * @description |
3672 | - * error | |
3667 | + * errorHtml | |
3673 | 3668 | * @tags basic-error-controller |
3674 | - * @produces * | |
3669 | + * @produces text/html | |
3675 | 3670 | * @consumes application/json |
3676 | 3671 | */ |
3677 | 3672 | export const postError = /* #__PURE__ */ (() => { |
... | ... | @@ -3696,9 +3691,7 @@ export interface DeleteErrorResponse { |
3696 | 3691 | * @description |
3697 | 3692 | * OK |
3698 | 3693 | */ |
3699 | - 200: { | |
3700 | - [propertyName: string]: any; | |
3701 | - }; | |
3694 | + 200: ModelAndView; | |
3702 | 3695 | /** |
3703 | 3696 | * @description |
3704 | 3697 | * No Content |
... | ... | @@ -3719,9 +3712,9 @@ export interface DeleteErrorResponse { |
3719 | 3712 | export type DeleteErrorResponseSuccess = DeleteErrorResponse[200]; |
3720 | 3713 | /** |
3721 | 3714 | * @description |
3722 | - * error | |
3715 | + * errorHtml | |
3723 | 3716 | * @tags basic-error-controller |
3724 | - * @produces * | |
3717 | + * @produces text/html | |
3725 | 3718 | */ |
3726 | 3719 | export const deleteError = /* #__PURE__ */ (() => { |
3727 | 3720 | const method = 'delete'; |
... | ... | @@ -3745,9 +3738,7 @@ export interface OptionsErrorResponse { |
3745 | 3738 | * @description |
3746 | 3739 | * OK |
3747 | 3740 | */ |
3748 | - 200: { | |
3749 | - [propertyName: string]: any; | |
3750 | - }; | |
3741 | + 200: ModelAndView; | |
3751 | 3742 | /** |
3752 | 3743 | * @description |
3753 | 3744 | * No Content |
... | ... | @@ -3768,9 +3759,9 @@ export interface OptionsErrorResponse { |
3768 | 3759 | export type OptionsErrorResponseSuccess = OptionsErrorResponse[200]; |
3769 | 3760 | /** |
3770 | 3761 | * @description |
3771 | - * error | |
3762 | + * errorHtml | |
3772 | 3763 | * @tags basic-error-controller |
3773 | - * @produces * | |
3764 | + * @produces text/html | |
3774 | 3765 | * @consumes application/json |
3775 | 3766 | */ |
3776 | 3767 | export const optionsError = /* #__PURE__ */ (() => { |
... | ... | @@ -3795,9 +3786,7 @@ export interface HeadErrorResponse { |
3795 | 3786 | * @description |
3796 | 3787 | * OK |
3797 | 3788 | */ |
3798 | - 200: { | |
3799 | - [propertyName: string]: any; | |
3800 | - }; | |
3789 | + 200: ModelAndView; | |
3801 | 3790 | /** |
3802 | 3791 | * @description |
3803 | 3792 | * No Content |
... | ... | @@ -3818,9 +3807,9 @@ export interface HeadErrorResponse { |
3818 | 3807 | export type HeadErrorResponseSuccess = HeadErrorResponse[200]; |
3819 | 3808 | /** |
3820 | 3809 | * @description |
3821 | - * error | |
3810 | + * errorHtml | |
3822 | 3811 | * @tags basic-error-controller |
3823 | - * @produces * | |
3812 | + * @produces text/html | |
3824 | 3813 | * @consumes application/json |
3825 | 3814 | */ |
3826 | 3815 | export const headError = /* #__PURE__ */ (() => { |
... | ... | @@ -3845,9 +3834,7 @@ export interface PatchErrorResponse { |
3845 | 3834 | * @description |
3846 | 3835 | * OK |
3847 | 3836 | */ |
3848 | - 200: { | |
3849 | - [propertyName: string]: any; | |
3850 | - }; | |
3837 | + 200: ModelAndView; | |
3851 | 3838 | /** |
3852 | 3839 | * @description |
3853 | 3840 | * No Content |
... | ... | @@ -3868,9 +3855,9 @@ export interface PatchErrorResponse { |
3868 | 3855 | export type PatchErrorResponseSuccess = PatchErrorResponse[200]; |
3869 | 3856 | /** |
3870 | 3857 | * @description |
3871 | - * error | |
3858 | + * errorHtml | |
3872 | 3859 | * @tags basic-error-controller |
3873 | - * @produces * | |
3860 | + * @produces text/html | |
3874 | 3861 | * @consumes application/json |
3875 | 3862 | */ |
3876 | 3863 | export const patchError = /* #__PURE__ */ (() => { |
... | ... | @@ -18098,6 +18085,77 @@ export const postServiceInvoiceReissueOld = /* #__PURE__ */ (() => { |
18098 | 18085 | return request; |
18099 | 18086 | })(); |
18100 | 18087 | |
18088 | +/** @description request parameter type for postServiceInvoiceReissueRecordDelete */ | |
18089 | +export interface PostServiceInvoiceReissueRecordDeleteOption { | |
18090 | + /** | |
18091 | + * @description | |
18092 | + * dto | |
18093 | + */ | |
18094 | + body: { | |
18095 | + /** | |
18096 | + @description | |
18097 | + dto */ | |
18098 | + dto: InvoiceReissueRecord; | |
18099 | + }; | |
18100 | +} | |
18101 | + | |
18102 | +/** @description response type for postServiceInvoiceReissueRecordDelete */ | |
18103 | +export interface PostServiceInvoiceReissueRecordDeleteResponse { | |
18104 | + /** | |
18105 | + * @description | |
18106 | + * OK | |
18107 | + */ | |
18108 | + 200: ServerResult; | |
18109 | + /** | |
18110 | + * @description | |
18111 | + * Created | |
18112 | + */ | |
18113 | + 201: any; | |
18114 | + /** | |
18115 | + * @description | |
18116 | + * Unauthorized | |
18117 | + */ | |
18118 | + 401: any; | |
18119 | + /** | |
18120 | + * @description | |
18121 | + * Forbidden | |
18122 | + */ | |
18123 | + 403: any; | |
18124 | + /** | |
18125 | + * @description | |
18126 | + * Not Found | |
18127 | + */ | |
18128 | + 404: any; | |
18129 | +} | |
18130 | + | |
18131 | +export type PostServiceInvoiceReissueRecordDeleteResponseSuccess = | |
18132 | + PostServiceInvoiceReissueRecordDeleteResponse[200]; | |
18133 | +/** | |
18134 | + * @description | |
18135 | + * deleteReissueRecord | |
18136 | + * @tags 发票 | |
18137 | + * @produces * | |
18138 | + * @consumes application/json | |
18139 | + */ | |
18140 | +export const postServiceInvoiceReissueRecordDelete = /* #__PURE__ */ (() => { | |
18141 | + const method = 'post'; | |
18142 | + const url = '/service/invoice/reissueRecord/delete'; | |
18143 | + function request( | |
18144 | + option: PostServiceInvoiceReissueRecordDeleteOption, | |
18145 | + ): Promise<PostServiceInvoiceReissueRecordDeleteResponseSuccess> { | |
18146 | + return requester(request.url, { | |
18147 | + method: request.method, | |
18148 | + ...option, | |
18149 | + }) as unknown as Promise<PostServiceInvoiceReissueRecordDeleteResponseSuccess>; | |
18150 | + } | |
18151 | + | |
18152 | + /** http method */ | |
18153 | + request.method = method; | |
18154 | + /** request url */ | |
18155 | + request.url = url; | |
18156 | + return request; | |
18157 | +})(); | |
18158 | + | |
18101 | 18159 | /** @description request parameter type for postServiceInvoiceReissueRecords */ |
18102 | 18160 | export interface PostServiceInvoiceReissueRecordsOption { |
18103 | 18161 | /** | ... | ... |