Commit ec2c129ce7acf9cdddb1dcf39e40db108104aaec

Authored by zhongnanhuang
1 parent b4bdf836

feat: update

src/pages/Order/components/Financial.tsx renamed to src/pages/Order/components/FinancialReceiptsModal.tsx
... ... @@ -2,7 +2,7 @@ import { ModalForm } from '@ant-design/pro-components';
2 2 import { Form } from 'antd';
3 3  
4 4 // import { cloneDeep } from 'lodash';
5   -export default ({ setCheckVisible, onClose }) => {
  5 +export default ({ setVisible, onClose }) => {
6 6 const [form] = Form.useForm<{ name: string; company: string }>();
7 7  
8 8 return (
... ... @@ -21,14 +21,14 @@ export default ({ setCheckVisible, onClose }) =&gt; {
21 21 cancelText: '取消',
22 22 destroyOnClose: true,
23 23 onCancel: () => {
24   - setCheckVisible(false);
  24 + setVisible(false);
25 25 },
26 26 }}
27 27 onFinish={async (values) => {
28 28 console.log(values);
29 29 onClose();
30 30 }}
31   - onOpenChange={setCheckVisible}
  31 + onOpenChange={setVisible}
32 32 ></ModalForm>
33 33 </>
34 34 );
... ...
src/pages/Order/components/HistoryModal.tsx
... ... @@ -17,6 +17,9 @@ export default ({ subOrders, isCancelledOrder, onClose }) =&gt; {
17 17 onClose();
18 18 };
19 19  
  20 + /**
  21 + * 获取历史记录
  22 + */
20 23 const getHistory = async () => {
21 24 let res = await postServiceOrderQueryHistoryOrderRecord({
22 25 data: { ids: subOrderIds, isDeleteQueryOrder: isCancelledOrder },
... ... @@ -25,6 +28,60 @@ export default ({ subOrders, isCancelledOrder, onClose }) =&gt; {
25 28 setLoading(false);
26 29 };
27 30  
  31 + const getRecord = (history: any) => {
  32 + let record = [];
  33 + record.push(
  34 + <span className="pr-2 text-[#5E5E5E]">
  35 + {formatDateTime(history.createTime)}
  36 + </span>,
  37 + );
  38 +
  39 + record.push(<span className="text-[#3b83e5]">{history.createByName}</span>);
  40 +
  41 + record.push(<span>进行了</span>);
  42 +
  43 + record.push(
  44 + <span className="text-[#3b83e5]">
  45 + {HISTORY_OPT_TYPE.get(history.record)}
  46 + </span>,
  47 + );
  48 +
  49 + let label = enumValueToLabel(history.status, ORDER_STATUS_OPTIONS);
  50 +
  51 + if (
  52 + history.record !== 'INVOICING' &&
  53 + history.record?.indexOf(':') === -1 &&
  54 + label !== undefined &&
  55 + label !== ''
  56 + ) {
  57 + record.push(
  58 + <>
  59 + <span>,订单状态为:</span>
  60 + <span className="text-[#3b83e5]">{label}</span>
  61 + </>,
  62 + );
  63 + }
  64 +
  65 + if (history.record?.indexOf(':') !== -1) {
  66 + let values = history.record?.split(':');
  67 + //采购转发
  68 + if (values[0] === 'PROCURE_CONVERT_PROCURE') {
  69 + record.push(
  70 + <>
  71 + <span>采购转发,{history.createByName}将订单转发给了</span>
  72 + <span className="text-[#3b83e5]">{values[1]}</span>
  73 + </>,
  74 + );
  75 + }
  76 + }
  77 +
  78 + if (history.notes !== null) {
  79 + record.push(<span className="pl-1">{'备注:' + history.notes}</span>);
  80 + }
  81 +
  82 + return record;
  83 + };
  84 +
28 85 useEffect(() => {
29 86 getHistory();
30 87 }, []);
... ... @@ -66,40 +123,7 @@ export default ({ subOrders, isCancelledOrder, onClose }) =&gt; {
66 123 {item.historySubOrderRecordDto?.map((history) => {
67 124 return (
68 125 <div className="py-1" key={history.id}>
69   - <span className="pr-2 text-[#5E5E5E]">
70   - {formatDateTime(history.createTime)}
71   - </span>
72   - <span className="text-[#3b83e5]">
73   - {history.createByName}
74   - </span>
75   - 进行了
76   - <span className="text-[#3b83e5]">
77   - {HISTORY_OPT_TYPE.get(history.record)}
78   - </span>
79   - {history.record !== 'INVOICING' &&
80   - enumValueToLabel(
81   - history.status,
82   - ORDER_STATUS_OPTIONS,
83   - ) !== undefined
84   - ? ',订单状态为:'
85   - : ''}
86   - <span className="text-[#3b83e5]">
87   - {history.status === null ? '已作废' : ''}
88   - {history.status !== null &&
89   - history.status !== 'INVOICING'
90   - ? enumValueToLabel(
91   - history.status,
92   - ORDER_STATUS_OPTIONS,
93   - )
94   - : ''}
95   - </span>
96   - {history.notes !== null ? (
97   - <span className="pl-1">
98   - {'备注:' + history.notes}
99   - </span>
100   - ) : (
101   - ''
102   - )}
  126 + {getRecord(history)}
103 127 </div>
104 128 );
105 129 })}
... ...
src/pages/Order/index.tsx
... ... @@ -56,6 +56,7 @@ import DeliverInfoDrawer from &#39;./components/DeliverInfoDrawer&#39;;
56 56 import DeliverModal from './components/DeliverModal';
57 57 import FinancialDrawer from './components/FinancialDrawer';
58 58 import FinancialEditDrawer from './components/FinancialEditDrawer';
  59 +import FinancialReceiptsModal from './components/FinancialReceiptsModal';
59 60 import HistoryModal from './components/HistoryModal';
60 61 import ImportModal from './components/ImportModal';
61 62 import OrderDrawer from './components/OrderDrawer';
... ... @@ -93,6 +94,8 @@ const OrderPage = () =&gt; {
93 94 const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
94 95 const [attachmentModalVisible, setAttachmentModalVisible] =
95 96 useState<boolean>(false);
  97 + const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] =
  98 + useState(false);
96 99 const [financialVisible, setFinancialVisible] = useState<boolean>(false);
97 100 const [financialEditVisible, setFinancialEditVisible] =
98 101 useState<boolean>(false);
... ... @@ -2600,6 +2603,17 @@ const OrderPage = () =&gt; {
2600 2603 />
2601 2604 )}
2602 2605  
  2606 + {financialReceiptsModalVisible && (
  2607 + <FinancialReceiptsModal
  2608 + setVisible={setFinancialReceiptsModalVisible}
  2609 + onClose={() => {
  2610 + setFinancialReceiptsModalVisible(false);
  2611 + setSelectedRows({});
  2612 + refreshTable();
  2613 + }}
  2614 + />
  2615 + )}
  2616 +
2603 2617 {contextHolder}
2604 2618 </PageContainer>
2605 2619 );
... ...