Commit 31c83c5a01a40c7d8f7e10bdb7a5528d73ebd01c
1 parent
53ad288e
feat: update 发票核销
Showing
4 changed files
with
75 additions
and
20 deletions
src/pages/Invoice/components/InvoiceVerificationModal.tsx
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | ||
1 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; | 2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
2 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; | 3 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; |
3 | -import { postServiceInvoiceQueryInvoiceDetail } from '@/services'; | 4 | +import { |
5 | + postServiceInvoiceCancelInvoiceAndBankStatement, | ||
6 | + postServiceInvoiceQueryInvoiceDetail, | ||
7 | +} from '@/services'; | ||
4 | import { enumValueToLabel, formatDateTime } from '@/utils'; | 8 | import { enumValueToLabel, formatDateTime } from '@/utils'; |
5 | import { formatDate } from '@/utils/time'; | 9 | import { formatDate } from '@/utils/time'; |
6 | import { PlusOutlined } from '@ant-design/icons'; | 10 | import { PlusOutlined } from '@ant-design/icons'; |
@@ -12,6 +16,7 @@ import { | @@ -12,6 +16,7 @@ import { | ||
12 | Divider, | 16 | Divider, |
13 | Flex, | 17 | Flex, |
14 | Form, | 18 | Form, |
19 | + message, | ||
15 | } from 'antd'; | 20 | } from 'antd'; |
16 | import { useEffect, useState } from 'react'; | 21 | import { useEffect, useState } from 'react'; |
17 | import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant'; | 22 | import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant'; |
@@ -205,25 +210,24 @@ export default ({ invoiceId, setVisible, onClose }) => { | @@ -205,25 +210,24 @@ export default ({ invoiceId, setVisible, onClose }) => { | ||
205 | fixed: 'right', | 210 | fixed: 'right', |
206 | width: 70, | 211 | width: 70, |
207 | render: (text, record) => [ | 212 | render: (text, record) => [ |
208 | - <Button | 213 | + <ButtonConfirm |
214 | + key="delete" | ||
209 | className="p-0" | 215 | className="p-0" |
210 | - key="choose" | ||
211 | - type="link" | ||
212 | - onClick={() => { | ||
213 | - //去掉表格中对应的数据 | ||
214 | - let newBankData = bankData.filter((item) => { | ||
215 | - return item.id !== record.id; | 216 | + title={'确认删除此项吗?'} |
217 | + text="删除" | ||
218 | + onConfirm={async () => { | ||
219 | + let res = await postServiceInvoiceCancelInvoiceAndBankStatement({ | ||
220 | + data: { | ||
221 | + invoiceId: invoiceId, | ||
222 | + cancelId: [record.id], | ||
223 | + }, | ||
216 | }); | 224 | }); |
217 | - setBankData(newBankData); | ||
218 | - | ||
219 | - //添加到已选中区域中 | ||
220 | - let newSelectedStatement = [...selectedStatement]; | ||
221 | - newSelectedStatement.push(record); | ||
222 | - setSelectedStatement(newSelectedStatement); | 225 | + if (res) { |
226 | + message.success(res.message); | ||
227 | + loadInvoiceData(); | ||
228 | + } | ||
223 | }} | 229 | }} |
224 | - > | ||
225 | - 选中 | ||
226 | - </Button>, | 230 | + />, |
227 | ], | 231 | ], |
228 | }); | 232 | }); |
229 | 233 |
src/pages/Order/index.tsx
@@ -25,8 +25,10 @@ import { | @@ -25,8 +25,10 @@ import { | ||
25 | QuestionCircleOutlined, | 25 | QuestionCircleOutlined, |
26 | } from '@ant-design/icons'; | 26 | } from '@ant-design/icons'; |
27 | import { | 27 | import { |
28 | + ActionType, | ||
28 | PageContainer, | 29 | PageContainer, |
29 | ProColumns, | 30 | ProColumns, |
31 | + ProFormInstance, | ||
30 | ProTable, | 32 | ProTable, |
31 | } from '@ant-design/pro-components'; | 33 | } from '@ant-design/pro-components'; |
32 | import { history } from '@umijs/max'; | 34 | import { history } from '@umijs/max'; |
@@ -45,7 +47,7 @@ import { | @@ -45,7 +47,7 @@ import { | ||
45 | message, | 47 | message, |
46 | } from 'antd'; | 48 | } from 'antd'; |
47 | import { cloneDeep } from 'lodash'; | 49 | import { cloneDeep } from 'lodash'; |
48 | -import React, { Key, useRef, useState } from 'react'; | 50 | +import React, { Key, useEffect, useRef, useState } from 'react'; |
49 | import OrderPrintModal from '../OrderPrint/OrderPrintModal'; | 51 | import OrderPrintModal from '../OrderPrint/OrderPrintModal'; |
50 | import AfterSalesDrawer from './components/AfterSalesDrawer'; | 52 | import AfterSalesDrawer from './components/AfterSalesDrawer'; |
51 | import ApplyForInvoicingModal from './components/ApplyForInvoicingModal'; | 53 | import ApplyForInvoicingModal from './components/ApplyForInvoicingModal'; |
@@ -143,7 +145,8 @@ const OrderPage = () => { | @@ -143,7 +145,8 @@ const OrderPage = () => { | ||
143 | const [mainOrderSelectedRows, setMainOrderSelectedRows] = useState([]); //选中的主订单集合 | 145 | const [mainOrderSelectedRows, setMainOrderSelectedRows] = useState([]); //选中的主订单集合 |
144 | const [onlyShowFinancialToBeProcessed, setOnlyShowFinancialToBeProcessed] = | 146 | const [onlyShowFinancialToBeProcessed, setOnlyShowFinancialToBeProcessed] = |
145 | useState(false); | 147 | useState(false); |
146 | - const mainTableRef = useRef(); | 148 | + const mainTableRef = useRef<ActionType>(); |
149 | + const mainTableFormRef = useRef<ProFormInstance>(); | ||
147 | let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 | 150 | let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 |
148 | const [messageApi, contextHolder] = message.useMessage(); | 151 | const [messageApi, contextHolder] = message.useMessage(); |
149 | 152 | ||
@@ -2322,6 +2325,15 @@ const OrderPage = () => { | @@ -2322,6 +2325,15 @@ const OrderPage = () => { | ||
2322 | return toolBtns; | 2325 | return toolBtns; |
2323 | } | 2326 | } |
2324 | 2327 | ||
2328 | + useEffect(() => { | ||
2329 | + // 使用URLSearchParams来解析查询参数 | ||
2330 | + const params = new URLSearchParams(location.search); | ||
2331 | + const id = params.get('id'); | ||
2332 | + if (id) { | ||
2333 | + mainTableFormRef.current?.setFieldValue('id', id); | ||
2334 | + } | ||
2335 | + }, []); | ||
2336 | + | ||
2325 | return ( | 2337 | return ( |
2326 | <PageContainer | 2338 | <PageContainer |
2327 | className="order-page-container" | 2339 | className="order-page-container" |
@@ -2365,6 +2377,7 @@ const OrderPage = () => { | @@ -2365,6 +2377,7 @@ const OrderPage = () => { | ||
2365 | // tableStyle={{backgroundColor:'red'}} | 2377 | // tableStyle={{backgroundColor:'red'}} |
2366 | 2378 | ||
2367 | actionRef={mainTableRef} | 2379 | actionRef={mainTableRef} |
2380 | + formRef={mainTableFormRef} | ||
2368 | expandIconColumnIndex={-1} | 2381 | expandIconColumnIndex={-1} |
2369 | columns={mainOrdersColumns} | 2382 | columns={mainOrdersColumns} |
2370 | rowKey="id" | 2383 | rowKey="id" |
@@ -2396,6 +2409,12 @@ const OrderPage = () => { | @@ -2396,6 +2409,12 @@ const OrderPage = () => { | ||
2396 | filter, | 2409 | filter, |
2397 | ) => { | 2410 | ) => { |
2398 | //订单id处理 | 2411 | //订单id处理 |
2412 | + /** | ||
2413 | + * 以params中的id为主,如果params没id,则取url中的id | ||
2414 | + * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来 | ||
2415 | + */ | ||
2416 | + let orderIds = mainTableFormRef.current?.getFieldValue('id'); | ||
2417 | + params.id = params.id || orderIds; | ||
2399 | if (params.id !== '') { | 2418 | if (params.id !== '') { |
2400 | if (params.id?.indexOf(',')) { | 2419 | if (params.id?.indexOf(',')) { |
2401 | params.id = params.id.split(','); | 2420 | params.id = params.id.split(','); |
src/services/definition.ts
@@ -324,6 +324,20 @@ export interface AuditVO { | @@ -324,6 +324,20 @@ export interface AuditVO { | ||
324 | total?: number; | 324 | total?: number; |
325 | } | 325 | } |
326 | 326 | ||
327 | +export interface CancelInvoiceAndBankStatementDto { | ||
328 | + /** | ||
329 | + * @description | ||
330 | + * 取消关联的银行流水id集合 | ||
331 | + */ | ||
332 | + cancelId?: Array<number>; | ||
333 | + /** | ||
334 | + * @description | ||
335 | + * 发票id | ||
336 | + * @format int64 | ||
337 | + */ | ||
338 | + invoiceId?: number; | ||
339 | +} | ||
340 | + | ||
327 | export interface CaptchaMessageVO { | 341 | export interface CaptchaMessageVO { |
328 | /** @format int32 */ | 342 | /** @format int32 */ |
329 | current?: number; | 343 | current?: number; |
src/services/request.ts
@@ -22,6 +22,7 @@ import type { | @@ -22,6 +22,7 @@ import type { | ||
22 | AdminUserRegisterVO, | 22 | AdminUserRegisterVO, |
23 | AdminUserVO, | 23 | AdminUserVO, |
24 | AuditVO, | 24 | AuditVO, |
25 | + CancelInvoiceAndBankStatementDto, | ||
25 | CaptchaMessageVO, | 26 | CaptchaMessageVO, |
26 | DictionaryQueryVO, | 27 | DictionaryQueryVO, |
27 | DictionaryVO, | 28 | DictionaryVO, |
@@ -5119,6 +5120,20 @@ export const postServiceBankStatementQueryBankStatement = | @@ -5119,6 +5120,20 @@ export const postServiceBankStatementQueryBankStatement = | ||
5119 | return request; | 5120 | return request; |
5120 | })(); | 5121 | })(); |
5121 | 5122 | ||
5123 | +/** @description request parameter type for postServiceInvoiceCancelInvoiceAndBankStatement */ | ||
5124 | +export interface PostServiceInvoiceCancelInvoiceAndBankStatementOption { | ||
5125 | + /** | ||
5126 | + * @description | ||
5127 | + * dto | ||
5128 | + */ | ||
5129 | + body: { | ||
5130 | + /** | ||
5131 | + @description | ||
5132 | + dto */ | ||
5133 | + dto: CancelInvoiceAndBankStatementDto; | ||
5134 | + }; | ||
5135 | +} | ||
5136 | + | ||
5122 | /** @description response type for postServiceInvoiceCancelInvoiceAndBankStatement */ | 5137 | /** @description response type for postServiceInvoiceCancelInvoiceAndBankStatement */ |
5123 | export interface PostServiceInvoiceCancelInvoiceAndBankStatementResponse { | 5138 | export interface PostServiceInvoiceCancelInvoiceAndBankStatementResponse { |
5124 | /** | 5139 | /** |
@@ -5161,9 +5176,12 @@ export const postServiceInvoiceCancelInvoiceAndBankStatement = | @@ -5161,9 +5176,12 @@ export const postServiceInvoiceCancelInvoiceAndBankStatement = | ||
5161 | /* #__PURE__ */ (() => { | 5176 | /* #__PURE__ */ (() => { |
5162 | const method = 'post'; | 5177 | const method = 'post'; |
5163 | const url = '/service/invoice/cancelInvoiceAndBankStatement'; | 5178 | const url = '/service/invoice/cancelInvoiceAndBankStatement'; |
5164 | - function request(): Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess> { | 5179 | + function request( |
5180 | + option: PostServiceInvoiceCancelInvoiceAndBankStatementOption, | ||
5181 | + ): Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess> { | ||
5165 | return requester(request.url, { | 5182 | return requester(request.url, { |
5166 | method: request.method, | 5183 | method: request.method, |
5184 | + ...option, | ||
5167 | }) as unknown as Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess>; | 5185 | }) as unknown as Promise<PostServiceInvoiceCancelInvoiceAndBankStatementResponseSuccess>; |
5168 | } | 5186 | } |
5169 | 5187 |