kts-component-invoice-operate 3.2.28 → 3.2.30
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 +1 -1
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.d.ts +1 -1
- package/dist/index.esm.js +236 -143
- package/dist/index.js +236 -143
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +1 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +5 -4
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemCodeInput/index.tsx +16 -5
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +6 -3
package/package.json
CHANGED
|
@@ -106,9 +106,10 @@ export default (form: WrappedFormUtils) => {
|
|
|
106
106
|
initialValue: editGood.itemCode,
|
|
107
107
|
})(
|
|
108
108
|
<ItemCodeInput
|
|
109
|
-
|
|
110
|
-
onChange={() => {
|
|
111
|
-
onChangeItemCode(controller, form, record);
|
|
109
|
+
record={record}
|
|
110
|
+
onChange={async () => {
|
|
111
|
+
await onChangeItemCode(controller, form, record);
|
|
112
|
+
await onChangeLineAmountIncludeTax(controller, form, record);
|
|
112
113
|
}}
|
|
113
114
|
/>
|
|
114
115
|
)}
|
|
@@ -128,7 +129,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
128
129
|
<Form.Item>
|
|
129
130
|
<div style={{ display: 'flex' }} >
|
|
130
131
|
{getFieldDecorator('itemName', {
|
|
131
|
-
initialValue:
|
|
132
|
+
initialValue: record.itemName,
|
|
132
133
|
rules: [
|
|
133
134
|
...getReplenishRules('itemName'),
|
|
134
135
|
{
|
|
@@ -5,7 +5,7 @@ import { AutoComplete } from 'kts-xui';
|
|
|
5
5
|
import { IGood, Invoice } from '../../../../../../../..';
|
|
6
6
|
import './index.less';
|
|
7
7
|
|
|
8
|
-
export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string,
|
|
8
|
+
export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, record: any }) {
|
|
9
9
|
|
|
10
10
|
const controller = Invoice.useInvoiceController();
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
21
21
|
const onSearch = React.useCallback(async (searchText: string) => {
|
|
22
22
|
try {
|
|
23
23
|
if (autoComplete.onItemCodeSearch) {
|
|
24
|
-
setOptions(await autoComplete.onItemCodeSearch(searchText))
|
|
24
|
+
setOptions(await autoComplete.onItemCodeSearch(searchText, props.record?.itemName))
|
|
25
25
|
}
|
|
26
26
|
} catch (error) {
|
|
27
27
|
setOptions([])
|
|
@@ -29,15 +29,26 @@ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
29
29
|
}
|
|
30
30
|
}, [autoComplete.onItemCodeSearch])
|
|
31
31
|
|
|
32
|
-
const onChangeAutoComplete = React.useCallback(itemName => {
|
|
32
|
+
const onChangeAutoComplete = React.useCallback(async itemName => {
|
|
33
33
|
const record = options.filter(e => e.itemCode === itemName)[0] as any;
|
|
34
34
|
if (!record) return;
|
|
35
|
+
|
|
36
|
+
const option = {
|
|
37
|
+
itemCode: record.itemCode,
|
|
38
|
+
itemName: record.itemName,
|
|
39
|
+
taxCategoryCode: record.taxCategoryCode,
|
|
40
|
+
shorthand: record.shorthand,
|
|
41
|
+
specification: record.specification,
|
|
42
|
+
unit: record.unit,
|
|
43
|
+
lineAmountIncludeTax: record.lineAmountIncludeTax,
|
|
44
|
+
taxRate: record.taxRate,
|
|
45
|
+
}
|
|
46
|
+
await controller.setEditGood(option);
|
|
35
47
|
}, [options, controller])
|
|
36
48
|
|
|
37
49
|
return (
|
|
38
50
|
<div className='kts-invoice-operate-goods-list-itemCode-input'>
|
|
39
|
-
{props.
|
|
40
|
-
<AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemCode }))} onChange={onChangeAutoComplete} >
|
|
51
|
+
<AutoComplete onSearch={onSearch} defaultValue={props.value} options={options.map(e => ({ value: e.itemCode }))} onChange={onChangeAutoComplete} >
|
|
41
52
|
<Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
|
|
42
53
|
</AutoComplete>
|
|
43
54
|
</div>
|
|
@@ -32,12 +32,15 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
32
32
|
}
|
|
33
33
|
}, [autoComplete.onItemNameSearch])
|
|
34
34
|
|
|
35
|
-
const onChangeAutoComplete = React.useCallback(itemName => {
|
|
35
|
+
const onChangeAutoComplete = React.useCallback(async itemName => {
|
|
36
36
|
// const good = options.filter(e=>e.itemName === itemName)[0];
|
|
37
37
|
// good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
|
|
38
38
|
|
|
39
39
|
const record = options.filter(e => e.itemName === itemName)[0] as any;
|
|
40
40
|
if (!record) return;
|
|
41
|
+
|
|
42
|
+
await controller.setEditGood({ itemName: record.itemName });
|
|
43
|
+
|
|
41
44
|
controller.importGoodsDrawer(record);
|
|
42
45
|
// controller.run(async s => {
|
|
43
46
|
// Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
|
|
@@ -96,7 +99,7 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
96
99
|
return (
|
|
97
100
|
<div className='kts-invoice-operate-goods-list-itemName-input'>
|
|
98
101
|
{props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
|
|
99
|
-
<AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
|
|
102
|
+
<AutoComplete onSearch={onSearch} defaultValue={props.value} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
|
|
100
103
|
<Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
|
|
101
104
|
</AutoComplete>
|
|
102
105
|
</div>
|
|
@@ -122,4 +125,4 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
122
125
|
|
|
123
126
|
// // 单价(含税)/(1+税率) = 单价(不含税)
|
|
124
127
|
// return format15(evaluate(`${record.priceIncludeTax} / (1+${s.taxRate}/100)`), calculatingDigits);
|
|
125
|
-
// };
|
|
128
|
+
// };
|