Commit 7b854ea1931e1d120cc3fda5885fca33d69a624f
1 parent
3201699b
Merge branch 'master' into zgt移除ManualInvoicingModal中的非必要注释代码
发现并删除了ManualInvoicingModal组件中未使用的注释代码,以提高代码清晰度和维护性。
Showing
1 changed file
with
93 additions
and
82 deletions
src/pages/procure/index.tsx
@@ -4,11 +4,11 @@ import { | @@ -4,11 +4,11 @@ import { | ||
4 | postServiceConstProcureReturnBills, | 4 | postServiceConstProcureReturnBills, |
5 | postServiceConstStores, | 5 | postServiceConstStores, |
6 | } from '@/services'; | 6 | } from '@/services'; |
7 | +import { orderExport } from '@/services/order'; | ||
7 | import { enumToSelect } from '@/utils'; | 8 | import { enumToSelect } from '@/utils'; |
8 | -import { EllipsisOutlined } from '@ant-design/icons'; | ||
9 | import type { ActionType, ProColumns } from '@ant-design/pro-components'; | 9 | import type { ActionType, ProColumns } from '@ant-design/pro-components'; |
10 | import { ProTable, TableDropdown } from '@ant-design/pro-components'; | 10 | import { ProTable, TableDropdown } from '@ant-design/pro-components'; |
11 | -import { Button, Dropdown } from 'antd'; | 11 | +import { Button, message } from 'antd'; |
12 | import { useRef } from 'react'; | 12 | import { useRef } from 'react'; |
13 | export const waitTimePromise = async (time: number = 100) => { | 13 | export const waitTimePromise = async (time: number = 100) => { |
14 | return new Promise((resolve) => { | 14 | return new Promise((resolve) => { |
@@ -196,87 +196,98 @@ const columns: ProColumns[] = [ | @@ -196,87 +196,98 @@ const columns: ProColumns[] = [ | ||
196 | ]; | 196 | ]; |
197 | 197 | ||
198 | export default () => { | 198 | export default () => { |
199 | + const [messageApi, contextHolder] = message.useMessage(); | ||
199 | const actionRef = useRef<ActionType>(); | 200 | const actionRef = useRef<ActionType>(); |
200 | return ( | 201 | return ( |
201 | - <ProTable | ||
202 | - columns={columns} | ||
203 | - actionRef={actionRef} | ||
204 | - cardBordered | ||
205 | - request={async (params, sort, filter) => { | ||
206 | - console.log(sort, filter); | ||
207 | - const res = await postProcureReturnBillPage({ | ||
208 | - data: params, | ||
209 | - }); | ||
210 | - console.log(res); | ||
211 | - return res.data; | ||
212 | - }} | ||
213 | - editable={{ | ||
214 | - type: 'multiple', | ||
215 | - }} | ||
216 | - scroll={{ x: 1300 }} | ||
217 | - columnsState={{ | ||
218 | - persistenceKey: 'pro-table-singe-demos', | ||
219 | - persistenceType: 'localStorage', | ||
220 | - defaultValue: { | ||
221 | - option: { fixed: 'right', disable: true }, | ||
222 | - }, | ||
223 | - onChange(value) { | ||
224 | - console.log('value: ', value); | ||
225 | - }, | ||
226 | - }} | ||
227 | - rowKey="id" | ||
228 | - search={{ | ||
229 | - labelWidth: 'auto', | ||
230 | - }} | ||
231 | - options={{ | ||
232 | - setting: { | ||
233 | - listsHeight: 400, | ||
234 | - }, | ||
235 | - }} | ||
236 | - form={{ | ||
237 | - // 由于配置了 transform,提交的参数与定义的不同这里需要转化一下 | ||
238 | - syncToUrl: (values, type) => { | ||
239 | - if (type === 'get') { | ||
240 | - return { | ||
241 | - ...values, | ||
242 | - created_at: [values.startTime, values.endTime], | ||
243 | - }; | ||
244 | - } | ||
245 | - return values; | ||
246 | - }, | ||
247 | - }} | ||
248 | - pagination={{ | ||
249 | - pageSize: 5, | ||
250 | - onChange: (page) => console.log(page), | ||
251 | - }} | ||
252 | - dateFormatter="string" | ||
253 | - headerTitle="高级表格" | ||
254 | - toolBarRender={() => [ | ||
255 | - <AddDrawer key="add" />, | ||
256 | - <Dropdown | ||
257 | - key="menu" | ||
258 | - menu={{ | ||
259 | - items: [ | ||
260 | - { | ||
261 | - label: '1st item', | ||
262 | - key: '1', | ||
263 | - }, | ||
264 | - { | ||
265 | - label: '2nd item', | ||
266 | - key: '2', | ||
267 | - }, | ||
268 | - { | ||
269 | - label: '3rd item', | ||
270 | - key: '3', | ||
271 | - }, | ||
272 | - ], | ||
273 | - }} | ||
274 | - > | ||
275 | - <Button> | ||
276 | - <EllipsisOutlined /> | ||
277 | - </Button> | ||
278 | - </Dropdown>, | ||
279 | - ]} | ||
280 | - /> | 202 | + <> |
203 | + <ProTable | ||
204 | + columns={columns} | ||
205 | + actionRef={actionRef} | ||
206 | + cardBordered | ||
207 | + request={async (params, sort, filter) => { | ||
208 | + console.log(sort, filter); | ||
209 | + const res = await postProcureReturnBillPage({ | ||
210 | + data: params, | ||
211 | + }); | ||
212 | + console.log(res); | ||
213 | + return res.data; | ||
214 | + }} | ||
215 | + editable={{ | ||
216 | + type: 'multiple', | ||
217 | + }} | ||
218 | + scroll={{ x: 1300 }} | ||
219 | + columnsState={{ | ||
220 | + persistenceKey: 'pro-table-singe-demos', | ||
221 | + persistenceType: 'localStorage', | ||
222 | + defaultValue: { | ||
223 | + option: { fixed: 'right', disable: true }, | ||
224 | + }, | ||
225 | + onChange(value) { | ||
226 | + console.log('value: ', value); | ||
227 | + }, | ||
228 | + }} | ||
229 | + rowKey="id" | ||
230 | + search={{ | ||
231 | + optionRender: (searchConfig, formProps, dom) => [ | ||
232 | + ...dom.reverse(), | ||
233 | + <Button | ||
234 | + key="out" | ||
235 | + onClick={() => { | ||
236 | + const values = searchConfig?.form?.getFieldsValue(); | ||
237 | + messageApi.open({ | ||
238 | + type: 'loading', | ||
239 | + content: '导出中...', | ||
240 | + duration: 0, | ||
241 | + }); | ||
242 | + orderExport( | ||
243 | + '/api/admin/client/exportClients', | ||
244 | + '客户信息.xlsx', | ||
245 | + 'POST', | ||
246 | + values, | ||
247 | + () => { | ||
248 | + messageApi.destroy(); | ||
249 | + }, | ||
250 | + ); | ||
251 | + }} | ||
252 | + > | ||
253 | + 导出 | ||
254 | + </Button>, | ||
255 | + ], | ||
256 | + labelWidth: 'auto', | ||
257 | + }} | ||
258 | + options={{ | ||
259 | + setting: { | ||
260 | + listsHeight: 400, | ||
261 | + }, | ||
262 | + }} | ||
263 | + form={{ | ||
264 | + // 由于配置了 transform,提交的参数与定义的不同这里需要转化一下 | ||
265 | + syncToUrl: (values, type) => { | ||
266 | + if (type === 'get') { | ||
267 | + return { | ||
268 | + ...values, | ||
269 | + created_at: [values.startTime, values.endTime], | ||
270 | + }; | ||
271 | + } | ||
272 | + return values; | ||
273 | + }, | ||
274 | + }} | ||
275 | + pagination={{ | ||
276 | + pageSize: 5, | ||
277 | + onChange: (page) => console.log(page), | ||
278 | + }} | ||
279 | + dateFormatter="string" | ||
280 | + headerTitle="高级表格" | ||
281 | + toolBarRender={() => [ | ||
282 | + <AddDrawer | ||
283 | + key="add" | ||
284 | + reloadTable={() => { | ||
285 | + actionRef.current?.reload(); | ||
286 | + }} | ||
287 | + />, | ||
288 | + ]} | ||
289 | + /> | ||
290 | + {contextHolder} | ||
291 | + </> | ||
281 | ); | 292 | ); |
282 | }; | 293 | }; |