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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.28",
3
+ "version": "3.2.30",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -13,5 +13,5 @@ export default class AutoComplete {
13
13
  onBuyerTaxIdSearch?: (searchText: string) => Promise<any[]>;
14
14
 
15
15
  /** 商品编码自动补全 */
16
- onItemCodeSearch?: (searchText: string) => Promise<any[]>;
16
+ onItemCodeSearch?: (searchText: string, itemName: any) => Promise<any[]>;
17
17
  }
@@ -106,9 +106,10 @@ export default (form: WrappedFormUtils) => {
106
106
  initialValue: editGood.itemCode,
107
107
  })(
108
108
  <ItemCodeInput
109
- shorthand={editGood.shorthand}
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: isMyShow ? record.itemNameSelf : record.itemName,
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, shorthand?: 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.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
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
+ // };