kts-component-invoice-operate 3.2.214 → 3.2.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dumi/theme/builtins/API.tsx +66 -66
- package/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +8 -8
- package/README.md +9 -9
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.d.ts +2 -0
- package/dist/index.esm.js +1 -0
- package/dist/index.js +1 -0
- package/docs/index.md +5 -5
- package/docs-dist/404.html +33 -33
- package/docs-dist/index.html +33 -33
- package/docs-dist/static/arrowDown.a1cbf0d8.svg +2 -2
- package/docs-dist/static/arrowUp.4c482054.svg +2 -2
- package/docs-dist/static/fork.5431267d.svg +11 -11
- package/docs-dist/static/plus.44013ce3.svg +11 -11
- package/docs-dist/static/plus.4fd1af30.svg +11 -11
- package/docs-dist/umi.css +18 -18
- package/index.html +12 -12
- package/package.json +62 -62
- package/src/Invoice/Invoice-digtal/_test/architecture/index.tsx +21 -21
- package/src/Invoice/Invoice-digtal/_test/disabled/index.tsx +40 -40
- package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +176 -174
- package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +14574 -14574
- package/src/Invoice/Invoice-digtal/_test/header/index.tsx +84 -84
- package/src/Invoice/Invoice-digtal/_test/importGoods/index.tsx +868 -868
- package/src/Invoice/Invoice-digtal/_test/importStakeholder/index.tsx +18 -18
- package/src/Invoice/Invoice-digtal/_test/lineCredit/index.tsx +19 -19
- package/src/Invoice/Invoice-digtal/_test/prefab/index.tsx +150 -150
- package/src/Invoice/Invoice-digtal/_test/readOnly/index.tsx +55 -55
- package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +21 -21
- package/src/Invoice/Invoice-digtal/_test/stakeholder/index.tsx +12 -12
- package/src/Invoice/Invoice-digtal/_test/typeSelection/index.tsx +29 -29
- package/src/Invoice/Invoice-digtal/index.md +41 -41
- package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +105 -105
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +26 -26
- package/src/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.tsx +88 -88
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.ts +10 -10
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.ts +33 -33
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.ts +81 -81
- package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.ts +39 -39
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.ts +15 -15
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +104 -104
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IColumnsReplenish/index.ts +10 -10
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +87 -87
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ImportGoods/index.ts +84 -81
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/LineAttributeType/index.ts +7 -7
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +9 -9
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +131 -131
- package/src/Invoice/InvoiceController/InvoiceControllerState/Stakeholder/index.ts +13 -13
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +71 -71
- package/src/Invoice/InvoiceController/fns/addFreight.ts +11 -11
- package/src/Invoice/InvoiceController/fns/addGood.ts +11 -11
- package/src/Invoice/InvoiceController/fns/addGoodDiscount.ts +126 -126
- package/src/Invoice/InvoiceController/fns/addGoodDiscountV2.ts +86 -86
- package/src/Invoice/InvoiceController/fns/delFreight.ts +38 -38
- package/src/Invoice/InvoiceController/fns/delGood.ts +41 -41
- package/src/Invoice/InvoiceController/fns/getGoodsSearch.ts +26 -26
- package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +79 -79
- package/src/Invoice/InvoiceController/fns/itemBlur.ts +40 -40
- package/src/Invoice/InvoiceController/fns/mergeDetails.ts +201 -201
- package/src/Invoice/InvoiceController/fns/mergeDiscount.ts +35 -35
- package/src/Invoice/InvoiceController/fns/saveEditFreight.ts +24 -24
- package/src/Invoice/InvoiceController/fns/saveEditGood.ts +24 -24
- package/src/Invoice/InvoiceController/fns/setEditFreight.ts +16 -16
- package/src/Invoice/InvoiceController/fns/setEditGood.ts +16 -16
- package/src/Invoice/InvoiceController/fns/setFreight.ts +10 -10
- package/src/Invoice/InvoiceController/fns/setGoods.ts +10 -10
- package/src/Invoice/InvoiceController/fns/updateInvoiceNo.ts +8 -8
- package/src/Invoice/InvoiceController/index.ts +106 -106
- package/src/Invoice/_test/buyerNameSearch/index.tsx +42 -42
- package/src/Invoice/_test/children/index.tsx +214 -214
- package/src/Invoice/_test/deduction/index.tsx +935 -935
- package/src/Invoice/_test/draft/index.tsx +40 -40
- package/src/Invoice/_test/easiest/index.tsx +5 -5
- package/src/Invoice/_test/endowCode/index.tsx +1158 -1158
- package/src/Invoice/_test/goodsMenuExpand/index.tsx +32 -32
- package/src/Invoice/_test/importBuyer/index.tsx +74 -74
- package/src/Invoice/_test/importGoods/index.tsx +1197 -1197
- package/src/Invoice/_test/invoiceType/index.tsx +59 -59
- package/src/Invoice/_test/isInvoiceNo/index.tsx +12 -12
- package/src/Invoice/_test/replaceHead/index.tsx +22 -22
- package/src/Invoice/_test/retrieveData/index.tsx +22 -22
- package/src/Invoice/_test/seller/index.tsx +28 -28
- package/src/Invoice/_test/setDataSource/index.tsx +73 -73
- package/src/Invoice/_test/unit/index.tsx +19 -19
- package/src/Invoice/index.less +31 -31
- package/src/Invoice/index.md +56 -56
- package/src/Invoice/index.tsx +197 -197
- package/src/Invoice/tools/calculate/index.ts +144 -144
- package/src/Invoice/tools/coolingFn/index.ts +17 -17
- package/src/Invoice/tools/evaluate/index.ts +7 -7
- package/src/Invoice/tools/idGenerator/index.ts +2 -2
- package/src/Invoice/tools/itemName/index.ts +55 -55
- package/src/Invoice/tools/lazyFn/index.ts +19 -19
- package/src/Invoice/tools/mounting/index.ts +13 -13
- package/src/Invoice/tools/strringFn/index.ts +40 -40
- package/src/Invoice/tools/useToGenerateId/index.ts +10 -10
- package/src/Invoice/tools/utils/index.ts +1 -1
- package/src/Invoice/tools/utils/money/index.ts +20 -20
- package/src/Invoice/ui/default/AddComparisonDrawer/index.tsx +149 -149
- package/src/Invoice/ui/default/Buyer/index.less +219 -219
- package/src/Invoice/ui/default/Buyer/index.tsx +114 -114
- package/src/Invoice/ui/default/Buyer/ui/BuyerNameInput/index.tsx +166 -166
- package/src/Invoice/ui/default/Buyer/ui/ImportBuyerButton/index.tsx +21 -21
- package/src/Invoice/ui/default/EndowCodeDrawer/index.less +8 -8
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +612 -612
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +647 -647
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +712 -712
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.less +20 -20
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.tsx +205 -205
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Expand/index.tsx +57 -57
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.less +18 -18
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.tsx +49 -49
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.less +17 -17
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +91 -91
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowEditButton/index.tsx +30 -30
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/_useAddComparison/index.tsx +43 -43
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +118 -118
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/dist/index.js +32 -32
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +41 -41
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +25 -25
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/index.less +13 -13
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +99 -99
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowSaveButton/index.tsx +14 -14
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/TitleText/index.tsx +20 -20
- package/src/Invoice/ui/default/GoodsList/hook/useDeduction/index.tsx +24 -24
- package/src/Invoice/ui/default/GoodsList/hook/useOnRow/index.tsx +52 -52
- package/src/Invoice/ui/default/GoodsList/hook/useRowSelection/index.tsx +120 -120
- package/src/Invoice/ui/default/GoodsList/hook/useWindowClick/index.tsx +23 -23
- package/src/Invoice/ui/default/GoodsList/index.less +185 -185
- package/src/Invoice/ui/default/GoodsList/index.tsx +205 -205
- package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +65 -65
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.less +21 -21
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +244 -244
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +75 -75
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +69 -69
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +65 -65
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +91 -91
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDiscount/index.tsx +36 -36
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesDiscount/index.tsx +109 -109
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesGifts/index.tsx +94 -94
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/index.tsx +37 -37
- package/src/Invoice/ui/default/GoodsList/ui/DescribeSwitch/index.tsx +36 -36
- package/src/Invoice/ui/default/GoodsList/ui/Search/index.less +10 -10
- package/src/Invoice/ui/default/GoodsList/ui/Search/index.tsx +52 -52
- package/src/Invoice/ui/default/GoodsList/ui/Statistics/index.less +18 -18
- package/src/Invoice/ui/default/GoodsList/ui/Statistics/index.tsx +114 -114
- package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.less +40 -40
- package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.tsx +71 -71
- package/src/Invoice/ui/default/GoodsList/ui/TableVirtual/index.less +38 -38
- package/src/Invoice/ui/default/GoodsList/ui/TableVirtual/index.tsx +130 -130
- package/src/Invoice/ui/default/GoodsList/ui/TableVirtual.o/index.less +44 -44
- package/src/Invoice/ui/default/GoodsList/ui/TableVirtual.o/index.tsx +96 -96
- package/src/Invoice/ui/default/GoodsList/ui/TaxIncludedSwitch/index.tsx +31 -31
- package/src/Invoice/ui/default/ImportBuyerDrawer/index.tsx +75 -75
- package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +198 -198
- package/src/Invoice/ui/default/InvoiceHeader/index.less +68 -68
- package/src/Invoice/ui/default/InvoiceHeader/index.tsx +246 -246
- package/src/Invoice/ui/default/Seller/index.less +113 -113
- package/src/Invoice/ui/default/Seller/index.tsx +98 -98
- package/src/Invoice/ui/default/Sign/index.less +14 -14
- package/src/Invoice/ui/default/Sign/index.tsx +71 -71
- package/src/Invoice/ui/digtal/Architecture/index.less +18 -18
- package/src/Invoice/ui/digtal/Architecture/index.tsx +177 -177
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/dist/index.js +616 -616
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/index.tsx +246 -246
- package/src/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.tsx +20 -20
- package/src/Invoice/ui/digtal/FreightList/hook/useOnRow/index.tsx +37 -37
- package/src/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.tsx +119 -119
- package/src/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.tsx +23 -23
- package/src/Invoice/ui/digtal/FreightList/index.less +72 -72
- package/src/Invoice/ui/digtal/FreightList/index.tsx +129 -129
- package/src/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.tsx +74 -74
- package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -50
- package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +36 -36
- package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.less +28 -28
- package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.tsx +20 -20
- package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.less +38 -38
- package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.tsx +108 -108
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +683 -683
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/dist/index.js +616 -616
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +703 -703
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/svg/plus.svg +11 -11
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/Drag/index.less +20 -20
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/Drag/index.tsx +205 -205
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.less +9 -9
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +87 -87
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowEditButton/index.tsx +30 -30
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/_useAddComparison/index.tsx +43 -43
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +76 -76
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +41 -41
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +34 -34
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/index.less +13 -13
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +98 -98
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/RowSaveButton/index.tsx +14 -14
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/TitleText/index.tsx +20 -20
- package/src/Invoice/ui/digtal/GoodsList/hook/useOnRow/index.tsx +51 -51
- package/src/Invoice/ui/digtal/GoodsList/hook/useRowSelection/index.tsx +121 -121
- package/src/Invoice/ui/digtal/GoodsList/hook/useWindowClick/index.tsx +23 -23
- package/src/Invoice/ui/digtal/GoodsList/index.less +56 -56
- package/src/Invoice/ui/digtal/GoodsList/index.tsx +179 -179
- package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +77 -77
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +340 -340
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/svg/add.svg +11 -11
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +75 -75
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -50
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -37
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +82 -82
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useReselectInvoiceType/index.tsx +57 -57
- package/src/Invoice/ui/digtal/GoodsList/ui/DescribeSwitch/index.tsx +36 -36
- package/src/Invoice/ui/digtal/GoodsList/ui/Search/index.less +11 -11
- package/src/Invoice/ui/digtal/GoodsList/ui/Search/index.tsx +60 -60
- package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/index.less +53 -53
- package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/index.tsx +98 -98
- package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/svg/fork.svg +11 -11
- package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.less +28 -28
- package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.tsx +52 -52
- package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.less +38 -38
- package/src/Invoice/ui/digtal/GoodsList/ui/TableVirtual/index.tsx +108 -108
- package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +31 -31
- package/src/Invoice/ui/digtal/InvoiceHeader/index.less +57 -57
- package/src/Invoice/ui/digtal/InvoiceHeader/index.tsx +77 -77
- package/src/Invoice/ui/digtal/RealEstateInfo/index.less +14 -14
- package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +192 -192
- package/src/Invoice/ui/digtal/Sign/index.less +48 -48
- package/src/Invoice/ui/digtal/Sign/index.tsx +99 -99
- package/src/Invoice/ui/digtal/StakeFarmerholder/index.less +99 -99
- package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +477 -477
- package/src/Invoice/ui/digtal/StakeFarmerholder/svg/arrowDown.svg +2 -2
- package/src/Invoice/ui/digtal/StakeFarmerholder/svg/arrowUp.svg +2 -2
- package/src/Invoice/ui/digtal/StakeFarmerholder/svg/plus.svg +11 -11
- package/src/Invoice/ui/digtal/Stakeholder/index.less +99 -99
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +435 -435
- package/src/Invoice/ui/digtal/Stakeholder/svg/arrowDown.svg +2 -2
- package/src/Invoice/ui/digtal/Stakeholder/svg/arrowUp.svg +2 -2
- package/src/Invoice/ui/digtal/Stakeholder/svg/plus.svg +11 -11
- package/src/InvoiceTypeModal/_test/easiest/index.tsx +31 -31
- package/src/InvoiceTypeModal/dist/index.js +92 -92
- package/src/InvoiceTypeModal/index.less +7 -7
- package/src/InvoiceTypeModal/index.md +5 -5
- package/src/InvoiceTypeModal/index.tsx +161 -161
- package/src/TaxClassificationCodeModal/_test/easiest/index.tsx +184 -184
- package/src/TaxClassificationCodeModal/index.less +17 -17
- package/src/TaxClassificationCodeModal/index.md +6 -6
- package/src/TaxClassificationCodeModal/index.tsx +152 -152
- package/src/index.ts +13 -13
- package/tsconfig.json +31 -31
- package/typings.d.ts +3 -3
|
@@ -1,477 +1,477 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Icon from '@ant-design/icons';
|
|
4
|
-
import { decorator } from "grey-react-box";
|
|
5
|
-
import { Form } from "kts-components-antd-x3";
|
|
6
|
-
import { AutoComplete, Button, Checkbox, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
|
|
7
|
-
import { CheckboxChangeEvent } from 'kts-components-antd-x4/lib/checkbox';
|
|
8
|
-
import { FormComponentProps } from "kts-components-antd-x3/lib/form";
|
|
9
|
-
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
10
|
-
import { ReactComponent as ArrowUpSvg } from './svg/arrowUp.svg';
|
|
11
|
-
import { ReactComponent as ArrowDownSvg } from './svg/arrowDown.svg';
|
|
12
|
-
import { ReactComponent as PlusSvg } from './svg/plus.svg'
|
|
13
|
-
import InvoiceController from "../../../InvoiceController";
|
|
14
|
-
import Invoice from "../../..";
|
|
15
|
-
import './index.less';
|
|
16
|
-
import classNames from 'classnames';
|
|
17
|
-
|
|
18
|
-
const RULES = {
|
|
19
|
-
companyName: (label: string) => [
|
|
20
|
-
{ required: true, message: `${label}必填` },
|
|
21
|
-
{ max: 100, message: `${label}内容超长` }
|
|
22
|
-
],
|
|
23
|
-
taxId: (label: string) => [
|
|
24
|
-
{ max: 20, message: `${label}内容超长` },
|
|
25
|
-
{ pattern: /^([a-zA-Z0-9])*$/g, message: `${label}仅能数字、英文` }
|
|
26
|
-
],
|
|
27
|
-
buyerTelPhone: (label: string) => [
|
|
28
|
-
{ required: true, message: `${label}必填` },
|
|
29
|
-
{ max: 100, message: `${label}内容超长` },
|
|
30
|
-
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
31
|
-
],
|
|
32
|
-
sellerTelPhone: (label: string) => [
|
|
33
|
-
|
|
34
|
-
{ max: 100, message: `${label}内容超长` },
|
|
35
|
-
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
36
|
-
],
|
|
37
|
-
bankName: (label: string) => [
|
|
38
|
-
{ max: 100, message: `${label}内容超长` }
|
|
39
|
-
],
|
|
40
|
-
bankAccount: (label: string) => [
|
|
41
|
-
{ max: 100, message: `${label}内容超长` },
|
|
42
|
-
{ pattern: /^([0-9a-zA-Z-\s])*$/g, message: `${label}仅能数字、字母、-、空格` }
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const formatCompanyName = (e: any) => {
|
|
47
|
-
const value = e?.target?.value;
|
|
48
|
-
if (value) {
|
|
49
|
-
return value.replace('(', '(').replace(')', ')').replace(' ', '');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IStakeholder {
|
|
54
|
-
|
|
55
|
-
/** 是否显示导入按钮 */
|
|
56
|
-
isShowImportButton?: boolean;
|
|
57
|
-
|
|
58
|
-
/** 点击了 */
|
|
59
|
-
onClickImportButton?: (e: InvoiceController) => void
|
|
60
|
-
|
|
61
|
-
/** 查看当前可用授信额度 */
|
|
62
|
-
lineCredit?: React.ReactNode;
|
|
63
|
-
|
|
64
|
-
/** 票种类型 */
|
|
65
|
-
isVatNormal?: boolean;
|
|
66
|
-
|
|
67
|
-
/** 是否可以选择自然人 */
|
|
68
|
-
isNaturalPerson?: boolean;
|
|
69
|
-
|
|
70
|
-
/** 是否展开 */
|
|
71
|
-
isExpand?: boolean;
|
|
72
|
-
|
|
73
|
-
leqi?: boolean;
|
|
74
|
-
|
|
75
|
-
riskData?: any;
|
|
76
|
-
|
|
77
|
-
invoiceMarkCallback?: (value: any) => void;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** 农产品干系人 */
|
|
81
|
-
export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.create())(props => {
|
|
82
|
-
|
|
83
|
-
const { form, isShowImportButton, onClickImportButton, isVatNormal = false } = props;
|
|
84
|
-
|
|
85
|
-
const [isExpand, setExpand] = React.useState(typeof props.isExpand === 'boolean' ? props.isExpand : true);
|
|
86
|
-
|
|
87
|
-
const { getFieldDecorator } = form;
|
|
88
|
-
|
|
89
|
-
const controller = Invoice.useInvoiceController();
|
|
90
|
-
|
|
91
|
-
const model = controller.useMemo(s => s.model, []);
|
|
92
|
-
|
|
93
|
-
const disableds = controller.useMemo(s => s.stakeholder.disableds || [], []);
|
|
94
|
-
|
|
95
|
-
const rulesMap = controller.useMemo(s => s.stakeholder.rulesMap || {}, []);
|
|
96
|
-
|
|
97
|
-
/** 乐企 */
|
|
98
|
-
const leqispanW = React.useMemo(() => {
|
|
99
|
-
if (props.leqi) {
|
|
100
|
-
return 0;
|
|
101
|
-
} else {
|
|
102
|
-
return 2;
|
|
103
|
-
}
|
|
104
|
-
}, [props.leqi, props.riskData]);
|
|
105
|
-
/** 直连 */
|
|
106
|
-
const riskspanW = React.useMemo(() => {
|
|
107
|
-
if (props.riskData?.code === 'success') {
|
|
108
|
-
return 0;
|
|
109
|
-
} else {
|
|
110
|
-
return 2;
|
|
111
|
-
}
|
|
112
|
-
}, [props.leqi, props.riskData]);
|
|
113
|
-
|
|
114
|
-
const readOnly = React.useMemo(() => {
|
|
115
|
-
if (model === 'readOnly') return true;
|
|
116
|
-
if (model === 'prefab') return true;
|
|
117
|
-
return false;
|
|
118
|
-
}, [model]);
|
|
119
|
-
|
|
120
|
-
const onExpand = React.useCallback(() => { setExpand(e => !e) }, []);
|
|
121
|
-
|
|
122
|
-
const isReadOnly = React.useCallback(field => readOnly || disableds.indexOf(field) >= 0, [disableds, readOnly]);
|
|
123
|
-
|
|
124
|
-
const getRules = React.useCallback((field, defaultRules) => {
|
|
125
|
-
if (isReadOnly(field)) return [];
|
|
126
|
-
return rulesMap[field] || defaultRules;
|
|
127
|
-
}, [rulesMap, isReadOnly, isReadOnly]);
|
|
128
|
-
|
|
129
|
-
controller.useForm('stakeholder', form);
|
|
130
|
-
|
|
131
|
-
// props.isExpand 变化的时候更新
|
|
132
|
-
React.useEffect(() => {
|
|
133
|
-
setExpand(typeof props.isExpand === 'boolean' ? props.isExpand : true);
|
|
134
|
-
}, [props.isExpand])
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<div className={classNames("kts-invoice-operate-invoice-digtal-stakeholder", { readOnly: readOnly })} >
|
|
138
|
-
<div>
|
|
139
|
-
{'销售方信息'.split('').map(e => <span>{e}</span>)}
|
|
140
|
-
{
|
|
141
|
-
!readOnly &&
|
|
142
|
-
<Icon
|
|
143
|
-
className="digtal-stakeholder-expand-button"
|
|
144
|
-
component={isExpand ? ArrowUpSvg : ArrowDownSvg}
|
|
145
|
-
onClick={onExpand}
|
|
146
|
-
/>
|
|
147
|
-
}
|
|
148
|
-
</div>
|
|
149
|
-
<div>
|
|
150
|
-
<div style={{ marginTop: 20 }} className='natural-person-flag' >
|
|
151
|
-
{
|
|
152
|
-
props.isNaturalPerson === true &&
|
|
153
|
-
<Form.Item colon={false}>
|
|
154
|
-
{getFieldDecorator('naturalPersonFlag', {
|
|
155
|
-
})(
|
|
156
|
-
<NaturalPersonFlag readOnly={isReadOnly('naturalPersonFlag')} />
|
|
157
|
-
)}
|
|
158
|
-
</Form.Item>
|
|
159
|
-
}
|
|
160
|
-
</div>
|
|
161
|
-
<Form className="digtal-stakeholder-form" >
|
|
162
|
-
<Row gutter={[16, 0]}>
|
|
163
|
-
<Col span={24} >
|
|
164
|
-
<Form.Item label='名称' colon={false}>
|
|
165
|
-
{getFieldDecorator('supplierName', {
|
|
166
|
-
rules: getRules('supplierName', RULES.companyName('销售方名称')),
|
|
167
|
-
// getValueFromEvent: formatCompanyName
|
|
168
|
-
})
|
|
169
|
-
// (<MyInput readOnly={isReadOnly('supplierName')} placeholder="请输入名称" autoComplete="off" />)
|
|
170
|
-
(
|
|
171
|
-
<BuyerNameInput
|
|
172
|
-
myform={form}
|
|
173
|
-
fieldName='supplierName'
|
|
174
|
-
readOnly={isReadOnly('supplierName')}
|
|
175
|
-
placeholder="请输入名称"
|
|
176
|
-
autoComplete="off"
|
|
177
|
-
suffix={
|
|
178
|
-
isShowImportButton === true &&
|
|
179
|
-
<Button
|
|
180
|
-
type='link'
|
|
181
|
-
style={{ padding: 0, width: 20, height: '100%' }}
|
|
182
|
-
icon={<Icon component={PlusSvg} />}
|
|
183
|
-
onClick={() => { onClickImportButton && onClickImportButton(controller) }}
|
|
184
|
-
/>
|
|
185
|
-
}
|
|
186
|
-
/>
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
</Form.Item>
|
|
190
|
-
</Col>
|
|
191
|
-
|
|
192
|
-
<Col span={24} >
|
|
193
|
-
<Form.Item label='统一社会信用代码/纳税人识别号' colon={false}>
|
|
194
|
-
{getFieldDecorator('supplierTaxId', {
|
|
195
|
-
rules: getRules('supplierTaxId', [{ required: true, message: '销售方纳税人识别号必填' }, ...RULES.taxId('销售方纳税人识别号')])
|
|
196
|
-
})
|
|
197
|
-
// (<MyInput readOnly={isReadOnly('supplierTaxId')} placeholder="请输入统一社会信用代码/纳税人识别号" autoComplete="off" />)
|
|
198
|
-
(<BuyerNameInput
|
|
199
|
-
myform={form}
|
|
200
|
-
fieldName='supplierTaxId'
|
|
201
|
-
readOnly={isReadOnly('supplierTaxId')}
|
|
202
|
-
placeholder="请输入统一社会信用代码/纳税人识别号"
|
|
203
|
-
autoComplete="off"
|
|
204
|
-
/>)
|
|
205
|
-
}
|
|
206
|
-
</Form.Item>
|
|
207
|
-
</Col>
|
|
208
|
-
|
|
209
|
-
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
210
|
-
<Form.Item label='销售方地址' colon={false}>
|
|
211
|
-
{getFieldDecorator('sellerAddress', {
|
|
212
|
-
rules: getRules('sellerAddress', [{ max: 300, message: '销售方地址内容超长' }])
|
|
213
|
-
})(<MyInput readOnly={isReadOnly('sellerAddress')} placeholder="请输入销售方地址" autoComplete="off" />)}
|
|
214
|
-
</Form.Item>
|
|
215
|
-
</Col>
|
|
216
|
-
|
|
217
|
-
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
218
|
-
<Form.Item label='电话' colon={false} className='telephone' >
|
|
219
|
-
{getFieldDecorator('sellerPhone', {
|
|
220
|
-
rules: getRules('sellerPhone', RULES.sellerTelPhone('销售方电话'))
|
|
221
|
-
})(<MyInput readOnly={isReadOnly('sellerPhone')} placeholder="请输入电话" autoComplete="off" />)}
|
|
222
|
-
</Form.Item>
|
|
223
|
-
</Col>
|
|
224
|
-
|
|
225
|
-
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
226
|
-
<Form.Item label='销售方开户银行' colon={false}>
|
|
227
|
-
{getFieldDecorator('sellerBank', {
|
|
228
|
-
rules: getRules('sellerBank', RULES.bankName('销售方开户银行'))
|
|
229
|
-
})(<MyInput readOnly={isReadOnly('sellerBank')} placeholder="请输入销售方开户银行" autoComplete="off" />)}
|
|
230
|
-
</Form.Item>
|
|
231
|
-
</Col>
|
|
232
|
-
|
|
233
|
-
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
234
|
-
<Form.Item label='银行账号' colon={false}>
|
|
235
|
-
{getFieldDecorator('sellerAccount', {
|
|
236
|
-
rules: getRules('sellerAccount', RULES.bankAccount('销售方银行账号'))
|
|
237
|
-
})(<MyInput readOnly={isReadOnly('sellerAccount')} placeholder="请输入银行账号" autoComplete="off" />)}
|
|
238
|
-
</Form.Item>
|
|
239
|
-
</Col>
|
|
240
|
-
{(props.leqi || props.riskData?.code === 'success') &&
|
|
241
|
-
<Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
|
|
242
|
-
<Form.Item colon={false}>
|
|
243
|
-
{getFieldDecorator('sellerBankAccountFlag', {
|
|
244
|
-
valuePropName: 'checked',
|
|
245
|
-
})(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('sellerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
|
|
246
|
-
</Form.Item>
|
|
247
|
-
</Col>
|
|
248
|
-
}
|
|
249
|
-
</Row>
|
|
250
|
-
</Form>
|
|
251
|
-
</div>
|
|
252
|
-
<div>
|
|
253
|
-
{'购买方信息'.split('').map(e => <span>{e}</span>)}
|
|
254
|
-
{
|
|
255
|
-
!readOnly &&
|
|
256
|
-
<Icon
|
|
257
|
-
className="digtal-stakeholder-expand-button"
|
|
258
|
-
component={isExpand ? ArrowUpSvg : ArrowDownSvg}
|
|
259
|
-
onClick={onExpand}
|
|
260
|
-
/>
|
|
261
|
-
}
|
|
262
|
-
</div>
|
|
263
|
-
<div>
|
|
264
|
-
{
|
|
265
|
-
!readOnly && props.lineCredit &&
|
|
266
|
-
<div style={{ marginTop: 20 }} >
|
|
267
|
-
<Tooltip trigger="click" title={props.lineCredit} >
|
|
268
|
-
<Button type="link" style={{ padding: `0px 8px` }} >查看当前可用授信额度</Button>
|
|
269
|
-
</Tooltip>
|
|
270
|
-
</div>
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
<Form className="digtal-stakeholder-form" >
|
|
274
|
-
<Row gutter={[16, 0]}>
|
|
275
|
-
<Col span={24} >
|
|
276
|
-
<Form.Item label='名称' colon={false}>
|
|
277
|
-
{getFieldDecorator('buyerName', {
|
|
278
|
-
rules: getRules('buyerName', RULES.companyName('购买方名称')),
|
|
279
|
-
})(
|
|
280
|
-
<BuyerNameInput
|
|
281
|
-
myform={form}
|
|
282
|
-
fieldName='buyerName'
|
|
283
|
-
readOnly={isReadOnly('buyerName')}
|
|
284
|
-
placeholder="请输入名称"
|
|
285
|
-
autoComplete="off"
|
|
286
|
-
suffix={
|
|
287
|
-
isShowImportButton === true &&
|
|
288
|
-
<Button
|
|
289
|
-
type='link'
|
|
290
|
-
style={{ padding: 0, width: 20, height: '100%' }}
|
|
291
|
-
icon={<Icon component={PlusSvg} />}
|
|
292
|
-
onClick={() => { onClickImportButton && onClickImportButton(controller) }}
|
|
293
|
-
/>
|
|
294
|
-
}
|
|
295
|
-
/>
|
|
296
|
-
)}
|
|
297
|
-
</Form.Item>
|
|
298
|
-
</Col>
|
|
299
|
-
|
|
300
|
-
<Col span={24} >
|
|
301
|
-
<Form.Item label='统一社会信用代码/纳税人识别号' colon={false}>
|
|
302
|
-
{getFieldDecorator('buyerTaxId', {
|
|
303
|
-
rules: getRules('buyerTaxId', [{ required: !isVatNormal, message: '购买方纳税人识别号必填' }, ...RULES.taxId('购买方纳税人识别号')])
|
|
304
|
-
})(
|
|
305
|
-
<BuyerNameInput
|
|
306
|
-
myform={form}
|
|
307
|
-
fieldName='buyerTaxId'
|
|
308
|
-
readOnly={isReadOnly('buyerTaxId')}
|
|
309
|
-
placeholder="请输入统一社会信用代码/纳税人识别号"
|
|
310
|
-
autoComplete="off"
|
|
311
|
-
/>
|
|
312
|
-
)}
|
|
313
|
-
</Form.Item>
|
|
314
|
-
</Col>
|
|
315
|
-
|
|
316
|
-
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
317
|
-
<Form.Item label='购买方地址' colon={false}>
|
|
318
|
-
{getFieldDecorator('buyerAddress', {
|
|
319
|
-
rules: getRules('buyerAddress', [{ max: 100, message: '购买方地址内容超长' }])
|
|
320
|
-
})(<MyInput readOnly={isReadOnly('buyerAddress')} placeholder="请输入购买方地址" autoComplete="off" />)}
|
|
321
|
-
</Form.Item>
|
|
322
|
-
</Col>
|
|
323
|
-
|
|
324
|
-
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
325
|
-
<Form.Item label='电话' colon={false} className='telephone'>
|
|
326
|
-
{getFieldDecorator('buyerPhone', {
|
|
327
|
-
rules: getRules('buyerPhone', RULES.buyerTelPhone('购买方电话'))
|
|
328
|
-
})(<MyInput readOnly={isReadOnly('buyerPhone')} placeholder="请输入电话" autoComplete="off" />)}
|
|
329
|
-
</Form.Item>
|
|
330
|
-
</Col>
|
|
331
|
-
|
|
332
|
-
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
333
|
-
<Form.Item label='购买方开户银行' colon={false}>
|
|
334
|
-
{getFieldDecorator('buyerBank', {
|
|
335
|
-
rules: getRules('buyerBank', RULES.bankName('购买方开户银行'))
|
|
336
|
-
})(<MyInput readOnly={isReadOnly('buyerBank')} placeholder="请输入购买方开户银行" autoComplete="off" />)}
|
|
337
|
-
</Form.Item>
|
|
338
|
-
</Col>
|
|
339
|
-
|
|
340
|
-
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
341
|
-
<Form.Item label='银行账号' colon={false}>
|
|
342
|
-
{getFieldDecorator('buyerAccount', {
|
|
343
|
-
rules: getRules('buyerAccount', RULES.bankAccount('购买方银行账号'))
|
|
344
|
-
})(<MyInput readOnly={isReadOnly('buyerAccount')} placeholder="请输入银行账号" autoComplete="off" />)}
|
|
345
|
-
</Form.Item>
|
|
346
|
-
</Col>
|
|
347
|
-
{(props.leqi || props.riskData?.code === 'success') &&
|
|
348
|
-
<Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
|
|
349
|
-
<Form.Item colon={false}>
|
|
350
|
-
{getFieldDecorator('buyerBankAccountFlag', {
|
|
351
|
-
valuePropName: 'checked',
|
|
352
|
-
})(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('buyerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
|
|
353
|
-
</Form.Item>
|
|
354
|
-
</Col>
|
|
355
|
-
}
|
|
356
|
-
</Row>
|
|
357
|
-
</Form>
|
|
358
|
-
</div>
|
|
359
|
-
|
|
360
|
-
</div>
|
|
361
|
-
)
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
function NaturalPersonFlag(props: {
|
|
365
|
-
// NATURAL("自然人"), COMPANY("非自然人");
|
|
366
|
-
value?: 'COMPANY' | 'NATURAL',
|
|
367
|
-
onChange?: (e: 'COMPANY' | 'NATURAL') => void
|
|
368
|
-
readOnly?: boolean;
|
|
369
|
-
}) {
|
|
370
|
-
|
|
371
|
-
const [value, setValue] = React.useState(props.value || 'COMPANY');
|
|
372
|
-
|
|
373
|
-
const onChange = React.useCallback((e: CheckboxChangeEvent) => {
|
|
374
|
-
if (props.readOnly) return;
|
|
375
|
-
setValue(e.target.checked ? 'NATURAL' : 'COMPANY');
|
|
376
|
-
props.onChange && props.onChange(e.target.checked ? 'NATURAL' : 'COMPANY');
|
|
377
|
-
}, [props.onChange, props.readOnly])
|
|
378
|
-
|
|
379
|
-
React.useEffect(() => {
|
|
380
|
-
setValue(props.value || 'COMPANY')
|
|
381
|
-
}, [props.value])
|
|
382
|
-
|
|
383
|
-
return (
|
|
384
|
-
<Checkbox
|
|
385
|
-
disabled={props.readOnly}
|
|
386
|
-
checked={value === 'NATURAL'}
|
|
387
|
-
onChange={onChange}
|
|
388
|
-
>
|
|
389
|
-
是否开票给自然人
|
|
390
|
-
</Checkbox>
|
|
391
|
-
)
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function BuyerNameInput(props: InputProps & { fieldName: string; myform: WrappedFormUtils<any> }) {
|
|
395
|
-
|
|
396
|
-
const { fieldName, myform: form } = props;
|
|
397
|
-
|
|
398
|
-
const controller = Invoice.useInvoiceController();
|
|
399
|
-
|
|
400
|
-
const rootElement = controller.useMemo(s => s.rootElement, []);
|
|
401
|
-
|
|
402
|
-
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
403
|
-
|
|
404
|
-
const [options, setOptions] = React.useState<any[]>([])
|
|
405
|
-
|
|
406
|
-
const onChangeAutoComplete = React.useCallback(value => {
|
|
407
|
-
const record = options.filter(e => e[fieldName] === value)[0] as any;
|
|
408
|
-
if (!record || !form) return;
|
|
409
|
-
|
|
410
|
-
form.setFieldsValue(record);
|
|
411
|
-
setOptions([])
|
|
412
|
-
}, [options, fieldName, form])
|
|
413
|
-
|
|
414
|
-
const onSearch = React.useCallback(async (searchText: string) => {
|
|
415
|
-
await Discontinue.start();
|
|
416
|
-
try {
|
|
417
|
-
if (fieldName === 'buyerName' ) {
|
|
418
|
-
if (autoComplete.onBuyerNameSearch) {
|
|
419
|
-
setOptions(await autoComplete.onBuyerNameSearch(searchText));
|
|
420
|
-
}
|
|
421
|
-
} else if (fieldName === 'buyerTaxId' ) {
|
|
422
|
-
if (autoComplete.onBuyerTaxIdSearch) {
|
|
423
|
-
setOptions(await autoComplete.onBuyerTaxIdSearch(searchText));
|
|
424
|
-
}
|
|
425
|
-
}else if(fieldName === 'supplierName'){
|
|
426
|
-
if (autoComplete.onSupplierNameSearch) {
|
|
427
|
-
setOptions(await autoComplete.onSupplierNameSearch(searchText));
|
|
428
|
-
}
|
|
429
|
-
}else if(fieldName === 'supplierTaxId'){
|
|
430
|
-
if (autoComplete.onSupplierTaxIdSearch) {
|
|
431
|
-
setOptions(await autoComplete.onSupplierTaxIdSearch(searchText));
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
} catch (error) {
|
|
436
|
-
setOptions([]);
|
|
437
|
-
throw error;
|
|
438
|
-
}
|
|
439
|
-
}, [autoComplete.onBuyerNameSearch, fieldName])
|
|
440
|
-
|
|
441
|
-
if (props.readOnly) return <span className='digtal-stakeholder-form-text'>{props.value}</span>;
|
|
442
|
-
|
|
443
|
-
return (
|
|
444
|
-
<AutoComplete
|
|
445
|
-
onSearch={onSearch}
|
|
446
|
-
options={options.map(e => ({ value: e[fieldName] }))}
|
|
447
|
-
onChange={onChangeAutoComplete}
|
|
448
|
-
value={props.value}
|
|
449
|
-
getPopupContainer={() => rootElement || document.body}
|
|
450
|
-
style={{ width: '100%' }}
|
|
451
|
-
>
|
|
452
|
-
<Input {...props} style={{ width: '100%', ...props.style }} />
|
|
453
|
-
</AutoComplete>
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
class MyInput extends React.Component<InputProps> {
|
|
458
|
-
render() {
|
|
459
|
-
const props = this.props;
|
|
460
|
-
if (props.readOnly) {
|
|
461
|
-
return <span className='digtal-stakeholder-form-text'>{props.value}</span>
|
|
462
|
-
} else {
|
|
463
|
-
return <Input {...props} />
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
class Discontinue {
|
|
469
|
-
|
|
470
|
-
private static timer: any;
|
|
471
|
-
|
|
472
|
-
static start = (interval = 200) => new Promise<void>(resolve => {
|
|
473
|
-
clearTimeout(Discontinue.timer);
|
|
474
|
-
Discontinue.timer = setTimeout(resolve, interval);
|
|
475
|
-
})
|
|
476
|
-
}
|
|
477
|
-
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Icon from '@ant-design/icons';
|
|
4
|
+
import { decorator } from "grey-react-box";
|
|
5
|
+
import { Form } from "kts-components-antd-x3";
|
|
6
|
+
import { AutoComplete, Button, Checkbox, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
|
|
7
|
+
import { CheckboxChangeEvent } from 'kts-components-antd-x4/lib/checkbox';
|
|
8
|
+
import { FormComponentProps } from "kts-components-antd-x3/lib/form";
|
|
9
|
+
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
10
|
+
import { ReactComponent as ArrowUpSvg } from './svg/arrowUp.svg';
|
|
11
|
+
import { ReactComponent as ArrowDownSvg } from './svg/arrowDown.svg';
|
|
12
|
+
import { ReactComponent as PlusSvg } from './svg/plus.svg'
|
|
13
|
+
import InvoiceController from "../../../InvoiceController";
|
|
14
|
+
import Invoice from "../../..";
|
|
15
|
+
import './index.less';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
|
|
18
|
+
const RULES = {
|
|
19
|
+
companyName: (label: string) => [
|
|
20
|
+
{ required: true, message: `${label}必填` },
|
|
21
|
+
{ max: 100, message: `${label}内容超长` }
|
|
22
|
+
],
|
|
23
|
+
taxId: (label: string) => [
|
|
24
|
+
{ max: 20, message: `${label}内容超长` },
|
|
25
|
+
{ pattern: /^([a-zA-Z0-9])*$/g, message: `${label}仅能数字、英文` }
|
|
26
|
+
],
|
|
27
|
+
buyerTelPhone: (label: string) => [
|
|
28
|
+
{ required: true, message: `${label}必填` },
|
|
29
|
+
{ max: 100, message: `${label}内容超长` },
|
|
30
|
+
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
31
|
+
],
|
|
32
|
+
sellerTelPhone: (label: string) => [
|
|
33
|
+
|
|
34
|
+
{ max: 100, message: `${label}内容超长` },
|
|
35
|
+
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
36
|
+
],
|
|
37
|
+
bankName: (label: string) => [
|
|
38
|
+
{ max: 100, message: `${label}内容超长` }
|
|
39
|
+
],
|
|
40
|
+
bankAccount: (label: string) => [
|
|
41
|
+
{ max: 100, message: `${label}内容超长` },
|
|
42
|
+
{ pattern: /^([0-9a-zA-Z-\s])*$/g, message: `${label}仅能数字、字母、-、空格` }
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const formatCompanyName = (e: any) => {
|
|
47
|
+
const value = e?.target?.value;
|
|
48
|
+
if (value) {
|
|
49
|
+
return value.replace('(', '(').replace(')', ')').replace(' ', '');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IStakeholder {
|
|
54
|
+
|
|
55
|
+
/** 是否显示导入按钮 */
|
|
56
|
+
isShowImportButton?: boolean;
|
|
57
|
+
|
|
58
|
+
/** 点击了 */
|
|
59
|
+
onClickImportButton?: (e: InvoiceController) => void
|
|
60
|
+
|
|
61
|
+
/** 查看当前可用授信额度 */
|
|
62
|
+
lineCredit?: React.ReactNode;
|
|
63
|
+
|
|
64
|
+
/** 票种类型 */
|
|
65
|
+
isVatNormal?: boolean;
|
|
66
|
+
|
|
67
|
+
/** 是否可以选择自然人 */
|
|
68
|
+
isNaturalPerson?: boolean;
|
|
69
|
+
|
|
70
|
+
/** 是否展开 */
|
|
71
|
+
isExpand?: boolean;
|
|
72
|
+
|
|
73
|
+
leqi?: boolean;
|
|
74
|
+
|
|
75
|
+
riskData?: any;
|
|
76
|
+
|
|
77
|
+
invoiceMarkCallback?: (value: any) => void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 农产品干系人 */
|
|
81
|
+
export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.create())(props => {
|
|
82
|
+
|
|
83
|
+
const { form, isShowImportButton, onClickImportButton, isVatNormal = false } = props;
|
|
84
|
+
|
|
85
|
+
const [isExpand, setExpand] = React.useState(typeof props.isExpand === 'boolean' ? props.isExpand : true);
|
|
86
|
+
|
|
87
|
+
const { getFieldDecorator } = form;
|
|
88
|
+
|
|
89
|
+
const controller = Invoice.useInvoiceController();
|
|
90
|
+
|
|
91
|
+
const model = controller.useMemo(s => s.model, []);
|
|
92
|
+
|
|
93
|
+
const disableds = controller.useMemo(s => s.stakeholder.disableds || [], []);
|
|
94
|
+
|
|
95
|
+
const rulesMap = controller.useMemo(s => s.stakeholder.rulesMap || {}, []);
|
|
96
|
+
|
|
97
|
+
/** 乐企 */
|
|
98
|
+
const leqispanW = React.useMemo(() => {
|
|
99
|
+
if (props.leqi) {
|
|
100
|
+
return 0;
|
|
101
|
+
} else {
|
|
102
|
+
return 2;
|
|
103
|
+
}
|
|
104
|
+
}, [props.leqi, props.riskData]);
|
|
105
|
+
/** 直连 */
|
|
106
|
+
const riskspanW = React.useMemo(() => {
|
|
107
|
+
if (props.riskData?.code === 'success') {
|
|
108
|
+
return 0;
|
|
109
|
+
} else {
|
|
110
|
+
return 2;
|
|
111
|
+
}
|
|
112
|
+
}, [props.leqi, props.riskData]);
|
|
113
|
+
|
|
114
|
+
const readOnly = React.useMemo(() => {
|
|
115
|
+
if (model === 'readOnly') return true;
|
|
116
|
+
if (model === 'prefab') return true;
|
|
117
|
+
return false;
|
|
118
|
+
}, [model]);
|
|
119
|
+
|
|
120
|
+
const onExpand = React.useCallback(() => { setExpand(e => !e) }, []);
|
|
121
|
+
|
|
122
|
+
const isReadOnly = React.useCallback(field => readOnly || disableds.indexOf(field) >= 0, [disableds, readOnly]);
|
|
123
|
+
|
|
124
|
+
const getRules = React.useCallback((field, defaultRules) => {
|
|
125
|
+
if (isReadOnly(field)) return [];
|
|
126
|
+
return rulesMap[field] || defaultRules;
|
|
127
|
+
}, [rulesMap, isReadOnly, isReadOnly]);
|
|
128
|
+
|
|
129
|
+
controller.useForm('stakeholder', form);
|
|
130
|
+
|
|
131
|
+
// props.isExpand 变化的时候更新
|
|
132
|
+
React.useEffect(() => {
|
|
133
|
+
setExpand(typeof props.isExpand === 'boolean' ? props.isExpand : true);
|
|
134
|
+
}, [props.isExpand])
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<div className={classNames("kts-invoice-operate-invoice-digtal-stakeholder", { readOnly: readOnly })} >
|
|
138
|
+
<div>
|
|
139
|
+
{'销售方信息'.split('').map(e => <span>{e}</span>)}
|
|
140
|
+
{
|
|
141
|
+
!readOnly &&
|
|
142
|
+
<Icon
|
|
143
|
+
className="digtal-stakeholder-expand-button"
|
|
144
|
+
component={isExpand ? ArrowUpSvg : ArrowDownSvg}
|
|
145
|
+
onClick={onExpand}
|
|
146
|
+
/>
|
|
147
|
+
}
|
|
148
|
+
</div>
|
|
149
|
+
<div>
|
|
150
|
+
<div style={{ marginTop: 20 }} className='natural-person-flag' >
|
|
151
|
+
{
|
|
152
|
+
props.isNaturalPerson === true &&
|
|
153
|
+
<Form.Item colon={false}>
|
|
154
|
+
{getFieldDecorator('naturalPersonFlag', {
|
|
155
|
+
})(
|
|
156
|
+
<NaturalPersonFlag readOnly={isReadOnly('naturalPersonFlag')} />
|
|
157
|
+
)}
|
|
158
|
+
</Form.Item>
|
|
159
|
+
}
|
|
160
|
+
</div>
|
|
161
|
+
<Form className="digtal-stakeholder-form" >
|
|
162
|
+
<Row gutter={[16, 0]}>
|
|
163
|
+
<Col span={24} >
|
|
164
|
+
<Form.Item label='名称' colon={false}>
|
|
165
|
+
{getFieldDecorator('supplierName', {
|
|
166
|
+
rules: getRules('supplierName', RULES.companyName('销售方名称')),
|
|
167
|
+
// getValueFromEvent: formatCompanyName
|
|
168
|
+
})
|
|
169
|
+
// (<MyInput readOnly={isReadOnly('supplierName')} placeholder="请输入名称" autoComplete="off" />)
|
|
170
|
+
(
|
|
171
|
+
<BuyerNameInput
|
|
172
|
+
myform={form}
|
|
173
|
+
fieldName='supplierName'
|
|
174
|
+
readOnly={isReadOnly('supplierName')}
|
|
175
|
+
placeholder="请输入名称"
|
|
176
|
+
autoComplete="off"
|
|
177
|
+
suffix={
|
|
178
|
+
isShowImportButton === true &&
|
|
179
|
+
<Button
|
|
180
|
+
type='link'
|
|
181
|
+
style={{ padding: 0, width: 20, height: '100%' }}
|
|
182
|
+
icon={<Icon component={PlusSvg} />}
|
|
183
|
+
onClick={() => { onClickImportButton && onClickImportButton(controller) }}
|
|
184
|
+
/>
|
|
185
|
+
}
|
|
186
|
+
/>
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
</Form.Item>
|
|
190
|
+
</Col>
|
|
191
|
+
|
|
192
|
+
<Col span={24} >
|
|
193
|
+
<Form.Item label='统一社会信用代码/纳税人识别号' colon={false}>
|
|
194
|
+
{getFieldDecorator('supplierTaxId', {
|
|
195
|
+
rules: getRules('supplierTaxId', [{ required: true, message: '销售方纳税人识别号必填' }, ...RULES.taxId('销售方纳税人识别号')])
|
|
196
|
+
})
|
|
197
|
+
// (<MyInput readOnly={isReadOnly('supplierTaxId')} placeholder="请输入统一社会信用代码/纳税人识别号" autoComplete="off" />)
|
|
198
|
+
(<BuyerNameInput
|
|
199
|
+
myform={form}
|
|
200
|
+
fieldName='supplierTaxId'
|
|
201
|
+
readOnly={isReadOnly('supplierTaxId')}
|
|
202
|
+
placeholder="请输入统一社会信用代码/纳税人识别号"
|
|
203
|
+
autoComplete="off"
|
|
204
|
+
/>)
|
|
205
|
+
}
|
|
206
|
+
</Form.Item>
|
|
207
|
+
</Col>
|
|
208
|
+
|
|
209
|
+
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
210
|
+
<Form.Item label='销售方地址' colon={false}>
|
|
211
|
+
{getFieldDecorator('sellerAddress', {
|
|
212
|
+
rules: getRules('sellerAddress', [{ max: 300, message: '销售方地址内容超长' }])
|
|
213
|
+
})(<MyInput readOnly={isReadOnly('sellerAddress')} placeholder="请输入销售方地址" autoComplete="off" />)}
|
|
214
|
+
</Form.Item>
|
|
215
|
+
</Col>
|
|
216
|
+
|
|
217
|
+
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
218
|
+
<Form.Item label='电话' colon={false} className='telephone' >
|
|
219
|
+
{getFieldDecorator('sellerPhone', {
|
|
220
|
+
rules: getRules('sellerPhone', RULES.sellerTelPhone('销售方电话'))
|
|
221
|
+
})(<MyInput readOnly={isReadOnly('sellerPhone')} placeholder="请输入电话" autoComplete="off" />)}
|
|
222
|
+
</Form.Item>
|
|
223
|
+
</Col>
|
|
224
|
+
|
|
225
|
+
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
226
|
+
<Form.Item label='销售方开户银行' colon={false}>
|
|
227
|
+
{getFieldDecorator('sellerBank', {
|
|
228
|
+
rules: getRules('sellerBank', RULES.bankName('销售方开户银行'))
|
|
229
|
+
})(<MyInput readOnly={isReadOnly('sellerBank')} placeholder="请输入销售方开户银行" autoComplete="off" />)}
|
|
230
|
+
</Form.Item>
|
|
231
|
+
</Col>
|
|
232
|
+
|
|
233
|
+
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
234
|
+
<Form.Item label='银行账号' colon={false}>
|
|
235
|
+
{getFieldDecorator('sellerAccount', {
|
|
236
|
+
rules: getRules('sellerAccount', RULES.bankAccount('销售方银行账号'))
|
|
237
|
+
})(<MyInput readOnly={isReadOnly('sellerAccount')} placeholder="请输入银行账号" autoComplete="off" />)}
|
|
238
|
+
</Form.Item>
|
|
239
|
+
</Col>
|
|
240
|
+
{(props.leqi || props.riskData?.code === 'success') &&
|
|
241
|
+
<Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
|
|
242
|
+
<Form.Item colon={false}>
|
|
243
|
+
{getFieldDecorator('sellerBankAccountFlag', {
|
|
244
|
+
valuePropName: 'checked',
|
|
245
|
+
})(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('sellerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
|
|
246
|
+
</Form.Item>
|
|
247
|
+
</Col>
|
|
248
|
+
}
|
|
249
|
+
</Row>
|
|
250
|
+
</Form>
|
|
251
|
+
</div>
|
|
252
|
+
<div>
|
|
253
|
+
{'购买方信息'.split('').map(e => <span>{e}</span>)}
|
|
254
|
+
{
|
|
255
|
+
!readOnly &&
|
|
256
|
+
<Icon
|
|
257
|
+
className="digtal-stakeholder-expand-button"
|
|
258
|
+
component={isExpand ? ArrowUpSvg : ArrowDownSvg}
|
|
259
|
+
onClick={onExpand}
|
|
260
|
+
/>
|
|
261
|
+
}
|
|
262
|
+
</div>
|
|
263
|
+
<div>
|
|
264
|
+
{
|
|
265
|
+
!readOnly && props.lineCredit &&
|
|
266
|
+
<div style={{ marginTop: 20 }} >
|
|
267
|
+
<Tooltip trigger="click" title={props.lineCredit} >
|
|
268
|
+
<Button type="link" style={{ padding: `0px 8px` }} >查看当前可用授信额度</Button>
|
|
269
|
+
</Tooltip>
|
|
270
|
+
</div>
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
<Form className="digtal-stakeholder-form" >
|
|
274
|
+
<Row gutter={[16, 0]}>
|
|
275
|
+
<Col span={24} >
|
|
276
|
+
<Form.Item label='名称' colon={false}>
|
|
277
|
+
{getFieldDecorator('buyerName', {
|
|
278
|
+
rules: getRules('buyerName', RULES.companyName('购买方名称')),
|
|
279
|
+
})(
|
|
280
|
+
<BuyerNameInput
|
|
281
|
+
myform={form}
|
|
282
|
+
fieldName='buyerName'
|
|
283
|
+
readOnly={isReadOnly('buyerName')}
|
|
284
|
+
placeholder="请输入名称"
|
|
285
|
+
autoComplete="off"
|
|
286
|
+
suffix={
|
|
287
|
+
isShowImportButton === true &&
|
|
288
|
+
<Button
|
|
289
|
+
type='link'
|
|
290
|
+
style={{ padding: 0, width: 20, height: '100%' }}
|
|
291
|
+
icon={<Icon component={PlusSvg} />}
|
|
292
|
+
onClick={() => { onClickImportButton && onClickImportButton(controller) }}
|
|
293
|
+
/>
|
|
294
|
+
}
|
|
295
|
+
/>
|
|
296
|
+
)}
|
|
297
|
+
</Form.Item>
|
|
298
|
+
</Col>
|
|
299
|
+
|
|
300
|
+
<Col span={24} >
|
|
301
|
+
<Form.Item label='统一社会信用代码/纳税人识别号' colon={false}>
|
|
302
|
+
{getFieldDecorator('buyerTaxId', {
|
|
303
|
+
rules: getRules('buyerTaxId', [{ required: !isVatNormal, message: '购买方纳税人识别号必填' }, ...RULES.taxId('购买方纳税人识别号')])
|
|
304
|
+
})(
|
|
305
|
+
<BuyerNameInput
|
|
306
|
+
myform={form}
|
|
307
|
+
fieldName='buyerTaxId'
|
|
308
|
+
readOnly={isReadOnly('buyerTaxId')}
|
|
309
|
+
placeholder="请输入统一社会信用代码/纳税人识别号"
|
|
310
|
+
autoComplete="off"
|
|
311
|
+
/>
|
|
312
|
+
)}
|
|
313
|
+
</Form.Item>
|
|
314
|
+
</Col>
|
|
315
|
+
|
|
316
|
+
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
317
|
+
<Form.Item label='购买方地址' colon={false}>
|
|
318
|
+
{getFieldDecorator('buyerAddress', {
|
|
319
|
+
rules: getRules('buyerAddress', [{ max: 100, message: '购买方地址内容超长' }])
|
|
320
|
+
})(<MyInput readOnly={isReadOnly('buyerAddress')} placeholder="请输入购买方地址" autoComplete="off" />)}
|
|
321
|
+
</Form.Item>
|
|
322
|
+
</Col>
|
|
323
|
+
|
|
324
|
+
<Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
325
|
+
<Form.Item label='电话' colon={false} className='telephone'>
|
|
326
|
+
{getFieldDecorator('buyerPhone', {
|
|
327
|
+
rules: getRules('buyerPhone', RULES.buyerTelPhone('购买方电话'))
|
|
328
|
+
})(<MyInput readOnly={isReadOnly('buyerPhone')} placeholder="请输入电话" autoComplete="off" />)}
|
|
329
|
+
</Form.Item>
|
|
330
|
+
</Col>
|
|
331
|
+
|
|
332
|
+
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
333
|
+
<Form.Item label='购买方开户银行' colon={false}>
|
|
334
|
+
{getFieldDecorator('buyerBank', {
|
|
335
|
+
rules: getRules('buyerBank', RULES.bankName('购买方开户银行'))
|
|
336
|
+
})(<MyInput readOnly={isReadOnly('buyerBank')} placeholder="请输入购买方开户银行" autoComplete="off" />)}
|
|
337
|
+
</Form.Item>
|
|
338
|
+
</Col>
|
|
339
|
+
|
|
340
|
+
<Col span={10 + leqispanW} style={{ display: isExpand ? undefined : 'none' }} >
|
|
341
|
+
<Form.Item label='银行账号' colon={false}>
|
|
342
|
+
{getFieldDecorator('buyerAccount', {
|
|
343
|
+
rules: getRules('buyerAccount', RULES.bankAccount('购买方银行账号'))
|
|
344
|
+
})(<MyInput readOnly={isReadOnly('buyerAccount')} placeholder="请输入银行账号" autoComplete="off" />)}
|
|
345
|
+
</Form.Item>
|
|
346
|
+
</Col>
|
|
347
|
+
{(props.leqi || props.riskData?.code === 'success') &&
|
|
348
|
+
<Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
|
|
349
|
+
<Form.Item colon={false}>
|
|
350
|
+
{getFieldDecorator('buyerBankAccountFlag', {
|
|
351
|
+
valuePropName: 'checked',
|
|
352
|
+
})(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('buyerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
|
|
353
|
+
</Form.Item>
|
|
354
|
+
</Col>
|
|
355
|
+
}
|
|
356
|
+
</Row>
|
|
357
|
+
</Form>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
</div>
|
|
361
|
+
)
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
function NaturalPersonFlag(props: {
|
|
365
|
+
// NATURAL("自然人"), COMPANY("非自然人");
|
|
366
|
+
value?: 'COMPANY' | 'NATURAL',
|
|
367
|
+
onChange?: (e: 'COMPANY' | 'NATURAL') => void
|
|
368
|
+
readOnly?: boolean;
|
|
369
|
+
}) {
|
|
370
|
+
|
|
371
|
+
const [value, setValue] = React.useState(props.value || 'COMPANY');
|
|
372
|
+
|
|
373
|
+
const onChange = React.useCallback((e: CheckboxChangeEvent) => {
|
|
374
|
+
if (props.readOnly) return;
|
|
375
|
+
setValue(e.target.checked ? 'NATURAL' : 'COMPANY');
|
|
376
|
+
props.onChange && props.onChange(e.target.checked ? 'NATURAL' : 'COMPANY');
|
|
377
|
+
}, [props.onChange, props.readOnly])
|
|
378
|
+
|
|
379
|
+
React.useEffect(() => {
|
|
380
|
+
setValue(props.value || 'COMPANY')
|
|
381
|
+
}, [props.value])
|
|
382
|
+
|
|
383
|
+
return (
|
|
384
|
+
<Checkbox
|
|
385
|
+
disabled={props.readOnly}
|
|
386
|
+
checked={value === 'NATURAL'}
|
|
387
|
+
onChange={onChange}
|
|
388
|
+
>
|
|
389
|
+
是否开票给自然人
|
|
390
|
+
</Checkbox>
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function BuyerNameInput(props: InputProps & { fieldName: string; myform: WrappedFormUtils<any> }) {
|
|
395
|
+
|
|
396
|
+
const { fieldName, myform: form } = props;
|
|
397
|
+
|
|
398
|
+
const controller = Invoice.useInvoiceController();
|
|
399
|
+
|
|
400
|
+
const rootElement = controller.useMemo(s => s.rootElement, []);
|
|
401
|
+
|
|
402
|
+
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
403
|
+
|
|
404
|
+
const [options, setOptions] = React.useState<any[]>([])
|
|
405
|
+
|
|
406
|
+
const onChangeAutoComplete = React.useCallback(value => {
|
|
407
|
+
const record = options.filter(e => e[fieldName] === value)[0] as any;
|
|
408
|
+
if (!record || !form) return;
|
|
409
|
+
|
|
410
|
+
form.setFieldsValue(record);
|
|
411
|
+
setOptions([])
|
|
412
|
+
}, [options, fieldName, form])
|
|
413
|
+
|
|
414
|
+
const onSearch = React.useCallback(async (searchText: string) => {
|
|
415
|
+
await Discontinue.start();
|
|
416
|
+
try {
|
|
417
|
+
if (fieldName === 'buyerName' ) {
|
|
418
|
+
if (autoComplete.onBuyerNameSearch) {
|
|
419
|
+
setOptions(await autoComplete.onBuyerNameSearch(searchText));
|
|
420
|
+
}
|
|
421
|
+
} else if (fieldName === 'buyerTaxId' ) {
|
|
422
|
+
if (autoComplete.onBuyerTaxIdSearch) {
|
|
423
|
+
setOptions(await autoComplete.onBuyerTaxIdSearch(searchText));
|
|
424
|
+
}
|
|
425
|
+
}else if(fieldName === 'supplierName'){
|
|
426
|
+
if (autoComplete.onSupplierNameSearch) {
|
|
427
|
+
setOptions(await autoComplete.onSupplierNameSearch(searchText));
|
|
428
|
+
}
|
|
429
|
+
}else if(fieldName === 'supplierTaxId'){
|
|
430
|
+
if (autoComplete.onSupplierTaxIdSearch) {
|
|
431
|
+
setOptions(await autoComplete.onSupplierTaxIdSearch(searchText));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
} catch (error) {
|
|
436
|
+
setOptions([]);
|
|
437
|
+
throw error;
|
|
438
|
+
}
|
|
439
|
+
}, [autoComplete.onBuyerNameSearch, fieldName])
|
|
440
|
+
|
|
441
|
+
if (props.readOnly) return <span className='digtal-stakeholder-form-text'>{props.value}</span>;
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<AutoComplete
|
|
445
|
+
onSearch={onSearch}
|
|
446
|
+
options={options.map(e => ({ value: e[fieldName] }))}
|
|
447
|
+
onChange={onChangeAutoComplete}
|
|
448
|
+
value={props.value}
|
|
449
|
+
getPopupContainer={() => rootElement || document.body}
|
|
450
|
+
style={{ width: '100%' }}
|
|
451
|
+
>
|
|
452
|
+
<Input {...props} style={{ width: '100%', ...props.style }} />
|
|
453
|
+
</AutoComplete>
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
class MyInput extends React.Component<InputProps> {
|
|
458
|
+
render() {
|
|
459
|
+
const props = this.props;
|
|
460
|
+
if (props.readOnly) {
|
|
461
|
+
return <span className='digtal-stakeholder-form-text'>{props.value}</span>
|
|
462
|
+
} else {
|
|
463
|
+
return <Input {...props} />
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
class Discontinue {
|
|
469
|
+
|
|
470
|
+
private static timer: any;
|
|
471
|
+
|
|
472
|
+
static start = (interval = 200) => new Promise<void>(resolve => {
|
|
473
|
+
clearTimeout(Discontinue.timer);
|
|
474
|
+
Discontinue.timer = setTimeout(resolve, interval);
|
|
475
|
+
})
|
|
476
|
+
}
|
|
477
|
+
|