Commit 88f9bcfd79c1cf3396ca277ddc1b651c578b9a85

Authored by zhongnanhuang
2 parents bff8eafa dacbb1cc

Merge remote-tracking branch 'origin/master'

.idea/inspectionProfiles/Project_Default.xml
1 <component name="InspectionProjectProfileManager"> 1 <component name="InspectionProjectProfileManager">
2 <profile version="1.0"> 2 <profile version="1.0">
3 <option name="myName" value="Project Default" /> 3 <option name="myName" value="Project Default" />
4 - <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />  
5 <inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" /> 4 <inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
6 </profile> 5 </profile>
7 </component> 6 </component>
8 \ No newline at end of file 7 \ No newline at end of file
package-lock.json
@@ -12,7 +12,6 @@ @@ -12,7 +12,6 @@
12 "@ant-design/pro-components": "^2.6.32", 12 "@ant-design/pro-components": "^2.6.32",
13 "@inspir/assembly-css": "1.0.0-alpha", 13 "@inspir/assembly-css": "1.0.0-alpha",
14 "@react-buddy/ide-toolbox": "^2.4.0", 14 "@react-buddy/ide-toolbox": "^2.4.0",
15 - "@react-buddy/palette-antd": "^5.3.0",  
16 "@umijs/max": "^4.0.87", 15 "@umijs/max": "^4.0.87",
17 "antd": "^5.10.2", 16 "antd": "^5.10.2",
18 "axios": "^1.6.1", 17 "axios": "^1.6.1",
@@ -3988,19 +3987,6 @@ @@ -3988,19 +3987,6 @@
3988 "react": "^17.0.0 || ^18.0.0" 3987 "react": "^17.0.0 || ^18.0.0"
3989 } 3988 }
3990 }, 3989 },
3991 - "node_modules/@react-buddy/palette-antd": {  
3992 - "version": "5.3.1",  
3993 - "resolved": "https://registry.npmjs.org/@react-buddy/palette-antd/-/palette-antd-5.3.1.tgz",  
3994 - "integrity": "sha512-G75Pik29FnmyvANiGLSpMFpru4Uzv5woq/IFrkmfYmJb+5vW3lhc+Y/PftLqatSH9fjXs/UOszuSbPzlykT9cw==",  
3995 - "dependencies": {  
3996 - "@react-buddy/ide-toolbox": "^2.4.0"  
3997 - },  
3998 - "peerDependencies": {  
3999 - "@ant-design/icons": "^5.1.4",  
4000 - "antd": "^5.3.0",  
4001 - "react": "^17.0.0 || ^18.0.0"  
4002 - }  
4003 - },  
4004 "node_modules/@sinclair/typebox": { 3990 "node_modules/@sinclair/typebox": {
4005 "version": "0.27.8", 3991 "version": "0.27.8",
4006 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", 3992 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@@ -28469,14 +28455,6 @@ @@ -28469,14 +28455,6 @@
28469 "integrity": "sha512-TWHX6gwa0Gop7215uHhjFMbYLLdjM/b9rr0wYE3E0m7GNJ56gbPpbZiq86w9uI8zksl827acqGeT437MkuO64w==", 28455 "integrity": "sha512-TWHX6gwa0Gop7215uHhjFMbYLLdjM/b9rr0wYE3E0m7GNJ56gbPpbZiq86w9uI8zksl827acqGeT437MkuO64w==",
28470 "requires": {} 28456 "requires": {}
28471 }, 28457 },
28472 - "@react-buddy/palette-antd": {  
28473 - "version": "5.3.1",  
28474 - "resolved": "https://registry.npmjs.org/@react-buddy/palette-antd/-/palette-antd-5.3.1.tgz",  
28475 - "integrity": "sha512-G75Pik29FnmyvANiGLSpMFpru4Uzv5woq/IFrkmfYmJb+5vW3lhc+Y/PftLqatSH9fjXs/UOszuSbPzlykT9cw==",  
28476 - "requires": {  
28477 - "@react-buddy/ide-toolbox": "^2.4.0"  
28478 - }  
28479 - },  
28480 "@sinclair/typebox": { 28458 "@sinclair/typebox": {
28481 "version": "0.27.8", 28459 "version": "0.27.8",
28482 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", 28460 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
src/pages/Invoice/components/AddInvoiceDrawerForm.tsx 0 → 100644
  1 +import { RESPONSE_CODE } from '@/constants/enum';
  2 +import { PAYEE_OPTIONS } from '@/pages/Order/constant';
  3 +import {
  4 + postServiceInvoiceAddInvoice,
  5 + postServiceOrderQuerySalesCode,
  6 +} from '@/services';
  7 +import { enumToSelect } from '@/utils';
  8 +import { PlusOutlined } from '@ant-design/icons';
  9 +import {
  10 + DrawerForm,
  11 + ProFormDateTimePicker,
  12 + ProFormGroup,
  13 + ProFormList,
  14 + ProFormMoney,
  15 + ProFormSelect,
  16 + ProFormText,
  17 + ProFormTextArea,
  18 +} from '@ant-design/pro-components';
  19 +import { Button, Form, message } from 'antd';
  20 +import { useEffect, useState } from 'react';
  21 +
  22 +export default ({ onClose }) => {
  23 + const [form] = Form.useForm<{
  24 + invoiceNumber: '';
  25 + invoiceStatus: '';
  26 + purchaser: '';
  27 + payee: '';
  28 + contacts: '';
  29 + sale: '';
  30 + invoicingTime: '';
  31 + notes: '';
  32 + mainOrderIdObjs: [
  33 + {
  34 + mainOrderId: '';
  35 + },
  36 + ];
  37 + money: '';
  38 + }>();
  39 + const [salesCodeOptions, setSalesCodeOptions] = useState([]);
  40 + const getSalesCodeOptions = async () => {
  41 + const res = await postServiceOrderQuerySalesCode();
  42 + let options = res.data?.map((item) => {
  43 + return {
  44 + label: item.userName,
  45 + value: item.userName,
  46 + number: item.number,
  47 + };
  48 + });
  49 + setSalesCodeOptions(options);
  50 + };
  51 + useEffect(() => {
  52 + getSalesCodeOptions();
  53 + }, []);
  54 + return (
  55 + <DrawerForm<{
  56 + invoiceNumber: string;
  57 + invoiceStatus: string;
  58 + purchaser: string;
  59 + payee: string;
  60 + contacts: string;
  61 + sale: string;
  62 + invoicingTime: Date;
  63 + notes: string;
  64 + mainOrderIdObjs: [
  65 + {
  66 + mainOrderId: string;
  67 + },
  68 + ];
  69 + money: string;
  70 + }>
  71 + title="新增开票"
  72 + resize={{
  73 + onResize() {
  74 + console.log('resize!');
  75 + },
  76 + maxWidth: window.innerWidth * 0.8,
  77 + minWidth: 500,
  78 + }}
  79 + form={form}
  80 + trigger={
  81 + <Button type="primary">
  82 + <PlusOutlined />
  83 + 新增
  84 + </Button>
  85 + }
  86 + autoFocusFirstInput
  87 + drawerProps={{
  88 + destroyOnClose: true,
  89 + }}
  90 + submitTimeout={2000}
  91 + onFinish={async (values) => {
  92 + console.log(values);
  93 + const mainOrderIds = values.mainOrderIdObjs.flatMap(
  94 + (item) => item.mainOrderId,
  95 + );
  96 + let attrs = { ...values, mainOrderIds };
  97 + let res = await postServiceInvoiceAddInvoice({
  98 + data: { ...attrs },
  99 + });
  100 + if (res.result === RESPONSE_CODE.SUCCESS) {
  101 + message.success(res.message);
  102 + } else {
  103 + message.error(res.message);
  104 + return false;
  105 + }
  106 + onClose();
  107 + // 不返回不会关闭弹框
  108 + return true;
  109 + }}
  110 + >
  111 + <ProFormText
  112 + name="invoiceNumber"
  113 + width="md"
  114 + label="发票号码"
  115 + placeholder="请输入名称"
  116 + rules={[{ required: true, message: '请输入名称!' }]}
  117 + />
  118 + <ProFormSelect
  119 + name="invoiceStatus"
  120 + label="发票类型"
  121 + valueEnum={{
  122 + SPECIALLY_INVOICED: '专票',
  123 + COMMON_INVOICED: '普票',
  124 + }}
  125 + rules={[{ required: true, message: '请选择发票类型!' }]}
  126 + />
  127 + <ProFormText
  128 + name="purchaser"
  129 + width="md"
  130 + label="购买方"
  131 + placeholder="请输入购买方"
  132 + rules={[{ required: true, message: '请输入购买方!' }]}
  133 + />
  134 + <ProFormSelect
  135 + placeholder="收款单位"
  136 + name="payee"
  137 + width="lg"
  138 + key="payee"
  139 + showSearch
  140 + label="开票收款单位"
  141 + tooltip="财务开票将依据这个字段,选择对应的公司开票"
  142 + options={enumToSelect(PAYEE_OPTIONS)}
  143 + />
  144 + <ProFormText
  145 + name="contacts"
  146 + width="md"
  147 + label="联系人"
  148 + placeholder="请输入联系人"
  149 + rules={[{ required: true, message: '请输入联系人!' }]}
  150 + />
  151 + <ProFormSelect
  152 + name="sale"
  153 + key="sale"
  154 + width="lg"
  155 + showSearch
  156 + label="销售代表"
  157 + placeholder="请选择销售代表"
  158 + options={salesCodeOptions}
  159 + />
  160 + <ProFormDateTimePicker
  161 + name="invoicingTime"
  162 + label="开票时间"
  163 + fieldProps={{
  164 + format: (value) => value.format('YYYY-MM-DD'),
  165 + }}
  166 + rules={[{ required: true, message: '请输入开票时间!' }]}
  167 + />
  168 + <ProFormTextArea name="notes" label="备注" placeholder="请输入名称" />
  169 + <ProFormList
  170 + name="mainOrderIdObjs"
  171 + label="订单号"
  172 + min={1}
  173 + copyIconProps={false}
  174 + deleteIconProps={{
  175 + tooltipText: '删除',
  176 + }}
  177 + initialValue={[
  178 + {
  179 + mainOrderId: '',
  180 + },
  181 + ]}
  182 + >
  183 + <ProFormGroup key="group">
  184 + <ProFormText
  185 + rules={[{ required: true, message: '请输入关联订单!' }]}
  186 + name="mainOrderId"
  187 + />
  188 + </ProFormGroup>
  189 + </ProFormList>
  190 + <ProFormMoney
  191 + label="金额"
  192 + name="money"
  193 + customSymbol="¥"
  194 + min={0}
  195 + rules={[{ required: true, message: '请输入金额!' }]}
  196 + />
  197 + </DrawerForm>
  198 + );
  199 +};
src/pages/Invoice/index.tsx
1 import ButtonConfirm from '@/components/ButtomConfirm'; 1 import ButtonConfirm from '@/components/ButtomConfirm';
2 import EllipsisDiv from '@/components/Div/EllipsisDiv'; 2 import EllipsisDiv from '@/components/Div/EllipsisDiv';
3 import { RESPONSE_CODE } from '@/constants/enum'; 3 import { RESPONSE_CODE } from '@/constants/enum';
  4 +import AddInvoiceDrawerForm from '@/pages/Invoice/components/AddInvoiceDrawerForm';
4 import { 5 import {
5 BANK_STATEMENT_COLUMNS, 6 BANK_STATEMENT_COLUMNS,
6 INVOICE_COLUMNS, 7 INVOICE_COLUMNS,
@@ -338,6 +339,15 @@ const InvoicePage = () =&gt; { @@ -338,6 +339,15 @@ const InvoicePage = () =&gt; {
338 dateFormatter="string" 339 dateFormatter="string"
339 headerTitle="发票列表" 340 headerTitle="发票列表"
340 scroll={{ x: 1400, y: 360 }} 341 scroll={{ x: 1400, y: 360 }}
  342 + toolBarRender={() => [
  343 + <AddInvoiceDrawerForm
  344 + onClose={() => {
  345 + invoiceActionRef.current?.reload();
  346 + bankActionRef.current?.reload();
  347 + }}
  348 + key="add"
  349 + ></AddInvoiceDrawerForm>,
  350 + ]}
341 /> 351 />
342 ), 352 ),
343 }, 353 },
src/pages/Order/components/HistoryModal.tsx
@@ -2,7 +2,6 @@ import { postServiceOrderQueryHistoryOrderRecord } from &#39;@/services&#39;; @@ -2,7 +2,6 @@ import { postServiceOrderQueryHistoryOrderRecord } from &#39;@/services&#39;;
2 import { formatDateTime } from '@/utils'; 2 import { formatDateTime } from '@/utils';
3 import { Button, Col, Empty, Flex, Modal, Row, Spin } from 'antd'; 3 import { Button, Col, Empty, Flex, Modal, Row, Spin } from 'antd';
4 import { useEffect, useState } from 'react'; 4 import { useEffect, useState } from 'react';
5 -import { HISTORY_OPT_TYPE } from '../constant';  
6 5
7 export default ({ subOrders, isCancelledOrder, onClose }) => { 6 export default ({ subOrders, isCancelledOrder, onClose }) => {
8 let subOrderIds = subOrders?.map((subOrder: any) => { 7 let subOrderIds = subOrders?.map((subOrder: any) => {
@@ -75,7 +74,7 @@ export default ({ subOrders, isCancelledOrder, onClose }) =&gt; { @@ -75,7 +74,7 @@ export default ({ subOrders, isCancelledOrder, onClose }) =&gt; {
75 } else { 74 } else {
76 record.push( 75 record.push(
77 <span className="text-[#3b83e5]"> 76 <span className="text-[#3b83e5]">
78 - {HISTORY_OPT_TYPE.get(history.record) + 77 + {history.recordText +
79 (history.record === 'INVOICING' 78 (history.record === 'INVOICING'
80 ? '(开票号码:' + history.invoiceNumber + ')' 79 ? '(开票号码:' + history.invoiceNumber + ')'
81 : '')} 80 : '')}
src/pages/Order/index.tsx
@@ -2067,6 +2067,41 @@ const OrderPage = () =&gt; { @@ -2067,6 +2067,41 @@ const OrderPage = () =&gt; {
2067 ) : ( 2067 ) : (
2068 '' 2068 ''
2069 )} 2069 )}
  2070 +
  2071 + {isAdmin() || isSales() || isFinance() ? (
  2072 + <Flex title={optRecord.notes} className="pt-2">
  2073 + <div className="flex items-center">
  2074 + <div className="flex items-center max-w-[500px]">
  2075 + <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
  2076 + <Tooltip title={optRecord.reissueNotes} placement="topLeft">
  2077 + <span className="text-[#8C8C8C]">
  2078 + 重新开票备注:
  2079 + {optRecord.reissueNotes === undefined ||
  2080 + optRecord.reissueNotes === null
  2081 + ? '暂无备注'
  2082 + : optRecord.reissueNotes}
  2083 + </span>
  2084 + </Tooltip>
  2085 + </div>
  2086 +
  2087 + <Tooltip title="编辑">
  2088 + <EditTwoTone
  2089 + className="pl-1 hover:curcor-pointer"
  2090 + onClick={() => {
  2091 + setNotesEditVisible(true);
  2092 + setSelectedRows([optRecord.id]);
  2093 + setNotes(optRecord.reissueNotes);
  2094 + setNotesType(5);
  2095 + }}
  2096 + />
  2097 + </Tooltip>
  2098 + </div>
  2099 + <Divider type="vertical" className="mx-5" />
  2100 + </div>
  2101 + </Flex>
  2102 + ) : (
  2103 + ''
  2104 + )}
2070 </> 2105 </>
2071 ); 2106 );
2072 }; 2107 };