kts-component-invoice-operate 3.2.69 → 3.2.71-1

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.
@@ -72,6 +72,8 @@ export default class GoodsListState {
72
72
  isMergeDiscount: boolean;
73
73
  /** 是否可以销售折让 */
74
74
  isSalesDiscount: boolean;
75
+ /** 是否可以销售赠品 */
76
+ isSalesGifts: boolean;
75
77
  /** 正在 添加商品对照 的货物 */
76
78
  addComparisonIndex?: string;
77
79
  /** 商品拖拽数据 */
@@ -3,6 +3,8 @@ import { ValidationRule } from "kts-components-antd-x3/lib/form";
3
3
  export default class Stakeholder {
4
4
  /** 禁用字段 */
5
5
  disableds?: string[];
6
+ /** 启用字段 */
7
+ enables?: string[];
6
8
  /** 字段字段规则 */
7
9
  rulesMap?: {
8
10
  [key: string]: ValidationRule[] | undefined;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  /** 销售折让 */
3
- export default function uaeSalesDiscount(): {
3
+ export default function useSalesDiscount(): {
4
4
  /** 按钮 */
5
5
  button: JSX.Element;
6
6
  };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ /** 销售赠品 */
3
+ export default function useSalesGifts(): {
4
+ /** 按钮 */
5
+ button: JSX.Element | undefined;
6
+ };
package/dist/index.esm.js CHANGED
@@ -616,6 +616,63 @@ function _nonIterableRest() {
616
616
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
617
617
  }
618
618
 
619
+ function _createForOfIteratorHelper(o, allowArrayLike) {
620
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
621
+
622
+ if (!it) {
623
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
624
+ if (it) o = it;
625
+ var i = 0;
626
+
627
+ var F = function () {};
628
+
629
+ return {
630
+ s: F,
631
+ n: function () {
632
+ if (i >= o.length) return {
633
+ done: true
634
+ };
635
+ return {
636
+ done: false,
637
+ value: o[i++]
638
+ };
639
+ },
640
+ e: function (e) {
641
+ throw e;
642
+ },
643
+ f: F
644
+ };
645
+ }
646
+
647
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
648
+ }
649
+
650
+ var normalCompletion = true,
651
+ didErr = false,
652
+ err;
653
+ return {
654
+ s: function () {
655
+ it = it.call(o);
656
+ },
657
+ n: function () {
658
+ var step = it.next();
659
+ normalCompletion = step.done;
660
+ return step;
661
+ },
662
+ e: function (e) {
663
+ didErr = true;
664
+ err = e;
665
+ },
666
+ f: function () {
667
+ try {
668
+ if (!normalCompletion && it.return != null) it.return();
669
+ } finally {
670
+ if (didErr) throw err;
671
+ }
672
+ }
673
+ };
674
+ }
675
+
619
676
  function styleInject(css, ref) {
620
677
  if ( ref === void 0 ) ref = {};
621
678
  var insertAt = ref.insertAt;
@@ -1032,6 +1089,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1032
1089
  this.isMergeDetails = false;
1033
1090
  this.isMergeDiscount = false;
1034
1091
  this.isSalesDiscount = false;
1092
+ this.isSalesGifts = false;
1035
1093
  this.addComparisonIndex = void 0;
1036
1094
  this.drag = new Drag();
1037
1095
  });
@@ -1094,6 +1152,7 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
1094
1152
  _classCallCheck(this, Stakeholder);
1095
1153
 
1096
1154
  this.disableds = void 0;
1155
+ this.enables = void 0;
1097
1156
  this.rulesMap = void 0;
1098
1157
  });
1099
1158
 
@@ -14712,7 +14771,7 @@ function useMergeDiscount() {
14712
14771
 
14713
14772
  /** 销售折让 */
14714
14773
 
14715
- function uaeSalesDiscount() {
14774
+ function useSalesDiscount() {
14716
14775
  var controller = Invoice.useInvoiceController();
14717
14776
  var selectedGoodIndex = controller.useMemo(function (s) {
14718
14777
  return s.goodsListState.selectedGoodIndex;
@@ -14904,6 +14963,183 @@ function uaeSalesDiscount() {
14904
14963
  };
14905
14964
  }
14906
14965
 
14966
+ /** 销售赠品 */
14967
+
14968
+ function useSalesGifts() {
14969
+ var controller = Invoice.useInvoiceController();
14970
+ var isSalesGifts = controller.useMemo(function (s) {
14971
+ return s.goodsListState.isSalesGifts;
14972
+ }, []);
14973
+ var selectedGoodIndex = controller.useMemo(function (s) {
14974
+ return s.goodsListState.selectedGoodIndex;
14975
+ }, []);
14976
+ var goodsList = controller.useMemo(function (s) {
14977
+ return s.goodsListState.goodsList;
14978
+ }, []);
14979
+ var giveaways = React.useMemo(function () {
14980
+ return goodsList.filter(function (e) {
14981
+ return e.lineAttribute === LineAttributeType$1.赠品行;
14982
+ });
14983
+ }, [goodsList]);
14984
+ var onClickAuto = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14985
+ var _iterator, _step, g;
14986
+
14987
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14988
+ while (1) {
14989
+ switch (_context.prev = _context.next) {
14990
+ case 0:
14991
+ _iterator = _createForOfIteratorHelper(giveaways);
14992
+ _context.prev = 1;
14993
+
14994
+ _iterator.s();
14995
+
14996
+ case 3:
14997
+ if ((_step = _iterator.n()).done) {
14998
+ _context.next = 10;
14999
+ break;
15000
+ }
15001
+
15002
+ g = _step.value;
15003
+ g.lineAttribute = LineAttributeType$1.正常;
15004
+ _context.next = 8;
15005
+ return controller.addGoodDiscountV2([{
15006
+ $index: g.$index,
15007
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15008
+ }]);
15009
+
15010
+ case 8:
15011
+ _context.next = 3;
15012
+ break;
15013
+
15014
+ case 10:
15015
+ _context.next = 15;
15016
+ break;
15017
+
15018
+ case 12:
15019
+ _context.prev = 12;
15020
+ _context.t0 = _context["catch"](1);
15021
+
15022
+ _iterator.e(_context.t0);
15023
+
15024
+ case 15:
15025
+ _context.prev = 15;
15026
+
15027
+ _iterator.f();
15028
+
15029
+ return _context.finish(15);
15030
+
15031
+ case 18:
15032
+ case "end":
15033
+ return _context.stop();
15034
+ }
15035
+ }
15036
+ }, _callee, null, [[1, 12, 15, 18]]);
15037
+ })), [controller, giveaways]);
15038
+ var onClickManual = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
15039
+ var _controller$state$goo, goodsMap, selectedGoodIndex, giveaways, content, _iterator2, _step2, g;
15040
+
15041
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
15042
+ while (1) {
15043
+ switch (_context2.prev = _context2.next) {
15044
+ case 0:
15045
+ _controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
15046
+ giveaways = selectedGoodIndex.map(function (e) {
15047
+ return goodsMap.get(e);
15048
+ }).filter(function (e) {
15049
+ return !!e;
15050
+ });
15051
+
15052
+ if (!(giveaways.some(function (e) {
15053
+ return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
15054
+ }) === false)) {
15055
+ _context2.next = 5;
15056
+ break;
15057
+ }
15058
+
15059
+ content = '只能选择‘赠品行’和‘正常行’';
15060
+ return _context2.abrupt("return", message.error({
15061
+ content: content,
15062
+ key: content
15063
+ }));
15064
+
15065
+ case 5:
15066
+ _iterator2 = _createForOfIteratorHelper(giveaways);
15067
+ _context2.prev = 6;
15068
+
15069
+ _iterator2.s();
15070
+
15071
+ case 8:
15072
+ if ((_step2 = _iterator2.n()).done) {
15073
+ _context2.next = 14;
15074
+ break;
15075
+ }
15076
+
15077
+ g = _step2.value;
15078
+ _context2.next = 12;
15079
+ return controller.addGoodDiscountV2([{
15080
+ $index: g.$index,
15081
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15082
+ }]);
15083
+
15084
+ case 12:
15085
+ _context2.next = 8;
15086
+ break;
15087
+
15088
+ case 14:
15089
+ _context2.next = 19;
15090
+ break;
15091
+
15092
+ case 16:
15093
+ _context2.prev = 16;
15094
+ _context2.t0 = _context2["catch"](6);
15095
+
15096
+ _iterator2.e(_context2.t0);
15097
+
15098
+ case 19:
15099
+ _context2.prev = 19;
15100
+
15101
+ _iterator2.f();
15102
+
15103
+ return _context2.finish(19);
15104
+
15105
+ case 22:
15106
+ controller.state.goodsListState.selectedGoodIndex = [];
15107
+
15108
+ case 23:
15109
+ case "end":
15110
+ return _context2.stop();
15111
+ }
15112
+ }
15113
+ }, _callee2, null, [[6, 16, 19, 22]]);
15114
+ })), [controller]);
15115
+ var items = React.useMemo(function () {
15116
+ return [{
15117
+ key: '0',
15118
+ label: '自动转换',
15119
+ disabled: giveaways.length <= 0,
15120
+ onClick: onClickAuto
15121
+ }, {
15122
+ key: '1',
15123
+ label: '手动转换',
15124
+ disabled: selectedGoodIndex.length <= 0,
15125
+ onClick: onClickManual
15126
+ }];
15127
+ }, [selectedGoodIndex, onClickManual, onClickAuto]);
15128
+ var button = React.useMemo(function () {
15129
+ if (!isSalesGifts) return;
15130
+ return React.createElement(Dropdown$1, {
15131
+ menu: {
15132
+ items: items
15133
+ },
15134
+ trigger: ['click']
15135
+ }, React.createElement(Button, null, "\u9500\u552E\u8D60\u54C1"));
15136
+ }, [items, isSalesGifts]);
15137
+ return {
15138
+ /** 按钮 */
15139
+ button: button
15140
+ };
15141
+ }
15142
+
14907
15143
  var GoodsList = /*#__PURE__*/function (_React$Component) {
14908
15144
  _inherits(GoodsList, _React$Component);
14909
15145
 
@@ -14968,7 +15204,10 @@ var Main = decorator(Form.create())(function (props) {
14968
15204
  var mergeDiscount = useMergeDiscount();
14969
15205
  /** 销售折让 */
14970
15206
 
14971
- var salesDiscount = uaeSalesDiscount();
15207
+ var salesDiscount = useSalesDiscount();
15208
+ /** 销售赠品 */
15209
+
15210
+ var salesGifts = useSalesGifts();
14972
15211
  /** 清空自动赋码缓存 */
14973
15212
 
14974
15213
  React.useEffect(function () {
@@ -15126,7 +15365,7 @@ var Main = decorator(Form.create())(function (props) {
15126
15365
  className: "kts-invoice-operate-goods-list-able"
15127
15366
  }, React.createElement("div", {
15128
15367
  className: "kts-invoice-operate-goods-list-able-list"
15129
- }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, React.createElement(Search, null)), React.createElement("div", {
15368
+ }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, salesGifts.button, React.createElement(Search, null)), React.createElement("div", {
15130
15369
  className: "kts-invoice-operate-goods-list-able-extend"
15131
15370
  }, props.menuExpansion, React.createElement(DescribeSwitch, null), React.createElement(TaxIncludedSwitch, null))), React.createElement("div", {
15132
15371
  className: classNames('kts-invoice-operate-goods-list-table', {
@@ -16405,15 +16644,25 @@ var SignDigtal = decorator(Form.create())(function (props) {
16405
16644
  var model = controller.useMemo(function (s) {
16406
16645
  return s.model;
16407
16646
  }, []);
16647
+ /** 禁用字段 */
16648
+
16408
16649
  var disableds = controller.useMemo(function (s) {
16409
16650
  return s.stakeholder.disableds || [];
16410
16651
  }, []);
16652
+ /** 启用字段 */
16653
+
16654
+ var enables = controller.useMemo(function (s) {
16655
+ return s.stakeholder.enables || [];
16656
+ }, []);
16411
16657
  var readOnly = React.useMemo(function () {
16412
16658
  return model === 'readOnly';
16413
16659
  }, [model]);
16414
16660
  var isReadOnly = React.useCallback(function (field) {
16415
16661
  return disableds.indexOf(field) >= 0;
16416
- }, [disableds]); // 注册 form
16662
+ }, [disableds]);
16663
+ var isEnables = React.useCallback(function (field) {
16664
+ return enables.indexOf(field) >= 0;
16665
+ }, [enables]); // 注册 form
16417
16666
 
16418
16667
  controller.useForm('sign', form);
16419
16668
 
@@ -16424,7 +16673,12 @@ var SignDigtal = decorator(Form.create())(function (props) {
16424
16673
  className: 'sign-digtal-readOnly-cont'
16425
16674
  }, React.createElement("div", null, React.createElement("span", null, "\u5907"), React.createElement("span", null, "\u6CE8")), React.createElement("div", null, getFieldDecorator('remarks', {
16426
16675
  initialValue: props.defaultRemark
16427
- })(React.createElement(MyDiv$1, null)))), React.createElement(Form, {
16676
+ })(isEnables('remarks') ? React.createElement(Input$1.TextArea, {
16677
+ placeholder: "\u8BF7\u8F93\u5165",
16678
+ style: {
16679
+ height: '100%'
16680
+ }
16681
+ }) : React.createElement(MyDiv$1, null)))), React.createElement(Form, {
16428
16682
  layout: 'inline',
16429
16683
  className: 'digtal-readOnly-form'
16430
16684
  }, React.createElement(Form.Item, {
package/dist/index.js CHANGED
@@ -626,6 +626,63 @@ function _nonIterableRest() {
626
626
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
627
627
  }
628
628
 
629
+ function _createForOfIteratorHelper(o, allowArrayLike) {
630
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
631
+
632
+ if (!it) {
633
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
634
+ if (it) o = it;
635
+ var i = 0;
636
+
637
+ var F = function () {};
638
+
639
+ return {
640
+ s: F,
641
+ n: function () {
642
+ if (i >= o.length) return {
643
+ done: true
644
+ };
645
+ return {
646
+ done: false,
647
+ value: o[i++]
648
+ };
649
+ },
650
+ e: function (e) {
651
+ throw e;
652
+ },
653
+ f: F
654
+ };
655
+ }
656
+
657
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
658
+ }
659
+
660
+ var normalCompletion = true,
661
+ didErr = false,
662
+ err;
663
+ return {
664
+ s: function () {
665
+ it = it.call(o);
666
+ },
667
+ n: function () {
668
+ var step = it.next();
669
+ normalCompletion = step.done;
670
+ return step;
671
+ },
672
+ e: function (e) {
673
+ didErr = true;
674
+ err = e;
675
+ },
676
+ f: function () {
677
+ try {
678
+ if (!normalCompletion && it.return != null) it.return();
679
+ } finally {
680
+ if (didErr) throw err;
681
+ }
682
+ }
683
+ };
684
+ }
685
+
629
686
  function styleInject(css, ref) {
630
687
  if ( ref === void 0 ) ref = {};
631
688
  var insertAt = ref.insertAt;
@@ -1042,6 +1099,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1042
1099
  this.isMergeDetails = false;
1043
1100
  this.isMergeDiscount = false;
1044
1101
  this.isSalesDiscount = false;
1102
+ this.isSalesGifts = false;
1045
1103
  this.addComparisonIndex = void 0;
1046
1104
  this.drag = new Drag();
1047
1105
  });
@@ -1104,6 +1162,7 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
1104
1162
  _classCallCheck(this, Stakeholder);
1105
1163
 
1106
1164
  this.disableds = void 0;
1165
+ this.enables = void 0;
1107
1166
  this.rulesMap = void 0;
1108
1167
  });
1109
1168
 
@@ -14722,7 +14781,7 @@ function useMergeDiscount() {
14722
14781
 
14723
14782
  /** 销售折让 */
14724
14783
 
14725
- function uaeSalesDiscount() {
14784
+ function useSalesDiscount() {
14726
14785
  var controller = Invoice.useInvoiceController();
14727
14786
  var selectedGoodIndex = controller.useMemo(function (s) {
14728
14787
  return s.goodsListState.selectedGoodIndex;
@@ -14914,6 +14973,183 @@ function uaeSalesDiscount() {
14914
14973
  };
14915
14974
  }
14916
14975
 
14976
+ /** 销售赠品 */
14977
+
14978
+ function useSalesGifts() {
14979
+ var controller = Invoice.useInvoiceController();
14980
+ var isSalesGifts = controller.useMemo(function (s) {
14981
+ return s.goodsListState.isSalesGifts;
14982
+ }, []);
14983
+ var selectedGoodIndex = controller.useMemo(function (s) {
14984
+ return s.goodsListState.selectedGoodIndex;
14985
+ }, []);
14986
+ var goodsList = controller.useMemo(function (s) {
14987
+ return s.goodsListState.goodsList;
14988
+ }, []);
14989
+ var giveaways = React__default['default'].useMemo(function () {
14990
+ return goodsList.filter(function (e) {
14991
+ return e.lineAttribute === LineAttributeType$1.赠品行;
14992
+ });
14993
+ }, [goodsList]);
14994
+ var onClickAuto = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14995
+ var _iterator, _step, g;
14996
+
14997
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14998
+ while (1) {
14999
+ switch (_context.prev = _context.next) {
15000
+ case 0:
15001
+ _iterator = _createForOfIteratorHelper(giveaways);
15002
+ _context.prev = 1;
15003
+
15004
+ _iterator.s();
15005
+
15006
+ case 3:
15007
+ if ((_step = _iterator.n()).done) {
15008
+ _context.next = 10;
15009
+ break;
15010
+ }
15011
+
15012
+ g = _step.value;
15013
+ g.lineAttribute = LineAttributeType$1.正常;
15014
+ _context.next = 8;
15015
+ return controller.addGoodDiscountV2([{
15016
+ $index: g.$index,
15017
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15018
+ }]);
15019
+
15020
+ case 8:
15021
+ _context.next = 3;
15022
+ break;
15023
+
15024
+ case 10:
15025
+ _context.next = 15;
15026
+ break;
15027
+
15028
+ case 12:
15029
+ _context.prev = 12;
15030
+ _context.t0 = _context["catch"](1);
15031
+
15032
+ _iterator.e(_context.t0);
15033
+
15034
+ case 15:
15035
+ _context.prev = 15;
15036
+
15037
+ _iterator.f();
15038
+
15039
+ return _context.finish(15);
15040
+
15041
+ case 18:
15042
+ case "end":
15043
+ return _context.stop();
15044
+ }
15045
+ }
15046
+ }, _callee, null, [[1, 12, 15, 18]]);
15047
+ })), [controller, giveaways]);
15048
+ var onClickManual = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
15049
+ var _controller$state$goo, goodsMap, selectedGoodIndex, giveaways, content, _iterator2, _step2, g;
15050
+
15051
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
15052
+ while (1) {
15053
+ switch (_context2.prev = _context2.next) {
15054
+ case 0:
15055
+ _controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
15056
+ giveaways = selectedGoodIndex.map(function (e) {
15057
+ return goodsMap.get(e);
15058
+ }).filter(function (e) {
15059
+ return !!e;
15060
+ });
15061
+
15062
+ if (!(giveaways.some(function (e) {
15063
+ return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
15064
+ }) === false)) {
15065
+ _context2.next = 5;
15066
+ break;
15067
+ }
15068
+
15069
+ content = '只能选择‘赠品行’和‘正常行’';
15070
+ return _context2.abrupt("return", ktsComponentsAntdX3.message.error({
15071
+ content: content,
15072
+ key: content
15073
+ }));
15074
+
15075
+ case 5:
15076
+ _iterator2 = _createForOfIteratorHelper(giveaways);
15077
+ _context2.prev = 6;
15078
+
15079
+ _iterator2.s();
15080
+
15081
+ case 8:
15082
+ if ((_step2 = _iterator2.n()).done) {
15083
+ _context2.next = 14;
15084
+ break;
15085
+ }
15086
+
15087
+ g = _step2.value;
15088
+ _context2.next = 12;
15089
+ return controller.addGoodDiscountV2([{
15090
+ $index: g.$index,
15091
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15092
+ }]);
15093
+
15094
+ case 12:
15095
+ _context2.next = 8;
15096
+ break;
15097
+
15098
+ case 14:
15099
+ _context2.next = 19;
15100
+ break;
15101
+
15102
+ case 16:
15103
+ _context2.prev = 16;
15104
+ _context2.t0 = _context2["catch"](6);
15105
+
15106
+ _iterator2.e(_context2.t0);
15107
+
15108
+ case 19:
15109
+ _context2.prev = 19;
15110
+
15111
+ _iterator2.f();
15112
+
15113
+ return _context2.finish(19);
15114
+
15115
+ case 22:
15116
+ controller.state.goodsListState.selectedGoodIndex = [];
15117
+
15118
+ case 23:
15119
+ case "end":
15120
+ return _context2.stop();
15121
+ }
15122
+ }
15123
+ }, _callee2, null, [[6, 16, 19, 22]]);
15124
+ })), [controller]);
15125
+ var items = React__default['default'].useMemo(function () {
15126
+ return [{
15127
+ key: '0',
15128
+ label: '自动转换',
15129
+ disabled: giveaways.length <= 0,
15130
+ onClick: onClickAuto
15131
+ }, {
15132
+ key: '1',
15133
+ label: '手动转换',
15134
+ disabled: selectedGoodIndex.length <= 0,
15135
+ onClick: onClickManual
15136
+ }];
15137
+ }, [selectedGoodIndex, onClickManual, onClickAuto]);
15138
+ var button = React__default['default'].useMemo(function () {
15139
+ if (!isSalesGifts) return;
15140
+ return React__default['default'].createElement(ktsXui.Dropdown, {
15141
+ menu: {
15142
+ items: items
15143
+ },
15144
+ trigger: ['click']
15145
+ }, React__default['default'].createElement(ktsComponentsAntdX3.Button, null, "\u9500\u552E\u8D60\u54C1"));
15146
+ }, [items, isSalesGifts]);
15147
+ return {
15148
+ /** 按钮 */
15149
+ button: button
15150
+ };
15151
+ }
15152
+
14917
15153
  var GoodsList = /*#__PURE__*/function (_React$Component) {
14918
15154
  _inherits(GoodsList, _React$Component);
14919
15155
 
@@ -14978,7 +15214,10 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
14978
15214
  var mergeDiscount = useMergeDiscount();
14979
15215
  /** 销售折让 */
14980
15216
 
14981
- var salesDiscount = uaeSalesDiscount();
15217
+ var salesDiscount = useSalesDiscount();
15218
+ /** 销售赠品 */
15219
+
15220
+ var salesGifts = useSalesGifts();
14982
15221
  /** 清空自动赋码缓存 */
14983
15222
 
14984
15223
  React__default['default'].useEffect(function () {
@@ -15136,7 +15375,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
15136
15375
  className: "kts-invoice-operate-goods-list-able"
15137
15376
  }, React__default['default'].createElement("div", {
15138
15377
  className: "kts-invoice-operate-goods-list-able-list"
15139
- }, React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, React__default['default'].createElement(Search, null)), React__default['default'].createElement("div", {
15378
+ }, React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, salesGifts.button, React__default['default'].createElement(Search, null)), React__default['default'].createElement("div", {
15140
15379
  className: "kts-invoice-operate-goods-list-able-extend"
15141
15380
  }, props.menuExpansion, React__default['default'].createElement(DescribeSwitch, null), React__default['default'].createElement(TaxIncludedSwitch, null))), React__default['default'].createElement("div", {
15142
15381
  className: classNames__default['default']('kts-invoice-operate-goods-list-table', {
@@ -16415,15 +16654,25 @@ var SignDigtal = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(funct
16415
16654
  var model = controller.useMemo(function (s) {
16416
16655
  return s.model;
16417
16656
  }, []);
16657
+ /** 禁用字段 */
16658
+
16418
16659
  var disableds = controller.useMemo(function (s) {
16419
16660
  return s.stakeholder.disableds || [];
16420
16661
  }, []);
16662
+ /** 启用字段 */
16663
+
16664
+ var enables = controller.useMemo(function (s) {
16665
+ return s.stakeholder.enables || [];
16666
+ }, []);
16421
16667
  var readOnly = React__default['default'].useMemo(function () {
16422
16668
  return model === 'readOnly';
16423
16669
  }, [model]);
16424
16670
  var isReadOnly = React__default['default'].useCallback(function (field) {
16425
16671
  return disableds.indexOf(field) >= 0;
16426
- }, [disableds]); // 注册 form
16672
+ }, [disableds]);
16673
+ var isEnables = React__default['default'].useCallback(function (field) {
16674
+ return enables.indexOf(field) >= 0;
16675
+ }, [enables]); // 注册 form
16427
16676
 
16428
16677
  controller.useForm('sign', form);
16429
16678
 
@@ -16434,7 +16683,12 @@ var SignDigtal = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(funct
16434
16683
  className: 'sign-digtal-readOnly-cont'
16435
16684
  }, React__default['default'].createElement("div", null, React__default['default'].createElement("span", null, "\u5907"), React__default['default'].createElement("span", null, "\u6CE8")), React__default['default'].createElement("div", null, getFieldDecorator('remarks', {
16436
16685
  initialValue: props.defaultRemark
16437
- })(React__default['default'].createElement(MyDiv$1, null)))), React__default['default'].createElement(ktsComponentsAntdX3.Form, {
16686
+ })(isEnables('remarks') ? React__default['default'].createElement(ktsXui.Input.TextArea, {
16687
+ placeholder: "\u8BF7\u8F93\u5165",
16688
+ style: {
16689
+ height: '100%'
16690
+ }
16691
+ }) : React__default['default'].createElement(MyDiv$1, null)))), React__default['default'].createElement(ktsComponentsAntdX3.Form, {
16438
16692
  layout: 'inline',
16439
16693
  className: 'digtal-readOnly-form'
16440
16694
  }, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.69",
3
+ "version": "3.2.71-1",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -9,10 +9,11 @@ export default () => {
9
9
  React.useEffect(() => {
10
10
  (async () => {
11
11
  await controller.run(async s => { s.model = 'readOnly' }); // 设置只读
12
+ await controller.run(async s => { s.stakeholder.enables = ['remarks'] });
12
13
  await controller.formList.get('invoiceHeader')?.setFieldsValue({
13
14
  no: '2029292029201920291029',
14
15
  invoicingDate: '2023年7月6日',
15
- tag:'成品油',
16
+ tag: '成品油',
16
17
  })
17
18
  await controller.formList.get('stakeholder')?.setFieldsValue({
18
19
  buyerName: '国能供应链内蒙古有限公司',
@@ -30,8 +31,8 @@ export default () => {
30
31
  sellerAccount: '9550880218186900195',
31
32
  })
32
33
  await controller.formList.get('sign')?.setFieldsValue({
33
- remark: '备注',
34
- issuer: '张自豪',
34
+ remarks: '备注',
35
+ drawer: '张自豪',
35
36
  })
36
37
  })()
37
38
  }, [controller])
@@ -102,9 +102,12 @@ export default class GoodsListState {
102
102
  /** 是否可以销售折让 */
103
103
  isSalesDiscount = false;
104
104
 
105
+ /** 是否可以销售赠品 */
106
+ isSalesGifts = false;
107
+
105
108
  /** 正在 添加商品对照 的货物 */
106
109
  addComparisonIndex?: string;
107
110
 
108
111
  /** 商品拖拽数据 */
109
- drag = new Drag()
112
+ drag = new Drag();
110
113
  }
@@ -6,6 +6,9 @@ export default class Stakeholder {
6
6
  /** 禁用字段 */
7
7
  disableds?: string[];
8
8
 
9
+ /** 启用字段 */
10
+ enables?: string[];
11
+
9
12
  /** 字段字段规则 */
10
13
  rulesMap?: { [key: string]: ValidationRule[] | undefined }
11
14
  }
@@ -249,9 +249,9 @@ const lines: any[] = [
249
249
  "id": "40823568750477313",
250
250
  "itemModelName": "",
251
251
  "itemName": "打折",
252
- "lineAmountExcludeTax": -100,
253
- "lineAmountIncludeTax": -100,
254
- "lineAttribute": 3,
252
+ "lineAmountExcludeTax": 100,
253
+ "lineAmountIncludeTax": 100,
254
+ "lineAttribute": 4,
255
255
  "lineDiscountExcludeTax": null,
256
256
  "lineDiscountRate": null,
257
257
  "lineId": "1740823580142206976",
@@ -29,7 +29,8 @@ import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
29
29
  import useAddDiscountRowButton from './ui/BulkMenu/hooks/useAddDiscountRowButton';
30
30
  import useMergeDetails from './ui/BulkMenu/hooks/useMergeDetails';
31
31
  import useMergeDiscount from './ui/BulkMenu/hooks/useMergeDiscount';
32
- import uaeSalesDiscount from './ui/BulkMenu/hooks/uaeSalesDiscount';
32
+ import useSalesDiscount from './ui/BulkMenu/hooks/useSalesDiscount';
33
+ import useSalesGifts from './ui/BulkMenu/hooks/useSalesGifts';
33
34
 
34
35
  export interface IGoodsListProps {
35
36
  /** 扩展部分 */
@@ -93,7 +94,10 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
93
94
  const mergeDiscount = useMergeDiscount()
94
95
 
95
96
  /** 销售折让 */
96
- const salesDiscount = uaeSalesDiscount()
97
+ const salesDiscount = useSalesDiscount()
98
+
99
+ /** 销售赠品 */
100
+ const salesGifts = useSalesGifts()
97
101
 
98
102
  /** 清空自动赋码缓存 */
99
103
  React.useEffect(() => {
@@ -156,6 +160,9 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
156
160
  {/* 销售折让 */}
157
161
  {salesDiscount.button}
158
162
 
163
+ {/* 销售赠品 */}
164
+ {salesGifts.button}
165
+
159
166
  {/* 搜索 */}
160
167
  <Search />
161
168
  </div>
@@ -6,7 +6,7 @@ import Invoice from '../../../../../../..'
6
6
  import { LineAttributeType } from "../../../../../../../InvoiceController";
7
7
 
8
8
  /** 销售折让 */
9
- export default function uaeSalesDiscount() {
9
+ export default function useSalesDiscount() {
10
10
 
11
11
  const controller = Invoice.useInvoiceController();
12
12
 
@@ -0,0 +1,76 @@
1
+
2
+ import React from "react"
3
+ import { Button, message } from "kts-components-antd-x3"
4
+ import { chain, bignumber } from 'mathjs';
5
+ import Invoice from '../../../../../../..'
6
+ import { IGood, LineAttributeType } from "../../../../../../../InvoiceController";
7
+ import { Dropdown, MenuProps } from "kts-xui";
8
+
9
+ /** 销售赠品 */
10
+ export default function useSalesGifts() {
11
+
12
+ const controller = Invoice.useInvoiceController();
13
+
14
+ const isSalesGifts = controller.useMemo(s => s.goodsListState.isSalesGifts, []);
15
+
16
+ const selectedGoodIndex = controller.useMemo(s => s.goodsListState.selectedGoodIndex, []);
17
+
18
+ const goodsList = controller.useMemo(s => s.goodsListState.goodsList, [])
19
+
20
+ const giveaways = React.useMemo(() => goodsList.filter(e => e.lineAttribute === LineAttributeType.赠品行), [goodsList])
21
+
22
+ const onClickAuto = React.useCallback(async () => {
23
+ for (let g of giveaways) {
24
+ g.lineAttribute = LineAttributeType.正常;
25
+ await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
26
+ }
27
+ }, [controller, giveaways])
28
+
29
+ const onClickManual = React.useCallback(async () => {
30
+ const { goodsMap, selectedGoodIndex } = controller.state.goodsListState;
31
+ const giveaways = selectedGoodIndex.map(e => goodsMap.get(e) as IGood).filter(e => !!e);
32
+
33
+ if (giveaways.some(e => e.lineAttribute === LineAttributeType.正常 || e.lineAttribute === LineAttributeType.赠品行) === false) {
34
+ const content = '只能选择‘赠品行’和‘正常行’';
35
+ return message.error({ content, key: content });
36
+ }
37
+
38
+ for (let g of giveaways) {
39
+ await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
40
+ }
41
+
42
+ controller.state.goodsListState.selectedGoodIndex = [];
43
+ }, [controller])
44
+
45
+ const items: MenuProps['items'] = React.useMemo(() => {
46
+ return [
47
+ {
48
+ key: '0',
49
+ label: '自动转换',
50
+ disabled: giveaways.length <= 0,
51
+ onClick: onClickAuto,
52
+ }, {
53
+ key: '1',
54
+ label: '手动转换',
55
+ disabled: selectedGoodIndex.length <= 0,
56
+ onClick: onClickManual,
57
+ },
58
+ ];
59
+ }, [selectedGoodIndex, onClickManual, onClickAuto])
60
+
61
+ const button = React.useMemo(() => {
62
+ if (!isSalesGifts) return;
63
+ return (
64
+ <Dropdown menu={{ items }} trigger={['click']} >
65
+ <Button>
66
+ 销售赠品
67
+ </Button>
68
+ </Dropdown>
69
+ )
70
+ }, [items, isSalesGifts])
71
+
72
+ return {
73
+ /** 按钮 */
74
+ button,
75
+ }
76
+ }
@@ -27,12 +27,18 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
27
27
 
28
28
  const model = controller.useMemo(s => s.model, []);
29
29
 
30
+ /** 禁用字段 */
30
31
  const disableds = controller.useMemo(s => s.stakeholder.disableds || [], []);
31
32
 
33
+ /** 启用字段 */
34
+ const enables = controller.useMemo(s => s.stakeholder.enables || [], []);
35
+
32
36
  const readOnly = React.useMemo(() => model === 'readOnly', [model]);
33
37
 
34
38
  const isReadOnly = React.useCallback(field => disableds.indexOf(field) >= 0, [disableds])
35
39
 
40
+ const isEnables = React.useCallback(field => enables.indexOf(field) >= 0, [enables])
41
+
36
42
  // 注册 form
37
43
  controller.useForm('sign', form);
38
44
 
@@ -47,7 +53,11 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
47
53
  <div>
48
54
  {getFieldDecorator('remarks', {
49
55
  initialValue: props.defaultRemark
50
- })(<MyDiv />)}
56
+ })(
57
+ isEnables('remarks')
58
+ ? <Input.TextArea placeholder='请输入' style={{ height: '100%' }} />
59
+ : <MyDiv />
60
+ )}
51
61
  </div>
52
62
  </div>
53
63
  <Form layout='inline' className='digtal-readOnly-form' >