kts-component-invoice-operate 3.2.21 → 3.2.24
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/dist/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.d.ts +4 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/InvoiceController/fns/importGoodsDrawer.d.ts +6 -0
- package/dist/Invoice/InvoiceController/fns/mergeDiscount.d.ts +2 -0
- package/dist/Invoice/InvoiceController/index.d.ts +4 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.d.ts +1 -0
- package/dist/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDiscount/index.d.ts +6 -0
- package/dist/Invoice/ui/digtal/Stakeholder/index.d.ts +1 -1
- package/dist/index.esm.js +7097 -6733
- package/dist/index.js +7097 -6733
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/header/index.tsx +68 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +7 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
- package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +68 -0
- package/src/Invoice/InvoiceController/fns/mergeDiscount.ts +29 -0
- package/src/Invoice/InvoiceController/index.ts +9 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +61 -61
- package/src/Invoice/ui/default/GoodsList/index.tsx +7 -0
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +1 -1
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDiscount/index.tsx +37 -0
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +33 -7
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +88 -14
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import React from
|
|
2
|
+
import React, { ChangeEvent } from 'react';
|
|
3
3
|
import Icon from '@ant-design/icons';
|
|
4
4
|
import { decorator } from "grey-react-box";
|
|
5
5
|
import { Form } from "kts-components-antd-x3";
|
|
6
|
-
import { Button, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
|
|
6
|
+
import { AutoComplete, Button, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
|
|
7
7
|
import { FormComponentProps } from "kts-components-antd-x3/lib/form";
|
|
8
|
+
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
8
9
|
import { ReactComponent as ArrowUpSvg } from './svg/arrowUp.svg';
|
|
9
10
|
import { ReactComponent as ArrowDownSvg } from './svg/arrowDown.svg';
|
|
10
11
|
import { ReactComponent as PlusSvg } from './svg/plus.svg'
|
|
@@ -19,21 +20,21 @@ const RULES = {
|
|
|
19
20
|
{ pattern: /^([A-Za-z()\u4e00-\u9fa5])*$/g, message: `${label}仅能中文、英文、括号` }
|
|
20
21
|
],
|
|
21
22
|
companyNameByNormal: (label: string) => [
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
{ required: true, message: `${label}必填` },
|
|
24
|
+
{ max: 200, message: `${label}内容超长` }
|
|
24
25
|
],
|
|
25
26
|
taxId: (label: string) => [
|
|
26
27
|
{ max: 20, message: `${label}内容超长` },
|
|
27
28
|
{ pattern: /^([a-zA-Z0-9])*$/g, message: `${label}仅能数字、英文` }
|
|
28
29
|
],
|
|
29
30
|
buyerTelPhone: (label: string) => [
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
{ max: 100, message: `${label}内容超长` },
|
|
32
|
+
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
32
33
|
],
|
|
33
34
|
sellerTelPhone: (label: string) => [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
{ required: true, message: `${label}必填` },
|
|
36
|
+
{ max: 100, message: `${label}内容超长` },
|
|
37
|
+
{ pattern: /^[0-9\s\-\+]+$/g, message: `${label}仅能数字、空格、-、+` }
|
|
37
38
|
],
|
|
38
39
|
bankName: (label: string) => [
|
|
39
40
|
{ max: 100, message: `${label}内容超长` }
|
|
@@ -69,7 +70,7 @@ export interface IStakeholder {
|
|
|
69
70
|
/** 干系人 */
|
|
70
71
|
export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.create())(props => {
|
|
71
72
|
|
|
72
|
-
const { form, isShowImportButton, onClickImportButton
|
|
73
|
+
const { form, isShowImportButton, onClickImportButton, isVatNormal = false } = props;
|
|
73
74
|
|
|
74
75
|
const [isExpand, setExpand] = React.useState(true);
|
|
75
76
|
|
|
@@ -120,10 +121,12 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
|
|
|
120
121
|
<Form.Item label='名称' colon={false}>
|
|
121
122
|
{getFieldDecorator('buyerName', {
|
|
122
123
|
rules: getRules('buyerName', isVatNormal ?
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
RULES.companyNameByNormal('购买方名称') :
|
|
125
|
+
RULES.companyNameBySpecial('购买方名称')),
|
|
125
126
|
})(
|
|
126
|
-
<
|
|
127
|
+
<BuyerNameInput
|
|
128
|
+
myform={form}
|
|
129
|
+
fieldName='buyerName'
|
|
127
130
|
readOnly={isReadOnly('buyerName')}
|
|
128
131
|
placeholder="请输入"
|
|
129
132
|
autoComplete="off"
|
|
@@ -145,7 +148,15 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
|
|
|
145
148
|
<Form.Item label='统一社会信用代码/纳税人识别号' colon={false}>
|
|
146
149
|
{getFieldDecorator('buyerTaxId', {
|
|
147
150
|
rules: getRules('buyerTaxId', [{ required: !isVatNormal, message: '购买方纳税人识别号必填' }, ...RULES.taxId('购买方纳税人识别号')])
|
|
148
|
-
})(
|
|
151
|
+
})(
|
|
152
|
+
<BuyerNameInput
|
|
153
|
+
myform={form}
|
|
154
|
+
fieldName='buyerTaxId'
|
|
155
|
+
readOnly={isReadOnly('buyerTaxId')}
|
|
156
|
+
placeholder="请输入"
|
|
157
|
+
autoComplete="off"
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
149
160
|
</Form.Item>
|
|
150
161
|
</Col>
|
|
151
162
|
{
|
|
@@ -270,6 +281,58 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
|
|
|
270
281
|
)
|
|
271
282
|
})
|
|
272
283
|
|
|
284
|
+
|
|
285
|
+
function BuyerNameInput(props: InputProps & { fieldName: string; myform: WrappedFormUtils<any> }) {
|
|
286
|
+
|
|
287
|
+
const { fieldName, myform: form } = props;
|
|
288
|
+
|
|
289
|
+
const controller = Invoice.useInvoiceController();
|
|
290
|
+
|
|
291
|
+
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
292
|
+
|
|
293
|
+
const [options, setOptions] = React.useState<any[]>([])
|
|
294
|
+
|
|
295
|
+
const onChangeAutoComplete = React.useCallback(value => {
|
|
296
|
+
const record = options.filter(e => e[fieldName] === value)[0] as any;
|
|
297
|
+
if (!record || !form) return;
|
|
298
|
+
|
|
299
|
+
form.setFieldsValue(record);
|
|
300
|
+
setOptions([])
|
|
301
|
+
}, [options, fieldName, form])
|
|
302
|
+
|
|
303
|
+
const onSearch = React.useCallback(async (searchText: string) => {
|
|
304
|
+
await Discontinue.start();
|
|
305
|
+
try {
|
|
306
|
+
if (fieldName === 'buyerName') {
|
|
307
|
+
if (autoComplete.onBuyerNameSearch) {
|
|
308
|
+
setOptions(await autoComplete.onBuyerNameSearch(searchText));
|
|
309
|
+
}
|
|
310
|
+
} else if (fieldName === 'buyerTaxId') {
|
|
311
|
+
if (autoComplete.onBuyerTaxIdSearch) {
|
|
312
|
+
setOptions(await autoComplete.onBuyerTaxIdSearch(searchText));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
} catch (error) {
|
|
317
|
+
setOptions([]);
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
}, [autoComplete.onBuyerNameSearch, fieldName])
|
|
321
|
+
|
|
322
|
+
if (props.readOnly) return <span>{props.value}</span>;
|
|
323
|
+
|
|
324
|
+
return (
|
|
325
|
+
<AutoComplete
|
|
326
|
+
onSearch={onSearch}
|
|
327
|
+
options={options.map(e => ({ value: e[fieldName] }))}
|
|
328
|
+
onChange={onChangeAutoComplete}
|
|
329
|
+
value={props.value}
|
|
330
|
+
>
|
|
331
|
+
<Input {...props} style={{ width: '100%', ...props.style }} />
|
|
332
|
+
</AutoComplete>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
273
336
|
class MyInput extends React.Component<InputProps>{
|
|
274
337
|
render() {
|
|
275
338
|
const props = this.props;
|
|
@@ -280,3 +343,14 @@ class MyInput extends React.Component<InputProps>{
|
|
|
280
343
|
}
|
|
281
344
|
}
|
|
282
345
|
}
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class Discontinue {
|
|
349
|
+
|
|
350
|
+
private static timer: any;
|
|
351
|
+
|
|
352
|
+
static start = (interval = 200) => new Promise<void>(resolve => {
|
|
353
|
+
clearTimeout(Discontinue.timer);
|
|
354
|
+
Discontinue.timer = setTimeout(resolve, interval);
|
|
355
|
+
})
|
|
356
|
+
}
|