kts-component-invoice-operate 3.2.128 → 3.2.130

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.
@@ -2,6 +2,7 @@ import './index.less';
2
2
  import React from 'react';
3
3
  import InvoiceController from './InvoiceController';
4
4
  import * as calculator from './tools/calculate';
5
+ import * as utils from './tools/utils';
5
6
  import GoodsList from './ui/default/GoodsList';
6
7
  import Seller from './ui/default/Seller';
7
8
  import Buyer from './ui/default/Buyer';
@@ -53,6 +54,8 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
53
54
  static idGenerator: () => string;
54
55
  /** 金额计算方法 */
55
56
  static calculator: typeof calculator;
57
+ /** 工具方法 */
58
+ static utils: typeof utils;
56
59
  /** 获取控制器钩子 */
57
60
  static useInvoiceController: () => InvoiceController;
58
61
  render(): JSX.Element;
@@ -0,0 +1 @@
1
+ export * as Money from './money';
@@ -0,0 +1,2 @@
1
+ /** 数字转中文 */
2
+ export declare const toStringChinese: (value: any) => any;
package/dist/index.esm.js CHANGED
@@ -916,9 +916,12 @@ var ImportGoods = /*#__PURE__*/_createClass(function ImportGoods() {
916
916
  dataIndex: 'unit',
917
917
  key: 'unit'
918
918
  }, {
919
- title: '税率(%)',
919
+ title: '税率',
920
920
  dataIndex: 'taxRate',
921
- key: 'taxRate'
921
+ key: 'taxRate',
922
+ render: function render(text) {
923
+ return text || text === 0 ? "".concat(text, "%") : '';
924
+ }
922
925
  }, {
923
926
  title: '单价(含税)',
924
927
  dataIndex: 'priceIncludeTax',
@@ -9733,6 +9736,39 @@ function useToGenerateId(controller) {
9733
9736
  }, [goodsList]);
9734
9737
  }
9735
9738
 
9739
+ var Nzh = require("nzh");
9740
+
9741
+ var nzhcn = new Nzh({
9742
+ ch: '零壹贰叁肆伍陆柒捌玖',
9743
+ ch_u: '个拾佰仟万亿',
9744
+ ch_f: '负',
9745
+ ch_d: '点',
9746
+ m_t: '人民币',
9747
+ m_z: '整',
9748
+ m_u: '圆角分'
9749
+ });
9750
+ /** 数字转中文 */
9751
+
9752
+ var toStringChinese = function toStringChinese(value) {
9753
+ try {
9754
+ return nzhcn.toMoney(value, {
9755
+ outSymbol: false
9756
+ });
9757
+ } catch (e) {
9758
+ return '';
9759
+ }
9760
+ };
9761
+
9762
+ var index = /*#__PURE__*/Object.freeze({
9763
+ __proto__: null,
9764
+ toStringChinese: toStringChinese
9765
+ });
9766
+
9767
+ var utils = /*#__PURE__*/Object.freeze({
9768
+ __proto__: null,
9769
+ Money: index
9770
+ });
9771
+
9736
9772
  var _defs, _path, _path2, _path3;
9737
9773
 
9738
9774
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -10092,7 +10128,7 @@ function TableVirtual (props) {
10092
10128
  var css_248z$3 = ".kts-invoice-operate-goods-list-statistics {\n background: #fafafa;\n overflow-y: scroll;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row {\n height: 30px;\n line-height: 30px;\n border-bottom: 1px solid #e8e8e8;\n display: flex;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div {\n border-right: 1px solid #e8e8e8;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div label {\n padding: 0 10px;\n}\n";
10093
10129
  styleInject(css_248z$3);
10094
10130
 
10095
- var nzhcn = require('nzh').cn;
10131
+ var nzhcn$1 = require('nzh').cn;
10096
10132
 
10097
10133
  var Statistics = (function () {
10098
10134
  var controller = Invoice.useInvoiceController();
@@ -10219,9 +10255,7 @@ var Statistics = (function () {
10219
10255
  flex: 5,
10220
10256
  border: 'none'
10221
10257
  }
10222
- }, /*#__PURE__*/React.createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React.createElement("label", null, nzhcn.toMoney(lineAmountIncludeTax, {
10223
- outSymbol: false
10224
- }))), /*#__PURE__*/React.createElement("div", {
10258
+ }, /*#__PURE__*/React.createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React.createElement("label", null, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React.createElement("div", {
10225
10259
  style: {
10226
10260
  flex: 5,
10227
10261
  border: 'none'
@@ -13726,7 +13760,7 @@ var useColumns = (function (form) {
13726
13760
  }, {
13727
13761
  title: /*#__PURE__*/React.createElement(TitleText, {
13728
13762
  required: true
13729
- }, "\u7A0E\u7387%"),
13763
+ }, "\u7A0E\u7387"),
13730
13764
  dataIndex: 'taxRate',
13731
13765
  key: 'taxRate',
13732
13766
  align: 'right',
@@ -17505,8 +17539,6 @@ function SvgFork(props) {
17505
17539
  var css_248z$j = ".kts-invoice-operate-goods-list-statistics-digtal {\n overflow-y: scroll;\n /* 设置滚动条滑块颜色 */\n}\n.kts-invoice-operate-goods-list-statistics-digtal::-webkit-scrollbar-track {\n background-color: #f1f1f1;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total {\n height: 42px;\n display: flex;\n align-items: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total > div:first-child {\n width: 225px;\n color: #9F613E;\n font-family: PingFang SC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax {\n border-top: 2px solid #9F613E;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child {\n border-right: 2px solid #9F613E;\n}\n";
17506
17540
  styleInject(css_248z$j);
17507
17541
 
17508
- var nzhcn$1 = require('nzh').cn;
17509
-
17510
17542
  var Statistics$1 = (function () {
17511
17543
  var controller = Invoice.useInvoiceController();
17512
17544
  /** 是否不含税) */
@@ -17617,9 +17649,7 @@ var Statistics$1 = (function () {
17617
17649
  fontWeight: 'bold',
17618
17650
  marginLeft: 4
17619
17651
  }
17620
- }, nzhcn$1.toMoney(lineAmountIncludeTax, {
17621
- outSymbol: false
17622
- }))), /*#__PURE__*/React.createElement("div", {
17652
+ }, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React.createElement("div", {
17623
17653
  style: {
17624
17654
  flex: 1
17625
17655
  }
@@ -20576,7 +20606,7 @@ var useColumns$1 = (function (form) {
20576
20606
  }, {
20577
20607
  title: /*#__PURE__*/React.createElement(TitleText$1, {
20578
20608
  required: true
20579
- }, "\u7A0E\u7387%"),
20609
+ }, "\u7A0E\u7387"),
20580
20610
  dataIndex: 'taxRate',
20581
20611
  key: 'taxRate',
20582
20612
  align: 'right',
@@ -24105,6 +24135,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
24105
24135
 
24106
24136
  /** 金额计算方法 */
24107
24137
 
24138
+ /** 工具方法 */
24139
+
24108
24140
  /** 获取控制器钩子 */
24109
24141
  function render() {
24110
24142
  if (this.props.invoiceType === 'digtal') {
@@ -24132,6 +24164,7 @@ Invoice.SignDigtal = SignDigtal;
24132
24164
  Invoice.GoodsListDigtal = GoodsList$1;
24133
24165
  Invoice.idGenerator = idGenerator;
24134
24166
  Invoice.calculator = calculator;
24167
+ Invoice.utils = utils;
24135
24168
 
24136
24169
  Invoice.useInvoiceController = function () {
24137
24170
  return React.useContext(InvoiceContext);
package/dist/index.js CHANGED
@@ -926,9 +926,12 @@ var ImportGoods = /*#__PURE__*/_createClass(function ImportGoods() {
926
926
  dataIndex: 'unit',
927
927
  key: 'unit'
928
928
  }, {
929
- title: '税率(%)',
929
+ title: '税率',
930
930
  dataIndex: 'taxRate',
931
- key: 'taxRate'
931
+ key: 'taxRate',
932
+ render: function render(text) {
933
+ return text || text === 0 ? "".concat(text, "%") : '';
934
+ }
932
935
  }, {
933
936
  title: '单价(含税)',
934
937
  dataIndex: 'priceIncludeTax',
@@ -9743,6 +9746,39 @@ function useToGenerateId(controller) {
9743
9746
  }, [goodsList]);
9744
9747
  }
9745
9748
 
9749
+ var Nzh = require("nzh");
9750
+
9751
+ var nzhcn = new Nzh({
9752
+ ch: '零壹贰叁肆伍陆柒捌玖',
9753
+ ch_u: '个拾佰仟万亿',
9754
+ ch_f: '负',
9755
+ ch_d: '点',
9756
+ m_t: '人民币',
9757
+ m_z: '整',
9758
+ m_u: '圆角分'
9759
+ });
9760
+ /** 数字转中文 */
9761
+
9762
+ var toStringChinese = function toStringChinese(value) {
9763
+ try {
9764
+ return nzhcn.toMoney(value, {
9765
+ outSymbol: false
9766
+ });
9767
+ } catch (e) {
9768
+ return '';
9769
+ }
9770
+ };
9771
+
9772
+ var index = /*#__PURE__*/Object.freeze({
9773
+ __proto__: null,
9774
+ toStringChinese: toStringChinese
9775
+ });
9776
+
9777
+ var utils = /*#__PURE__*/Object.freeze({
9778
+ __proto__: null,
9779
+ Money: index
9780
+ });
9781
+
9746
9782
  var _defs, _path, _path2, _path3;
9747
9783
 
9748
9784
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -10102,7 +10138,7 @@ function TableVirtual (props) {
10102
10138
  var css_248z$3 = ".kts-invoice-operate-goods-list-statistics {\n background: #fafafa;\n overflow-y: scroll;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row {\n height: 30px;\n line-height: 30px;\n border-bottom: 1px solid #e8e8e8;\n display: flex;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div {\n border-right: 1px solid #e8e8e8;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div label {\n padding: 0 10px;\n}\n";
10103
10139
  styleInject(css_248z$3);
10104
10140
 
10105
- var nzhcn = require('nzh').cn;
10141
+ var nzhcn$1 = require('nzh').cn;
10106
10142
 
10107
10143
  var Statistics = (function () {
10108
10144
  var controller = Invoice.useInvoiceController();
@@ -10229,9 +10265,7 @@ var Statistics = (function () {
10229
10265
  flex: 5,
10230
10266
  border: 'none'
10231
10267
  }
10232
- }, /*#__PURE__*/React__default['default'].createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React__default['default'].createElement("label", null, nzhcn.toMoney(lineAmountIncludeTax, {
10233
- outSymbol: false
10234
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
10268
+ }, /*#__PURE__*/React__default['default'].createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React__default['default'].createElement("label", null, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React__default['default'].createElement("div", {
10235
10269
  style: {
10236
10270
  flex: 5,
10237
10271
  border: 'none'
@@ -13736,7 +13770,7 @@ var useColumns = (function (form) {
13736
13770
  }, {
13737
13771
  title: /*#__PURE__*/React__default['default'].createElement(TitleText, {
13738
13772
  required: true
13739
- }, "\u7A0E\u7387%"),
13773
+ }, "\u7A0E\u7387"),
13740
13774
  dataIndex: 'taxRate',
13741
13775
  key: 'taxRate',
13742
13776
  align: 'right',
@@ -17515,8 +17549,6 @@ function SvgFork(props) {
17515
17549
  var css_248z$j = ".kts-invoice-operate-goods-list-statistics-digtal {\n overflow-y: scroll;\n /* 设置滚动条滑块颜色 */\n}\n.kts-invoice-operate-goods-list-statistics-digtal::-webkit-scrollbar-track {\n background-color: #f1f1f1;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total {\n height: 42px;\n display: flex;\n align-items: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total > div:first-child {\n width: 225px;\n color: #9F613E;\n font-family: PingFang SC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax {\n border-top: 2px solid #9F613E;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child {\n border-right: 2px solid #9F613E;\n}\n";
17516
17550
  styleInject(css_248z$j);
17517
17551
 
17518
- var nzhcn$1 = require('nzh').cn;
17519
-
17520
17552
  var Statistics$1 = (function () {
17521
17553
  var controller = Invoice.useInvoiceController();
17522
17554
  /** 是否不含税) */
@@ -17627,9 +17659,7 @@ var Statistics$1 = (function () {
17627
17659
  fontWeight: 'bold',
17628
17660
  marginLeft: 4
17629
17661
  }
17630
- }, nzhcn$1.toMoney(lineAmountIncludeTax, {
17631
- outSymbol: false
17632
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
17662
+ }, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React__default['default'].createElement("div", {
17633
17663
  style: {
17634
17664
  flex: 1
17635
17665
  }
@@ -20586,7 +20616,7 @@ var useColumns$1 = (function (form) {
20586
20616
  }, {
20587
20617
  title: /*#__PURE__*/React__default['default'].createElement(TitleText$1, {
20588
20618
  required: true
20589
- }, "\u7A0E\u7387%"),
20619
+ }, "\u7A0E\u7387"),
20590
20620
  dataIndex: 'taxRate',
20591
20621
  key: 'taxRate',
20592
20622
  align: 'right',
@@ -24115,6 +24145,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
24115
24145
 
24116
24146
  /** 金额计算方法 */
24117
24147
 
24148
+ /** 工具方法 */
24149
+
24118
24150
  /** 获取控制器钩子 */
24119
24151
  function render() {
24120
24152
  if (this.props.invoiceType === 'digtal') {
@@ -24142,6 +24174,7 @@ Invoice.SignDigtal = SignDigtal;
24142
24174
  Invoice.GoodsListDigtal = GoodsList$1;
24143
24175
  Invoice.idGenerator = idGenerator;
24144
24176
  Invoice.calculator = calculator;
24177
+ Invoice.utils = utils;
24145
24178
 
24146
24179
  Invoice.useInvoiceController = function () {
24147
24180
  return React__default['default'].useContext(InvoiceContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.128",
3
+ "version": "3.2.130",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -37,9 +37,10 @@ export default class ImportGoods<ColumnType = any> {
37
37
  key: 'unit',
38
38
  },
39
39
  {
40
- title: '税率(%)',
40
+ title: '税率',
41
41
  dataIndex: 'taxRate',
42
42
  key: 'taxRate',
43
+ render: text => text || text === 0 ? `${text}%` : ''
43
44
  },
44
45
  {
45
46
  title: '单价(含税)',
@@ -5,6 +5,7 @@ import InvoiceController from './InvoiceController';
5
5
  import useToGenerateId from './tools/useToGenerateId';
6
6
  import idGenerator from './tools/idGenerator';
7
7
  import * as calculator from './tools/calculate';
8
+ import * as utils from './tools/utils';
8
9
 
9
10
  import InvoiceHeader from './ui/default/InvoiceHeader';
10
11
  import GoodsList from './ui/default/GoodsList';
@@ -93,6 +94,9 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
93
94
  /** 金额计算方法 */
94
95
  static calculator = calculator;
95
96
 
97
+ /** 工具方法 */
98
+ static utils = utils;
99
+
96
100
  /** 获取控制器钩子 */
97
101
  static useInvoiceController = () => { return React.useContext(InvoiceContext) };
98
102
 
@@ -0,0 +1 @@
1
+ export * as Money from './money';
@@ -0,0 +1,20 @@
1
+ const Nzh = require("nzh");
2
+
3
+ const nzhcn = new Nzh({
4
+ ch: '零壹贰叁肆伍陆柒捌玖'
5
+ ,ch_u: '个拾佰仟万亿'
6
+ ,ch_f: '负'
7
+ ,ch_d: '点'
8
+ ,m_t: '人民币'
9
+ ,m_z: '整'
10
+ ,m_u: '圆角分'
11
+ })
12
+
13
+ /** 数字转中文 */
14
+ export const toStringChinese = (value: any) => {
15
+ try {
16
+ return nzhcn.toMoney(value, { outSymbol: false })
17
+ } catch(e) {
18
+ return ''
19
+ }
20
+ };
@@ -475,7 +475,7 @@ export default (form: WrappedFormUtils) => {
475
475
  },
476
476
  },
477
477
  {
478
- title: <TitleText required >税率%</TitleText>,
478
+ title: <TitleText required >税率</TitleText>,
479
479
  dataIndex: 'taxRate',
480
480
  key: 'taxRate',
481
481
  align: 'right',
@@ -3,6 +3,7 @@ import { } from 'kts-components-antd-x3';
3
3
  import { chain, bignumber } from 'mathjs';
4
4
  import { LineAttributeType } from '../../../../../../Invoice/InvoiceController';
5
5
  import Invoice from '../../../../..';
6
+ import { Money } from '../../../../../tools/utils';
6
7
  import './index.less';
7
8
 
8
9
  const nzhcn = require('nzh').cn;
@@ -101,7 +102,7 @@ export default () => {
101
102
  <div style={{ flex: 5, border: 'none' }}>
102
103
  <label>价税合计(大写)</label>
103
104
  <label>
104
- {nzhcn.toMoney(lineAmountIncludeTax, { outSymbol: false })}
105
+ {Money.toStringChinese(lineAmountIncludeTax)}
105
106
  </label>
106
107
  </div>
107
108
  <div style={{ flex: 5, border: 'none' }}>
@@ -445,7 +445,7 @@ export default (form: WrappedFormUtils) => {
445
445
  },
446
446
  },
447
447
  {
448
- title: <TitleText required >税率%</TitleText>,
448
+ title: <TitleText required >税率</TitleText>,
449
449
  dataIndex: 'taxRate',
450
450
  key: 'taxRate',
451
451
  align: 'right',
@@ -4,10 +4,9 @@ import { } from 'kts-components-antd-x3';
4
4
  import { ReactComponent as ForkSvg } from './svg/fork.svg';
5
5
  import { chain, bignumber } from 'mathjs';
6
6
  import Invoice from '../../../../..';
7
+ import { Money } from '../../../../../tools/utils';
7
8
  import './index.less';
8
9
 
9
- const nzhcn = require('nzh').cn;
10
-
11
10
  export default () => {
12
11
  const controller = Invoice.useInvoiceController();
13
12
 
@@ -88,7 +87,7 @@ export default () => {
88
87
  <div>价税合计(大写)</div>
89
88
  <div style={{ paddingLeft: 30 }} >
90
89
  <Icon style={{fontSize: 16}} component={ForkSvg} />
91
- <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{nzhcn.toMoney(lineAmountIncludeTax, { outSymbol: false })}</span>
90
+ <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{Money.toStringChinese(lineAmountIncludeTax)}</span>
92
91
  </div>
93
92
  <div style={{ flex: 1 }} />
94
93
  <div style={{ width: 90, color: '#9F613E' }} >(小写)</div>