Commit 73fd7ef2486a851b7a9f093e591dd211733795d0

Authored by zhusen
2 parents 08a71b12 523b3b7d

Merge branch 'zhongnanhuang' into 'develop'

feat: updated the interaction logic between various operation buttons and interfaces

更新了各个按钮与接口的交互。还有部分按钮未完成。

See merge request !3
.umirc.ts
... ... @@ -13,7 +13,8 @@ export default defineConfig({
13 13 },
14 14 proxy: {
15 15 '/service/': {
16   - target: 'http://39.108.227.113:8085/',
  16 + target: 'http://localhost:8085/',
  17 + // target: 'http://39.108.227.113:8085/',
17 18 changeOrigin: true,
18 19 // pathRewrite: { '^/api': '' },
19 20 },
... ...
src/app.ts
... ... @@ -91,7 +91,7 @@ export const request: RequestConfig = {
91 91 // 不再需要异步处理读取返回体内容,可直接在data中读出,部分字段可在 config 中找到
92 92 const { data = {} as any } = response;
93 93 if (data.result !== RESPONSE_CODE.SUCCESS) {
94   - message.error('服务器错误,请稍后再试!');
  94 + message.error(data.message);
95 95 }
96 96 // do something
97 97 return response;
... ...
src/pages/Order/components/CheckModal.tsx
  1 +import { RESPONSE_CODE } from '@/constants/enum';
1 2 import { postServiceOrderCheckOrder } from '@/services';
2 3 import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
3 4 import { Button, Form, message } from 'antd';
... ... @@ -12,13 +13,11 @@ export default ({ setCheckVisible, data, onClose }) => {
12 13 subOrderIds = subOrderList.map((subOrder) => subOrder.id);
13 14 }
14 15 async function doCheck(body: object) {
15   - const res = await postServiceOrderCheckOrder({
  16 + const data = await postServiceOrderCheckOrder({
16 17 data: body,
17 18 });
18   - if (res.result === 0) {
19   - message.success(res.message);
20   - } else {
21   - message.error(res.message);
  19 + if (data.result === RESPONSE_CODE.SUCCESS) {
  20 + message.success(data.message);
22 21 }
23 22 onClose();
24 23 return true;
... ...
src/pages/Order/components/DeliverModal.tsx
  1 +import { RESPONSE_CODE } from '@/constants/enum';
  2 +import { postServiceOrderSendProduct } from '@/services';
1 3 import { enumToSelect } from '@/utils';
2 4 import {
3 5 ProColumns,
... ... @@ -6,7 +8,7 @@ import {
6 8 ProFormText,
7 9 ProTable,
8 10 } from '@ant-design/pro-components';
9   -import { Button, InputNumber, Modal } from 'antd';
  11 +import { Button, Input, InputNumber, Modal, Select, message } from 'antd';
10 12 import { cloneDeep } from 'lodash';
11 13 import { useEffect, useRef, useState } from 'react';
12 14 import { LOGISTICS_STATUS_OPTIONS } from '../constant';
... ... @@ -19,49 +21,67 @@ const DeliverModal = ({ data: propsData, onClose }) => {
19 21 setData(propsData);
20 22 }, [propsData]);
21 23  
22   - const handleChange = (key: string, index: number) => (e) => {
23   - const newData = cloneDeep(data);
24   - newData[index][key] = e.target.value;
25   - setData(newData);
26   - };
  24 + // const handleChange = (key: string, index: number) => (e) => {
  25 + // const newData = cloneDeep(data);
  26 + // newData[index][key] = e.target.value;
  27 + // setData(newData);
  28 + // };
27 29 const columns: ProColumns<any>[] = [
28 30 {
  31 + title: 'ID',
  32 + width: 80,
  33 + dataIndex: 'id',
  34 + render: (_, record) => <Input value={record.id} disabled />,
  35 + },
  36 + {
29 37 title: '商品编号',
30 38 width: 80,
31   - dataIndex: 'name',
  39 + dataIndex: 'productCode',
  40 + render: (_, record) => <Input value={record.productCode} disabled />,
32 41 },
33 42 {
34 43 title: '商品名称',
35   - dataIndex: 'containers',
  44 + dataIndex: 'productName',
36 45 align: 'right',
  46 + width: 80,
  47 + render: (_, record) => <Input value={record.productName} disabled />,
  48 + },
  49 + {
  50 + title: '商品参数',
  51 + dataIndex: 'parameters',
  52 + align: 'right',
  53 + width: 80,
  54 + render: (_, record) => <Input value={record.parameters} disabled />,
37 55 },
38 56 {
39 57 title: '商品数量',
40 58 width: 80,
41 59 dataIndex: 'status',
  60 + render: (_, record) => <InputNumber value={record.quantity} disabled />,
42 61 },
43 62 {
44 63 title: '物流方式',
45   - width: 180,
  64 + width: 150,
46 65 key: 'logisticsMethod',
47   - render: () => (
48   - <ProFormSelect
  66 + render: (_, record) => (
  67 + <Select
49 68 placeholder="请输入物流方式"
50   - name="logisticsMethod"
51   - width="lg"
52   - label="物流方式"
  69 + value={record.logisticsMethod}
53 70 options={enumToSelect(LOGISTICS_STATUS_OPTIONS)}
  71 + onChange={(value) => (record.logisticsMethod = value)} //修改时更改record数据
54 72 />
55 73 ),
56 74 },
57 75 {
58 76 title: '物流单号',
59   - width: 180,
  77 + width: 150,
60 78 key: 'serialNumber',
61   - render: (_, record, index) => (
62   - <InputNumber
63   - value={record.productCode}
64   - onChange={handleChange('productCode', index)}
  79 + render: (_, record) => (
  80 + <Input
  81 + placeholder="请输入物流单号"
  82 + value={record.serialNumber}
  83 + onChange={(event) => (record.serialNumber = event.target.value)}
  84 + // onChange={handleChange('productCode', index)}
65 85 />
66 86 ),
67 87 },
... ... @@ -72,9 +92,23 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
72 92 open
73 93 width={800}
74 94 title="发货"
75   - onOk={() => {
76   - console.log(data);
77   - onClose();
  95 + onOk={async () => {
  96 + //请求体封装
  97 + let list = data.map((item) => {
  98 + return {
  99 + id: item.id,
  100 + logisticsMethod: item.logisticsMethod,
  101 + serialNumber: item.serialNumber,
  102 + };
  103 + });
  104 + let body = { id: data[0].mainOrderId, list: list };
  105 + console.log(body);
  106 + //发货请求
  107 + const res = await postServiceOrderSendProduct({ data: body });
  108 + if (res.result === RESPONSE_CODE.SUCCESS) {
  109 + message.success(res.message);
  110 + onClose();
  111 + }
78 112 }}
79 113 onCancel={() => {
80 114 onClose();
... ... @@ -87,8 +121,14 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
87 121 className="mb-8"
88 122 formRef={form}
89 123 >
90   - <ProFormText name="paymentChannel" label="物流方式"></ProFormText>
91   - <ProFormText name="productCode" label="物流单号"></ProFormText>
  124 + <ProFormSelect
  125 + placeholder="请输入物流方式"
  126 + name="logisticsMethod"
  127 + width="sm"
  128 + label="物流方式"
  129 + options={enumToSelect(LOGISTICS_STATUS_OPTIONS)}
  130 + />
  131 + <ProFormText name="serialNumber" label="物流单号"></ProFormText>
92 132 <Button
93 133 type="primary"
94 134 onClick={() => {
... ... @@ -96,8 +136,8 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
96 136 let newData = cloneDeep(data);
97 137 newData = newData.map((item) => ({
98 138 ...item,
99   - paymentChannel: values.paymentChannel,
100   - productCode: values.productCode, // 物流单号?
  139 + logisticsMethod: values.logisticsMethod,
  140 + serialNumber: values.serialNumber, // 物流单号?
101 141 }));
102 142 setData(newData);
103 143 }}
... ... @@ -108,7 +148,7 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
108 148 <ProTable<any>
109 149 className="px-0"
110 150 dataSource={data}
111   - rowKey="key"
  151 + rowKey="id"
112 152 pagination={false}
113 153 columns={columns}
114 154 search={false}
... ...
src/pages/Order/components/OrderDrawer.tsx
  1 +import { RESPONSE_CODE } from '@/constants/enum';
1 2 import {
2 3 postServiceOrderAddOrder,
3 4 postServiceOrderQueryProductInformation,
... ... @@ -145,8 +146,10 @@ export default ({ onClose, data }) =&gt; {
145 146 }}
146 147 submitTimeout={2000}
147 148 onFinish={async (values) => {
148   - await postServiceOrderAddOrder({ data: values });
149   - message.success('提交成功');
  149 + const data = await postServiceOrderAddOrder({ data: values });
  150 + if (data.result === RESPONSE_CODE.SUCCESS) {
  151 + message.success(data.message);
  152 + }
150 153 // 不返回不会关闭弹框
151 154 onClose();
152 155 return true;
... ... @@ -361,9 +364,8 @@ export default ({ onClose, data }) =&gt; {
361 364 },
362 365 ]}
363 366 actionGuard={{
364   - beforeAddRow: async (defaultValue, insertIndex) => {
  367 + beforeAddRow: async () => {
365 368 return new Promise((resolve) => {
366   - console.log(defaultValue, insertIndex);
367 369 rowNumber.current = 1;
368 370 setTimeout(() => resolve(true), 1000);
369 371 });
... ... @@ -371,7 +373,7 @@ export default ({ onClose, data }) =&gt; {
371 373 beforeRemoveRow: async (index) => {
372 374 return new Promise((resolve) => {
373 375 if (index === 0) {
374   - message.error('这行不能删');
  376 + message.error('第一行数据不能删除');
375 377 resolve(false);
376 378 return;
377 379 }
... ...
src/pages/Order/index.tsx
1 1 import ButtonConfirm from '@/components/ButtomConfirm';
2   -import { postServiceOrderQueryServiceOrder } from '@/services';
  2 +import { RESPONSE_CODE } from '@/constants/enum';
  3 +import {
  4 + postServiceOrderExport,
  5 + postServiceOrderOrderCancel,
  6 + postServiceOrderPrintOrder,
  7 + postServiceOrderQueryServiceOrder,
  8 +} from '@/services';
  9 +import { orderExport } from '@/services/order';
3 10 import { enumValueToLabel } from '@/utils';
  11 +import { DownOutlined } from '@ant-design/icons';
4 12 import {
5 13 PageContainer,
6 14 ProColumns,
7 15 ProTable,
8 16 } from '@ant-design/pro-components';
9   -import { Button, Checkbox, Divider, Flex, Space, Tag, message } from 'antd';
  17 +import {
  18 + Button,
  19 + Checkbox,
  20 + Divider,
  21 + Dropdown,
  22 + Flex,
  23 + MenuProps,
  24 + Space,
  25 + Tag,
  26 + message,
  27 +} from 'antd';
  28 +import { cloneDeep } from 'lodash';
10 29 import { Key, useRef, useState } from 'react';
11 30 import CheckModal from './components/CheckModal';
12 31 import DeliverModal from './components/DeliverModal';
13 32 import OrderDrawer from './components/OrderDrawer';
14 33 import {
15 34 INVOCING_STATUS_OPTIONS,
  35 + LOGISTICS_STATUS_OPTIONS,
16 36 MAIN_ORDER_COLUMNS,
17 37 ORDER_STATUS_OPTIONS,
18 38 PAYMENT_CHANNEL_OPTIONS,
... ... @@ -29,6 +49,7 @@ const OrderPage = () =&gt; {
29 49 const [expandedRowKeys, setExpandedRowKeys] = useState<Key[]>([]);
30 50 const [orderRow, setOrderRow] = useState<Partial<OrderType>>({});
31 51 const [mainOrderAllItemKeys, setMainOrderAllItemKeys] = useState([]);
  52 + const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮)
32 53  
33 54 const [selectedRows, setSelectedRows] = useState({});
34 55 const [selectedRowObj, setSelectedRowObj] = useState({});
... ... @@ -126,60 +147,94 @@ const OrderPage = () =&gt; {
126 147 总金额:<span className="text-lg">{record.totalPayment}¥</span>
127 148 </div>
128 149 <Space>
129   - <Button
130   - className="p-0"
131   - type="link"
132   - onClick={() => {
133   - if (!selectedRowObj[record.id]?.length) {
134   - return message.error('请选择选择子订单');
135   - }
136   - setSelectedRows(selectedRowObj[record.id]);
137   - setDeliverVisible(true);
138   - }}
139   - >
140   - 发货
141   - </Button>
142   - <Button
143   - className="p-0"
144   - type="link"
145   - onClick={() => {
146   - window.print();
147   - }}
148   - >
149   - 打印
150   - </Button>
151   - <ButtonConfirm
152   - className="p-0"
153   - title="确认开票?"
154   - text="开票"
155   - onConfirm={() => {}}
156   - />
157   - <Button
158   - className="p-0"
159   - type="link"
160   - onClick={() => {
161   - setOrderDrawerVisible(true);
162   - setOrderRow(record);
163   - }}
164   - >
165   - 编辑
166   - </Button>
167   - <Button
168   - className="p-0"
169   - type="link"
170   - onClick={() => {
171   - setOrderRow(record);
172   - setCheckVisible(true);
173   - }}
174   - >
175   - 审核
176   - </Button>
177   - <ButtonConfirm
178   - className="p-0"
179   - title="确认作废?"
180   - text="作废"
181   - onConfirm={() => {}}
182   - />
  150 + {record.mainPath.includes('sendProduct') ? (
  151 + <Button
  152 + className="p-0"
  153 + type="link"
  154 + onClick={() => {
  155 + if (!selectedRowObj[record.id]?.length) {
  156 + return message.error('请选择选择子订单');
  157 + }
  158 + setSelectedRows(selectedRowObj[record.id]);
  159 + setDeliverVisible(true);
  160 + }}
  161 + >
  162 + 发货
  163 + </Button>
  164 + ) : (
  165 + ''
  166 + )}
  167 + {record.mainPath.includes('printOrder') ? (
  168 + <Button
  169 + className="p-0"
  170 + type="link"
  171 + onClick={() => {
  172 + window.print();
  173 + }}
  174 + >
  175 + 打印
  176 + </Button>
  177 + ) : (
  178 + ''
  179 + )}
  180 + {record.mainPath.includes('confirmReceipt') ? (
  181 + <ButtonConfirm
  182 + className="p-0"
  183 + title="确认开票?"
  184 + text="开票"
  185 + onConfirm={() => {}}
  186 + />
  187 + ) : (
  188 + ''
  189 + )}
  190 + {record.mainPath.includes('updateOrder') ? (
  191 + <Button
  192 + className="p-0"
  193 + type="link"
  194 + onClick={() => {
  195 + setOrderDrawerVisible(true);
  196 + setOrderRow(record);
  197 + }}
  198 + >
  199 + 编辑
  200 + </Button>
  201 + ) : (
  202 + ''
  203 + )}
  204 + {record.mainPath.includes('checkOrder') ? (
  205 + <Button
  206 + className="p-0"
  207 + type="link"
  208 + onClick={() => {
  209 + setOrderRow(record);
  210 + setCheckVisible(true);
  211 + }}
  212 + >
  213 + 审核
  214 + </Button>
  215 + ) : (
  216 + ''
  217 + )}
  218 +
  219 + {record.mainPath.includes('OrderCancel') ? (
  220 + <ButtonConfirm
  221 + className="p-0"
  222 + title="确认作废?"
  223 + text="作废"
  224 + onConfirm={async () => {
  225 + let body = { id: record.id };
  226 + const data = await postServiceOrderOrderCancel({
  227 + data: body,
  228 + });
  229 + if (data.result === RESPONSE_CODE.SUCCESS) {
  230 + message.success(data.message);
  231 + mainTableRef.current?.reload();
  232 + }
  233 + }}
  234 + />
  235 + ) : (
  236 + ''
  237 + )}
183 238 </Space>
184 239 </Space.Compact>
185 240 <Space.Compact direction="vertical">
... ... @@ -225,7 +280,6 @@ const OrderPage = () =&gt; {
225 280 ...item,
226 281 render: (text: string) => {
227 282 let label = enumValueToLabel(text, ORDER_STATUS_OPTIONS);
228   - console.log('label:' + label);
229 283 if (label === undefined) {
230 284 label = enumValueToLabel(text, INVOCING_STATUS_OPTIONS);
231 285 }
... ... @@ -239,7 +293,11 @@ const OrderPage = () =&gt; {
239 293 }
240 294  
241 295 //枚举字段处理
242   - if (item.key === 'paymentMethod' || item.key === 'paymentChannel') {
  296 + if (
  297 + item.key === 'paymentMethod' ||
  298 + item.key === 'paymentChannel' ||
  299 + item.key === 'logisticsMethod'
  300 + ) {
243 301 return {
244 302 ...item,
245 303 render: (text: string) => {
... ... @@ -247,6 +305,9 @@ const OrderPage = () =&gt; {
247 305 if (label === undefined) {
248 306 label = enumValueToLabel(text, PAYMENT_METHOD_OPTIONS);
249 307 }
  308 + if (label === undefined) {
  309 + label = enumValueToLabel(text, LOGISTICS_STATUS_OPTIONS);
  310 + }
250 311 return label;
251 312 },
252 313 };
... ... @@ -261,32 +322,92 @@ const OrderPage = () =&gt; {
261 322 align: 'center',
262 323 render: (optText, optRecord) => (
263 324 <Flex>
264   - <Button
265   - type="link"
266   - size="small"
267   - onClick={() => {
268   - mainTableRef.current?.reload();
269   - }}
270   - >
271   - 编辑
272   - </Button>
273   - <Button
274   - type="link"
275   - size="small"
276   - onClick={() => {
277   - setCheckVisible(true);
278   - setOrderRow(optRecord);
279   - }}
280   - >
281   - 审核
282   - </Button>
  325 + {optRecord.subPath.includes('sendProduct') ? (
  326 + <Button
  327 + className="p-0"
  328 + type="link"
  329 + onClick={() => {
  330 + optRecord.mainOrderId = record.id;
  331 + setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
  332 + setDeliverVisible(true);
  333 + }}
  334 + >
  335 + 发货
  336 + </Button>
  337 + ) : (
  338 + ''
  339 + )}
  340 + {optRecord.subPath.includes('printOrder') ? (
  341 + <Button
  342 + className="p-0"
  343 + type="link"
  344 + onClick={async () => {
  345 + //调用打印接口
  346 + let body = { subIds: [optRecord.id] };
  347 + const data = await postServiceOrderPrintOrder({
  348 + data: body,
  349 + });
  350 + if (data.result === RESPONSE_CODE.SUCCESS) {
  351 + message.success(data.message);
  352 + window.print();
  353 + mainTableRef.current?.reload();
  354 + }
  355 + }}
  356 + >
  357 + 打印
  358 + </Button>
  359 + ) : (
  360 + ''
  361 + )}
  362 + {optRecord.subPath.includes('confirmReceipt') ? (
  363 + <ButtonConfirm
  364 + className="p-0"
  365 + title="确认开票?"
  366 + text="开票"
  367 + onConfirm={() => {}}
  368 + />
  369 + ) : (
  370 + ''
  371 + )}
  372 + {optRecord.subPath.includes('updateOrder') ? (
  373 + <Button
  374 + className="p-0"
  375 + type="link"
  376 + onClick={() => {
  377 + setOrderDrawerVisible(true);
  378 + setOrderRow(optRecord);
  379 + }}
  380 + >
  381 + 编辑
  382 + </Button>
  383 + ) : (
  384 + ''
  385 + )}
  386 + {optRecord.subPath.includes('checkOrder') ? (
  387 + <Button
  388 + className="p-0"
  389 + type="link"
  390 + onClick={() => {
  391 + setOrderRow(optRecord);
  392 + setCheckVisible(true);
  393 + }}
  394 + >
  395 + 审核
  396 + </Button>
  397 + ) : (
  398 + ''
  399 + )}
283 400  
284   - <Button type="link" size="small">
285   - 备注
286   - </Button>
287   - <Button type="link" size="small">
288   - 作废
289   - </Button>
  401 + {/* {optRecord.subPath.includes("OrderCancel") ?
  402 + <ButtonConfirm
  403 + className="p-0"
  404 + title="确认作废?"
  405 + text="作废"
  406 + onConfirm={() => {
  407 + }}
  408 + />
  409 + : ''
  410 + } */}
290 411 </Flex>
291 412 ),
292 413 },
... ... @@ -304,7 +425,6 @@ const OrderPage = () =&gt; {
304 425 ])}
305 426 rowSelection={{
306 427 onChange: (selectedRowKeys: any, selectedRows: any) => {
307   - console.log(selectedRowKeys, selectedRows);
308 428 setSelectedRowObj({
309 429 ...setSelectedRowObj,
310 430 [record.id]: selectedRows,
... ... @@ -325,6 +445,101 @@ const OrderPage = () =&gt; {
325 445 );
326 446 };
327 447  
  448 + function toolBarRender() {
  449 + let toolBtns = [];
  450 +
  451 + //导出按钮配置
  452 + const items: MenuProps['items'] = [
  453 + {
  454 + label: '导出已选中订单',
  455 + key: '1',
  456 + onClick: async () => {
  457 + if (selectedItems.length === 0) {
  458 + message.error('请选择订单');
  459 + return;
  460 + }
  461 + let body = { flag: true, ids: selectedItems };
  462 + // const data = await postServiceOrderExport({ data: { flag: true, ids: selectedItems } });
  463 + orderExport(body);
  464 + // if (data.result === RESPONSE_CODE.SUCCESS) {
  465 + // message.success(data.message);
  466 + // }
  467 + },
  468 + },
  469 + {
  470 + label: '导出当前页订单',
  471 + key: '2',
  472 + onClick: async () => {
  473 + if (mainOrderAllItemKeys.length === 0) {
  474 + message.error('当前没有订单');
  475 + return;
  476 + }
  477 + const data = await postServiceOrderExport({
  478 + data: { flag: true, ids: mainOrderAllItemKeys },
  479 + });
  480 + if (data.result === RESPONSE_CODE.SUCCESS) {
  481 + message.success(data.message);
  482 + }
  483 + },
  484 + },
  485 + {
  486 + label: '导出所有订单',
  487 + key: '3',
  488 + onClick: async () => {
  489 + const data = await postServiceOrderExport({
  490 + data: { flag: false, ids: [] },
  491 + });
  492 + if (data.result === RESPONSE_CODE.SUCCESS) {
  493 + message.success(data.message);
  494 + }
  495 + },
  496 + },
  497 + ];
  498 +
  499 + const menuProps = {
  500 + items,
  501 + onClick: () => {},
  502 + };
  503 +
  504 + if (rolePath.includes('addOrder')) {
  505 + toolBtns.push(
  506 + <Button
  507 + type="primary"
  508 + key="out"
  509 + onClick={() => setOrderDrawerVisible(true)}
  510 + >
  511 + 新增
  512 + </Button>,
  513 + );
  514 + }
  515 +
  516 + toolBtns.push(
  517 + <Dropdown menu={menuProps}>
  518 + <Button>
  519 + <Space>
  520 + 导出
  521 + <DownOutlined />
  522 + </Space>
  523 + </Button>
  524 + </Dropdown>,
  525 + );
  526 +
  527 + toolBtns.push(
  528 + <Button
  529 + key="show"
  530 + onClick={() => {
  531 + handleAllExpand();
  532 + }}
  533 + >
  534 + {mainOrderAllItemKeys?.length !== expandedRowKeys.length
  535 + ? '一键展开'
  536 + : '一键收起'}
  537 + </Button>,
  538 + );
  539 +
  540 + return toolBtns;
  541 + }
  542 +
328 543 return (
329 544 <PageContainer
330 545 header={{
... ... @@ -363,30 +578,21 @@ const OrderPage = () =&gt; {
363 578 filter,
364 579 data: params,
365 580 });
366   - setMainOrderAllItemKeys(data?.data?.map((d) => d.id)); //存储所有主订单的key,一键展开用
  581 + let mainOrderIds = data?.data?.map((d) => d.id);
  582 + if (mainOrderAllItemKeys === undefined) {
  583 + setMainOrderAllItemKeys([]);
  584 + } else {
  585 + setMainOrderAllItemKeys(mainOrderIds);
  586 + }
  587 + setRolePath(data.specialPath);
367 588 return {
368 589 data: data?.data || [],
369 590 total: data?.total || 0,
370 591 };
371 592 }}
372   - toolBarRender={() => [
373   - <Button
374   - key="show"
375   - onClick={() => {
376   - handleAllExpand();
377   - }}
378   - >
379   - {mainOrderAllItemKeys.length !== expandedRowKeys.length
380   - ? '一键展开'
381   - : '一键收起'}
382   - </Button>,
383   - <Button key="out" onClick={() => setOrderDrawerVisible(true)}>
384   - 新增
385   - </Button>,
386   - <Button key="primary" type="primary" onClick={() => {}}>
387   - 导出
388   - </Button>,
389   - ]}
  593 + toolBarRender={() => {
  594 + return toolBarRender();
  595 + }}
390 596 />
391 597  
392 598 {orderDrawerVisible && (
... ... @@ -416,8 +622,9 @@ const OrderPage = () =&gt; {
416 622 <DeliverModal
417 623 data={selectedRows}
418 624 onClose={() => {
419   - setCheckVisible(false);
  625 + setDeliverVisible(false);
420 626 setOrderRow({});
  627 + mainTableRef.current?.reload();
421 628 }}
422 629 />
423 630 )}
... ...
src/services/definition.ts
... ... @@ -365,6 +365,30 @@ export interface DictionaryVO {
365 365 sort?: number;
366 366 }
367 367  
  368 +export interface InvoicingDto {
  369 + /**
  370 + * @description
  371 + * 收款时间
  372 + * @format date-time
  373 + * @example
  374 + * 2023-11-12 16:12
  375 + */
  376 + collectMoneyTime?: string;
  377 + /**
  378 + * @description
  379 + * 开票时间
  380 + * @format date-time
  381 + * @example
  382 + * 2023-11-12 16:12
  383 + */
  384 + invoicingTime?: string;
  385 + /**
  386 + * @description
  387 + * 子订单id集合
  388 + */
  389 + subIds?: Array<number>;
  390 +}
  391 +
368 392 export interface ModelAndView {
369 393 empty?: boolean;
370 394 model?: any;
... ... @@ -485,6 +509,15 @@ export interface OrderBaseInfoVO {
485 509 smallPicUrl?: string;
486 510 }
487 511  
  512 +export interface OrderCancelDto {
  513 + /**
  514 + * @description
  515 + * 订单id
  516 + * @format int64
  517 + */
  518 + id?: number;
  519 +}
  520 +
488 521 export interface OrderCompletionReportFieldVO {
489 522 ideaManualRate?: string;
490 523 ideaSource?: string;
... ...
src/services/order.ts 0 → 100644
  1 +import axios from 'axios';
  2 +
  3 +export const orderExport = async (data: any = {}) => {
  4 + // const res = await defHttp.post<any>({ url: Api.EXPORT, data });
  5 +
  6 + axios({
  7 + url: '/service/order/export',
  8 + method: 'post',
  9 + responseType: 'blob',
  10 + data,
  11 + })
  12 + .then((response) => {
  13 + // 创建一个新的 Blob 对象,它包含了服务器响应的数据(即你的 Excel 文件)
  14 + const blob = new Blob([response.data]); // Excel 的 MIME 类型
  15 + const downloadUrl = window.URL.createObjectURL(blob);
  16 + const a = document.createElement('a');
  17 + a.href = downloadUrl;
  18 + a.download = '订单.xlsx'; // 你可以为文件命名
  19 + document.body.appendChild(a);
  20 + a.click(); // 模拟点击操作来下载文件
  21 + URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存
  22 + document.body.removeChild(a);
  23 + })
  24 + .catch((error) => {
  25 + // 处理错误
  26 + console.error('导出错误', error);
  27 + });
  28 +};
... ...
src/services/request.ts
... ... @@ -26,9 +26,12 @@ import type {
26 26 DictionaryQueryVO,
27 27 DictionaryVO,
28 28 Dto,
  29 + InvoicingDto,
  30 + ModelAndView,
29 31 OrderAddVO,
30 32 OrderAuditLogQueryVO,
31 33 OrderBaseInfoQueryVO,
  34 + OrderCancelDto,
32 35 OrderFieldLockApplyQueryVO,
33 36 OrderOptLogQueryVO,
34 37 OrderProfitAnalysisVo,
... ... @@ -217,9 +220,7 @@ export interface GetErrorResponse {
217 220 * @description
218 221 * OK
219 222 */
220   - 200: {
221   - [propertyName: string]: any;
222   - };
  223 + 200: ModelAndView;
223 224 /**
224 225 * @description
225 226 * Unauthorized
... ... @@ -240,9 +241,9 @@ export interface GetErrorResponse {
240 241 export type GetErrorResponseSuccess = GetErrorResponse[200];
241 242 /**
242 243 * @description
243   - * error
  244 + * errorHtml
244 245 * @tags basic-error-controller
245   - * @produces *
  246 + * @produces text/html
246 247 */
247 248 export const getError = /* #__PURE__ */ (() => {
248 249 const method = 'get';
... ... @@ -266,9 +267,7 @@ export interface PutErrorResponse {
266 267 * @description
267 268 * OK
268 269 */
269   - 200: {
270   - [propertyName: string]: any;
271   - };
  270 + 200: ModelAndView;
272 271 /**
273 272 * @description
274 273 * Created
... ... @@ -294,9 +293,9 @@ export interface PutErrorResponse {
294 293 export type PutErrorResponseSuccess = PutErrorResponse[200];
295 294 /**
296 295 * @description
297   - * error
  296 + * errorHtml
298 297 * @tags basic-error-controller
299   - * @produces *
  298 + * @produces text/html
300 299 * @consumes application/json
301 300 */
302 301 export const putError = /* #__PURE__ */ (() => {
... ... @@ -321,9 +320,7 @@ export interface PostErrorResponse {
321 320 * @description
322 321 * OK
323 322 */
324   - 200: {
325   - [propertyName: string]: any;
326   - };
  323 + 200: ModelAndView;
327 324 /**
328 325 * @description
329 326 * Created
... ... @@ -349,9 +346,9 @@ export interface PostErrorResponse {
349 346 export type PostErrorResponseSuccess = PostErrorResponse[200];
350 347 /**
351 348 * @description
352   - * error
  349 + * errorHtml
353 350 * @tags basic-error-controller
354   - * @produces *
  351 + * @produces text/html
355 352 * @consumes application/json
356 353 */
357 354 export const postError = /* #__PURE__ */ (() => {
... ... @@ -376,9 +373,7 @@ export interface DeleteErrorResponse {
376 373 * @description
377 374 * OK
378 375 */
379   - 200: {
380   - [propertyName: string]: any;
381   - };
  376 + 200: ModelAndView;
382 377 /**
383 378 * @description
384 379 * No Content
... ... @@ -399,9 +394,9 @@ export interface DeleteErrorResponse {
399 394 export type DeleteErrorResponseSuccess = DeleteErrorResponse[200];
400 395 /**
401 396 * @description
402   - * error
  397 + * errorHtml
403 398 * @tags basic-error-controller
404   - * @produces *
  399 + * @produces text/html
405 400 */
406 401 export const deleteError = /* #__PURE__ */ (() => {
407 402 const method = 'delete';
... ... @@ -425,9 +420,7 @@ export interface OptionsErrorResponse {
425 420 * @description
426 421 * OK
427 422 */
428   - 200: {
429   - [propertyName: string]: any;
430   - };
  423 + 200: ModelAndView;
431 424 /**
432 425 * @description
433 426 * No Content
... ... @@ -448,9 +441,9 @@ export interface OptionsErrorResponse {
448 441 export type OptionsErrorResponseSuccess = OptionsErrorResponse[200];
449 442 /**
450 443 * @description
451   - * error
  444 + * errorHtml
452 445 * @tags basic-error-controller
453   - * @produces *
  446 + * @produces text/html
454 447 * @consumes application/json
455 448 */
456 449 export const optionsError = /* #__PURE__ */ (() => {
... ... @@ -475,9 +468,7 @@ export interface HeadErrorResponse {
475 468 * @description
476 469 * OK
477 470 */
478   - 200: {
479   - [propertyName: string]: any;
480   - };
  471 + 200: ModelAndView;
481 472 /**
482 473 * @description
483 474 * No Content
... ... @@ -498,9 +489,9 @@ export interface HeadErrorResponse {
498 489 export type HeadErrorResponseSuccess = HeadErrorResponse[200];
499 490 /**
500 491 * @description
501   - * error
  492 + * errorHtml
502 493 * @tags basic-error-controller
503   - * @produces *
  494 + * @produces text/html
504 495 * @consumes application/json
505 496 */
506 497 export const headError = /* #__PURE__ */ (() => {
... ... @@ -525,9 +516,7 @@ export interface PatchErrorResponse {
525 516 * @description
526 517 * OK
527 518 */
528   - 200: {
529   - [propertyName: string]: any;
530   - };
  519 + 200: ModelAndView;
531 520 /**
532 521 * @description
533 522 * No Content
... ... @@ -548,9 +537,9 @@ export interface PatchErrorResponse {
548 537 export type PatchErrorResponseSuccess = PatchErrorResponse[200];
549 538 /**
550 539 * @description
551   - * error
  540 + * errorHtml
552 541 * @tags basic-error-controller
553   - * @produces *
  542 + * @produces text/html
554 543 * @consumes application/json
555 544 */
556 545 export const patchError = /* #__PURE__ */ (() => {
... ... @@ -4708,24 +4697,22 @@ export const postOrderErpUsersUpdatePass = /* #__PURE__ */ (() =&gt; {
4708 4697 return request;
4709 4698 })();
4710 4699  
4711   -/** @description request parameter type for getServiceOrderOrderCancelId */
4712   -export interface GetServiceOrderOrderCancelIdOption {
  4700 +/** @description request parameter type for postServiceOrderOrderCancel */
  4701 +export interface PostServiceOrderOrderCancelOption {
4713 4702 /**
4714 4703 * @description
4715   - * id
4716   - * @format int64
  4704 + * dto
4717 4705 */
4718   - path: {
  4706 + body: {
4719 4707 /**
4720 4708 @description
4721   - id
4722   - @format int64 */
4723   - id: number;
  4709 + dto */
  4710 + dto: OrderCancelDto;
4724 4711 };
4725 4712 }
4726 4713  
4727   -/** @description response type for getServiceOrderOrderCancelId */
4728   -export interface GetServiceOrderOrderCancelIdResponse {
  4714 +/** @description response type for postServiceOrderOrderCancel */
  4715 +export interface PostServiceOrderOrderCancelResponse {
4729 4716 /**
4730 4717 * @description
4731 4718 * OK
... ... @@ -4733,6 +4720,11 @@ export interface GetServiceOrderOrderCancelIdResponse {
4733 4720 200: ServerResult;
4734 4721 /**
4735 4722 * @description
  4723 + * Created
  4724 + */
  4725 + 201: any;
  4726 + /**
  4727 + * @description
4736 4728 * Unauthorized
4737 4729 */
4738 4730 401: any;
... ... @@ -4748,24 +4740,25 @@ export interface GetServiceOrderOrderCancelIdResponse {
4748 4740 404: any;
4749 4741 }
4750 4742  
4751   -export type GetServiceOrderOrderCancelIdResponseSuccess =
4752   - GetServiceOrderOrderCancelIdResponse[200];
  4743 +export type PostServiceOrderOrderCancelResponseSuccess =
  4744 + PostServiceOrderOrderCancelResponse[200];
4753 4745 /**
4754 4746 * @description
4755 4747 * 订单作废
4756 4748 * @tags 内部订单
4757 4749 * @produces *
  4750 + * @consumes application/json
4758 4751 */
4759   -export const getServiceOrderOrderCancelId = /* #__PURE__ */ (() => {
4760   - const method = 'get';
4761   - const url = '/service/order/OrderCancel/:id';
  4752 +export const postServiceOrderOrderCancel = /* #__PURE__ */ (() => {
  4753 + const method = 'post';
  4754 + const url = '/service/order/OrderCancel';
4762 4755 function request(
4763   - option: GetServiceOrderOrderCancelIdOption,
4764   - ): Promise<GetServiceOrderOrderCancelIdResponseSuccess> {
  4756 + option: PostServiceOrderOrderCancelOption,
  4757 + ): Promise<PostServiceOrderOrderCancelResponseSuccess> {
4765 4758 return requester(request.url, {
4766 4759 method: request.method,
4767 4760 ...option,
4768   - }) as unknown as Promise<GetServiceOrderOrderCancelIdResponseSuccess>;
  4761 + }) as unknown as Promise<PostServiceOrderOrderCancelResponseSuccess>;
4769 4762 }
4770 4763  
4771 4764 /** http method */
... ... @@ -4917,8 +4910,8 @@ export const postServiceOrderCheckOrder = /* #__PURE__ */ (() =&gt; {
4917 4910 return request;
4918 4911 })();
4919 4912  
4920   -/** @description request parameter type for getServiceOrderConfirmReceipt */
4921   -export interface GetServiceOrderConfirmReceiptOption {
  4913 +/** @description request parameter type for postServiceOrderConfirmReceipt */
  4914 +export interface PostServiceOrderConfirmReceiptOption {
4922 4915 /**
4923 4916 * @description
4924 4917 * file
... ... @@ -4931,14 +4924,14 @@ export interface GetServiceOrderConfirmReceiptOption {
4931 4924 };
4932 4925 }
4933 4926  
4934   -/** @description request parameter type for getServiceOrderConfirmReceipt */
4935   -export interface GetServiceOrderConfirmReceiptOption {
  4927 +/** @description request parameter type for postServiceOrderConfirmReceipt */
  4928 +export interface PostServiceOrderConfirmReceiptOption {
4936 4929 /**
4937 4930 * @description
4938 4931 * id
4939 4932 * @format int64
4940 4933 */
4941   - path: {
  4934 + query: {
4942 4935 /**
4943 4936 @description
4944 4937 id
... ... @@ -4947,8 +4940,8 @@ export interface GetServiceOrderConfirmReceiptOption {
4947 4940 };
4948 4941 }
4949 4942  
4950   -/** @description response type for getServiceOrderConfirmReceipt */
4951   -export interface GetServiceOrderConfirmReceiptResponse {
  4943 +/** @description response type for postServiceOrderConfirmReceipt */
  4944 +export interface PostServiceOrderConfirmReceiptResponse {
4952 4945 /**
4953 4946 * @description
4954 4947 * OK
... ... @@ -4956,6 +4949,11 @@ export interface GetServiceOrderConfirmReceiptResponse {
4956 4949 200: ServerResult;
4957 4950 /**
4958 4951 * @description
  4952 + * Created
  4953 + */
  4954 + 201: any;
  4955 + /**
  4956 + * @description
4959 4957 * Unauthorized
4960 4958 */
4961 4959 401: any;
... ... @@ -4971,8 +4969,8 @@ export interface GetServiceOrderConfirmReceiptResponse {
4971 4969 404: any;
4972 4970 }
4973 4971  
4974   -export type GetServiceOrderConfirmReceiptResponseSuccess =
4975   - GetServiceOrderConfirmReceiptResponse[200];
  4972 +export type PostServiceOrderConfirmReceiptResponseSuccess =
  4973 + PostServiceOrderConfirmReceiptResponse[200];
4976 4974 /**
4977 4975 * @description
4978 4976 * 确认收货
... ... @@ -4980,16 +4978,16 @@ export type GetServiceOrderConfirmReceiptResponseSuccess =
4980 4978 * @produces *
4981 4979 * @consumes multipart/form-data
4982 4980 */
4983   -export const getServiceOrderConfirmReceipt = /* #__PURE__ */ (() => {
4984   - const method = 'get';
  4981 +export const postServiceOrderConfirmReceipt = /* #__PURE__ */ (() => {
  4982 + const method = 'post';
4985 4983 const url = '/service/order/confirmReceipt';
4986 4984 function request(
4987   - option: GetServiceOrderConfirmReceiptOption,
4988   - ): Promise<GetServiceOrderConfirmReceiptResponseSuccess> {
  4985 + option: PostServiceOrderConfirmReceiptOption,
  4986 + ): Promise<PostServiceOrderConfirmReceiptResponseSuccess> {
4989 4987 return requester(request.url, {
4990 4988 method: request.method,
4991 4989 ...option,
4992   - }) as unknown as Promise<GetServiceOrderConfirmReceiptResponseSuccess>;
  4990 + }) as unknown as Promise<PostServiceOrderConfirmReceiptResponseSuccess>;
4993 4991 }
4994 4992  
4995 4993 /** http method */
... ... @@ -5070,6 +5068,20 @@ export const postServiceOrderExport = /* #__PURE__ */ (() =&gt; {
5070 5068 return request;
5071 5069 })();
5072 5070  
  5071 +/** @description request parameter type for postServiceOrderInvoicing */
  5072 +export interface PostServiceOrderInvoicingOption {
  5073 + /**
  5074 + * @description
  5075 + * dto
  5076 + */
  5077 + body: {
  5078 + /**
  5079 + @description
  5080 + dto */
  5081 + dto: InvoicingDto;
  5082 + };
  5083 +}
  5084 +
5073 5085 /** @description response type for postServiceOrderInvoicing */
5074 5086 export interface PostServiceOrderInvoicingResponse {
5075 5087 /**
... ... @@ -5111,9 +5123,12 @@ export type PostServiceOrderInvoicingResponseSuccess =
5111 5123 export const postServiceOrderInvoicing = /* #__PURE__ */ (() => {
5112 5124 const method = 'post';
5113 5125 const url = '/service/order/invoicing';
5114   - function request(): Promise<PostServiceOrderInvoicingResponseSuccess> {
  5126 + function request(
  5127 + option: PostServiceOrderInvoicingOption,
  5128 + ): Promise<PostServiceOrderInvoicingResponseSuccess> {
5115 5129 return requester(request.url, {
5116 5130 method: request.method,
  5131 + ...option,
5117 5132 }) as unknown as Promise<PostServiceOrderInvoicingResponseSuccess>;
5118 5133 }
5119 5134  
... ... @@ -5124,6 +5139,20 @@ export const postServiceOrderInvoicing = /* #__PURE__ */ (() =&gt; {
5124 5139 return request;
5125 5140 })();
5126 5141  
  5142 +/** @description request parameter type for postServiceOrderPrintOrder */
  5143 +export interface PostServiceOrderPrintOrderOption {
  5144 + /**
  5145 + * @description
  5146 + * dto
  5147 + */
  5148 + body: {
  5149 + /**
  5150 + @description
  5151 + dto */
  5152 + dto: Dto;
  5153 + };
  5154 +}
  5155 +
5127 5156 /** @description response type for postServiceOrderPrintOrder */
5128 5157 export interface PostServiceOrderPrintOrderResponse {
5129 5158 /**
... ... @@ -5165,9 +5194,12 @@ export type PostServiceOrderPrintOrderResponseSuccess =
5165 5194 export const postServiceOrderPrintOrder = /* #__PURE__ */ (() => {
5166 5195 const method = 'post';
5167 5196 const url = '/service/order/printOrder';
5168   - function request(): Promise<PostServiceOrderPrintOrderResponseSuccess> {
  5197 + function request(
  5198 + option: PostServiceOrderPrintOrderOption,
  5199 + ): Promise<PostServiceOrderPrintOrderResponseSuccess> {
5169 5200 return requester(request.url, {
5170 5201 method: request.method,
  5202 + ...option,
5171 5203 }) as unknown as Promise<PostServiceOrderPrintOrderResponseSuccess>;
5172 5204 }
5173 5205  
... ...
src/tsg.config.ts
... ... @@ -33,7 +33,7 @@ const projects: Project[] = [
33 33 * openapi 文档地址,可以是远程的json文件,也可以是本地的json文件
34 34 * 如果使用本地文件,相对路径以当前'tsg.config.ts'为基准
35 35 * */
36   - source: 'http://localhost:8085/request.json',
  36 + source: 'http://localhost:8085/v2/api-docs',
37 37  
38 38 // source: 'https://petstore3.swagger.io/api/v3/openapi.json',
39 39 // source: './fixture/pet.json',
... ...