kts-component-invoice-operate 3.2.31 → 3.2.33

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
@@ -4,7 +4,7 @@ import GreyReactBox, { decorator } from 'grey-react-box';
4
4
  import { chain as chain$1, bignumber, create, all } from 'mathjs';
5
5
  import { message, Form, Input, Icon as Icon$1, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover, Table as Table$1, Tree, Modal as Modal$1, Row as Row$1, Col as Col$1 } from 'kts-components-antd-x3';
6
6
  import { v4 } from 'uuid';
7
- import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
7
+ import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
8
8
  import classnames from 'classnames';
9
9
  import { Table } from 'kts-components-antd-x4-v4';
10
10
  import { render } from 'react-dom';
@@ -10619,7 +10619,7 @@ function ItemNameInput(props) {
10619
10619
  }
10620
10620
  }, "*", props.shorthand, "*"), React.createElement(AutoComplete$1, {
10621
10621
  onSearch: onSearch,
10622
- defaultValue: props.value,
10622
+ value: props.value,
10623
10623
  options: options.map(function (e) {
10624
10624
  return {
10625
10625
  value: e.itemName
@@ -10631,7 +10631,6 @@ function ItemNameInput(props) {
10631
10631
  height: '100%',
10632
10632
  border: 'none'
10633
10633
  },
10634
- value: props.value,
10635
10634
  onChange: onChange
10636
10635
  })));
10637
10636
  } // function removeNullUndefined(obj: Record<string, any>): Record<string, any> {
@@ -15625,6 +15624,13 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
15625
15624
  gutter: [16, 0]
15626
15625
  }, React.createElement(Col, {
15627
15626
  span: 24
15627
+ }, React.createElement(Form.Item, {
15628
+ label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
15629
+ colon: false
15630
+ }, getFieldDecorator('naturalPersonFlag', {})(React.createElement(NaturalPersonFlag, {
15631
+ readOnly: isReadOnly('naturalPersonFlag')
15632
+ })))), React.createElement(Col, {
15633
+ span: 24
15628
15634
  }, React.createElement(Form.Item, {
15629
15635
  label: "\u540D\u79F0",
15630
15636
  colon: false
@@ -15807,6 +15813,27 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
15807
15813
  })))))))));
15808
15814
  });
15809
15815
 
15816
+ function NaturalPersonFlag(props) {
15817
+ var _React$useState3 = React.useState(props.value || 0),
15818
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
15819
+ value = _React$useState4[0],
15820
+ setValue = _React$useState4[1];
15821
+
15822
+ var onChange = React.useCallback(function (e) {
15823
+ if (props.readOnly) return;
15824
+ setValue(e.target.checked ? 1 : 0);
15825
+ props.onChange && props.onChange(e.target.checked ? 1 : 0);
15826
+ }, [props.onChange, props.readOnly]);
15827
+ React.useEffect(function () {
15828
+ setValue(props.value || 0);
15829
+ }, [props.value]);
15830
+ return React.createElement(Checkbox$1, {
15831
+ disabled: props.readOnly,
15832
+ checked: value === 1,
15833
+ onChange: onChange
15834
+ }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
15835
+ }
15836
+
15810
15837
  function BuyerNameInput$1(props) {
15811
15838
  var fieldName = props.fieldName,
15812
15839
  form = props.myform;
@@ -15815,10 +15842,10 @@ function BuyerNameInput$1(props) {
15815
15842
  return s.autoComplete;
15816
15843
  }, []);
15817
15844
 
15818
- var _React$useState3 = React.useState([]),
15819
- _React$useState4 = _slicedToArray(_React$useState3, 2),
15820
- options = _React$useState4[0],
15821
- setOptions = _React$useState4[1];
15845
+ var _React$useState5 = React.useState([]),
15846
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
15847
+ options = _React$useState6[0],
15848
+ setOptions = _React$useState6[1];
15822
15849
 
15823
15850
  var onChangeAutoComplete = React.useCallback(function (value) {
15824
15851
  var record = options.filter(function (e) {
@@ -21218,14 +21245,17 @@ var DrawerBody$2 = function DrawerBody() {
21218
21245
  } // 导入FORM里
21219
21246
 
21220
21247
 
21221
- if (s.goodsListState.isMyShow) {
21222
- s.goodsListState.form.setFieldsValue(_objectSpread2(_objectSpread2({}, editGood), {}, {
21223
- itemName: editGood.itemNameSelf,
21224
- itemModelName: editGood.itemModelNameSelf
21225
- }));
21226
- } else {
21227
- s.goodsListState.form.setFieldsValue(_objectSpread2({}, editGood));
21228
- }
21248
+ s.goodsListState.form.setFieldsValue(_objectSpread2({}, editGood)); // if (s.goodsListState.isMyShow) {
21249
+ // s.goodsListState.form.setFieldsValue({
21250
+ // ...editGood,
21251
+ // itemName: editGood.itemNameSelf,
21252
+ // itemModelName: editGood.itemModelNameSelf,
21253
+ // });
21254
+ // } else {
21255
+ // s.goodsListState.form.setFieldsValue({
21256
+ // ...editGood,
21257
+ // });
21258
+ // }
21229
21259
 
21230
21260
  s.goodsListState.importGoods.isVisibleDrawer = false;
21231
21261
 
package/dist/index.js CHANGED
@@ -10629,7 +10629,7 @@ function ItemNameInput(props) {
10629
10629
  }
10630
10630
  }, "*", props.shorthand, "*"), React__default['default'].createElement(ktsXui.AutoComplete, {
10631
10631
  onSearch: onSearch,
10632
- defaultValue: props.value,
10632
+ value: props.value,
10633
10633
  options: options.map(function (e) {
10634
10634
  return {
10635
10635
  value: e.itemName
@@ -10641,7 +10641,6 @@ function ItemNameInput(props) {
10641
10641
  height: '100%',
10642
10642
  border: 'none'
10643
10643
  },
10644
- value: props.value,
10645
10644
  onChange: onChange
10646
10645
  })));
10647
10646
  } // function removeNullUndefined(obj: Record<string, any>): Record<string, any> {
@@ -15635,6 +15634,13 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
15635
15634
  gutter: [16, 0]
15636
15635
  }, React__default['default'].createElement(ktsXui.Col, {
15637
15636
  span: 24
15637
+ }, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
15638
+ label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
15639
+ colon: false
15640
+ }, getFieldDecorator('naturalPersonFlag', {})(React__default['default'].createElement(NaturalPersonFlag, {
15641
+ readOnly: isReadOnly('naturalPersonFlag')
15642
+ })))), React__default['default'].createElement(ktsXui.Col, {
15643
+ span: 24
15638
15644
  }, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
15639
15645
  label: "\u540D\u79F0",
15640
15646
  colon: false
@@ -15817,6 +15823,27 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
15817
15823
  })))))))));
15818
15824
  });
15819
15825
 
15826
+ function NaturalPersonFlag(props) {
15827
+ var _React$useState3 = React__default['default'].useState(props.value || 0),
15828
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
15829
+ value = _React$useState4[0],
15830
+ setValue = _React$useState4[1];
15831
+
15832
+ var onChange = React__default['default'].useCallback(function (e) {
15833
+ if (props.readOnly) return;
15834
+ setValue(e.target.checked ? 1 : 0);
15835
+ props.onChange && props.onChange(e.target.checked ? 1 : 0);
15836
+ }, [props.onChange, props.readOnly]);
15837
+ React__default['default'].useEffect(function () {
15838
+ setValue(props.value || 0);
15839
+ }, [props.value]);
15840
+ return React__default['default'].createElement(ktsXui.Checkbox, {
15841
+ disabled: props.readOnly,
15842
+ checked: value === 1,
15843
+ onChange: onChange
15844
+ }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
15845
+ }
15846
+
15820
15847
  function BuyerNameInput$1(props) {
15821
15848
  var fieldName = props.fieldName,
15822
15849
  form = props.myform;
@@ -15825,10 +15852,10 @@ function BuyerNameInput$1(props) {
15825
15852
  return s.autoComplete;
15826
15853
  }, []);
15827
15854
 
15828
- var _React$useState3 = React__default['default'].useState([]),
15829
- _React$useState4 = _slicedToArray(_React$useState3, 2),
15830
- options = _React$useState4[0],
15831
- setOptions = _React$useState4[1];
15855
+ var _React$useState5 = React__default['default'].useState([]),
15856
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
15857
+ options = _React$useState6[0],
15858
+ setOptions = _React$useState6[1];
15832
15859
 
15833
15860
  var onChangeAutoComplete = React__default['default'].useCallback(function (value) {
15834
15861
  var record = options.filter(function (e) {
@@ -21228,14 +21255,17 @@ var DrawerBody$2 = function DrawerBody() {
21228
21255
  } // 导入FORM里
21229
21256
 
21230
21257
 
21231
- if (s.goodsListState.isMyShow) {
21232
- s.goodsListState.form.setFieldsValue(_objectSpread2(_objectSpread2({}, editGood), {}, {
21233
- itemName: editGood.itemNameSelf,
21234
- itemModelName: editGood.itemModelNameSelf
21235
- }));
21236
- } else {
21237
- s.goodsListState.form.setFieldsValue(_objectSpread2({}, editGood));
21238
- }
21258
+ s.goodsListState.form.setFieldsValue(_objectSpread2({}, editGood)); // if (s.goodsListState.isMyShow) {
21259
+ // s.goodsListState.form.setFieldsValue({
21260
+ // ...editGood,
21261
+ // itemName: editGood.itemNameSelf,
21262
+ // itemModelName: editGood.itemModelNameSelf,
21263
+ // });
21264
+ // } else {
21265
+ // s.goodsListState.form.setFieldsValue({
21266
+ // ...editGood,
21267
+ // });
21268
+ // }
21239
21269
 
21240
21270
  s.goodsListState.importGoods.isVisibleDrawer = false;
21241
21271
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.31",
3
+ "version": "3.2.33",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -53,7 +53,7 @@ export default () => {
53
53
  <Switch checkedChildren="预制" unCheckedChildren="默认" onChange={e => { e ? setController(controller2) : setController(controller1) }} ></Switch>
54
54
  <Button onClick={controller.pipeline(async s => { s.goodsListState.endowCode.getReadOnlyTaxRate = s.goodsListState.endowCode.readOnlyTaxRateMap.DRAFT })} >税率(草稿)</Button>
55
55
  <Button onClick={controller.pipeline(async s => { s.goodsListState.endowCode.getReadOnlyTaxRate = () => true })} >税率(预制)</Button>
56
- <Invoice invoiceType='digtal' controller={controller} />
56
+ <Invoice controller={controller} />
57
57
  </div>
58
58
  );
59
59
  };
@@ -1,7 +1,7 @@
1
1
 
2
2
  import React from 'react';
3
3
  import { Button } from 'kts-components-antd-x3/lib/radio';
4
- import { Invoice, IGood } from '../../../..';
4
+ import { Invoice, IGood } from '../../../../src';
5
5
  import { IGetBuyerListOption } from '../../../Invoice/InvoiceController/InvoiceControllerState/BuyerState';
6
6
 
7
7
  const InvoiceController = Invoice.InvoiceController
@@ -16,7 +16,7 @@ export default () => {
16
16
  return (
17
17
  <div>
18
18
  <Button onClick={onClick} style={{ marginBottom: 10 }}>获取数据</Button>
19
- <Invoice controller={controller}/>
19
+ <Invoice invoiceType='digtal' controller={controller}/>
20
20
  </div>
21
21
  );
22
22
  };
@@ -99,8 +99,8 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
99
99
  return (
100
100
  <div className='kts-invoice-operate-goods-list-itemName-input'>
101
101
  {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
102
- <AutoComplete onSearch={onSearch} defaultValue={props.value} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
103
- <Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
102
+ <AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
103
+ <Input style={{ height: '100%', border: 'none' }} onChange={onChange} />
104
104
  </AutoComplete>
105
105
  </div>
106
106
  )
@@ -27,10 +27,12 @@ export default () => {
27
27
  onClose={onClose}
28
28
  visible={visible}
29
29
  >
30
- {topExpand &&
30
+ {
31
+ topExpand &&
31
32
  <div style={{ marginBottom: 10 }} >
32
33
  {topExpand}
33
- </div>}
34
+ </div>
35
+ }
34
36
  <DrawerBody />
35
37
  </Drawer>
36
38
  );
@@ -98,17 +100,20 @@ const DrawerBody = () => {
98
100
  }
99
101
 
100
102
  // 导入FORM里
101
- if (s.goodsListState.isMyShow) {
102
- s.goodsListState.form.setFieldsValue({
103
- ...editGood,
104
- itemName: editGood.itemNameSelf,
105
- itemModelName: editGood.itemModelNameSelf,
106
- });
107
- } else {
108
- s.goodsListState.form.setFieldsValue({
109
- ...editGood,
110
- });
111
- }
103
+ s.goodsListState.form.setFieldsValue({
104
+ ...editGood,
105
+ });
106
+ // if (s.goodsListState.isMyShow) {
107
+ // s.goodsListState.form.setFieldsValue({
108
+ // ...editGood,
109
+ // itemName: editGood.itemNameSelf,
110
+ // itemModelName: editGood.itemModelNameSelf,
111
+ // });
112
+ // } else {
113
+ // s.goodsListState.form.setFieldsValue({
114
+ // ...editGood,
115
+ // });
116
+ // }
112
117
 
113
118
  s.goodsListState.importGoods.isVisibleDrawer = false;
114
119
  s.goodsListState.isTaxIncluded
@@ -165,6 +170,5 @@ const getItemNameOther = (record: any, editGood: IGood) => {
165
170
  // if (shorthand) {
166
171
  // return `*${shorthand}*${record.itemNameSelf}`;
167
172
  // }
168
-
169
173
  return record.itemName;
170
174
  }
@@ -1,9 +1,10 @@
1
1
 
2
- import React, { ChangeEvent } from 'react';
2
+ import React 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 { AutoComplete, Button, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
6
+ import { AutoComplete, Button, Checkbox, Col, Input, InputProps, Row, Tooltip } from 'kts-xui'
7
+ import { CheckboxChangeEvent } from 'kts-components-antd-x4/lib/checkbox';
7
8
  import { FormComponentProps } from "kts-components-antd-x3/lib/form";
8
9
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
9
10
  import { ReactComponent as ArrowUpSvg } from './svg/arrowUp.svg';
@@ -112,6 +113,15 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
112
113
  <div>
113
114
  <Form className="digtal-stakeholder-form" >
114
115
  <Row gutter={[16, 0]}>
116
+ <Col span={24} >
117
+ <Form.Item label='购买方信息' colon={false}>
118
+ {getFieldDecorator('naturalPersonFlag', {
119
+ })(
120
+ <NaturalPersonFlag readOnly={isReadOnly('naturalPersonFlag')} />
121
+ )}
122
+ </Form.Item>
123
+ </Col>
124
+
115
125
  <Col span={24} >
116
126
  <Form.Item label='名称' colon={false}>
117
127
  {getFieldDecorator('buyerName', {
@@ -274,6 +284,34 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
274
284
  )
275
285
  })
276
286
 
287
+ function NaturalPersonFlag(props: {
288
+ value?: 0 | 1,
289
+ onChange?: (e: 0 | 1) => void
290
+ readOnly?: boolean;
291
+ }) {
292
+
293
+ const [value, setValue] = React.useState(props.value || 0);
294
+
295
+ const onChange = React.useCallback((e: CheckboxChangeEvent) => {
296
+ if (props.readOnly) return;
297
+ setValue(e.target.checked ? 1 : 0);
298
+ props.onChange && props.onChange(e.target.checked ? 1 : 0);
299
+ }, [props.onChange, props.readOnly])
300
+
301
+ React.useEffect(() => {
302
+ setValue(props.value || 0)
303
+ }, [props.value])
304
+
305
+ return (
306
+ <Checkbox
307
+ disabled={props.readOnly}
308
+ checked={value === 1}
309
+ onChange={onChange}
310
+ >
311
+ 是否开票给自然人
312
+ </Checkbox>
313
+ )
314
+ }
277
315
 
278
316
  function BuyerNameInput(props: InputProps & { fieldName: string; myform: WrappedFormUtils<any> }) {
279
317
 
@@ -337,7 +375,6 @@ class MyInput extends React.Component<InputProps>{
337
375
  }
338
376
  }
339
377
 
340
-
341
378
  class Discontinue {
342
379
 
343
380
  private static timer: any;
@@ -347,3 +384,4 @@ class Discontinue {
347
384
  Discontinue.timer = setTimeout(resolve, interval);
348
385
  })
349
386
  }
387
+