Commit 7d171173862f64eebefeca0184eb1ad7817def64
1 parent
98ce63ab
feat(Order): 修复一些bug
Showing
11 changed files
with
485 additions
and
12 deletions
.umirc.ts
@@ -102,7 +102,7 @@ export default defineConfig({ | @@ -102,7 +102,7 @@ export default defineConfig({ | ||
102 | }, | 102 | }, |
103 | { | 103 | { |
104 | name: '待红冲发票', | 104 | name: '待红冲发票', |
105 | - path: 'waitFlushInvoice', | 105 | + path: 'wnpmaitFlushInvoice', |
106 | icon: 'BookOutlined', | 106 | icon: 'BookOutlined', |
107 | access: 'canReadAdminAndFinanceAndSales', | 107 | access: 'canReadAdminAndFinanceAndSales', |
108 | component: './Invoice/waitFlushInvoice', | 108 | component: './Invoice/waitFlushInvoice', |
src/pages/Invoice/Invoice/index.tsx
@@ -184,7 +184,7 @@ const InvoiceRecord = () => { | @@ -184,7 +184,7 @@ const InvoiceRecord = () => { | ||
184 | text="删除" | 184 | text="删除" |
185 | onConfirm={async () => { | 185 | onConfirm={async () => { |
186 | let res = await postServiceInvoiceDeleteInvoice({ | 186 | let res = await postServiceInvoiceDeleteInvoice({ |
187 | - data: { invoiceId: record.id }, | 187 | + data: { invoiceIds: [record.id] }, |
188 | }); | 188 | }); |
189 | if (res) { | 189 | if (res) { |
190 | message.success(res.message); | 190 | message.success(res.message); |
src/pages/Invoice/InvoiceRecord/index.tsx
src/pages/Invoice/waitFlushInvoice/index.tsx
@@ -19,7 +19,6 @@ const InvoiceRecord = () => { | @@ -19,7 +19,6 @@ const InvoiceRecord = () => { | ||
19 | const [invoiceVerificationVisible, setInvoiceVerificationVisible] = | 19 | const [invoiceVerificationVisible, setInvoiceVerificationVisible] = |
20 | useState(false); | 20 | useState(false); |
21 | const [invoiceId, setInvoiceId] = useState(undefined); | 21 | const [invoiceId, setInvoiceId] = useState(undefined); |
22 | - const [setPerms] = useState([]); | ||
23 | const [messageApi, contextHolder] = message.useMessage(); | 22 | const [messageApi, contextHolder] = message.useMessage(); |
24 | const reloadInvoiceTable = () => { | 23 | const reloadInvoiceTable = () => { |
25 | invoiceActionRef.current?.reload(); | 24 | invoiceActionRef.current?.reload(); |
@@ -101,7 +100,7 @@ const InvoiceRecord = () => { | @@ -101,7 +100,7 @@ const InvoiceRecord = () => { | ||
101 | title: '收款单位', | 100 | title: '收款单位', |
102 | dataIndex: 'payee', | 101 | dataIndex: 'payee', |
103 | valueType: 'text', | 102 | valueType: 'text', |
104 | - width: 200, | 103 | + width: 250, |
105 | valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS), | 104 | valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS), |
106 | }, | 105 | }, |
107 | { | 106 | { |
@@ -123,7 +122,7 @@ const InvoiceRecord = () => { | @@ -123,7 +122,7 @@ const InvoiceRecord = () => { | ||
123 | key: 'option', | 122 | key: 'option', |
124 | fixed: 'right', | 123 | fixed: 'right', |
125 | width: 160, | 124 | width: 160, |
126 | - render: ({ record }) => { | 125 | + render: (record) => { |
127 | let btns = []; | 126 | let btns = []; |
128 | if (record.paths?.includes('queryInvoiceDetails')) { | 127 | if (record.paths?.includes('queryInvoiceDetails')) { |
129 | btns.push( | 128 | btns.push( |
@@ -234,7 +233,6 @@ const InvoiceRecord = () => { | @@ -234,7 +233,6 @@ const InvoiceRecord = () => { | ||
234 | }, | 233 | }, |
235 | }); | 234 | }); |
236 | if (res) { | 235 | if (res) { |
237 | - setPerms(res?.data?.specialPath); | ||
238 | return { | 236 | return { |
239 | data: res?.data?.data || [], | 237 | data: res?.data?.data || [], |
240 | total: res?.data?.total || 0, | 238 | total: res?.data?.total || 0, |
src/pages/Order/Order/index.tsx
@@ -5,11 +5,12 @@ import { | @@ -5,11 +5,12 @@ import { | ||
5 | } from '@/services'; | 5 | } from '@/services'; |
6 | import { getUserInfo } from '@/utils/user'; | 6 | import { getUserInfo } from '@/utils/user'; |
7 | import { useModel } from '@umijs/max'; | 7 | import { useModel } from '@umijs/max'; |
8 | -import { Button, Card, Col, Modal, Row } from 'antd'; | 8 | +import { Button, Card, Col, Modal, Row, message } from 'antd'; |
9 | import { useEffect, useState } from 'react'; | 9 | import { useEffect, useState } from 'react'; |
10 | import OrderList from '../OrderList/OrderList'; | 10 | import OrderList from '../OrderList/OrderList'; |
11 | import './index.less'; | 11 | import './index.less'; |
12 | // import { useNavigate } from 'react-router-dom'; | 12 | // import { useNavigate } from 'react-router-dom'; |
13 | +import { excelExport } from '@/services/exportRequest'; | ||
13 | import { ProCard, ProTable } from '@ant-design/pro-components'; | 14 | import { ProCard, ProTable } from '@ant-design/pro-components'; |
14 | import { history } from '@umijs/max'; | 15 | import { history } from '@umijs/max'; |
15 | // import { format } from 'fecha'; | 16 | // import { format } from 'fecha'; |
@@ -46,6 +47,7 @@ const OrderPage = () => { | @@ -46,6 +47,7 @@ const OrderPage = () => { | ||
46 | const [pendingDelivery, setPendingDelivery] = useState(0); | 47 | const [pendingDelivery, setPendingDelivery] = useState(0); |
47 | const [pendingCompletion, setPendingCompletion] = useState(0); | 48 | const [pendingCompletion, setPendingCompletion] = useState(0); |
48 | const [deliveryOpen, setDeliveryOpen] = useState(false); | 49 | const [deliveryOpen, setDeliveryOpen] = useState(false); |
50 | + const [messageApi, contextHolder] = message.useMessage(); | ||
49 | async function getInvoiceWarningNum() { | 51 | async function getInvoiceWarningNum() { |
50 | const res = await postServiceOrderWarningOrderStatistics({ | 52 | const res = await postServiceOrderWarningOrderStatistics({ |
51 | data: { | 53 | data: { |
@@ -118,7 +120,7 @@ const OrderPage = () => { | @@ -118,7 +120,7 @@ const OrderPage = () => { | ||
118 | <div className="order-page-container"> | 120 | <div className="order-page-container"> |
119 | <div id="resizeDiv"></div> | 121 | <div id="resizeDiv"></div> |
120 | <div id="resizeDiv"></div> | 122 | <div id="resizeDiv"></div> |
121 | - {roleCode === 'SALES_REPRESENTATIVE' && ( | 123 | + {roleCode !== 'SALES_MANAGER' && ( |
122 | <Modal | 124 | <Modal |
123 | title="订单预警提醒" | 125 | title="订单预警提醒" |
124 | open={open} | 126 | open={open} |
@@ -535,6 +537,45 @@ const OrderPage = () => { | @@ -535,6 +537,45 @@ const OrderPage = () => { | ||
535 | return res.data; | 537 | return res.data; |
536 | }} | 538 | }} |
537 | rowKey="index" | 539 | rowKey="index" |
540 | + search={{ | ||
541 | + labelWidth: 'auto', | ||
542 | + defaultCollapsed: false, | ||
543 | + optionRender: (searchConfig, formProps, dom) => [ | ||
544 | + ...dom, | ||
545 | + <Button | ||
546 | + key="out" | ||
547 | + onClick={() => { | ||
548 | + const searchParams = | ||
549 | + searchConfig?.form?.getFieldsValue(); | ||
550 | + const values = { | ||
551 | + ...searchConfig?.form?.getFieldsValue(), | ||
552 | + limitOrderDatetimeGe: searchParams?.limitDatetime | ||
553 | + ? searchParams.limitDatetime[0] | ||
554 | + : null, | ||
555 | + limitOrderDatetimeLe: searchParams?.limitDatetime | ||
556 | + ? searchParams.limitDatetime[1] | ||
557 | + : null, | ||
558 | + }; | ||
559 | + messageApi.open({ | ||
560 | + type: 'loading', | ||
561 | + content: '正在导出文件...', | ||
562 | + }); | ||
563 | + excelExport( | ||
564 | + '/api/service/order/exportLockOrders', | ||
565 | + { | ||
566 | + ...values, | ||
567 | + }, | ||
568 | + () => { | ||
569 | + messageApi.destroy(); | ||
570 | + }, | ||
571 | + '锁单', | ||
572 | + ); | ||
573 | + }} | ||
574 | + > | ||
575 | + 导出 | ||
576 | + </Button>, | ||
577 | + ], | ||
578 | + }} | ||
538 | pagination={{ pageSize: 10 }} | 579 | pagination={{ pageSize: 10 }} |
539 | /> | 580 | /> |
540 | </ProCard.TabPane> | 581 | </ProCard.TabPane> |
@@ -661,7 +702,7 @@ const OrderPage = () => { | @@ -661,7 +702,7 @@ const OrderPage = () => { | ||
661 | </Row> | 702 | </Row> |
662 | </Modal> | 703 | </Modal> |
663 | )} | 704 | )} |
664 | - | 705 | + {contextHolder} |
665 | <OrderList paramsNew={{}} searchShow={true} toolbarShow={true} /> | 706 | <OrderList paramsNew={{}} searchShow={true} toolbarShow={true} /> |
666 | </div> | 707 | </div> |
667 | ); | 708 | ); |
src/pages/Order/OrderList/OrderList.tsx
@@ -18,6 +18,7 @@ import { | @@ -18,6 +18,7 @@ import { | ||
18 | postServiceOrderProcureOrder, | 18 | postServiceOrderProcureOrder, |
19 | postServiceOrderProcurePrint, | 19 | postServiceOrderProcurePrint, |
20 | postServiceOrderProvideProcurementRoles, | 20 | postServiceOrderProvideProcurementRoles, |
21 | + postServiceOrderPurchaseRejectionToSale, | ||
21 | postServiceOrderQueryServiceOrder, | 22 | postServiceOrderQueryServiceOrder, |
22 | postServiceOrderSaleCancelInvoicing, | 23 | postServiceOrderSaleCancelInvoicing, |
23 | postServiceOrderSalesConfirm, | 24 | postServiceOrderSalesConfirm, |
@@ -67,6 +68,7 @@ import { | @@ -67,6 +68,7 @@ import { | ||
67 | Flex, | 68 | Flex, |
68 | FloatButton, | 69 | FloatButton, |
69 | Image, | 70 | Image, |
71 | + Input, | ||
70 | MenuProps, | 72 | MenuProps, |
71 | Modal, | 73 | Modal, |
72 | Popconfirm, | 74 | Popconfirm, |
@@ -232,7 +234,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | @@ -232,7 +234,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | ||
232 | .flat() | 234 | .flat() |
233 | .every((subItem) => subItem.paths?.includes('applyInvoicing_old')); | 235 | .every((subItem) => subItem.paths?.includes('applyInvoicing_old')); |
234 | }, [selectedSubOrderKeys]); | 236 | }, [selectedSubOrderKeys]); |
235 | - | 237 | + const [procureNotes, setProcureNotes] = useState<string>(''); |
236 | console.log(JSON.stringify(userInfo)); | 238 | console.log(JSON.stringify(userInfo)); |
237 | const triggerRecordOptNode = async (id) => { | 239 | const triggerRecordOptNode = async (id) => { |
238 | const res = await postServiceOrderGetCurrentOptNode({ | 240 | const res = await postServiceOrderGetCurrentOptNode({ |
@@ -1972,6 +1974,42 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | @@ -1972,6 +1974,42 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | ||
1972 | '' | 1974 | '' |
1973 | )} | 1975 | )} |
1974 | 1976 | ||
1977 | + {optRecord.paths?.includes('procureReject') && ( | ||
1978 | + <Popconfirm | ||
1979 | + title="是否驳回至销售" | ||
1980 | + description={ | ||
1981 | + <div> | ||
1982 | + <Input.TextArea | ||
1983 | + placeholder="请填写备注" | ||
1984 | + onChange={(e: any) => { | ||
1985 | + setProcureNotes(e.target.value); | ||
1986 | + }} | ||
1987 | + rows={4} | ||
1988 | + ></Input.TextArea> | ||
1989 | + </div> | ||
1990 | + } | ||
1991 | + onConfirm={async () => { | ||
1992 | + let res = await postServiceOrderPurchaseRejectionToSale({ | ||
1993 | + data: { | ||
1994 | + subIds: [optRecord.id], | ||
1995 | + procureNotes: procureNotes, | ||
1996 | + }, | ||
1997 | + }); | ||
1998 | + | ||
1999 | + if (res?.result === RESPONSE_CODE.SUCCESS) { | ||
2000 | + message.success(res.message); | ||
2001 | + clearOptObject(); | ||
2002 | + setIsMainOrder(false); | ||
2003 | + refreshTable(); | ||
2004 | + return true; | ||
2005 | + } | ||
2006 | + }} | ||
2007 | + okText="确定" | ||
2008 | + cancelText="取消" | ||
2009 | + > | ||
2010 | + <Button type="link">驳回至销售</Button> | ||
2011 | + </Popconfirm> | ||
2012 | + )} | ||
1975 | {optRecord.paths?.includes('procureConvertProcure') ? ( | 2013 | {optRecord.paths?.includes('procureConvertProcure') ? ( |
1976 | <Button | 2014 | <Button |
1977 | className="p-0" | 2015 | className="p-0" |
@@ -4646,6 +4684,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | @@ -4646,6 +4684,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | ||
4646 | columns={mainOrdersColumns} | 4684 | columns={mainOrdersColumns} |
4647 | rowKey="id" | 4685 | rowKey="id" |
4648 | pagination={{ | 4686 | pagination={{ |
4687 | + pageSizeOptions: [10, 20, 50, 100, 200], | ||
4649 | showQuickJumper: true, | 4688 | showQuickJumper: true, |
4650 | pageSize: pageSize, | 4689 | pageSize: pageSize, |
4651 | current: currentPage, | 4690 | current: currentPage, |
src/pages/Order/WarningWhitelist/index.tsx
@@ -208,7 +208,7 @@ const WarningWhitelist = () => { | @@ -208,7 +208,7 @@ const WarningWhitelist = () => { | ||
208 | onConfirm={async () => { | 208 | onConfirm={async () => { |
209 | await postServiceOrderDeleteWarningOrderWhiteList({ | 209 | await postServiceOrderDeleteWarningOrderWhiteList({ |
210 | query: { | 210 | query: { |
211 | - id: record.id, | 211 | + orderId: record.orderId, |
212 | }, | 212 | }, |
213 | }); | 213 | }); |
214 | action?.reload(); | 214 | action?.reload(); |
src/pages/Order/constant.ts
@@ -264,6 +264,8 @@ export const AFTER_INVOICING_STATUS = { | @@ -264,6 +264,8 @@ export const AFTER_INVOICING_STATUS = { | ||
264 | COMPLETE_INVOICING: '完全开票', | 264 | COMPLETE_INVOICING: '完全开票', |
265 | INVOICING: '开票中', | 265 | INVOICING: '开票中', |
266 | REISSUE: '重新开票', | 266 | REISSUE: '重新开票', |
267 | + WAIT_FLUSH: '待冲红', | ||
268 | + FLUSHED: '已冲红', | ||
267 | }; | 269 | }; |
268 | 270 | ||
269 | export const TAGS_COLOR = new Map<string, string>([ | 271 | export const TAGS_COLOR = new Map<string, string>([ |
src/pages/Prepaid/constant.tsx
@@ -247,6 +247,13 @@ export const BALANCE_CHANGE_COLUMNS = [ | @@ -247,6 +247,13 @@ export const BALANCE_CHANGE_COLUMNS = [ | ||
247 | width: 200, | 247 | width: 200, |
248 | }, | 248 | }, |
249 | { | 249 | { |
250 | + title: '关联订单id', | ||
251 | + dataIndex: 'linkId', | ||
252 | + key: 'linkId', | ||
253 | + dataType: 'text', | ||
254 | + width: 200, | ||
255 | + }, | ||
256 | + { | ||
250 | title: '类型', | 257 | title: '类型', |
251 | dataIndex: 'title', | 258 | dataIndex: 'title', |
252 | key: 'title', | 259 | key: 'title', |
src/pages/integral/index.tsx
0 → 100644
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | ||
2 | +import EllipsisDiv from '@/components/Div/EllipsisDiv'; | ||
3 | +import { RESPONSE_CODE } from '@/constants/enum'; | ||
4 | +import {} from '@/pages/Invoice/constant'; | ||
5 | +import { | ||
6 | + postCanrdApiUserList, | ||
7 | + postPrepaidDelete, | ||
8 | + postPrepaidList, | ||
9 | +} from '@/services'; | ||
10 | +import { enumValueToLabel, formatDateTime } from '@/utils'; | ||
11 | +import { PlusOutlined } from '@ant-design/icons'; | ||
12 | +import { ActionType, ProTable } from '@ant-design/pro-components'; | ||
13 | +import { Button, Divider, Image, Tabs, message } from 'antd'; | ||
14 | +import { cloneDeep } from 'lodash'; | ||
15 | +import React, { useRef, useState } from 'react'; | ||
16 | +import CheckModal from '../Order/Order/components/CheckModal'; | ||
17 | +import { CHECK_TYPE } from '../Order/constant'; | ||
18 | +import BalanceChangeRecordsModal from './components/BalanceChangeRecordsModal'; | ||
19 | +import RechargePrepaymentModal from './components/RechargePrepaymentModal'; | ||
20 | +import { | ||
21 | + ACCOUNT_COLUMNS, | ||
22 | + PREPAID_STATUS_OPTIONS, | ||
23 | + SALES_RECHARGE_PREPAYMENT_COLUMNS, | ||
24 | +} from './constant'; | ||
25 | +import './index.less'; | ||
26 | +const PrepaidPage = () => { | ||
27 | + const prepaidActionRef = useRef<ActionType>(); | ||
28 | + const accountActionRef = useRef<ActionType>(); | ||
29 | + const [rechargePrepaymentModalVisible, setRechargePrepaymentModalVisible] = | ||
30 | + useState(false); | ||
31 | + const [currentOptPrepaymentObj, setCurrentOptPrepaymentObj] = useState(null); | ||
32 | + const [currentOptUserObj, setCurrentOptUserObj] = useState(null); | ||
33 | + const [checkVisible, setCheckVisible] = useState(false); | ||
34 | + const [ | ||
35 | + balanceChangeRecordsModalVisible, | ||
36 | + setBalanceChangeRecordsModalVisible, | ||
37 | + ] = useState(false); | ||
38 | + | ||
39 | + const reloadPrepaidTable = () => { | ||
40 | + prepaidActionRef.current?.reload(); | ||
41 | + }; | ||
42 | + | ||
43 | + const reloadAccountTable = () => { | ||
44 | + accountActionRef.current?.reload(); | ||
45 | + }; | ||
46 | + | ||
47 | + const getTableCellText = (target: any) => { | ||
48 | + if (!target) { | ||
49 | + return ''; | ||
50 | + } | ||
51 | + | ||
52 | + if (target.props) { | ||
53 | + return target.props.text; | ||
54 | + } | ||
55 | + | ||
56 | + return target; | ||
57 | + }; | ||
58 | + | ||
59 | + /** | ||
60 | + * 加载发票列表表格的各个列格式 | ||
61 | + */ | ||
62 | + const prepaidColumnsInit = () => { | ||
63 | + let columns = SALES_RECHARGE_PREPAYMENT_COLUMNS.map((item) => { | ||
64 | + let newItem = { ...item }; | ||
65 | + let dataIndex = item.dataIndex; | ||
66 | + | ||
67 | + newItem.render = (text, record) => { | ||
68 | + let textValue = record[dataIndex]; | ||
69 | + | ||
70 | + if (dataIndex === 'status') { | ||
71 | + textValue = enumValueToLabel(textValue, PREPAID_STATUS_OPTIONS); | ||
72 | + } | ||
73 | + | ||
74 | + if (dataIndex.endsWith('Time')) { | ||
75 | + textValue = formatDateTime(textValue); | ||
76 | + } | ||
77 | + | ||
78 | + if ( | ||
79 | + dataIndex === 'proofImages' && | ||
80 | + textValue !== null && | ||
81 | + textValue !== undefined | ||
82 | + ) { | ||
83 | + console.log(textValue); | ||
84 | + return ( | ||
85 | + <Image.PreviewGroup | ||
86 | + className="mr-10" | ||
87 | + preview={{ | ||
88 | + onChange: (current, prev) => | ||
89 | + console.log(`current index: ${current}, prev index: ${prev}`), | ||
90 | + }} | ||
91 | + > | ||
92 | + {textValue.map((item, index) => ( | ||
93 | + <React.Fragment key={index}> | ||
94 | + {index > 0 ? <Divider type="vertical" /> : ''} | ||
95 | + <Image | ||
96 | + className="max-h-[35px] max-w-[45px]" | ||
97 | + src={item} | ||
98 | + title={item} | ||
99 | + />{' '} | ||
100 | + </React.Fragment> | ||
101 | + ))} | ||
102 | + </Image.PreviewGroup> | ||
103 | + ); | ||
104 | + } | ||
105 | + | ||
106 | + return <EllipsisDiv text={textValue} />; | ||
107 | + }; | ||
108 | + | ||
109 | + return newItem; | ||
110 | + }); | ||
111 | + | ||
112 | + columns.push({ | ||
113 | + title: '操作', | ||
114 | + valueType: 'option', | ||
115 | + key: 'option', | ||
116 | + fixed: 'right', | ||
117 | + width: 120, | ||
118 | + render: (text, record) => { | ||
119 | + let btns = []; | ||
120 | + let opts = record.operations; | ||
121 | + if (opts?.includes('modify')) { | ||
122 | + btns.push( | ||
123 | + <Button | ||
124 | + className="p-0" | ||
125 | + key="modify" | ||
126 | + type="link" | ||
127 | + onClick={() => { | ||
128 | + setRechargePrepaymentModalVisible(true); | ||
129 | + setCurrentOptPrepaymentObj(cloneDeep(record)); | ||
130 | + }} | ||
131 | + > | ||
132 | + 编辑 | ||
133 | + </Button>, | ||
134 | + ); | ||
135 | + } | ||
136 | + | ||
137 | + if (opts?.includes('audit')) { | ||
138 | + btns.push( | ||
139 | + <Button | ||
140 | + className="p-0" | ||
141 | + key="view" | ||
142 | + type="link" | ||
143 | + onClick={() => { | ||
144 | + setCurrentOptPrepaymentObj(record); | ||
145 | + setCheckVisible(true); | ||
146 | + }} | ||
147 | + > | ||
148 | + 审核 | ||
149 | + </Button>, | ||
150 | + ); | ||
151 | + } | ||
152 | + | ||
153 | + if (opts?.includes('delete')) { | ||
154 | + btns.push( | ||
155 | + <ButtonConfirm | ||
156 | + key="delete" | ||
157 | + className="p-0" | ||
158 | + title={'确认删除这条预存记录吗?'} | ||
159 | + text="删除" | ||
160 | + onConfirm={async () => { | ||
161 | + let res = await postPrepaidDelete({ | ||
162 | + data: { ids: [record.id] }, | ||
163 | + }); | ||
164 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
165 | + message.success(res.message); | ||
166 | + reloadPrepaidTable(); | ||
167 | + } | ||
168 | + }} | ||
169 | + />, | ||
170 | + ); | ||
171 | + } | ||
172 | + return btns; | ||
173 | + }, | ||
174 | + }); | ||
175 | + | ||
176 | + return columns; | ||
177 | + }; | ||
178 | + | ||
179 | + const accountColumnsInit = () => { | ||
180 | + let columns = ACCOUNT_COLUMNS.map((item) => { | ||
181 | + let newItem = { ...item }; | ||
182 | + let dataIndex = item.dataIndex; | ||
183 | + | ||
184 | + newItem.render = (text, record) => { | ||
185 | + let textValue = record[dataIndex]; | ||
186 | + return <EllipsisDiv text={getTableCellText(textValue)} />; | ||
187 | + }; | ||
188 | + | ||
189 | + return newItem; | ||
190 | + }); | ||
191 | + | ||
192 | + columns.push({ | ||
193 | + title: '操作', | ||
194 | + valueType: 'option', | ||
195 | + key: 'option', | ||
196 | + fixed: 'right', | ||
197 | + width: 120, | ||
198 | + render: (text, record) => { | ||
199 | + let btns = []; | ||
200 | + btns.push( | ||
201 | + <Button | ||
202 | + className="p-0" | ||
203 | + key="view" | ||
204 | + type="link" | ||
205 | + onClick={() => { | ||
206 | + setCurrentOptUserObj(record); | ||
207 | + setBalanceChangeRecordsModalVisible(true); | ||
208 | + }} | ||
209 | + > | ||
210 | + 消费记录 | ||
211 | + </Button>, | ||
212 | + ); | ||
213 | + return btns; | ||
214 | + }, | ||
215 | + }); | ||
216 | + | ||
217 | + return columns; | ||
218 | + }; | ||
219 | + | ||
220 | + const tabsItems = [ | ||
221 | + { | ||
222 | + key: 1, | ||
223 | + label: '预存充值', | ||
224 | + children: ( | ||
225 | + <ProTable | ||
226 | + columns={prepaidColumnsInit()} | ||
227 | + actionRef={prepaidActionRef} | ||
228 | + cardBordered | ||
229 | + pagination={{ | ||
230 | + pageSize: 10, | ||
231 | + }} | ||
232 | + request={async (params) => { | ||
233 | + const res = await postPrepaidList({ | ||
234 | + data: { ...params }, | ||
235 | + }); | ||
236 | + return { | ||
237 | + data: res?.data?.data || [], | ||
238 | + total: res?.data?.total || 0, | ||
239 | + }; | ||
240 | + }} | ||
241 | + columnsState={{ | ||
242 | + persistenceKey: 'pro-table-singe-prepaid', | ||
243 | + persistenceType: 'localStorage', | ||
244 | + defaultValue: { | ||
245 | + option: { fixed: 'right', disable: true }, | ||
246 | + }, | ||
247 | + onChange(value) { | ||
248 | + console.log('value: ', value); | ||
249 | + }, | ||
250 | + }} | ||
251 | + rowKey="id" | ||
252 | + search={{ | ||
253 | + labelWidth: 'auto', | ||
254 | + }} | ||
255 | + options={{ | ||
256 | + setting: { | ||
257 | + listsHeight: 400, | ||
258 | + }, | ||
259 | + }} | ||
260 | + form={{}} | ||
261 | + dateFormatter="string" | ||
262 | + headerTitle="预存充值" | ||
263 | + scroll={{ x: 1400 }} | ||
264 | + toolBarRender={() => [ | ||
265 | + <Button | ||
266 | + key="button" | ||
267 | + icon={<PlusOutlined />} | ||
268 | + onClick={() => { | ||
269 | + setCurrentOptPrepaymentObj(null); | ||
270 | + setRechargePrepaymentModalVisible(true); | ||
271 | + }} | ||
272 | + type="primary" | ||
273 | + > | ||
274 | + 新增充值 | ||
275 | + </Button>, | ||
276 | + ]} | ||
277 | + /> | ||
278 | + ), | ||
279 | + }, | ||
280 | + { | ||
281 | + key: 2, | ||
282 | + label: '账号列表', | ||
283 | + children: ( | ||
284 | + <ProTable | ||
285 | + columns={accountColumnsInit()} | ||
286 | + actionRef={accountActionRef} | ||
287 | + cardBordered | ||
288 | + pagination={{ | ||
289 | + pageSize: 10, | ||
290 | + }} | ||
291 | + request={async (params) => { | ||
292 | + const res = await postCanrdApiUserList({ | ||
293 | + data: { ...params }, | ||
294 | + }); | ||
295 | + return { | ||
296 | + data: res?.data?.data || [], | ||
297 | + total: res?.data?.total || 0, | ||
298 | + }; | ||
299 | + }} | ||
300 | + columnsState={{ | ||
301 | + persistenceKey: 'pro-table-singe-account', | ||
302 | + persistenceType: 'localStorage', | ||
303 | + defaultValue: { | ||
304 | + option: { fixed: 'right', disable: true }, | ||
305 | + }, | ||
306 | + onChange(value) { | ||
307 | + console.log('value: ', value); | ||
308 | + }, | ||
309 | + }} | ||
310 | + rowKey="id" | ||
311 | + search={{ | ||
312 | + labelWidth: 'auto', | ||
313 | + }} | ||
314 | + options={{ | ||
315 | + setting: { | ||
316 | + listsHeight: 400, | ||
317 | + }, | ||
318 | + }} | ||
319 | + form={{}} | ||
320 | + dateFormatter="string" | ||
321 | + headerTitle="账号列表" | ||
322 | + scroll={{ x: 1400 }} | ||
323 | + toolBarRender={() => []} | ||
324 | + /> | ||
325 | + ), | ||
326 | + }, | ||
327 | + ]; | ||
328 | + return ( | ||
329 | + <div className="prepaid-index"> | ||
330 | + <Tabs | ||
331 | + defaultActiveKey="1" | ||
332 | + items={tabsItems} | ||
333 | + onChange={(value) => { | ||
334 | + if (value === '1') { | ||
335 | + reloadPrepaidTable(); | ||
336 | + } else { | ||
337 | + reloadAccountTable(); | ||
338 | + } | ||
339 | + }} | ||
340 | + /> | ||
341 | + | ||
342 | + {rechargePrepaymentModalVisible && ( | ||
343 | + <RechargePrepaymentModal | ||
344 | + setVisible={setRechargePrepaymentModalVisible} | ||
345 | + onClose={() => { | ||
346 | + setRechargePrepaymentModalVisible(false); | ||
347 | + reloadPrepaidTable(); | ||
348 | + }} | ||
349 | + prepaymentObject={currentOptPrepaymentObj} | ||
350 | + /> | ||
351 | + )} | ||
352 | + | ||
353 | + {checkVisible && ( | ||
354 | + <CheckModal | ||
355 | + setCheckVisible={(val: boolean) => { | ||
356 | + setCheckVisible(val); | ||
357 | + }} | ||
358 | + data={[currentOptPrepaymentObj]} | ||
359 | + subOrders={[currentOptPrepaymentObj]} | ||
360 | + orderCheckType={CHECK_TYPE.PREPAID_AUDIT} | ||
361 | + openOrderDrawer={false} | ||
362 | + onClose={() => { | ||
363 | + setCheckVisible(false); | ||
364 | + reloadPrepaidTable(); | ||
365 | + }} | ||
366 | + /> | ||
367 | + )} | ||
368 | + | ||
369 | + {balanceChangeRecordsModalVisible && ( | ||
370 | + <BalanceChangeRecordsModal | ||
371 | + setVisible={(val: boolean) => { | ||
372 | + setBalanceChangeRecordsModalVisible(val); | ||
373 | + }} | ||
374 | + userInfoObj={currentOptUserObj} | ||
375 | + onClose={() => { | ||
376 | + setBalanceChangeRecordsModalVisible(false); | ||
377 | + }} | ||
378 | + /> | ||
379 | + )} | ||
380 | + </div> | ||
381 | + ); | ||
382 | +}; | ||
383 | + | ||
384 | +export default PrepaidPage; |
src/services/exportRequest.ts
@@ -4,6 +4,7 @@ export const excelExport = async ( | @@ -4,6 +4,7 @@ export const excelExport = async ( | ||
4 | url: any = '', | 4 | url: any = '', |
5 | data: any = {}, | 5 | data: any = {}, |
6 | exportLoadingDestory: any, | 6 | exportLoadingDestory: any, |
7 | + fileName, | ||
7 | ) => { | 8 | ) => { |
8 | axios({ | 9 | axios({ |
9 | url: url, | 10 | url: url, |
@@ -23,7 +24,7 @@ export const excelExport = async ( | @@ -23,7 +24,7 @@ export const excelExport = async ( | ||
23 | let a = document.createElement('a'); | 24 | let a = document.createElement('a'); |
24 | a.style.display = 'none'; | 25 | a.style.display = 'none'; |
25 | a.href = fileUrl; | 26 | a.href = fileUrl; |
26 | - a.download = '开票记录.xlsx'; | 27 | + a.download = fileName + '.xlsx'; |
27 | document.body.appendChild(a); | 28 | document.body.appendChild(a); |
28 | a.click(); | 29 | a.click(); |
29 | window.URL.revokeObjectURL(a.href); | 30 | window.URL.revokeObjectURL(a.href); |