diff --git a/src/app.ts b/src/app.ts index 330f003..0407140 100644 --- a/src/app.ts +++ b/src/app.ts @@ -90,7 +90,7 @@ export const request: RequestConfig = { (response) => { // 不再需要异步处理读取返回体内容,可直接在data中读出,部分字段可在 config 中找到 const { data = {} as any } = response; - if (data.code !== RESPONSE_CODE.SUCCESS) { + if (data.result !== RESPONSE_CODE.SUCCESS) { message.error('服务器错误,请稍后再试!'); } // do something diff --git a/src/pages/Order/components/OrderDrawer.tsx b/src/pages/Order/components/OrderDrawer.tsx index 5b63cef..192704f 100644 --- a/src/pages/Order/components/OrderDrawer.tsx +++ b/src/pages/Order/components/OrderDrawer.tsx @@ -1,10 +1,14 @@ -import { postServiceOrderAddOrder } from '@/services'; +import { + postServiceOrderAddOrder, + postServiceOrderQueryProductInformation, +} from '@/services'; import { enumToSelect } from '@/utils'; import { DrawerForm, FormListActionType, ProCard, ProFormDateTimePicker, + ProFormDigit, ProFormGroup, ProFormList, ProFormSelect, @@ -35,6 +39,10 @@ export default ({ onClose, data }) => { form.setFieldsValue({ ...data }); }, [data]); + function autoFillProductInfo(action) { + console.log(action); + } + return ( <DrawerForm<{ name: string; @@ -354,20 +362,34 @@ export default ({ onClose, data }) => { actionRef={actionRef} > <ProFormGroup key="group"> - <ProFormText + <ProFormSelect + label="商品名称" width="lg" + showSearch name="productName" - label="商品名称" - placeholder="请输入商品名称" + placeholder="请搜索商品" + onChange={() => { + autoFillProductInfo(actionRef); + }} + request={async (value) => { + const { data } = await postServiceOrderQueryProductInformation({ + data: { productName: value.keyWords }, + }); + return data.map((p: any) => { + return { ...p, label: p.productName, value: p.id }; + }); + }} /> <ProFormText width="lg" name="productCode" + disabled label="商品编码" placeholder="未输入商品名称" /> <ProFormText width="lg" + disabled name="parameters" label="商品参数" placeholder="请输入商品参数" @@ -378,7 +400,7 @@ export default ({ onClose, data }) => { label="商品数量" placeholder="请输入商品数量" /> - <ProFormText + <ProFormDigit width="lg" name="productPrice" label="商品单价" @@ -387,11 +409,12 @@ export default ({ onClose, data }) => { <ProFormText width="lg" name="unit" + disabled label="价格单位" placeholder="请输入价格单位" /> - <ProFormText + <ProFormDigit width="lg" name="subOrderPayment" label="子订单金额" diff --git a/src/services/definition.ts b/src/services/definition.ts index be8ca47..c5271e2 100644 --- a/src/services/definition.ts +++ b/src/services/definition.ts @@ -687,6 +687,19 @@ export interface OrderUpdateVO { trackStageInfo?: OrderTrackStageVO; } +export interface ProductInformationDto { + /** + * @description + * 货品编码 + */ + productCode?: string; + /** + * @description + * 货品名称 + */ + productName?: string; +} + export interface ResetPwdVO { /** @format int64 */ userId?: number; diff --git a/src/services/request.ts b/src/services/request.ts index 99fed18..0e091b9 100644 --- a/src/services/request.ts +++ b/src/services/request.ts @@ -34,6 +34,7 @@ import type { OrderProfitAnalysisVo, OrderUnlockFieldApplyVO, OrderUpdateVO, + ProductInformationDto, ResetPwdVO, ServerResult, SysLogQueryVO, @@ -4920,6 +4921,20 @@ export const postServiceOrderCheckOrder = /* #__PURE__ */ (() => { export interface GetServiceOrderConfirmReceiptOption { /** * @description + * file + */ + formData: { + /** + @description + file */ + file: File; + }; +} + +/** @description request parameter type for getServiceOrderConfirmReceipt */ +export interface GetServiceOrderConfirmReceiptOption { + /** + * @description * id * @format int64 */ @@ -4963,6 +4978,7 @@ export type GetServiceOrderConfirmReceiptResponseSuccess = * 确认收货 * @tags 内部订单 * @produces * + * @consumes multipart/form-data */ export const getServiceOrderConfirmReceipt = /* #__PURE__ */ (() => { const method = 'get'; @@ -5547,6 +5563,77 @@ export const getServiceOrderProvideToken = /* #__PURE__ */ (() => { return request; })(); +/** @description request parameter type for postServiceOrderQueryProductInformation */ +export interface PostServiceOrderQueryProductInformationOption { + /** + * @description + * dto + */ + body: { + /** + @description + dto */ + dto: ProductInformationDto; + }; +} + +/** @description response type for postServiceOrderQueryProductInformation */ +export interface PostServiceOrderQueryProductInformationResponse { + /** + * @description + * OK + */ + 200: ServerResult; + /** + * @description + * Created + */ + 201: any; + /** + * @description + * Unauthorized + */ + 401: any; + /** + * @description + * Forbidden + */ + 403: any; + /** + * @description + * Not Found + */ + 404: any; +} + +export type PostServiceOrderQueryProductInformationResponseSuccess = + PostServiceOrderQueryProductInformationResponse[200]; +/** + * @description + * 查询货品信息 + * @tags 内部订单 + * @produces * + * @consumes application/json + */ +export const postServiceOrderQueryProductInformation = /* #__PURE__ */ (() => { + const method = 'post'; + const url = '/service/order/queryProductInformation'; + function request( + option: PostServiceOrderQueryProductInformationOption, + ): Promise<PostServiceOrderQueryProductInformationResponseSuccess> { + return requester(request.url, { + method: request.method, + ...option, + }) as unknown as Promise<PostServiceOrderQueryProductInformationResponseSuccess>; + } + + /** http method */ + request.method = method; + /** request url */ + request.url = url; + return request; +})(); + /** @description request parameter type for postServiceOrderQueryServiceOrder */ export interface PostServiceOrderQueryServiceOrderOption { /** diff --git a/src/tsg.config.ts b/src/tsg.config.ts index f565131..22dfb57 100644 --- a/src/tsg.config.ts +++ b/src/tsg.config.ts @@ -33,7 +33,7 @@ const projects: Project[] = [ * openapi 文档地址,可以是远程的json文件,也可以是本地的json文件 * 如果使用本地文件,相对路径以当前'tsg.config.ts'为基准 * */ - source: 'http://39.108.227.113:8085/v2/api-docs', + source: 'http://localhost:8085/request.json', // source: 'https://petstore3.swagger.io/api/v3/openapi.json', // source: './fixture/pet.json',