Commit 70550778ebd715353642b132ed6b75c69bc585fa

Authored by 曾国涛
1 parent 0d00c8c5

refactor(Order): 重构开票申请功能

- 新增 type 参数区分申请开票和重新申请- 优化界面布局和字段显示逻辑
- 提高代码复用性和可维护性
src/pages/Order/OrderList/InvoicingDrawerForm.tsx
@@ -34,7 +34,13 @@ import { @@ -34,7 +34,13 @@ import {
34 import { Button, Divider, Form, Space, Tooltip, message } from 'antd'; 34 import { Button, Divider, Form, Space, Tooltip, message } from 'antd';
35 import { useEffect, useRef, useState } from 'react'; 35 import { useEffect, useRef, useState } from 'react';
36 36
37 -export default ({ dataList, setVisible, mainOrder, onClose }) => { 37 +export default ({
  38 + dataList,
  39 + setVisible,
  40 + mainOrder,
  41 + onClose,
  42 + type = 'applyInvoicing',
  43 +}) => {
38 // let subOrderIds = dataList?.map((item) => { 44 // let subOrderIds = dataList?.map((item) => {
39 // return item.id; 45 // return item.id;
40 // }) 46 // })
@@ -76,7 +82,12 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { @@ -76,7 +82,12 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => {
76 }, []); 82 }, []);
77 83
78 useEffect(() => {}, [projectOptions]); 84 useEffect(() => {}, [projectOptions]);
79 - 85 + const types = new Map();
  86 + types.set('applyInvoicing', {
  87 + title: '申请开票',
  88 + subOrderIdsName: '开票订单',
  89 + });
  90 + types.set('reissue', { title: '重新申请', subOrderIdsName: '重开订单' });
80 function copyToClipboard(text: string) { 91 function copyToClipboard(text: string) {
81 // 创建一个临时的textarea元素 92 // 创建一个临时的textarea元素
82 const textarea = document.createElement('textarea'); 93 const textarea = document.createElement('textarea');
@@ -119,7 +130,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { @@ -119,7 +130,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => {
119 return ( 130 return (
120 <DrawerForm 131 <DrawerForm
121 open 132 open
122 - title="申请开票" 133 + title={types.get(type).title}
123 resize={{ 134 resize={{
124 maxWidth: window.innerWidth * 0.8, 135 maxWidth: window.innerWidth * 0.8,
125 minWidth: 500, 136 minWidth: 500,
@@ -188,7 +199,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) =&gt; { @@ -188,7 +199,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) =&gt; {
188 <ProFormList 199 <ProFormList
189 name="subOrderIdObjs" 200 name="subOrderIdObjs"
190 readonly={true} 201 readonly={true}
191 - label="开票订单" 202 + label={types.get(type).subOrderIdsName}
192 initialValue={dataListCopy.map((item) => { 203 initialValue={dataListCopy.map((item) => {
193 return { 204 return {
194 value: item.id, 205 value: item.id,
@@ -202,6 +213,23 @@ export default ({ dataList, setVisible, mainOrder, onClose }) =&gt; { @@ -202,6 +213,23 @@ export default ({ dataList, setVisible, mainOrder, onClose }) =&gt; {
202 </ProFormGroup> 213 </ProFormGroup>
203 </ProFormList> 214 </ProFormList>
204 <ProFormSelect 215 <ProFormSelect
  216 + name="invoices"
  217 + label="invoices"
  218 + request={async () => {
  219 + let reissueIds = dataListCopy.map((item) => {
  220 + return item.id;
  221 + });
  222 + let res = await postServiceInvoiceWaitReissueInvoices({
  223 + data: reissueIds,
  224 + });
  225 + return enum2ReverseSelect(res.data);
  226 + }}
  227 + fieldProps={{
  228 + mode: 'multiple',
  229 + }}
  230 + placeholder="请选择要重开的发票"
  231 + />
  232 + <ProFormSelect
205 name="ReissueInvoiceRecordIds" 233 name="ReissueInvoiceRecordIds"
206 label="重开的发票" 234 label="重开的发票"
207 fieldProps={{ 235 fieldProps={{
src/services/definition.ts
@@ -2553,23 +2553,16 @@ export interface OrderStagesFromDo { @@ -2553,23 +2553,16 @@ export interface OrderStagesFromDo {
2553 } 2553 }
2554 2554
2555 export interface OrderStagesPayWay { 2555 export interface OrderStagesPayWay {
2556 - createByName?: string;  
2557 - /** @format date-time */  
2558 - createTime?: string;  
2559 /** @format date-time */ 2556 /** @format date-time */
2560 dateRange?: string; 2557 dateRange?: string;
2561 fileName?: string; 2558 fileName?: string;
2562 fileUrl?: string; 2559 fileUrl?: string;
2563 /** @format int32 */ 2560 /** @format int32 */
2564 id?: number; 2561 id?: number;
2565 - logicDelete?: boolean;  
2566 /** @format int32 */ 2562 /** @format int32 */
2567 number?: number; 2563 number?: number;
2568 /** @format int32 */ 2564 /** @format int32 */
2569 ossId?: number; 2565 ossId?: number;
2570 - updateByName?: string;  
2571 - /** @format date-time */  
2572 - updateTime?: string;  
2573 } 2566 }
2574 2567
2575 export interface OrderStagesPayWayDo { 2568 export interface OrderStagesPayWayDo {
@@ -3940,15 +3933,16 @@ export interface SystemCustomFieldReq { @@ -3940,15 +3933,16 @@ export interface SystemCustomFieldReq {
3940 entityNumber?: string; 3933 entityNumber?: string;
3941 } 3934 }
3942 3935
  3936 +export interface TicketsDeteleVo {
  3937 + ids?: Array<number>;
  3938 +}
  3939 +
3943 export interface TicketsSearchVo { 3940 export interface TicketsSearchVo {
3944 annexName?: string; 3941 annexName?: string;
3945 annexUrl?: string; 3942 annexUrl?: string;
3946 assignPeople?: string; 3943 assignPeople?: string;
3947 createByName?: string; 3944 createByName?: string;
3948 - /** @format date-time */  
3949 - createTimeBegin?: string;  
3950 - /** @format date-time */  
3951 - createTimeEnd?: string; 3945 + createTime?: Array<LocalDateTime>;
3952 /** @format int32 */ 3946 /** @format int32 */
3953 current?: number; 3947 current?: number;
3954 detailText?: string; 3948 detailText?: string;
@@ -3959,10 +3953,7 @@ export interface TicketsSearchVo { @@ -3959,10 +3953,7 @@ export interface TicketsSearchVo {
3959 origin?: string; 3953 origin?: string;
3960 /** @format int32 */ 3954 /** @format int32 */
3961 pageSize?: number; 3955 pageSize?: number;
3962 - /** @format date-time */  
3963 - resolveTimeBegin?: string;  
3964 - /** @format date-time */  
3965 - resolveTimeEnd?: string; 3956 + resolveTime?: Array<LocalDateTime>;
3966 /** @format int32 */ 3957 /** @format int32 */
3967 start?: number; 3958 start?: number;
3968 status?: string; 3959 status?: string;
@@ -3981,6 +3972,9 @@ export interface TicketsVo { @@ -3981,6 +3972,9 @@ export interface TicketsVo {
3981 /** @format int64 */ 3972 /** @format int64 */
3982 id?: number; 3973 id?: number;
3983 origin?: string; 3974 origin?: string;
  3975 + result?: string;
  3976 + resultAnnexName?: string;
  3977 + resultAnnexUrl?: string;
3984 status?: string; 3978 status?: string;
3985 type?: string; 3979 type?: string;
3986 } 3980 }
@@ -4367,6 +4361,7 @@ export interface ClientCommunicationInfo { @@ -4367,6 +4361,7 @@ export interface ClientCommunicationInfo {
4367 ticketsAttachments?: string; 4361 ticketsAttachments?: string;
4368 ticketsDetail?: string; 4362 ticketsDetail?: string;
4369 ticketsType?: string; 4363 ticketsType?: string;
  4364 + ticketsTypeText?: string;
4370 /** 4365 /**
4371 * @description 4366 * @description
4372 * 客户状态 4367 * 客户状态
@@ -4992,3 +4987,5 @@ export interface Dto { @@ -4992,3 +4987,5 @@ export interface Dto {
4992 */ 4987 */
4993 subOrderIds?: Array<string>; 4988 subOrderIds?: Array<string>;
4994 } 4989 }
  4990 +
  4991 +export type LocalDateTime = any;
src/services/request.ts
@@ -133,6 +133,7 @@ import type { @@ -133,6 +133,7 @@ import type {
133 StoreOrderInvoiceRequest, 133 StoreOrderInvoiceRequest,
134 SysLogQueryVO, 134 SysLogQueryVO,
135 SystemCustomFieldReq, 135 SystemCustomFieldReq,
  136 + TicketsDeteleVo,
136 TicketsSearchVo, 137 TicketsSearchVo,
137 TicketsVo, 138 TicketsVo,
138 ToProcureAuditDto, 139 ToProcureAuditDto,
@@ -5218,6 +5219,77 @@ export const postOrderErpAuditWaitAuditList = /* #__PURE__ */ (() =&gt; { @@ -5218,6 +5219,77 @@ export const postOrderErpAuditWaitAuditList = /* #__PURE__ */ (() =&gt; {
5218 return request; 5219 return request;
5219 })(); 5220 })();
5220 5221
  5222 +/** @description request parameter type for postOrderErpAuthGenerateToken */
  5223 +export interface PostOrderErpAuthGenerateTokenOption {
  5224 + /**
  5225 + * @description
  5226 + * tokenApiDto
  5227 + */
  5228 + body: {
  5229 + /**
  5230 + @description
  5231 + tokenApiDto */
  5232 + tokenApiDto: TokenApiDto;
  5233 + };
  5234 +}
  5235 +
  5236 +/** @description response type for postOrderErpAuthGenerateToken */
  5237 +export interface PostOrderErpAuthGenerateTokenResponse {
  5238 + /**
  5239 + * @description
  5240 + * OK
  5241 + */
  5242 + 200: ServerResult;
  5243 + /**
  5244 + * @description
  5245 + * Created
  5246 + */
  5247 + 201: any;
  5248 + /**
  5249 + * @description
  5250 + * Unauthorized
  5251 + */
  5252 + 401: any;
  5253 + /**
  5254 + * @description
  5255 + * Forbidden
  5256 + */
  5257 + 403: any;
  5258 + /**
  5259 + * @description
  5260 + * Not Found
  5261 + */
  5262 + 404: any;
  5263 +}
  5264 +
  5265 +export type PostOrderErpAuthGenerateTokenResponseSuccess =
  5266 + PostOrderErpAuthGenerateTokenResponse[200];
  5267 +/**
  5268 + * @description
  5269 + * 生成token
  5270 + * @tags login-controller
  5271 + * @produces *
  5272 + * @consumes application/json
  5273 + */
  5274 +export const postOrderErpAuthGenerateToken = /* #__PURE__ */ (() => {
  5275 + const method = 'post';
  5276 + const url = '/order/erp/auth/generateToken';
  5277 + function request(
  5278 + option: PostOrderErpAuthGenerateTokenOption,
  5279 + ): Promise<PostOrderErpAuthGenerateTokenResponseSuccess> {
  5280 + return requester(request.url, {
  5281 + method: request.method,
  5282 + ...option,
  5283 + }) as unknown as Promise<PostOrderErpAuthGenerateTokenResponseSuccess>;
  5284 + }
  5285 +
  5286 + /** http method */
  5287 + request.method = method;
  5288 + /** request url */
  5289 + request.url = url;
  5290 + return request;
  5291 +})();
  5292 +
5221 /** @description request parameter type for postOrderErpAuthLoginByPhone */ 5293 /** @description request parameter type for postOrderErpAuthLoginByPhone */
5222 export interface PostOrderErpAuthLoginByPhoneOption { 5294 export interface PostOrderErpAuthLoginByPhoneOption {
5223 /** 5295 /**
@@ -9985,13 +10057,13 @@ export const postOrderErpTicketsCreate = /* #__PURE__ */ (() =&gt; { @@ -9985,13 +10057,13 @@ export const postOrderErpTicketsCreate = /* #__PURE__ */ (() =&gt; {
9985 export interface PostOrderErpTicketsDeleteOption { 10057 export interface PostOrderErpTicketsDeleteOption {
9986 /** 10058 /**
9987 * @description 10059 * @description
9988 - * ids 10060 + * ticketsDeteleVo
9989 */ 10061 */
9990 - query: { 10062 + body: {
9991 /** 10063 /**
9992 @description 10064 @description
9993 - ids */  
9994 - ids: Array<number>; 10065 + ticketsDeteleVo */
  10066 + ticketsDeteleVo: TicketsDeteleVo;
9995 }; 10067 };
9996 } 10068 }
9997 10069