kts-component-invoice-operate 3.0.5 → 3.0.6

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.
@@ -0,0 +1,6 @@
1
+ /** 商品表格补充配置 */
2
+ import { ValidationRule } from "kts-components-antd-x3/lib/form";
3
+ export default interface IColumnsReplenish {
4
+ /** 补充的规则 */
5
+ rules: ValidationRule[];
6
+ }
@@ -5,6 +5,7 @@ import EndowCode from './EndowCode';
5
5
  import ProductComparison from './ProductComparison';
6
6
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
7
7
  import InvoiceController from '../..';
8
+ import IColumnsReplenish from './IColumnsReplenish';
8
9
  export default class GoodsListState {
9
10
  /** 扣除额 */
10
11
  deduction: number;
@@ -22,6 +23,10 @@ export default class GoodsListState {
22
23
  editGood?: IGood;
23
24
  /** 被编辑行的form对象 */
24
25
  form?: WrappedFormUtils;
26
+ /** 商品表格补充配置 */
27
+ columnsReplenish: {
28
+ [key: string]: IColumnsReplenish;
29
+ };
25
30
  /** 单位列表 */
26
31
  unitList: string[];
27
32
  /** 默认税率 */
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ValidationRule } from 'kts-components-antd-x3/lib/form';
3
+ declare const _default: (props: {
4
+ children?: React.ReactNode;
5
+ required?: boolean;
6
+ rules?: ValidationRule[];
7
+ }) => JSX.Element;
8
+ export default _default;
package/dist/index.esm.js CHANGED
@@ -993,6 +993,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
993
993
  this.isMyShow = false;
994
994
  this.editGood = void 0;
995
995
  this.form = void 0;
996
+ this.columnsReplenish = {};
996
997
  this.unitList = [];
997
998
  this.defaultRate = 3;
998
999
  this.taxRateList = [0, 3, 5, 6, 9, 13];
@@ -9384,6 +9385,20 @@ var RowMenu = (function (props) {
9384
9385
  });
9385
9386
 
9386
9387
  var Text$2 = Typography.Text;
9388
+ var TitleText = (function (props) {
9389
+ var rules = props.rules,
9390
+ children = props.children;
9391
+ var required = React.useMemo(function () {
9392
+ return (rules === null || rules === void 0 ? void 0 : rules.some(function (e) {
9393
+ return !!e.required;
9394
+ })) || props.required;
9395
+ }, [rules, props.required]);
9396
+ return React.createElement(React.Fragment, null, required ? React.createElement(Text$2, {
9397
+ type: "danger"
9398
+ }, "*") : React.createElement(React.Fragment, null), children);
9399
+ });
9400
+
9401
+ var Text$3 = Typography.Text;
9387
9402
  var useColumns = (function (form) {
9388
9403
  var getFieldDecorator = form.getFieldDecorator,
9389
9404
  getFieldValue = form.getFieldValue;
@@ -9423,6 +9438,11 @@ var useColumns = (function (form) {
9423
9438
  var unitList = controller.useMemo(function (e) {
9424
9439
  return e.goodsListState.unitList;
9425
9440
  }, []);
9441
+ /** 商品表格补充配置 */
9442
+
9443
+ var columnsReplenish = controller.useMemo(function (e) {
9444
+ return e.goodsListState.columnsReplenish;
9445
+ }, []);
9426
9446
  /** 扣除额 */
9427
9447
 
9428
9448
  var deduction = controller.useMemo(function (e) {
@@ -9434,10 +9454,17 @@ var useColumns = (function (form) {
9434
9454
  _React$useState2 = _slicedToArray(_React$useState, 2),
9435
9455
  changeField = _React$useState2[0],
9436
9456
  setChangeField = _React$useState2[1];
9437
- /** 表头 */
9457
+ /** 获取补充校验规则 */
9438
9458
 
9439
9459
 
9460
+ var getReplenishRules = React.useCallback(function (id) {
9461
+ return columnsReplenish[id] ? columnsReplenish[id].rules || [] : [];
9462
+ }, [columnsReplenish]);
9463
+ /** 表头 */
9464
+
9440
9465
  var columns = React.useMemo(function () {
9466
+ var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2, _columnsReplenish$tax;
9467
+
9441
9468
  return [{
9442
9469
  title: '序号',
9443
9470
  key: 'serialNo',
@@ -9451,9 +9478,9 @@ var useColumns = (function (form) {
9451
9478
  }, e);
9452
9479
  }
9453
9480
  }, {
9454
- title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
9455
- type: "danger"
9456
- }, "*"), "\u9879\u76EE\u540D\u79F0"),
9481
+ title: React.createElement(TitleText, {
9482
+ required: true
9483
+ }, "\u9879\u76EE\u540D\u79F0"),
9457
9484
  key: 'itemName',
9458
9485
  render: function render(_, record) {
9459
9486
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
@@ -9463,7 +9490,7 @@ var useColumns = (function (form) {
9463
9490
  }
9464
9491
  }, getFieldDecorator('itemName', {
9465
9492
  initialValue: isMyShow ? record.itemNameSelf : record.itemName,
9466
- rules: [{
9493
+ rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
9467
9494
  validator: function () {
9468
9495
  var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, __, callback) {
9469
9496
  var value;
@@ -9503,7 +9530,7 @@ var useColumns = (function (form) {
9503
9530
 
9504
9531
  return validator;
9505
9532
  }()
9506
- }]
9533
+ }])
9507
9534
  })(React.createElement(MyInput, {
9508
9535
  style: {
9509
9536
  flex: 1
@@ -9548,13 +9575,16 @@ var useColumns = (function (form) {
9548
9575
  }
9549
9576
  }
9550
9577
  }, {
9551
- title: '货物规格型号',
9578
+ title: React.createElement(TitleText, {
9579
+ rules: (_columnsReplenish$ite = columnsReplenish['itemModelName']) === null || _columnsReplenish$ite === void 0 ? void 0 : _columnsReplenish$ite.rules
9580
+ }, "\u8D27\u7269\u89C4\u683C\u578B\u53F7"),
9552
9581
  key: 'itemModelName',
9553
9582
  width: 119,
9554
9583
  render: function render(_, record) {
9555
9584
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9556
9585
  return React.createElement(Form.Item, null, getFieldDecorator('itemModelName', {
9557
- initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName
9586
+ initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
9587
+ rules: getReplenishRules('itemModelName')
9558
9588
  })(React.createElement(MyInput, {
9559
9589
  onChange: function () {
9560
9590
  var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
@@ -9596,13 +9626,16 @@ var useColumns = (function (form) {
9596
9626
  }
9597
9627
  }
9598
9628
  }, {
9599
- title: '单位',
9629
+ title: React.createElement(TitleText, {
9630
+ rules: (_columnsReplenish$uni = columnsReplenish['unit']) === null || _columnsReplenish$uni === void 0 ? void 0 : _columnsReplenish$uni.rules
9631
+ }, "\u5355\u4F4D"),
9600
9632
  key: 'unit',
9601
9633
  width: 70,
9602
9634
  render: function render(_, record) {
9603
9635
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9604
9636
  return React.createElement(Form.Item, null, getFieldDecorator('unit', {
9605
- initialValue: editGood.unit
9637
+ initialValue: editGood.unit,
9638
+ rules: getReplenishRules('unit')
9606
9639
  })(React.createElement(AutoComplete, {
9607
9640
  style: {
9608
9641
  width: '100%'
@@ -9649,7 +9682,9 @@ var useColumns = (function (form) {
9649
9682
  }
9650
9683
  }
9651
9684
  }, {
9652
- title: '数量',
9685
+ title: React.createElement(TitleText, {
9686
+ rules: (_columnsReplenish$qua = columnsReplenish['quantity']) === null || _columnsReplenish$qua === void 0 ? void 0 : _columnsReplenish$qua.rules
9687
+ }, "\u6570\u91CF"),
9653
9688
  dataIndex: 'quantity',
9654
9689
  key: 'quantity',
9655
9690
  align: 'right',
@@ -9658,7 +9693,7 @@ var useColumns = (function (form) {
9658
9693
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9659
9694
  return React.createElement(Form.Item, null, getFieldDecorator('quantity', {
9660
9695
  initialValue: editGood.quantity,
9661
- rules: [{
9696
+ rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
9662
9697
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9663
9698
  message: '数量必须为数字'
9664
9699
  }, {
@@ -9700,7 +9735,7 @@ var useColumns = (function (form) {
9700
9735
 
9701
9736
  return validator;
9702
9737
  }()
9703
- }]
9738
+ }])
9704
9739
  })(React.createElement(MyInput, {
9705
9740
  style: {
9706
9741
  textAlign: 'right'
@@ -9721,7 +9756,9 @@ var useColumns = (function (form) {
9721
9756
  }
9722
9757
  }
9723
9758
  }, {
9724
- title: '单价(含税)',
9759
+ title: React.createElement(TitleText, {
9760
+ rules: (_columnsReplenish$pri = columnsReplenish['priceIncludeTax']) === null || _columnsReplenish$pri === void 0 ? void 0 : _columnsReplenish$pri.rules
9761
+ }, "\u5355\u4EF7(\u542B\u7A0E)"),
9725
9762
  dataIndex: 'priceIncludeTax',
9726
9763
  key: 'priceIncludeTax',
9727
9764
  align: 'right',
@@ -9730,7 +9767,7 @@ var useColumns = (function (form) {
9730
9767
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9731
9768
  return React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
9732
9769
  initialValue: editGood.priceIncludeTax,
9733
- rules: [{
9770
+ rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
9734
9771
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9735
9772
  message: '单价必须为数字'
9736
9773
  }, {
@@ -9772,7 +9809,7 @@ var useColumns = (function (form) {
9772
9809
 
9773
9810
  return validator;
9774
9811
  }()
9775
- }]
9812
+ }])
9776
9813
  })(React.createElement(MyInput, {
9777
9814
  style: {
9778
9815
  textAlign: 'right'
@@ -9793,7 +9830,9 @@ var useColumns = (function (form) {
9793
9830
  }
9794
9831
  }
9795
9832
  }, {
9796
- title: '单价(不含税)',
9833
+ title: React.createElement(TitleText, {
9834
+ rules: (_columnsReplenish$pri2 = columnsReplenish['priceExcludeTax']) === null || _columnsReplenish$pri2 === void 0 ? void 0 : _columnsReplenish$pri2.rules
9835
+ }, "\u5355\u4EF7(\u4E0D\u542B\u7A0E)"),
9797
9836
  dataIndex: 'priceExcludeTax',
9798
9837
  key: 'priceExcludeTax',
9799
9838
  align: 'right',
@@ -9802,7 +9841,7 @@ var useColumns = (function (form) {
9802
9841
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9803
9842
  return React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
9804
9843
  initialValue: editGood.priceExcludeTax,
9805
- rules: [{
9844
+ rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
9806
9845
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9807
9846
  message: '单价必须为数字'
9808
9847
  }, {
@@ -9844,7 +9883,7 @@ var useColumns = (function (form) {
9844
9883
 
9845
9884
  return validator;
9846
9885
  }()
9847
- }]
9886
+ }])
9848
9887
  })(React.createElement(MyInput, {
9849
9888
  style: {
9850
9889
  textAlign: 'right'
@@ -9865,9 +9904,9 @@ var useColumns = (function (form) {
9865
9904
  }
9866
9905
  }
9867
9906
  }, {
9868
- title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
9869
- type: "danger"
9870
- }, "*"), "\u91D1\u989D(\u542B\u7A0E)"),
9907
+ title: React.createElement(TitleText, {
9908
+ required: true
9909
+ }, "\u91D1\u989D(\u542B\u7A0E)"),
9871
9910
  dataIndex: 'lineAmountIncludeTax',
9872
9911
  key: 'lineAmountIncludeTax',
9873
9912
  width: 119,
@@ -9876,7 +9915,7 @@ var useColumns = (function (form) {
9876
9915
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9877
9916
  return React.createElement(Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
9878
9917
  initialValue: editGood.lineAmountIncludeTax,
9879
- rules: [{
9918
+ rules: [].concat(_toConsumableArray(getReplenishRules('lineAmountIncludeTax')), [{
9880
9919
  required: true,
9881
9920
  message: '金额不能为空'
9882
9921
  }, {
@@ -9932,7 +9971,7 @@ var useColumns = (function (form) {
9932
9971
 
9933
9972
  return validator;
9934
9973
  }()
9935
- }]
9974
+ }])
9936
9975
  })(React.createElement(MyInput, {
9937
9976
  style: {
9938
9977
  textAlign: 'right'
@@ -9952,9 +9991,9 @@ var useColumns = (function (form) {
9952
9991
  }
9953
9992
  }
9954
9993
  }, {
9955
- title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
9956
- type: "danger"
9957
- }, "*"), "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
9994
+ title: React.createElement(TitleText, {
9995
+ required: true
9996
+ }, "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
9958
9997
  dataIndex: 'lineAmountExcludeTax',
9959
9998
  key: 'lineAmountExcludeTax',
9960
9999
  align: 'right',
@@ -9963,7 +10002,7 @@ var useColumns = (function (form) {
9963
10002
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9964
10003
  return React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
9965
10004
  initialValue: editGood.lineAmountExcludeTax,
9966
- rules: [{
10005
+ rules: [].concat(_toConsumableArray(getReplenishRules('lineAmountExcludeTax')), [{
9967
10006
  required: true,
9968
10007
  message: '金额不能为空'
9969
10008
  }, {
@@ -9994,7 +10033,7 @@ var useColumns = (function (form) {
9994
10033
 
9995
10034
  return validator;
9996
10035
  }()
9997
- }]
10036
+ }])
9998
10037
  })(React.createElement(MyInput, {
9999
10038
  style: {
10000
10039
  textAlign: 'right'
@@ -10014,9 +10053,9 @@ var useColumns = (function (form) {
10014
10053
  }
10015
10054
  }
10016
10055
  }, {
10017
- title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10018
- type: "danger"
10019
- }, "*"), "\u7A0E\u7387%"),
10056
+ title: React.createElement(TitleText, {
10057
+ required: true
10058
+ }, "\u7A0E\u7387%"),
10020
10059
  dataIndex: 'taxRate',
10021
10060
  key: 'taxRate',
10022
10061
  align: 'right',
@@ -10025,13 +10064,13 @@ var useColumns = (function (form) {
10025
10064
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10026
10065
  return React.createElement(Form.Item, null, getFieldDecorator('taxRate', {
10027
10066
  initialValue: editGood.taxRate,
10028
- rules: [{
10067
+ rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
10029
10068
  required: true,
10030
10069
  message: ' '
10031
10070
  }, {
10032
10071
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
10033
10072
  message: ' '
10034
- }]
10073
+ }])
10035
10074
  })(React.createElement(Select, {
10036
10075
  className: "kts-invoice-operate-goods-list-table-tax-rate",
10037
10076
  dropdownMenuStyle: {
@@ -10060,7 +10099,9 @@ var useColumns = (function (form) {
10060
10099
  }
10061
10100
  }
10062
10101
  }, {
10063
- title: '税额',
10102
+ title: React.createElement(TitleText, {
10103
+ rules: (_columnsReplenish$tax = columnsReplenish['taxAmount']) === null || _columnsReplenish$tax === void 0 ? void 0 : _columnsReplenish$tax.rules
10104
+ }, "\u7A0E\u989D"),
10064
10105
  dataIndex: 'taxAmount',
10065
10106
  key: 'taxAmount',
10066
10107
  align: 'right',
@@ -10068,7 +10109,8 @@ var useColumns = (function (form) {
10068
10109
  render: function render(value, record) {
10069
10110
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10070
10111
  return getFieldDecorator('taxAmount', {
10071
- initialValue: editGood.taxAmount
10112
+ initialValue: editGood.taxAmount,
10113
+ rules: getReplenishRules('taxAmount')
10072
10114
  })(React.createElement(MyDiv, {
10073
10115
  loading: isCipher(changeField, 'taxAmount')
10074
10116
  }));
@@ -10998,7 +11040,7 @@ var lazyFn$1 = (function (fn) {
10998
11040
  var css_248z$7 = ".kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-body {\n flex: 1;\n overflow: auto;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-footer {\n flex: none;\n}\n";
10999
11041
  styleInject(css_248z$7);
11000
11042
 
11001
- var Text$3 = Typography.Text;
11043
+ var Text$4 = Typography.Text;
11002
11044
 
11003
11045
  var _create = create(all, {
11004
11046
  number: 'BigNumber',
@@ -11287,9 +11329,9 @@ var DrawerBody = decorator(Form.create())(function (props) {
11287
11329
  }, 300), [form, lineAmountSum]);
11288
11330
  return React.createElement(React.Fragment, null, React.createElement("div", {
11289
11331
  className: "add-discount-row-body"
11290
- }, React.createElement("p", null, "\u5F53\u524D\u9009\u62E9", React.createElement(Text$3, {
11332
+ }, React.createElement("p", null, "\u5F53\u524D\u9009\u62E9", React.createElement(Text$4, {
11291
11333
  type: "danger"
11292
- }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React.createElement(Text$3, {
11334
+ }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React.createElement(Text$4, {
11293
11335
  type: "danger"
11294
11336
  }, lineAmountSum.toFixed(2))), React.createElement(Form.Item, {
11295
11337
  label: "\u6298\u6263\u7387\uFF1A"
@@ -12103,7 +12145,7 @@ function interval(i, t) {
12103
12145
  var css_248z$a = ".kts-invoice-operate-buyer {\n display: flex;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message {\n flex: 1;\n display: flex;\n position: relative;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .ktsAnt3x-descriptions-item-label {\n width: 179px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list {\n width: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-view {\n border: none;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-label {\n padding: 0 10px;\n font-size: 12px;\n background-color: #fff;\n line-height: 30px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content {\n padding: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input {\n box-shadow: none;\n border-color: #fff;\n border-radius: 0;\n padding: 0 10px;\n font-size: 12px;\n line-height: 30px;\n width: 100%;\n height: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input:hover {\n border: 1 solid;\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input,\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input:hover {\n background-color: #fff;\n border: 1 solid;\n border-color: #f5222d;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-control {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children .ktsAnt3x-btn {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-explain {\n position: absolute;\n left: 5px;\n top: 6px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-Import {\n position: absolute;\n right: 0px;\n top: 0px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-password {\n border-left: 1px solid #dcdcdc;\n display: flex;\n flex: none;\n width: 458px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title {\n flex: none;\n width: 30px;\n height: 100%;\n text-align: center;\n border-right: 1px solid #dcdcdc;\n display: table;\n padding: 0 5px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title label {\n display: table-cell;\n vertical-align: middle;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover {\n padding-top: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-inner-content {\n padding: 6px 0;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overflow-x: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-arrow {\n display: none;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content {\n width: 567px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block {\n padding: 14px 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block label {\n display: block;\n font-size: 12px;\n color: #666666;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued {\n padding: 0;\n margin: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued li {\n list-style: none;\n width: 50%;\n float: left;\n margin-bottom: 20px;\n padding: 0 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company {\n padding: 0;\n margin: 0;\n font-size: 12px;\n padding: 10px;\n font-weight: bold;\n color: #000000;\n cursor: pointer;\n transition: background 0.4s;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:hover {\n background: #e6e6e6e6;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:last-child {\n margin-bottom: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company li {\n list-style: none;\n width: 50%;\n float: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag {\n line-height: 1;\n padding: 4px 12px;\n background: #F3F3F3;\n border-radius: 9999px;\n font-size: 12px;\n font-weight: bold;\n color: #000;\n cursor: pointer;\n transition: background 0.4s;\n display: inline-block;\n max-width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag:hover {\n background: #e6e6e6e6;\n}\n";
12104
12146
  styleInject(css_248z$a);
12105
12147
 
12106
- var Text$4 = Typography.Text;
12148
+ var Text$5 = Typography.Text;
12107
12149
 
12108
12150
  var Buyer$1 = /*#__PURE__*/function (_React$Component) {
12109
12151
  _inherits(Buyer, _React$Component);
@@ -12217,7 +12259,7 @@ var Main$2 = decorator(Form.create())(function (props) {
12217
12259
  if (e.options.rules.some(function (e) {
12218
12260
  return e.required;
12219
12261
  })) {
12220
- return React.createElement(React.Fragment, null, React.createElement(Text$4, {
12262
+ return React.createElement(React.Fragment, null, React.createElement(Text$5, {
12221
12263
  type: "danger"
12222
12264
  }, "*"), e.label);
12223
12265
  } else {
package/dist/index.js CHANGED
@@ -1003,6 +1003,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1003
1003
  this.isMyShow = false;
1004
1004
  this.editGood = void 0;
1005
1005
  this.form = void 0;
1006
+ this.columnsReplenish = {};
1006
1007
  this.unitList = [];
1007
1008
  this.defaultRate = 3;
1008
1009
  this.taxRateList = [0, 3, 5, 6, 9, 13];
@@ -9394,6 +9395,20 @@ var RowMenu = (function (props) {
9394
9395
  });
9395
9396
 
9396
9397
  var Text$2 = ktsComponentsAntdX3.Typography.Text;
9398
+ var TitleText = (function (props) {
9399
+ var rules = props.rules,
9400
+ children = props.children;
9401
+ var required = React__default['default'].useMemo(function () {
9402
+ return (rules === null || rules === void 0 ? void 0 : rules.some(function (e) {
9403
+ return !!e.required;
9404
+ })) || props.required;
9405
+ }, [rules, props.required]);
9406
+ return React__default['default'].createElement(React__default['default'].Fragment, null, required ? React__default['default'].createElement(Text$2, {
9407
+ type: "danger"
9408
+ }, "*") : React__default['default'].createElement(React__default['default'].Fragment, null), children);
9409
+ });
9410
+
9411
+ var Text$3 = ktsComponentsAntdX3.Typography.Text;
9397
9412
  var useColumns = (function (form) {
9398
9413
  var getFieldDecorator = form.getFieldDecorator,
9399
9414
  getFieldValue = form.getFieldValue;
@@ -9433,6 +9448,11 @@ var useColumns = (function (form) {
9433
9448
  var unitList = controller.useMemo(function (e) {
9434
9449
  return e.goodsListState.unitList;
9435
9450
  }, []);
9451
+ /** 商品表格补充配置 */
9452
+
9453
+ var columnsReplenish = controller.useMemo(function (e) {
9454
+ return e.goodsListState.columnsReplenish;
9455
+ }, []);
9436
9456
  /** 扣除额 */
9437
9457
 
9438
9458
  var deduction = controller.useMemo(function (e) {
@@ -9444,10 +9464,17 @@ var useColumns = (function (form) {
9444
9464
  _React$useState2 = _slicedToArray(_React$useState, 2),
9445
9465
  changeField = _React$useState2[0],
9446
9466
  setChangeField = _React$useState2[1];
9447
- /** 表头 */
9467
+ /** 获取补充校验规则 */
9448
9468
 
9449
9469
 
9470
+ var getReplenishRules = React__default['default'].useCallback(function (id) {
9471
+ return columnsReplenish[id] ? columnsReplenish[id].rules || [] : [];
9472
+ }, [columnsReplenish]);
9473
+ /** 表头 */
9474
+
9450
9475
  var columns = React__default['default'].useMemo(function () {
9476
+ var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2, _columnsReplenish$tax;
9477
+
9451
9478
  return [{
9452
9479
  title: '序号',
9453
9480
  key: 'serialNo',
@@ -9461,9 +9488,9 @@ var useColumns = (function (form) {
9461
9488
  }, e);
9462
9489
  }
9463
9490
  }, {
9464
- title: React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$2, {
9465
- type: "danger"
9466
- }, "*"), "\u9879\u76EE\u540D\u79F0"),
9491
+ title: React__default['default'].createElement(TitleText, {
9492
+ required: true
9493
+ }, "\u9879\u76EE\u540D\u79F0"),
9467
9494
  key: 'itemName',
9468
9495
  render: function render(_, record) {
9469
9496
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
@@ -9473,7 +9500,7 @@ var useColumns = (function (form) {
9473
9500
  }
9474
9501
  }, getFieldDecorator('itemName', {
9475
9502
  initialValue: isMyShow ? record.itemNameSelf : record.itemName,
9476
- rules: [{
9503
+ rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
9477
9504
  validator: function () {
9478
9505
  var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, __, callback) {
9479
9506
  var value;
@@ -9513,7 +9540,7 @@ var useColumns = (function (form) {
9513
9540
 
9514
9541
  return validator;
9515
9542
  }()
9516
- }]
9543
+ }])
9517
9544
  })(React__default['default'].createElement(MyInput, {
9518
9545
  style: {
9519
9546
  flex: 1
@@ -9558,13 +9585,16 @@ var useColumns = (function (form) {
9558
9585
  }
9559
9586
  }
9560
9587
  }, {
9561
- title: '货物规格型号',
9588
+ title: React__default['default'].createElement(TitleText, {
9589
+ rules: (_columnsReplenish$ite = columnsReplenish['itemModelName']) === null || _columnsReplenish$ite === void 0 ? void 0 : _columnsReplenish$ite.rules
9590
+ }, "\u8D27\u7269\u89C4\u683C\u578B\u53F7"),
9562
9591
  key: 'itemModelName',
9563
9592
  width: 119,
9564
9593
  render: function render(_, record) {
9565
9594
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9566
9595
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemModelName', {
9567
- initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName
9596
+ initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
9597
+ rules: getReplenishRules('itemModelName')
9568
9598
  })(React__default['default'].createElement(MyInput, {
9569
9599
  onChange: function () {
9570
9600
  var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
@@ -9606,13 +9636,16 @@ var useColumns = (function (form) {
9606
9636
  }
9607
9637
  }
9608
9638
  }, {
9609
- title: '单位',
9639
+ title: React__default['default'].createElement(TitleText, {
9640
+ rules: (_columnsReplenish$uni = columnsReplenish['unit']) === null || _columnsReplenish$uni === void 0 ? void 0 : _columnsReplenish$uni.rules
9641
+ }, "\u5355\u4F4D"),
9610
9642
  key: 'unit',
9611
9643
  width: 70,
9612
9644
  render: function render(_, record) {
9613
9645
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9614
9646
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('unit', {
9615
- initialValue: editGood.unit
9647
+ initialValue: editGood.unit,
9648
+ rules: getReplenishRules('unit')
9616
9649
  })(React__default['default'].createElement(ktsComponentsAntdX3.AutoComplete, {
9617
9650
  style: {
9618
9651
  width: '100%'
@@ -9659,7 +9692,9 @@ var useColumns = (function (form) {
9659
9692
  }
9660
9693
  }
9661
9694
  }, {
9662
- title: '数量',
9695
+ title: React__default['default'].createElement(TitleText, {
9696
+ rules: (_columnsReplenish$qua = columnsReplenish['quantity']) === null || _columnsReplenish$qua === void 0 ? void 0 : _columnsReplenish$qua.rules
9697
+ }, "\u6570\u91CF"),
9663
9698
  dataIndex: 'quantity',
9664
9699
  key: 'quantity',
9665
9700
  align: 'right',
@@ -9668,7 +9703,7 @@ var useColumns = (function (form) {
9668
9703
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9669
9704
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
9670
9705
  initialValue: editGood.quantity,
9671
- rules: [{
9706
+ rules: [].concat(_toConsumableArray(getReplenishRules('quantity')), [{
9672
9707
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9673
9708
  message: '数量必须为数字'
9674
9709
  }, {
@@ -9710,7 +9745,7 @@ var useColumns = (function (form) {
9710
9745
 
9711
9746
  return validator;
9712
9747
  }()
9713
- }]
9748
+ }])
9714
9749
  })(React__default['default'].createElement(MyInput, {
9715
9750
  style: {
9716
9751
  textAlign: 'right'
@@ -9731,7 +9766,9 @@ var useColumns = (function (form) {
9731
9766
  }
9732
9767
  }
9733
9768
  }, {
9734
- title: '单价(含税)',
9769
+ title: React__default['default'].createElement(TitleText, {
9770
+ rules: (_columnsReplenish$pri = columnsReplenish['priceIncludeTax']) === null || _columnsReplenish$pri === void 0 ? void 0 : _columnsReplenish$pri.rules
9771
+ }, "\u5355\u4EF7(\u542B\u7A0E)"),
9735
9772
  dataIndex: 'priceIncludeTax',
9736
9773
  key: 'priceIncludeTax',
9737
9774
  align: 'right',
@@ -9740,7 +9777,7 @@ var useColumns = (function (form) {
9740
9777
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9741
9778
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
9742
9779
  initialValue: editGood.priceIncludeTax,
9743
- rules: [{
9780
+ rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
9744
9781
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9745
9782
  message: '单价必须为数字'
9746
9783
  }, {
@@ -9782,7 +9819,7 @@ var useColumns = (function (form) {
9782
9819
 
9783
9820
  return validator;
9784
9821
  }()
9785
- }]
9822
+ }])
9786
9823
  })(React__default['default'].createElement(MyInput, {
9787
9824
  style: {
9788
9825
  textAlign: 'right'
@@ -9803,7 +9840,9 @@ var useColumns = (function (form) {
9803
9840
  }
9804
9841
  }
9805
9842
  }, {
9806
- title: '单价(不含税)',
9843
+ title: React__default['default'].createElement(TitleText, {
9844
+ rules: (_columnsReplenish$pri2 = columnsReplenish['priceExcludeTax']) === null || _columnsReplenish$pri2 === void 0 ? void 0 : _columnsReplenish$pri2.rules
9845
+ }, "\u5355\u4EF7(\u4E0D\u542B\u7A0E)"),
9807
9846
  dataIndex: 'priceExcludeTax',
9808
9847
  key: 'priceExcludeTax',
9809
9848
  align: 'right',
@@ -9812,7 +9851,7 @@ var useColumns = (function (form) {
9812
9851
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9813
9852
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
9814
9853
  initialValue: editGood.priceExcludeTax,
9815
- rules: [{
9854
+ rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
9816
9855
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
9817
9856
  message: '单价必须为数字'
9818
9857
  }, {
@@ -9854,7 +9893,7 @@ var useColumns = (function (form) {
9854
9893
 
9855
9894
  return validator;
9856
9895
  }()
9857
- }]
9896
+ }])
9858
9897
  })(React__default['default'].createElement(MyInput, {
9859
9898
  style: {
9860
9899
  textAlign: 'right'
@@ -9875,9 +9914,9 @@ var useColumns = (function (form) {
9875
9914
  }
9876
9915
  }
9877
9916
  }, {
9878
- title: React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$2, {
9879
- type: "danger"
9880
- }, "*"), "\u91D1\u989D(\u542B\u7A0E)"),
9917
+ title: React__default['default'].createElement(TitleText, {
9918
+ required: true
9919
+ }, "\u91D1\u989D(\u542B\u7A0E)"),
9881
9920
  dataIndex: 'lineAmountIncludeTax',
9882
9921
  key: 'lineAmountIncludeTax',
9883
9922
  width: 119,
@@ -9886,7 +9925,7 @@ var useColumns = (function (form) {
9886
9925
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9887
9926
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
9888
9927
  initialValue: editGood.lineAmountIncludeTax,
9889
- rules: [{
9928
+ rules: [].concat(_toConsumableArray(getReplenishRules('lineAmountIncludeTax')), [{
9890
9929
  required: true,
9891
9930
  message: '金额不能为空'
9892
9931
  }, {
@@ -9942,7 +9981,7 @@ var useColumns = (function (form) {
9942
9981
 
9943
9982
  return validator;
9944
9983
  }()
9945
- }]
9984
+ }])
9946
9985
  })(React__default['default'].createElement(MyInput, {
9947
9986
  style: {
9948
9987
  textAlign: 'right'
@@ -9962,9 +10001,9 @@ var useColumns = (function (form) {
9962
10001
  }
9963
10002
  }
9964
10003
  }, {
9965
- title: React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$2, {
9966
- type: "danger"
9967
- }, "*"), "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
10004
+ title: React__default['default'].createElement(TitleText, {
10005
+ required: true
10006
+ }, "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
9968
10007
  dataIndex: 'lineAmountExcludeTax',
9969
10008
  key: 'lineAmountExcludeTax',
9970
10009
  align: 'right',
@@ -9973,7 +10012,7 @@ var useColumns = (function (form) {
9973
10012
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
9974
10013
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
9975
10014
  initialValue: editGood.lineAmountExcludeTax,
9976
- rules: [{
10015
+ rules: [].concat(_toConsumableArray(getReplenishRules('lineAmountExcludeTax')), [{
9977
10016
  required: true,
9978
10017
  message: '金额不能为空'
9979
10018
  }, {
@@ -10004,7 +10043,7 @@ var useColumns = (function (form) {
10004
10043
 
10005
10044
  return validator;
10006
10045
  }()
10007
- }]
10046
+ }])
10008
10047
  })(React__default['default'].createElement(MyInput, {
10009
10048
  style: {
10010
10049
  textAlign: 'right'
@@ -10024,9 +10063,9 @@ var useColumns = (function (form) {
10024
10063
  }
10025
10064
  }
10026
10065
  }, {
10027
- title: React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$2, {
10028
- type: "danger"
10029
- }, "*"), "\u7A0E\u7387%"),
10066
+ title: React__default['default'].createElement(TitleText, {
10067
+ required: true
10068
+ }, "\u7A0E\u7387%"),
10030
10069
  dataIndex: 'taxRate',
10031
10070
  key: 'taxRate',
10032
10071
  align: 'right',
@@ -10035,13 +10074,13 @@ var useColumns = (function (form) {
10035
10074
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10036
10075
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('taxRate', {
10037
10076
  initialValue: editGood.taxRate,
10038
- rules: [{
10077
+ rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
10039
10078
  required: true,
10040
10079
  message: ' '
10041
10080
  }, {
10042
10081
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
10043
10082
  message: ' '
10044
- }]
10083
+ }])
10045
10084
  })(React__default['default'].createElement(ktsComponentsAntdX3.Select, {
10046
10085
  className: "kts-invoice-operate-goods-list-table-tax-rate",
10047
10086
  dropdownMenuStyle: {
@@ -10070,7 +10109,9 @@ var useColumns = (function (form) {
10070
10109
  }
10071
10110
  }
10072
10111
  }, {
10073
- title: '税额',
10112
+ title: React__default['default'].createElement(TitleText, {
10113
+ rules: (_columnsReplenish$tax = columnsReplenish['taxAmount']) === null || _columnsReplenish$tax === void 0 ? void 0 : _columnsReplenish$tax.rules
10114
+ }, "\u7A0E\u989D"),
10074
10115
  dataIndex: 'taxAmount',
10075
10116
  key: 'taxAmount',
10076
10117
  align: 'right',
@@ -10078,7 +10119,8 @@ var useColumns = (function (form) {
10078
10119
  render: function render(value, record) {
10079
10120
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10080
10121
  return getFieldDecorator('taxAmount', {
10081
- initialValue: editGood.taxAmount
10122
+ initialValue: editGood.taxAmount,
10123
+ rules: getReplenishRules('taxAmount')
10082
10124
  })(React__default['default'].createElement(MyDiv, {
10083
10125
  loading: isCipher(changeField, 'taxAmount')
10084
10126
  }));
@@ -11008,7 +11050,7 @@ var lazyFn$1 = (function (fn) {
11008
11050
  var css_248z$7 = ".kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-body {\n flex: 1;\n overflow: auto;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-footer {\n flex: none;\n}\n";
11009
11051
  styleInject(css_248z$7);
11010
11052
 
11011
- var Text$3 = ktsComponentsAntdX3.Typography.Text;
11053
+ var Text$4 = ktsComponentsAntdX3.Typography.Text;
11012
11054
 
11013
11055
  var _create = mathjs.create(mathjs.all, {
11014
11056
  number: 'BigNumber',
@@ -11297,9 +11339,9 @@ var DrawerBody = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(funct
11297
11339
  }, 300), [form, lineAmountSum]);
11298
11340
  return React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement("div", {
11299
11341
  className: "add-discount-row-body"
11300
- }, React__default['default'].createElement("p", null, "\u5F53\u524D\u9009\u62E9", React__default['default'].createElement(Text$3, {
11342
+ }, React__default['default'].createElement("p", null, "\u5F53\u524D\u9009\u62E9", React__default['default'].createElement(Text$4, {
11301
11343
  type: "danger"
11302
- }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React__default['default'].createElement(Text$3, {
11344
+ }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React__default['default'].createElement(Text$4, {
11303
11345
  type: "danger"
11304
11346
  }, lineAmountSum.toFixed(2))), React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
11305
11347
  label: "\u6298\u6263\u7387\uFF1A"
@@ -12113,7 +12155,7 @@ function interval(i, t) {
12113
12155
  var css_248z$a = ".kts-invoice-operate-buyer {\n display: flex;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message {\n flex: 1;\n display: flex;\n position: relative;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .ktsAnt3x-descriptions-item-label {\n width: 179px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list {\n width: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-view {\n border: none;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-label {\n padding: 0 10px;\n font-size: 12px;\n background-color: #fff;\n line-height: 30px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content {\n padding: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input {\n box-shadow: none;\n border-color: #fff;\n border-radius: 0;\n padding: 0 10px;\n font-size: 12px;\n line-height: 30px;\n width: 100%;\n height: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input:hover {\n border: 1 solid;\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input,\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input:hover {\n background-color: #fff;\n border: 1 solid;\n border-color: #f5222d;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-control {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children .ktsAnt3x-btn {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-explain {\n position: absolute;\n left: 5px;\n top: 6px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-Import {\n position: absolute;\n right: 0px;\n top: 0px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-password {\n border-left: 1px solid #dcdcdc;\n display: flex;\n flex: none;\n width: 458px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title {\n flex: none;\n width: 30px;\n height: 100%;\n text-align: center;\n border-right: 1px solid #dcdcdc;\n display: table;\n padding: 0 5px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title label {\n display: table-cell;\n vertical-align: middle;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover {\n padding-top: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-inner-content {\n padding: 6px 0;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overflow-x: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-arrow {\n display: none;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content {\n width: 567px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block {\n padding: 14px 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block label {\n display: block;\n font-size: 12px;\n color: #666666;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued {\n padding: 0;\n margin: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued li {\n list-style: none;\n width: 50%;\n float: left;\n margin-bottom: 20px;\n padding: 0 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company {\n padding: 0;\n margin: 0;\n font-size: 12px;\n padding: 10px;\n font-weight: bold;\n color: #000000;\n cursor: pointer;\n transition: background 0.4s;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:hover {\n background: #e6e6e6e6;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:last-child {\n margin-bottom: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company li {\n list-style: none;\n width: 50%;\n float: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag {\n line-height: 1;\n padding: 4px 12px;\n background: #F3F3F3;\n border-radius: 9999px;\n font-size: 12px;\n font-weight: bold;\n color: #000;\n cursor: pointer;\n transition: background 0.4s;\n display: inline-block;\n max-width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag:hover {\n background: #e6e6e6e6;\n}\n";
12114
12156
  styleInject(css_248z$a);
12115
12157
 
12116
- var Text$4 = ktsComponentsAntdX3.Typography.Text;
12158
+ var Text$5 = ktsComponentsAntdX3.Typography.Text;
12117
12159
 
12118
12160
  var Buyer$1 = /*#__PURE__*/function (_React$Component) {
12119
12161
  _inherits(Buyer, _React$Component);
@@ -12227,7 +12269,7 @@ var Main$2 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function
12227
12269
  if (e.options.rules.some(function (e) {
12228
12270
  return e.required;
12229
12271
  })) {
12230
- return React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$4, {
12272
+ return React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(Text$5, {
12231
12273
  type: "danger"
12232
12274
  }, "*"), e.label);
12233
12275
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -0,0 +1,10 @@
1
+
2
+ /** 商品表格补充配置 */
3
+
4
+ import { ValidationRule } from "kts-components-antd-x3/lib/form";
5
+
6
+ export default interface IColumnsReplenish {
7
+
8
+ /** 补充的规则 */
9
+ rules: ValidationRule[];
10
+ }
@@ -4,6 +4,7 @@ import EndowCode from './EndowCode';
4
4
  import ProductComparison from './ProductComparison';
5
5
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
6
6
  import InvoiceController from '../..';
7
+ import IColumnsReplenish from './IColumnsReplenish';
7
8
 
8
9
  export default class GoodsListState {
9
10
 
@@ -31,6 +32,9 @@ export default class GoodsListState {
31
32
  /** 被编辑行的form对象 */
32
33
  form?: WrappedFormUtils;
33
34
 
35
+ /** 商品表格补充配置 */
36
+ columnsReplenish: { [key: string]: IColumnsReplenish } = {};
37
+
34
38
  /** 单位列表 */
35
39
  unitList: string[] = [];
36
40
 
@@ -69,7 +69,7 @@ class MyController1 extends Invoice.InvoiceController {
69
69
  getTaxCategoryCodeList = this.pipeline(async (s) => {
70
70
  console.log('===> 准备赋码的货物索引列表', s.goodsListState.endowCode.endowcodeGoodIndex);
71
71
  s.goodsListState.endowCode.getTaxCategoryCodeTree = async (taxCategoryCode?: string | undefined, val?: string | undefined) => {
72
- if(! taxCategoryCode && !val) return [];
72
+ if (!taxCategoryCode && !val) return [];
73
73
  return moke.map(e => {
74
74
  return {
75
75
  label: `${e.taxCategoryCode}-${e.shorthand}`,
@@ -128,24 +128,83 @@ for (let i = 0; i <= 10000; i++) {
128
128
 
129
129
  const lines: any[] = [
130
130
  {
131
+ "buyersItemCode": null,
132
+ "buyersItemModelName": "GN-G32Z104",
133
+ "buyersItemName": "*配电控制设备*公牛(BULL)",
134
+ "buyersItemUnit": null,
135
+ "discount": 5010.04,
136
+ "discountGroup": "31b6d887-4877-4926-abe8-ab49ef6902da",
137
+ "dispatchDocumentReference": null,
138
+ "dispatchLineReference": null,
139
+ "favouredPolicyMark": "0",
140
+ "favouredPolicyName": null,
141
+ "id": "40823568750477313",
142
+ "itemModelName": "GN-G32Z104",
143
+ "itemName": "*配电控制设备*公牛(BULL)",
144
+ "lineAmountExcludeTax": 443365.88,
145
+ "lineAmountIncludeTax": 501003.53,
146
+ "lineAttribute": "2",
147
+ "lineDiscountExcludeTax": 4433.66,
148
+ "lineDiscountRate": null,
149
+ "lineId": "1740823580142206976",
150
+ "lineOrder": 1,
151
+ "materialCode": null,
152
+ "noticeCodeNo": null,
153
+ "noticeLineId": null,
154
+ "orderLineId": null,
155
+ "orderLineReference": null,
156
+ "orderNo": null,
157
+ "orderReference": null,
158
+ "priceExcludeTax": 827.17518997,
159
+ "priceIncludeTax": 934.70796467,
160
+ "quantity": 536,
161
+ "receiptDocumentReference": null,
162
+ "receiptLineReference": null,
163
+ "reconciliationDocumentReference": null,
164
+ "reconciliationSheetLineReference": null,
165
+ "relationReferences": null,
166
+ "requisitionLineNo": null,
167
+ "sellersItemCode": null,
168
+ "sellersItemModelName": null,
169
+ "sellersItemName": "*配电控制设备*1",
170
+ "sellersItemUnit": null,
171
+ "specialManagement": null,
172
+ "statementCode": null,
173
+ "statementLineId": null,
174
+ "taxAmount": 57637.65,
175
+ "taxClassificationCode": "1090407030000000000",
176
+ "taxDiscount": 576.38,
177
+ "taxRate": 13,
178
+ "unit": "件",
179
+ "zeroTaxRateFlag": null
180
+ },
181
+ {
182
+ "buyersItemCode": null,
183
+ "buyersItemModelName": "GN-G32Z104",
184
+ "buyersItemName": "*配电控制设备*公牛(BULL)",
185
+ "buyersItemUnit": null,
131
186
  "discount": null,
132
- "discountGroup": "187da922-946f-4f0d-ba63-7935f0e5f9e5",
187
+ "discountGroup": "31b6d887-4877-4926-abe8-ab49ef6902da",
133
188
  "dispatchDocumentReference": null,
134
189
  "dispatchLineReference": null,
135
- "favouredPolicyMark": "1",
136
- "favouredPolicyName": "稀土产品",
137
- "id": "1",
138
- "itemModelName": null,
139
- "itemName": "*研发和技术服务*技术服务费",
140
- "lineAmountExcludeTax": 94.34,
141
- "lineAmountIncludeTax": 100.00,
142
- "lineAttribute": '0',
190
+ "favouredPolicyMark": "0",
191
+ "favouredPolicyName": null,
192
+ "id": "40823568750477313",
193
+ "itemModelName": "",
194
+ "itemName": "*配电控制设备*公牛(BULL)",
195
+ "lineAmountExcludeTax": -4433.66,
196
+ "lineAmountIncludeTax": -5010.04,
197
+ "lineAttribute": "1",
143
198
  "lineDiscountExcludeTax": null,
144
199
  "lineDiscountRate": null,
145
- "lineId": "1449262336593362944",
146
- "lineOrder": 0,
200
+ "lineId": "1740823580142206976",
201
+ "lineOrder": 2,
147
202
  "materialCode": null,
203
+ "noticeCodeNo": null,
204
+ "noticeLineId": null,
205
+ "orderLineId": null,
148
206
  "orderLineReference": null,
207
+ "orderNo": null,
149
208
  "orderReference": null,
150
209
  "priceExcludeTax": null,
151
210
  "priceIncludeTax": null,
@@ -156,11 +215,17 @@ const lines: any[] = [
156
215
  "reconciliationSheetLineReference": null,
157
216
  "relationReferences": null,
158
217
  "requisitionLineNo": null,
159
- "specialManagement": "稀土产品",
160
- "taxAmount": 5.66,
161
- "taxClassificationCode": "3040105000000000000",
218
+ "sellersItemCode": null,
219
+ "sellersItemModelName": null,
220
+ "sellersItemName": "*配电控制设备*1",
221
+ "sellersItemUnit": null,
222
+ "specialManagement": null,
223
+ "statementCode": null,
224
+ "statementLineId": null,
225
+ "taxAmount": -576.38,
226
+ "taxClassificationCode": "1090407030000000000",
162
227
  "taxDiscount": null,
163
- "taxRate": 6,
228
+ "taxRate": 13,
164
229
  "unit": "",
165
230
  "zeroTaxRateFlag": null
166
231
  }
@@ -5,6 +5,7 @@ import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
5
5
  import { IGood } from '../../../../InvoiceController';
6
6
  import Invoice from '../../../../';
7
7
  import RowMenu from './ui/RowMenu';
8
+ import TitleText from './ui/TitleText';
8
9
  import {
9
10
  onChangeQuantity,
10
11
  onChangePriceIncludeTax,
@@ -12,8 +13,6 @@ import {
12
13
  onChangeLineAmountIncludeTax,
13
14
  onChangeLineAmountExcludeTax,
14
15
  onChangeTaxRate,
15
- // onSaveEditGood,
16
- // endowCode,
17
16
  onChangeItemName,
18
17
  } from './autoFillFn';
19
18
 
@@ -45,12 +44,20 @@ export default (form: WrappedFormUtils) => {
45
44
  /** 单位列表 */
46
45
  const unitList = controller.useMemo((e) => e.goodsListState.unitList, []);
47
46
 
47
+ /** 商品表格补充配置 */
48
+ const columnsReplenish = controller.useMemo((e) => e.goodsListState.columnsReplenish, []);
49
+
48
50
  /** 扣除额 */
49
51
  const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
50
52
 
51
53
  /** 变动的字段 */
52
54
  const [changeField, setChangeField] = React.useState('');
53
55
 
56
+ /** 获取补充校验规则 */
57
+ const getReplenishRules = React.useCallback((id: string) => {
58
+ return columnsReplenish[id] ? columnsReplenish[id].rules || [] : []
59
+ }, [columnsReplenish])
60
+
54
61
  /** 表头 */
55
62
  const columns = React.useMemo(() => {
56
63
  return [
@@ -62,11 +69,7 @@ export default (form: WrappedFormUtils) => {
62
69
  render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
63
70
  },
64
71
  {
65
- title: (
66
- <>
67
- <Text type="danger">*</Text>项目名称
68
- </>
69
- ),
72
+ title: <TitleText required >项目名称</TitleText>,
70
73
  key: 'itemName',
71
74
  render: (_: string, record: IGood) => {
72
75
  if (editGood?.$index === record.$index) {
@@ -75,17 +78,20 @@ export default (form: WrappedFormUtils) => {
75
78
  <div style={{ display: 'flex' }} >
76
79
  {getFieldDecorator('itemName', {
77
80
  initialValue: isMyShow ? record.itemNameSelf : record.itemName,
78
- rules: [{
79
- validator: async (_, __, callback) => {
80
- await controller.wait();
81
- const value = controller.state.goodsListState.editGood;
82
- if (!value?.itemName && !value?.itemNameSelf) {
83
- callback('货物名称不能为空');
84
- } else {
85
- return;
81
+ rules: [
82
+ ...getReplenishRules('itemName'),
83
+ {
84
+ validator: async (_, __, callback) => {
85
+ await controller.wait();
86
+ const value = controller.state.goodsListState.editGood;
87
+ if (!value?.itemName && !value?.itemNameSelf) {
88
+ callback('货物名称不能为空');
89
+ } else {
90
+ return;
91
+ }
86
92
  }
87
93
  }
88
- }]
94
+ ]
89
95
  })(
90
96
  <MyInput
91
97
  style={{ flex: 1 }}
@@ -120,7 +126,7 @@ export default (form: WrappedFormUtils) => {
120
126
  },
121
127
  },
122
128
  {
123
- title: '货物规格型号',
129
+ title: <TitleText rules={columnsReplenish['itemModelName']?.rules} >货物规格型号</TitleText>,
124
130
  key: 'itemModelName',
125
131
  width: 119,
126
132
  render: (_: string, record: IGood) => {
@@ -129,6 +135,7 @@ export default (form: WrappedFormUtils) => {
129
135
  <Form.Item>
130
136
  {getFieldDecorator('itemModelName', {
131
137
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
138
+ rules: getReplenishRules('itemModelName'),
132
139
  })(
133
140
  <MyInput
134
141
  onChange={async () => {
@@ -154,7 +161,7 @@ export default (form: WrappedFormUtils) => {
154
161
  },
155
162
  },
156
163
  {
157
- title: '单位',
164
+ title: <TitleText rules={columnsReplenish['unit']?.rules} >单位</TitleText>,
158
165
  key: 'unit',
159
166
  width: 70,
160
167
  render: (_: string, record: IGood) => {
@@ -163,6 +170,7 @@ export default (form: WrappedFormUtils) => {
163
170
  <Form.Item>
164
171
  {getFieldDecorator('unit', {
165
172
  initialValue: editGood.unit,
173
+ rules: getReplenishRules('unit'),
166
174
  })(
167
175
  <AutoComplete
168
176
  style={{ width: '100%' }}
@@ -184,7 +192,7 @@ export default (form: WrappedFormUtils) => {
184
192
  },
185
193
  },
186
194
  {
187
- title: '数量',
195
+ title: <TitleText rules={columnsReplenish['quantity']?.rules} >数量</TitleText>,
188
196
  dataIndex: 'quantity',
189
197
  key: 'quantity',
190
198
  align: 'right',
@@ -196,6 +204,7 @@ export default (form: WrappedFormUtils) => {
196
204
  {getFieldDecorator('quantity', {
197
205
  initialValue: editGood.quantity,
198
206
  rules: [
207
+ ...getReplenishRules('quantity'),
199
208
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
200
209
  {
201
210
  validator: async (_, value, callback) => {
@@ -226,7 +235,7 @@ export default (form: WrappedFormUtils) => {
226
235
  },
227
236
  },
228
237
  {
229
- title: '单价(含税)',
238
+ title: <TitleText rules={columnsReplenish['priceIncludeTax']?.rules} >单价(含税)</TitleText>,
230
239
  dataIndex: 'priceIncludeTax',
231
240
  key: 'priceIncludeTax',
232
241
  align: 'right',
@@ -238,6 +247,7 @@ export default (form: WrappedFormUtils) => {
238
247
  {getFieldDecorator('priceIncludeTax', {
239
248
  initialValue: editGood.priceIncludeTax,
240
249
  rules: [
250
+ ...getReplenishRules('priceIncludeTax'),
241
251
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
242
252
  {
243
253
  validator: async (_, value, callback) => {
@@ -268,7 +278,7 @@ export default (form: WrappedFormUtils) => {
268
278
  },
269
279
  },
270
280
  {
271
- title: '单价(不含税)',
281
+ title: <TitleText rules={columnsReplenish['priceExcludeTax']?.rules} >单价(不含税)</TitleText>,
272
282
  dataIndex: 'priceExcludeTax',
273
283
  key: 'priceExcludeTax',
274
284
  align: 'right',
@@ -280,6 +290,7 @@ export default (form: WrappedFormUtils) => {
280
290
  {getFieldDecorator('priceExcludeTax', {
281
291
  initialValue: editGood.priceExcludeTax,
282
292
  rules: [
293
+ ...getReplenishRules('priceExcludeTax'),
283
294
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
284
295
  {
285
296
  validator: async (_, value, callback) => {
@@ -310,11 +321,7 @@ export default (form: WrappedFormUtils) => {
310
321
  },
311
322
  },
312
323
  {
313
- title: (
314
- <>
315
- <Text type="danger">*</Text>金额(含税)
316
- </>
317
- ),
324
+ title: <TitleText required >金额(含税)</TitleText>,
318
325
  dataIndex: 'lineAmountIncludeTax',
319
326
  key: 'lineAmountIncludeTax',
320
327
  width: 119,
@@ -326,6 +333,7 @@ export default (form: WrappedFormUtils) => {
326
333
  {getFieldDecorator('lineAmountIncludeTax', {
327
334
  initialValue: editGood.lineAmountIncludeTax,
328
335
  rules: [
336
+ ...getReplenishRules('lineAmountIncludeTax'),
329
337
  { required: true, message: '金额不能为空' },
330
338
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
331
339
  {
@@ -361,11 +369,7 @@ export default (form: WrappedFormUtils) => {
361
369
  },
362
370
  },
363
371
  {
364
- title: (
365
- <>
366
- <Text type="danger">*</Text>金额(不含税)
367
- </>
368
- ),
372
+ title: <TitleText required >金额(不含税)</TitleText>,
369
373
  dataIndex: 'lineAmountExcludeTax',
370
374
  key: 'lineAmountExcludeTax',
371
375
  align: 'right',
@@ -377,6 +381,7 @@ export default (form: WrappedFormUtils) => {
377
381
  {getFieldDecorator('lineAmountExcludeTax', {
378
382
  initialValue: editGood.lineAmountExcludeTax,
379
383
  rules: [
384
+ ...getReplenishRules('lineAmountExcludeTax'),
380
385
  { required: true, message: '金额不能为空' },
381
386
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
382
387
  {
@@ -405,11 +410,7 @@ export default (form: WrappedFormUtils) => {
405
410
  },
406
411
  },
407
412
  {
408
- title: (
409
- <>
410
- <Text type="danger">*</Text>税率%
411
- </>
412
- ),
413
+ title: <TitleText required >税率%</TitleText>,
413
414
  dataIndex: 'taxRate',
414
415
  key: 'taxRate',
415
416
  align: 'right',
@@ -421,6 +422,7 @@ export default (form: WrappedFormUtils) => {
421
422
  {getFieldDecorator('taxRate', {
422
423
  initialValue: editGood.taxRate,
423
424
  rules: [
425
+ ...getReplenishRules('taxRate'),
424
426
  { required: true, message: ' ' },
425
427
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: ' ' },
426
428
  ],
@@ -452,7 +454,7 @@ export default (form: WrappedFormUtils) => {
452
454
  },
453
455
  },
454
456
  {
455
- title: '税额',
457
+ title: <TitleText rules={columnsReplenish['taxAmount']?.rules} >税额</TitleText>,
456
458
  dataIndex: 'taxAmount',
457
459
  key: 'taxAmount',
458
460
  align: 'right',
@@ -461,6 +463,7 @@ export default (form: WrappedFormUtils) => {
461
463
  if (editGood?.$index === record.$index) {
462
464
  return getFieldDecorator('taxAmount', {
463
465
  initialValue: editGood.taxAmount,
466
+ rules: getReplenishRules('taxAmount'),
464
467
  })(<MyDiv loading={isCipher(changeField, 'taxAmount')} />);
465
468
  } else {
466
469
  return <span style={{ padding: '0 10px' }}>{parseFloat(value).toFixed(2)}</span>;
@@ -0,0 +1,20 @@
1
+
2
+ import React from 'react';
3
+ import { Typography } from 'kts-components-antd-x3';
4
+ import { ValidationRule } from 'kts-components-antd-x3/lib/form';
5
+
6
+ const { Text } = Typography;
7
+
8
+ export default (props: { children?: React.ReactNode, required?: boolean, rules?: ValidationRule[] }) => {
9
+
10
+ const { rules, children } = props;
11
+
12
+ const required = React.useMemo(() => rules?.some(e => !!e.required) || props.required, [rules, props.required]);
13
+
14
+ return (
15
+ <>
16
+ {required ? <Text type="danger">*</Text> : <></>}
17
+ {children}
18
+ </>
19
+ )
20
+ };