kts-component-invoice-operate 3.2.31 → 3.2.32

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';
@@ -15625,6 +15625,13 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
15625
15625
  gutter: [16, 0]
15626
15626
  }, React.createElement(Col, {
15627
15627
  span: 24
15628
+ }, React.createElement(Form.Item, {
15629
+ label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
15630
+ colon: false
15631
+ }, getFieldDecorator('naturalPersonFlag', {})(React.createElement(NaturalPersonFlag, {
15632
+ readOnly: isReadOnly('naturalPersonFlag')
15633
+ })))), React.createElement(Col, {
15634
+ span: 24
15628
15635
  }, React.createElement(Form.Item, {
15629
15636
  label: "\u540D\u79F0",
15630
15637
  colon: false
@@ -15807,6 +15814,27 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
15807
15814
  })))))))));
15808
15815
  });
15809
15816
 
15817
+ function NaturalPersonFlag(props) {
15818
+ var _React$useState3 = React.useState(props.value || 0),
15819
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
15820
+ value = _React$useState4[0],
15821
+ setValue = _React$useState4[1];
15822
+
15823
+ var onChange = React.useCallback(function (e) {
15824
+ if (props.readOnly) return;
15825
+ setValue(e.target.checked ? 1 : 0);
15826
+ props.onChange && props.onChange(e.target.checked ? 1 : 0);
15827
+ }, [props.onChange, props.readOnly]);
15828
+ React.useEffect(function () {
15829
+ setValue(props.value || 0);
15830
+ }, [props.value]);
15831
+ return React.createElement(Checkbox$1, {
15832
+ disabled: props.readOnly,
15833
+ checked: value === 1,
15834
+ onChange: onChange
15835
+ }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
15836
+ }
15837
+
15810
15838
  function BuyerNameInput$1(props) {
15811
15839
  var fieldName = props.fieldName,
15812
15840
  form = props.myform;
@@ -15815,10 +15843,10 @@ function BuyerNameInput$1(props) {
15815
15843
  return s.autoComplete;
15816
15844
  }, []);
15817
15845
 
15818
- var _React$useState3 = React.useState([]),
15819
- _React$useState4 = _slicedToArray(_React$useState3, 2),
15820
- options = _React$useState4[0],
15821
- setOptions = _React$useState4[1];
15846
+ var _React$useState5 = React.useState([]),
15847
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
15848
+ options = _React$useState6[0],
15849
+ setOptions = _React$useState6[1];
15822
15850
 
15823
15851
  var onChangeAutoComplete = React.useCallback(function (value) {
15824
15852
  var record = options.filter(function (e) {
package/dist/index.js CHANGED
@@ -15635,6 +15635,13 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
15635
15635
  gutter: [16, 0]
15636
15636
  }, React__default['default'].createElement(ktsXui.Col, {
15637
15637
  span: 24
15638
+ }, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
15639
+ label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
15640
+ colon: false
15641
+ }, getFieldDecorator('naturalPersonFlag', {})(React__default['default'].createElement(NaturalPersonFlag, {
15642
+ readOnly: isReadOnly('naturalPersonFlag')
15643
+ })))), React__default['default'].createElement(ktsXui.Col, {
15644
+ span: 24
15638
15645
  }, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
15639
15646
  label: "\u540D\u79F0",
15640
15647
  colon: false
@@ -15817,6 +15824,27 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
15817
15824
  })))))))));
15818
15825
  });
15819
15826
 
15827
+ function NaturalPersonFlag(props) {
15828
+ var _React$useState3 = React__default['default'].useState(props.value || 0),
15829
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
15830
+ value = _React$useState4[0],
15831
+ setValue = _React$useState4[1];
15832
+
15833
+ var onChange = React__default['default'].useCallback(function (e) {
15834
+ if (props.readOnly) return;
15835
+ setValue(e.target.checked ? 1 : 0);
15836
+ props.onChange && props.onChange(e.target.checked ? 1 : 0);
15837
+ }, [props.onChange, props.readOnly]);
15838
+ React__default['default'].useEffect(function () {
15839
+ setValue(props.value || 0);
15840
+ }, [props.value]);
15841
+ return React__default['default'].createElement(ktsXui.Checkbox, {
15842
+ disabled: props.readOnly,
15843
+ checked: value === 1,
15844
+ onChange: onChange
15845
+ }, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
15846
+ }
15847
+
15820
15848
  function BuyerNameInput$1(props) {
15821
15849
  var fieldName = props.fieldName,
15822
15850
  form = props.myform;
@@ -15825,10 +15853,10 @@ function BuyerNameInput$1(props) {
15825
15853
  return s.autoComplete;
15826
15854
  }, []);
15827
15855
 
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];
15856
+ var _React$useState5 = React__default['default'].useState([]),
15857
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
15858
+ options = _React$useState6[0],
15859
+ setOptions = _React$useState6[1];
15832
15860
 
15833
15861
  var onChangeAutoComplete = React__default['default'].useCallback(function (value) {
15834
15862
  var record = options.filter(function (e) {
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.32",
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
  };
@@ -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
  };
@@ -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
+