kts-component-invoice-operate 3.2.72 → 3.2.74

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/index.esm.js CHANGED
@@ -10706,8 +10706,6 @@ function ItemNameInput(props) {
10706
10706
  while (1) {
10707
10707
  switch (_context2.prev = _context2.next) {
10708
10708
  case 0:
10709
- // const good = options.filter(e=>e.itemName === itemName)[0];
10710
- // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10711
10709
  record = options.filter(function (e) {
10712
10710
  return e.itemName === itemName;
10713
10711
  })[0];
@@ -10726,51 +10724,10 @@ function ItemNameInput(props) {
10726
10724
  });
10727
10725
 
10728
10726
  case 5:
10729
- controller.importGoodsDrawer(record); // controller.run(async s => {
10730
- // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10731
- // // 没用 被编辑的货物 和 form 就退出
10732
- // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10733
- // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10734
- // record.quantity = undefined;
10735
- // record.lineAmountExcludeTax = undefined;
10736
- // record.lineAmountIncludeTax = undefined;
10737
- // // 中间数据
10738
- // const between = { ...record };
10739
- // between.itemName = record.itemName;
10740
- // between.itemNameOther = record.itemName;
10741
- // // 设置编辑货物
10742
- // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10743
- // if (editGood.taxRate) {
10744
- // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10745
- // }
10746
- // if (`${editGood.priceIncludeTax}` === '0') {
10747
- // editGood.priceIncludeTax = undefined;
10748
- // editGood.priceExcludeTax = undefined;
10749
- // } else {
10750
- // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10751
- // }
10752
- // if (editGood.quantity && editGood.priceIncludeTax) {
10753
- // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10754
- // }
10755
- // // 导入FORM里
10756
- // if (s.goodsListState.isMyShow) {
10757
- // s.goodsListState.form.setFieldsValue({
10758
- // ...editGood,
10759
- // itemName: editGood.itemNameSelf,
10760
- // itemModelName: editGood.itemModelNameSelf,
10761
- // });
10762
- // } else {
10763
- // s.goodsListState.form.setFieldsValue({
10764
- // ...editGood,
10765
- // });
10766
- // }
10767
- // s.goodsListState.importGoods.isVisibleDrawer = false;
10768
- // s.goodsListState.isTaxIncluded
10769
- // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10770
- // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10771
- // })
10727
+ controller.importGoodsDrawer(record);
10728
+ setOptions([]);
10772
10729
 
10773
- case 6:
10730
+ case 7:
10774
10731
  case "end":
10775
10732
  return _context2.stop();
10776
10733
  }
@@ -16486,22 +16443,22 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
16486
16443
  });
16487
16444
 
16488
16445
  function NaturalPersonFlag(props) {
16489
- var _React$useState3 = React.useState(props.value || 0),
16446
+ var _React$useState3 = React.useState(props.value || 'COMPANY'),
16490
16447
  _React$useState4 = _slicedToArray(_React$useState3, 2),
16491
16448
  value = _React$useState4[0],
16492
16449
  setValue = _React$useState4[1];
16493
16450
 
16494
16451
  var onChange = React.useCallback(function (e) {
16495
16452
  if (props.readOnly) return;
16496
- setValue(e.target.checked ? 1 : 0);
16497
- props.onChange && props.onChange(e.target.checked ? 1 : 0);
16453
+ setValue(e.target.checked ? 'NATURAL' : 'COMPANY');
16454
+ props.onChange && props.onChange(e.target.checked ? 'NATURAL' : 'COMPANY');
16498
16455
  }, [props.onChange, props.readOnly]);
16499
16456
  React.useEffect(function () {
16500
- setValue(props.value || 0);
16457
+ setValue(props.value || 'COMPANY');
16501
16458
  }, [props.value]);
16502
16459
  return React.createElement(Checkbox$1, {
16503
16460
  disabled: props.readOnly,
16504
- checked: value === 1,
16461
+ checked: value === 'NATURAL',
16505
16462
  onChange: onChange
16506
16463
  }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
16507
16464
  }
package/dist/index.js CHANGED
@@ -10716,8 +10716,6 @@ function ItemNameInput(props) {
10716
10716
  while (1) {
10717
10717
  switch (_context2.prev = _context2.next) {
10718
10718
  case 0:
10719
- // const good = options.filter(e=>e.itemName === itemName)[0];
10720
- // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10721
10719
  record = options.filter(function (e) {
10722
10720
  return e.itemName === itemName;
10723
10721
  })[0];
@@ -10736,51 +10734,10 @@ function ItemNameInput(props) {
10736
10734
  });
10737
10735
 
10738
10736
  case 5:
10739
- controller.importGoodsDrawer(record); // controller.run(async s => {
10740
- // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10741
- // // 没用 被编辑的货物 和 form 就退出
10742
- // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10743
- // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10744
- // record.quantity = undefined;
10745
- // record.lineAmountExcludeTax = undefined;
10746
- // record.lineAmountIncludeTax = undefined;
10747
- // // 中间数据
10748
- // const between = { ...record };
10749
- // between.itemName = record.itemName;
10750
- // between.itemNameOther = record.itemName;
10751
- // // 设置编辑货物
10752
- // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10753
- // if (editGood.taxRate) {
10754
- // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10755
- // }
10756
- // if (`${editGood.priceIncludeTax}` === '0') {
10757
- // editGood.priceIncludeTax = undefined;
10758
- // editGood.priceExcludeTax = undefined;
10759
- // } else {
10760
- // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10761
- // }
10762
- // if (editGood.quantity && editGood.priceIncludeTax) {
10763
- // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10764
- // }
10765
- // // 导入FORM里
10766
- // if (s.goodsListState.isMyShow) {
10767
- // s.goodsListState.form.setFieldsValue({
10768
- // ...editGood,
10769
- // itemName: editGood.itemNameSelf,
10770
- // itemModelName: editGood.itemModelNameSelf,
10771
- // });
10772
- // } else {
10773
- // s.goodsListState.form.setFieldsValue({
10774
- // ...editGood,
10775
- // });
10776
- // }
10777
- // s.goodsListState.importGoods.isVisibleDrawer = false;
10778
- // s.goodsListState.isTaxIncluded
10779
- // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10780
- // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10781
- // })
10737
+ controller.importGoodsDrawer(record);
10738
+ setOptions([]);
10782
10739
 
10783
- case 6:
10740
+ case 7:
10784
10741
  case "end":
10785
10742
  return _context2.stop();
10786
10743
  }
@@ -16496,22 +16453,22 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
16496
16453
  });
16497
16454
 
16498
16455
  function NaturalPersonFlag(props) {
16499
- var _React$useState3 = React__default['default'].useState(props.value || 0),
16456
+ var _React$useState3 = React__default['default'].useState(props.value || 'COMPANY'),
16500
16457
  _React$useState4 = _slicedToArray(_React$useState3, 2),
16501
16458
  value = _React$useState4[0],
16502
16459
  setValue = _React$useState4[1];
16503
16460
 
16504
16461
  var onChange = React__default['default'].useCallback(function (e) {
16505
16462
  if (props.readOnly) return;
16506
- setValue(e.target.checked ? 1 : 0);
16507
- props.onChange && props.onChange(e.target.checked ? 1 : 0);
16463
+ setValue(e.target.checked ? 'NATURAL' : 'COMPANY');
16464
+ props.onChange && props.onChange(e.target.checked ? 'NATURAL' : 'COMPANY');
16508
16465
  }, [props.onChange, props.readOnly]);
16509
16466
  React__default['default'].useEffect(function () {
16510
- setValue(props.value || 0);
16467
+ setValue(props.value || 'COMPANY');
16511
16468
  }, [props.value]);
16512
16469
  return React__default['default'].createElement(ktsXui.Checkbox, {
16513
16470
  disabled: props.readOnly,
16514
- checked: value === 1,
16471
+ checked: value === 'NATURAL',
16515
16472
  onChange: onChange
16516
16473
  }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
16517
16474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.72",
3
+ "version": "3.2.74",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -56,14 +56,7 @@ class MyInvoiceController extends InvoiceController {
56
56
  "shorthand": "发电",
57
57
  "taxRate": 2
58
58
  },
59
- {
60
- "itemName": "苹果",
61
- "taxClassificationCode": "1010115010100000000",
62
- "itemModelName": null,
63
- "shorthand": "水果",
64
- "taxRate": 3
65
- }
66
- ] as any
59
+ ].slice() as any
67
60
  }
68
61
  }
69
62
 
@@ -24,7 +24,7 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
24
24
  const onSearch = React.useCallback(async (searchText: string) => {
25
25
  try {
26
26
  if (autoComplete.onItemNameSearch) {
27
- setOptions(await autoComplete.onItemNameSearch(searchText))
27
+ setOptions(await autoComplete.onItemNameSearch(searchText));
28
28
  }
29
29
  } catch (error) {
30
30
  setOptions([])
@@ -33,67 +33,14 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
33
33
  }, [autoComplete.onItemNameSearch])
34
34
 
35
35
  const onChangeAutoComplete = React.useCallback(async itemName => {
36
- // const good = options.filter(e=>e.itemName === itemName)[0];
37
- // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
38
-
39
36
  const record = options.filter(e => e.itemName === itemName)[0] as any;
40
37
  if (!record) return;
41
38
 
42
39
  await controller.setEditGood({ itemName: record.itemName });
43
40
 
44
41
  controller.importGoodsDrawer(record);
45
- // controller.run(async s => {
46
- // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
47
-
48
- // // 没用 被编辑的货物 和 form 就退出
49
- // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
50
-
51
- // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
52
- // record.quantity = undefined;
53
- // record.lineAmountExcludeTax = undefined;
54
- // record.lineAmountIncludeTax = undefined;
55
-
56
- // // 中间数据
57
- // const between = { ...record };
58
- // between.itemName = record.itemName;
59
- // between.itemNameOther = record.itemName;
60
-
61
- // // 设置编辑货物
62
- // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
63
-
64
- // if (editGood.taxRate) {
65
- // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
66
- // }
67
-
68
- // if (`${editGood.priceIncludeTax}` === '0') {
69
- // editGood.priceIncludeTax = undefined;
70
- // editGood.priceExcludeTax = undefined;
71
- // } else {
72
- // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
73
- // }
74
-
75
- // if (editGood.quantity && editGood.priceIncludeTax) {
76
- // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
77
- // }
78
-
79
- // // 导入FORM里
80
- // if (s.goodsListState.isMyShow) {
81
- // s.goodsListState.form.setFieldsValue({
82
- // ...editGood,
83
- // itemName: editGood.itemNameSelf,
84
- // itemModelName: editGood.itemModelNameSelf,
85
- // });
86
- // } else {
87
- // s.goodsListState.form.setFieldsValue({
88
- // ...editGood,
89
- // });
90
- // }
91
-
92
- // s.goodsListState.importGoods.isVisibleDrawer = false;
93
- // s.goodsListState.isTaxIncluded
94
- // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
95
- // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
96
- // })
42
+
43
+ setOptions([]);
97
44
  }, [options, controller])
98
45
 
99
46
  return (
@@ -286,27 +286,28 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
286
286
  })
287
287
 
288
288
  function NaturalPersonFlag(props: {
289
- value?: 0 | 1,
290
- onChange?: (e: 0 | 1) => void
289
+ // NATURAL("自然人"), COMPANY("非自然人");
290
+ value?: 'COMPANY' | 'NATURAL',
291
+ onChange?: (e: 'COMPANY' | 'NATURAL') => void
291
292
  readOnly?: boolean;
292
293
  }) {
293
294
 
294
- const [value, setValue] = React.useState(props.value || 0);
295
+ const [value, setValue] = React.useState(props.value || 'COMPANY');
295
296
 
296
297
  const onChange = React.useCallback((e: CheckboxChangeEvent) => {
297
298
  if (props.readOnly) return;
298
- setValue(e.target.checked ? 1 : 0);
299
- props.onChange && props.onChange(e.target.checked ? 1 : 0);
299
+ setValue(e.target.checked ? 'NATURAL' : 'COMPANY');
300
+ props.onChange && props.onChange(e.target.checked ? 'NATURAL' : 'COMPANY');
300
301
  }, [props.onChange, props.readOnly])
301
302
 
302
303
  React.useEffect(() => {
303
- setValue(props.value || 0)
304
+ setValue(props.value || 'COMPANY')
304
305
  }, [props.value])
305
306
 
306
307
  return (
307
308
  <Checkbox
308
309
  disabled={props.readOnly}
309
- checked={value === 1}
310
+ checked={value === 'NATURAL'}
310
311
  onChange={onChange}
311
312
  >
312
313
  是否开票给自然人