Commit 91ecba534f86cdb93b3846aea2f2b8c06a9927e1
1 parent
688a371d
feat: add production infomation item search
Showing
5 changed files
with
131 additions
and
8 deletions
src/app.ts
... | ... | @@ -90,7 +90,7 @@ export const request: RequestConfig = { |
90 | 90 | (response) => { |
91 | 91 | // 不再需要异步处理读取返回体内容,可直接在data中读出,部分字段可在 config 中找到 |
92 | 92 | const { data = {} as any } = response; |
93 | - if (data.code !== RESPONSE_CODE.SUCCESS) { | |
93 | + if (data.result !== RESPONSE_CODE.SUCCESS) { | |
94 | 94 | message.error('服务器错误,请稍后再试!'); |
95 | 95 | } |
96 | 96 | // do something | ... | ... |
src/pages/Order/components/OrderDrawer.tsx
1 | -import { postServiceOrderAddOrder } from '@/services'; | |
1 | +import { | |
2 | + postServiceOrderAddOrder, | |
3 | + postServiceOrderQueryProductInformation, | |
4 | +} from '@/services'; | |
2 | 5 | import { enumToSelect } from '@/utils'; |
3 | 6 | import { |
4 | 7 | DrawerForm, |
5 | 8 | FormListActionType, |
6 | 9 | ProCard, |
7 | 10 | ProFormDateTimePicker, |
11 | + ProFormDigit, | |
8 | 12 | ProFormGroup, |
9 | 13 | ProFormList, |
10 | 14 | ProFormSelect, |
... | ... | @@ -35,6 +39,10 @@ export default ({ onClose, data }) => { |
35 | 39 | form.setFieldsValue({ ...data }); |
36 | 40 | }, [data]); |
37 | 41 | |
42 | + function autoFillProductInfo(action) { | |
43 | + console.log(action); | |
44 | + } | |
45 | + | |
38 | 46 | return ( |
39 | 47 | <DrawerForm<{ |
40 | 48 | name: string; |
... | ... | @@ -354,20 +362,34 @@ export default ({ onClose, data }) => { |
354 | 362 | actionRef={actionRef} |
355 | 363 | > |
356 | 364 | <ProFormGroup key="group"> |
357 | - <ProFormText | |
365 | + <ProFormSelect | |
366 | + label="商品名称" | |
358 | 367 | width="lg" |
368 | + showSearch | |
359 | 369 | name="productName" |
360 | - label="商品名称" | |
361 | - placeholder="请输入商品名称" | |
370 | + placeholder="请搜索商品" | |
371 | + onChange={() => { | |
372 | + autoFillProductInfo(actionRef); | |
373 | + }} | |
374 | + request={async (value) => { | |
375 | + const { data } = await postServiceOrderQueryProductInformation({ | |
376 | + data: { productName: value.keyWords }, | |
377 | + }); | |
378 | + return data.map((p: any) => { | |
379 | + return { ...p, label: p.productName, value: p.id }; | |
380 | + }); | |
381 | + }} | |
362 | 382 | /> |
363 | 383 | <ProFormText |
364 | 384 | width="lg" |
365 | 385 | name="productCode" |
386 | + disabled | |
366 | 387 | label="商品编码" |
367 | 388 | placeholder="未输入商品名称" |
368 | 389 | /> |
369 | 390 | <ProFormText |
370 | 391 | width="lg" |
392 | + disabled | |
371 | 393 | name="parameters" |
372 | 394 | label="商品参数" |
373 | 395 | placeholder="请输入商品参数" |
... | ... | @@ -378,7 +400,7 @@ export default ({ onClose, data }) => { |
378 | 400 | label="商品数量" |
379 | 401 | placeholder="请输入商品数量" |
380 | 402 | /> |
381 | - <ProFormText | |
403 | + <ProFormDigit | |
382 | 404 | width="lg" |
383 | 405 | name="productPrice" |
384 | 406 | label="商品单价" |
... | ... | @@ -387,11 +409,12 @@ export default ({ onClose, data }) => { |
387 | 409 | <ProFormText |
388 | 410 | width="lg" |
389 | 411 | name="unit" |
412 | + disabled | |
390 | 413 | label="价格单位" |
391 | 414 | placeholder="请输入价格单位" |
392 | 415 | /> |
393 | 416 | |
394 | - <ProFormText | |
417 | + <ProFormDigit | |
395 | 418 | width="lg" |
396 | 419 | name="subOrderPayment" |
397 | 420 | label="子订单金额" | ... | ... |
src/services/definition.ts
... | ... | @@ -687,6 +687,19 @@ export interface OrderUpdateVO { |
687 | 687 | trackStageInfo?: OrderTrackStageVO; |
688 | 688 | } |
689 | 689 | |
690 | +export interface ProductInformationDto { | |
691 | + /** | |
692 | + * @description | |
693 | + * 货品编码 | |
694 | + */ | |
695 | + productCode?: string; | |
696 | + /** | |
697 | + * @description | |
698 | + * 货品名称 | |
699 | + */ | |
700 | + productName?: string; | |
701 | +} | |
702 | + | |
690 | 703 | export interface ResetPwdVO { |
691 | 704 | /** @format int64 */ |
692 | 705 | userId?: number; | ... | ... |
src/services/request.ts
... | ... | @@ -34,6 +34,7 @@ import type { |
34 | 34 | OrderProfitAnalysisVo, |
35 | 35 | OrderUnlockFieldApplyVO, |
36 | 36 | OrderUpdateVO, |
37 | + ProductInformationDto, | |
37 | 38 | ResetPwdVO, |
38 | 39 | ServerResult, |
39 | 40 | SysLogQueryVO, |
... | ... | @@ -4920,6 +4921,20 @@ export const postServiceOrderCheckOrder = /* #__PURE__ */ (() => { |
4920 | 4921 | export interface GetServiceOrderConfirmReceiptOption { |
4921 | 4922 | /** |
4922 | 4923 | * @description |
4924 | + * file | |
4925 | + */ | |
4926 | + formData: { | |
4927 | + /** | |
4928 | + @description | |
4929 | + file */ | |
4930 | + file: File; | |
4931 | + }; | |
4932 | +} | |
4933 | + | |
4934 | +/** @description request parameter type for getServiceOrderConfirmReceipt */ | |
4935 | +export interface GetServiceOrderConfirmReceiptOption { | |
4936 | + /** | |
4937 | + * @description | |
4923 | 4938 | * id |
4924 | 4939 | * @format int64 |
4925 | 4940 | */ |
... | ... | @@ -4963,6 +4978,7 @@ export type GetServiceOrderConfirmReceiptResponseSuccess = |
4963 | 4978 | * 确认收货 |
4964 | 4979 | * @tags 内部订单 |
4965 | 4980 | * @produces * |
4981 | + * @consumes multipart/form-data | |
4966 | 4982 | */ |
4967 | 4983 | export const getServiceOrderConfirmReceipt = /* #__PURE__ */ (() => { |
4968 | 4984 | const method = 'get'; |
... | ... | @@ -5547,6 +5563,77 @@ export const getServiceOrderProvideToken = /* #__PURE__ */ (() => { |
5547 | 5563 | return request; |
5548 | 5564 | })(); |
5549 | 5565 | |
5566 | +/** @description request parameter type for postServiceOrderQueryProductInformation */ | |
5567 | +export interface PostServiceOrderQueryProductInformationOption { | |
5568 | + /** | |
5569 | + * @description | |
5570 | + * dto | |
5571 | + */ | |
5572 | + body: { | |
5573 | + /** | |
5574 | + @description | |
5575 | + dto */ | |
5576 | + dto: ProductInformationDto; | |
5577 | + }; | |
5578 | +} | |
5579 | + | |
5580 | +/** @description response type for postServiceOrderQueryProductInformation */ | |
5581 | +export interface PostServiceOrderQueryProductInformationResponse { | |
5582 | + /** | |
5583 | + * @description | |
5584 | + * OK | |
5585 | + */ | |
5586 | + 200: ServerResult; | |
5587 | + /** | |
5588 | + * @description | |
5589 | + * Created | |
5590 | + */ | |
5591 | + 201: any; | |
5592 | + /** | |
5593 | + * @description | |
5594 | + * Unauthorized | |
5595 | + */ | |
5596 | + 401: any; | |
5597 | + /** | |
5598 | + * @description | |
5599 | + * Forbidden | |
5600 | + */ | |
5601 | + 403: any; | |
5602 | + /** | |
5603 | + * @description | |
5604 | + * Not Found | |
5605 | + */ | |
5606 | + 404: any; | |
5607 | +} | |
5608 | + | |
5609 | +export type PostServiceOrderQueryProductInformationResponseSuccess = | |
5610 | + PostServiceOrderQueryProductInformationResponse[200]; | |
5611 | +/** | |
5612 | + * @description | |
5613 | + * 查询货品信息 | |
5614 | + * @tags 内部订单 | |
5615 | + * @produces * | |
5616 | + * @consumes application/json | |
5617 | + */ | |
5618 | +export const postServiceOrderQueryProductInformation = /* #__PURE__ */ (() => { | |
5619 | + const method = 'post'; | |
5620 | + const url = '/service/order/queryProductInformation'; | |
5621 | + function request( | |
5622 | + option: PostServiceOrderQueryProductInformationOption, | |
5623 | + ): Promise<PostServiceOrderQueryProductInformationResponseSuccess> { | |
5624 | + return requester(request.url, { | |
5625 | + method: request.method, | |
5626 | + ...option, | |
5627 | + }) as unknown as Promise<PostServiceOrderQueryProductInformationResponseSuccess>; | |
5628 | + } | |
5629 | + | |
5630 | + /** http method */ | |
5631 | + request.method = method; | |
5632 | + /** request url */ | |
5633 | + request.url = url; | |
5634 | + return request; | |
5635 | +})(); | |
5636 | + | |
5550 | 5637 | /** @description request parameter type for postServiceOrderQueryServiceOrder */ |
5551 | 5638 | export interface PostServiceOrderQueryServiceOrderOption { |
5552 | 5639 | /** | ... | ... |
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://39.108.227.113:8085/v2/api-docs', | |
36 | + source: 'http://localhost:8085/request.json', | |
37 | 37 | |
38 | 38 | // source: 'https://petstore3.swagger.io/api/v3/openapi.json', |
39 | 39 | // source: './fixture/pet.json', | ... | ... |