Commit 8efee6b5ad8cbc65f0571eacedc7a1cde022067d
1 parent
4e3604e2
feat: 改进分期账单的显示
Showing
1 changed file
with
173 additions
and
118 deletions
src/pages/Instalment/components/title/titletest.tsx
... | ... | @@ -7,7 +7,7 @@ import { orderExport } from '@/services/order'; |
7 | 7 | import { VerticalAlignTopOutlined } from '@ant-design/icons'; |
8 | 8 | import type { ProColumns } from '@ant-design/pro-components'; |
9 | 9 | import { EditableProTable } from '@ant-design/pro-components'; |
10 | -import { Button, Tag, message } from 'antd'; | |
10 | +import { Badge, Button, Tag, message } from 'antd'; | |
11 | 11 | import { useRef } from 'react'; |
12 | 12 | import CheckModal from '../checkModal/checkModal'; |
13 | 13 | import Comfire from '../comfire/comfire'; |
... | ... | @@ -67,7 +67,8 @@ type OrderStagesItem = { |
67 | 67 | //审核备注 |
68 | 68 | statusMark?: string; |
69 | 69 | //子类 |
70 | - children?: OrderStagesItem[]; | |
70 | + // children?: OrderStagesItem[]; | |
71 | + orderStagesDeviceVoList: orderStagesDevice[]; | |
71 | 72 | }; |
72 | 73 | |
73 | 74 | type OrderStagesWithListItem = { |
... | ... | @@ -206,13 +207,31 @@ export default () => { |
206 | 207 | disable: true, |
207 | 208 | onFilter: true, |
208 | 209 | ellipsis: true, |
209 | - // render: (_, record) => { | |
210 | - // if (record.id) { | |
211 | - // const text = record?.id.toString(); | |
212 | - // const paddedText = '0'.repeat(4 - text.length) + text; | |
213 | - // return paddedText; | |
214 | - // } | |
215 | - // }, | |
210 | + // align: 'center', | |
211 | + render: (_, record) => { | |
212 | + if (record?.id) { | |
213 | + const text = record?.id?.toString(); | |
214 | + const paddedText = '0'.repeat(4 - text.length) + text; | |
215 | + return ( | |
216 | + <> | |
217 | + {paddedText} | |
218 | + {record?.orderStagesDeviceVoList?.length > 1 && ( | |
219 | + <> | |
220 | + <Badge | |
221 | + count={record?.orderStagesDeviceVoList?.length} | |
222 | + style={{ | |
223 | + marginBlockStart: -2, | |
224 | + marginInlineStart: 4, | |
225 | + color: '#1890FF', | |
226 | + backgroundColor: '#E6F7FF', | |
227 | + }} | |
228 | + /> | |
229 | + </> | |
230 | + )} | |
231 | + </> | |
232 | + ); | |
233 | + } | |
234 | + }, | |
216 | 235 | }, |
217 | 236 | { |
218 | 237 | title: '签合同日期', |
... | ... | @@ -277,7 +296,7 @@ export default () => { |
277 | 296 | return <Tag color="red">审核未通过</Tag>; |
278 | 297 | } |
279 | 298 | } |
280 | - return <Tag color="orange">暂无状态</Tag>; | |
299 | + // return <Tag color="orange">暂无状态</Tag>; | |
281 | 300 | }, |
282 | 301 | }, |
283 | 302 | { |
... | ... | @@ -287,6 +306,8 @@ export default () => { |
287 | 306 | disable: true, |
288 | 307 | onFilter: true, |
289 | 308 | ellipsis: true, |
309 | + hideInTable: true, | |
310 | + hideInSearch: true, | |
290 | 311 | }, |
291 | 312 | { |
292 | 313 | title: '设备型号', |
... | ... | @@ -296,6 +317,7 @@ export default () => { |
296 | 317 | disable: true, |
297 | 318 | onFilter: true, |
298 | 319 | ellipsis: true, |
320 | + hideInTable: true, | |
299 | 321 | }, |
300 | 322 | { |
301 | 323 | title: '数量', |
... | ... | @@ -305,6 +327,7 @@ export default () => { |
305 | 327 | disable: true, |
306 | 328 | onFilter: true, |
307 | 329 | ellipsis: true, |
330 | + hideInTable: true, | |
308 | 331 | }, |
309 | 332 | { |
310 | 333 | title: '单价', |
... | ... | @@ -314,6 +337,7 @@ export default () => { |
314 | 337 | disable: true, |
315 | 338 | onFilter: true, |
316 | 339 | ellipsis: true, |
340 | + hideInTable: true, | |
317 | 341 | }, |
318 | 342 | { |
319 | 343 | title: '总价', |
... | ... | @@ -323,6 +347,7 @@ export default () => { |
323 | 347 | disable: true, |
324 | 348 | onFilter: true, |
325 | 349 | ellipsis: true, |
350 | + hideInTable: true, | |
326 | 351 | }, |
327 | 352 | { |
328 | 353 | title: '合同总金额', |
... | ... | @@ -456,6 +481,27 @@ export default () => { |
456 | 481 | scroll={{ x: 1400, y: 360 }} |
457 | 482 | recordCreatorProps={false} |
458 | 483 | request={async (params) => { |
484 | + if (params.id === '') { | |
485 | + params.id = null; | |
486 | + } | |
487 | + if (params.contract === '') { | |
488 | + params.contract = null; | |
489 | + } | |
490 | + if (params.vendor === '') { | |
491 | + params.vendor = null; | |
492 | + } | |
493 | + if (params.terminal === '') { | |
494 | + params.terminal = null; | |
495 | + } | |
496 | + if (params.deviceName === '') { | |
497 | + params.deviceName = null; | |
498 | + } | |
499 | + if (params.dateRange === '') { | |
500 | + params.dateRange = null; | |
501 | + } | |
502 | + if (params.status === '') { | |
503 | + params.status = null; | |
504 | + } | |
459 | 505 | if ( |
460 | 506 | params.id !== null || |
461 | 507 | params.contract !== null || |
... | ... | @@ -507,6 +553,7 @@ export default () => { |
507 | 553 | opt: undefined, |
508 | 554 | status: undefined, |
509 | 555 | statusMark: undefined, |
556 | + orderStagesDeviceVoList: [], | |
510 | 557 | }; |
511 | 558 | if (index === 0) { |
512 | 559 | item.id = orderStagesWithList[ind].id; |
... | ... | @@ -544,68 +591,72 @@ export default () => { |
544 | 591 | item.remark = orderStagesWithList[ind].remark; |
545 | 592 | item.status = orderStagesWithList[ind].status; |
546 | 593 | item.statusMark = orderStagesWithList[ind].statusMark; |
594 | + item.orderStagesDeviceVoList = | |
595 | + orderStagesWithList[ind].orderStagesDeviceVoList; | |
596 | + // item.children = []; | |
547 | 597 | if (orderStagesWithList[ind].paths) { |
548 | 598 | item.opt = [...orderStagesWithList[ind].paths]; |
549 | 599 | if (orderStagesWithList[ind]?.paths?.includes('READ')) { |
550 | 600 | item.opt.push('ONLYREAD'); |
551 | 601 | } |
552 | 602 | } |
553 | - item.children = []; | |
554 | - if ( | |
555 | - orderStagesWithList[ind].orderStagesDeviceVoList.length <= | |
556 | - 1 | |
557 | - ) { | |
558 | - delete item.children; | |
559 | - } | |
603 | + // item.children = []; | |
604 | + // if ( | |
605 | + // orderStagesWithList[ind].orderStagesDeviceVoList.length <= | |
606 | + // 1 | |
607 | + // ) { | |
608 | + // delete item.children; | |
609 | + // } | |
560 | 610 | orderStagesList.push(item); |
561 | - } else { | |
562 | - item.id = orderStagesWithList[ind].id; | |
563 | - item.contract = orderStagesWithList[ind].contract; | |
564 | - item.vendor = orderStagesWithList[ind].vendor; | |
565 | - item.dateRange = orderStagesWithList[ind].dateRange; | |
566 | - item.terminal = orderStagesWithList[ind].terminal; | |
567 | - item.dId = | |
568 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
569 | - index | |
570 | - ].dId; | |
571 | - item.deviceName = | |
572 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
573 | - index | |
574 | - ].deviceName; | |
575 | - item.deviceModel = | |
576 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
577 | - index | |
578 | - ].deviceModel; | |
579 | - item.count = | |
580 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
581 | - index | |
582 | - ].count; | |
583 | - item.unitPrice = | |
584 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
585 | - index | |
586 | - ].unitPrice; | |
587 | - item.price = | |
588 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
589 | - index | |
590 | - ].price; | |
591 | - item.totalPrice = orderStagesWithList[ind].totalPrice; | |
592 | - item.payWay = orderStagesWithList[ind].payWay; | |
593 | - item.annex = orderStagesWithList[ind].annex; | |
594 | - item.remark = orderStagesWithList[ind].remark; | |
595 | - if (orderStagesWithList[ind].paths) { | |
596 | - if (orderStagesList[ind]?.opt?.includes('READ')) { | |
597 | - item.opt = ['ONLYREAD']; | |
598 | - } | |
599 | - } | |
600 | - item.status = orderStagesWithList[ind].status; | |
601 | - item.statusMark = orderStagesWithList[ind].statusMark; | |
602 | - if ( | |
603 | - orderStagesWithList[ind].orderStagesDeviceVoList.length > | |
604 | - 1 | |
605 | - ) { | |
606 | - orderStagesList[ind].children?.push(item); | |
607 | - } | |
608 | 611 | } |
612 | + // else { | |
613 | + // item.id = orderStagesWithList[ind].id; | |
614 | + // item.contract = orderStagesWithList[ind].contract; | |
615 | + // item.vendor = orderStagesWithList[ind].vendor; | |
616 | + // item.dateRange = orderStagesWithList[ind].dateRange; | |
617 | + // item.terminal = orderStagesWithList[ind].terminal; | |
618 | + // item.dId = | |
619 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
620 | + // index | |
621 | + // ].dId; | |
622 | + // item.deviceName = | |
623 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
624 | + // index | |
625 | + // ].deviceName; | |
626 | + // item.deviceModel = | |
627 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
628 | + // index | |
629 | + // ].deviceModel; | |
630 | + // item.count = | |
631 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
632 | + // index | |
633 | + // ].count; | |
634 | + // item.unitPrice = | |
635 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
636 | + // index | |
637 | + // ].unitPrice; | |
638 | + // item.price = | |
639 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
640 | + // index | |
641 | + // ].price; | |
642 | + // item.totalPrice = orderStagesWithList[ind].totalPrice; | |
643 | + // item.payWay = orderStagesWithList[ind].payWay; | |
644 | + // item.annex = orderStagesWithList[ind].annex; | |
645 | + // item.remark = orderStagesWithList[ind].remark; | |
646 | + // if (orderStagesWithList[ind].paths) { | |
647 | + // if (orderStagesList[ind]?.opt?.includes('READ')) { | |
648 | + // item.opt = ['ONLYREAD']; | |
649 | + // } | |
650 | + // } | |
651 | + // item.status = orderStagesWithList[ind].status; | |
652 | + // item.statusMark = orderStagesWithList[ind].statusMark; | |
653 | + // if ( | |
654 | + // orderStagesWithList[ind].orderStagesDeviceVoList.length > | |
655 | + // 1 | |
656 | + // ) { | |
657 | + // orderStagesList[ind].children?.push(item); | |
658 | + // } | |
659 | + // } | |
609 | 660 | } |
610 | 661 | } |
611 | 662 | return { |
... | ... | @@ -642,9 +693,10 @@ export default () => { |
642 | 693 | annex: undefined, |
643 | 694 | remark: undefined, |
644 | 695 | opt: undefined, |
645 | - children: undefined, | |
696 | + // children: undefined, | |
646 | 697 | status: undefined, |
647 | 698 | statusMark: undefined, |
699 | + orderStagesDeviceVoList: [], | |
648 | 700 | }; |
649 | 701 | if (index === 0) { |
650 | 702 | item.id = orderStagesWithList[ind].id; |
... | ... | @@ -683,67 +735,70 @@ export default () => { |
683 | 735 | item.opt = orderStagesWithList[ind].paths; |
684 | 736 | item.status = orderStagesWithList[ind].status; |
685 | 737 | item.statusMark = orderStagesWithList[ind].statusMark; |
738 | + item.orderStagesDeviceVoList = | |
739 | + orderStagesWithList[ind].orderStagesDeviceVoList; | |
686 | 740 | if (orderStagesWithList[ind].paths) { |
687 | 741 | item.opt = [...orderStagesWithList[ind].paths]; |
688 | 742 | if (orderStagesWithList[ind]?.paths?.includes('READ')) { |
689 | 743 | item.opt.push('ONLYREAD'); |
690 | 744 | } |
691 | 745 | } |
692 | - if ( | |
693 | - orderStagesWithList[ind].orderStagesDeviceVoList.length <= | |
694 | - 1 | |
695 | - ) { | |
696 | - delete item.children; | |
697 | - } | |
746 | + // if ( | |
747 | + // orderStagesWithList[ind].orderStagesDeviceVoList.length <= | |
748 | + // 1 | |
749 | + // ) { | |
750 | + // delete item.children; | |
751 | + // } | |
698 | 752 | orderStagesList.push(item); |
699 | - } else { | |
700 | - item.id = orderStagesWithList[ind].id; | |
701 | - item.contract = orderStagesWithList[ind].contract; | |
702 | - item.vendor = orderStagesWithList[ind].vendor; | |
703 | - item.dateRange = orderStagesWithList[ind].dateRange; | |
704 | - item.terminal = orderStagesWithList[ind].terminal; | |
705 | - item.dId = | |
706 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
707 | - index | |
708 | - ].dId; | |
709 | - item.deviceName = | |
710 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
711 | - index | |
712 | - ].deviceName; | |
713 | - item.deviceModel = | |
714 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
715 | - index | |
716 | - ].deviceModel; | |
717 | - item.count = | |
718 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
719 | - index | |
720 | - ].count; | |
721 | - item.unitPrice = | |
722 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
723 | - index | |
724 | - ].unitPrice; | |
725 | - item.price = | |
726 | - orderStagesWithList[ind].orderStagesDeviceVoList[ | |
727 | - index | |
728 | - ].price; | |
729 | - item.totalPrice = orderStagesWithList[ind].totalPrice; | |
730 | - item.payWay = orderStagesWithList[ind].payWay; | |
731 | - item.annex = orderStagesWithList[ind].annex; | |
732 | - item.remark = orderStagesWithList[ind].remark; | |
733 | - if (orderStagesWithList[ind].paths) { | |
734 | - if (orderStagesList[ind]?.opt?.includes('READ')) { | |
735 | - item.opt = ['ONLYREAD']; | |
736 | - } | |
737 | - } | |
738 | - item.status = orderStagesWithList[ind].status; | |
739 | - item.statusMark = orderStagesWithList[ind].statusMark; | |
740 | - if ( | |
741 | - orderStagesWithList[ind].orderStagesDeviceVoList.length > | |
742 | - 1 | |
743 | - ) { | |
744 | - orderStagesList[ind].children?.push(item); | |
745 | - } | |
746 | 753 | } |
754 | + // else { | |
755 | + // item.id = orderStagesWithList[ind].id; | |
756 | + // item.contract = orderStagesWithList[ind].contract; | |
757 | + // item.vendor = orderStagesWithList[ind].vendor; | |
758 | + // item.dateRange = orderStagesWithList[ind].dateRange; | |
759 | + // item.terminal = orderStagesWithList[ind].terminal; | |
760 | + // item.dId = | |
761 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
762 | + // index | |
763 | + // ].dId; | |
764 | + // item.deviceName = | |
765 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
766 | + // index | |
767 | + // ].deviceName; | |
768 | + // item.deviceModel = | |
769 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
770 | + // index | |
771 | + // ].deviceModel; | |
772 | + // item.count = | |
773 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
774 | + // index | |
775 | + // ].count; | |
776 | + // item.unitPrice = | |
777 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
778 | + // index | |
779 | + // ].unitPrice; | |
780 | + // item.price = | |
781 | + // orderStagesWithList[ind].orderStagesDeviceVoList[ | |
782 | + // index | |
783 | + // ].price; | |
784 | + // item.totalPrice = orderStagesWithList[ind].totalPrice; | |
785 | + // item.payWay = orderStagesWithList[ind].payWay; | |
786 | + // item.annex = orderStagesWithList[ind].annex; | |
787 | + // item.remark = orderStagesWithList[ind].remark; | |
788 | + // if (orderStagesWithList[ind].paths) { | |
789 | + // if (orderStagesList[ind]?.opt?.includes('READ')) { | |
790 | + // item.opt = ['ONLYREAD']; | |
791 | + // } | |
792 | + // } | |
793 | + // item.status = orderStagesWithList[ind].status; | |
794 | + // item.statusMark = orderStagesWithList[ind].statusMark; | |
795 | + // if ( | |
796 | + // orderStagesWithList[ind].orderStagesDeviceVoList.length > | |
797 | + // 1 | |
798 | + // ) { | |
799 | + // orderStagesList[ind].children?.push(item); | |
800 | + // } | |
801 | + // } | |
747 | 802 | } |
748 | 803 | } |
749 | 804 | return { | ... | ... |