kts-component-invoice-operate 3.2.181-36 → 3.2.181-37gd

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.
@@ -32,7 +32,9 @@ export interface IInvoiceProps {
32
32
  /** 发票种类: default-默认,digtal-数电 */
33
33
  invoiceType?: 'default' | 'digtal';
34
34
  /** 编辑中的商品行变化时触发(数量/单价/税率等字段变更时) */
35
- onEditGoodChange?: (editGood: any, goodsList: any[]) => void;
35
+ onEditGoodChange?: (editGood: any) => void;
36
+ /** 商品列表变化时触发(新增/删除行时) */
37
+ onGoodsListChange?: (goodsList: any[]) => void;
36
38
  }
37
39
  export default class Invoice extends React.PureComponent<IInvoiceProps> {
38
40
  /** 控制器 */
package/dist/index.esm.js CHANGED
@@ -13893,7 +13893,7 @@ var useColumns = (function (form) {
13893
13893
  key: 'itemCode',
13894
13894
  width: 119,
13895
13895
  render: function render(_, record) {
13896
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
13896
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
13897
13897
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('itemCode', {
13898
13898
  initialValue: editGood.itemCode,
13899
13899
  rules: [].concat(_toConsumableArray(getReplenishRules('itemCode')), [{
@@ -13939,7 +13939,7 @@ var useColumns = (function (form) {
13939
13939
  }, "\u9879\u76EE\u540D\u79F0"),
13940
13940
  key: 'itemName',
13941
13941
  render: function render(_, record) {
13942
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
13942
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
13943
13943
  return /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement("div", {
13944
13944
  style: {
13945
13945
  display: 'flex'
@@ -14042,7 +14042,7 @@ var useColumns = (function (form) {
14042
14042
  key: 'itemModelName',
14043
14043
  width: 119,
14044
14044
  render: function render(_, record) {
14045
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14045
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14046
14046
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('itemModelName', {
14047
14047
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
14048
14048
  rules: getReplenishRules('itemModelName')
@@ -14129,7 +14129,7 @@ var useColumns = (function (form) {
14129
14129
  key: 'unit',
14130
14130
  width: 70,
14131
14131
  render: function render(_, record) {
14132
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14132
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14133
14133
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('unit', {
14134
14134
  initialValue: editGood.unit,
14135
14135
  rules: getReplenishRules('unit')
@@ -14187,7 +14187,7 @@ var useColumns = (function (form) {
14187
14187
  align: 'right',
14188
14188
  width: 149,
14189
14189
  render: function render(value, record) {
14190
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14190
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14191
14191
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
14192
14192
  initialValue: nonScientificNotation(editGood.quantity),
14193
14193
  getValueFromEvent: onNumberValueChange,
@@ -14282,7 +14282,7 @@ var useColumns = (function (form) {
14282
14282
  align: 'right',
14283
14283
  width: 149,
14284
14284
  render: function render(value, record) {
14285
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14285
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14286
14286
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
14287
14287
  initialValue: nonScientificNotation(editGood.priceIncludeTax, 8),
14288
14288
  getValueFromEvent: onNumberValueChange,
@@ -14378,7 +14378,7 @@ var useColumns = (function (form) {
14378
14378
  align: 'right',
14379
14379
  width: 149,
14380
14380
  render: function render(value, record) {
14381
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14381
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14382
14382
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
14383
14383
  initialValue: nonScientificNotation(editGood.priceExcludeTax, 8),
14384
14384
  getValueFromEvent: onNumberValueChange,
@@ -14473,7 +14473,7 @@ var useColumns = (function (form) {
14473
14473
  width: 119,
14474
14474
  align: 'right',
14475
14475
  render: function render(value, record) {
14476
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14476
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14477
14477
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
14478
14478
  initialValue: editGood.lineAmountIncludeTax,
14479
14479
  getValueFromEvent: onNumberValueChange,
@@ -14561,7 +14561,7 @@ var useColumns = (function (form) {
14561
14561
  align: 'right',
14562
14562
  width: 119,
14563
14563
  render: function render(value, record) {
14564
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14564
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14565
14565
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
14566
14566
  initialValue: editGood.lineAmountExcludeTax,
14567
14567
  getValueFromEvent: onNumberValueChange,
@@ -14624,7 +14624,7 @@ var useColumns = (function (form) {
14624
14624
  align: 'right',
14625
14625
  width: 75,
14626
14626
  render: function render(value, record) {
14627
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !(model === 'prefab' && calculateType === '3')) {
14627
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !(model === 'prefab' && calculateType === '3')) {
14628
14628
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('taxRate', {
14629
14629
  initialValue: editGood.taxRate,
14630
14630
  rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
@@ -14683,6 +14683,8 @@ var useColumns = (function (form) {
14683
14683
  }, {
14684
14684
  validator: function () {
14685
14685
  var _validator8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_, taxAmountValue, callback) {
14686
+ var _getFieldValue, _getFieldValue2;
14687
+
14686
14688
  var amount, taxRate, amountNum, taxRateNum, taxAmountNum, calculatedTaxAmount, roundedCalc, roundedInput, diff;
14687
14689
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
14688
14690
  while (1) {
@@ -14692,8 +14694,9 @@ var useColumns = (function (form) {
14692
14694
  return controller.wait();
14693
14695
 
14694
14696
  case 2:
14695
- amount = getFieldValue(isTaxIncluded ? 'lineAmountIncludeTax' : 'lineAmountExcludeTax');
14696
- taxRate = getFieldValue('taxRate');
14697
+ // 折扣行/被折扣行仅渲染税额输入框,其他字段为只读,需从当前编辑行读取金额和税率。
14698
+ amount = (_getFieldValue = getFieldValue(isTaxIncluded ? 'lineAmountIncludeTax' : 'lineAmountExcludeTax')) !== null && _getFieldValue !== void 0 ? _getFieldValue : isTaxIncluded ? editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax : editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax;
14699
+ taxRate = (_getFieldValue2 = getFieldValue('taxRate')) !== null && _getFieldValue2 !== void 0 ? _getFieldValue2 : editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
14697
14700
 
14698
14701
  if (!(!amount || amount === '' || !taxRate || taxRate === '' || !taxAmountValue || taxAmountValue === '')) {
14699
14702
  _context15.next = 6;
@@ -15081,9 +15084,9 @@ var useOnRow = (function () {
15081
15084
  return _context2.abrupt("return");
15082
15085
 
15083
15086
  case 4:
15084
- editGood = controller.state.goodsListState.editGood;
15087
+ editGood = controller.state.goodsListState.editGood; // 正常行可编辑全部字段;折扣行和被折扣行仅允许编辑税额。
15085
15088
 
15086
- if (!(record.lineAttribute !== LineAttributeType$1.正常)) {
15089
+ if (!(record.lineAttribute !== LineAttributeType$1.正常 && record.lineAttribute !== LineAttributeType$1.折扣行 && record.lineAttribute !== LineAttributeType$1.被折扣行)) {
15087
15090
  _context2.next = 7;
15088
15091
  break;
15089
15092
  }
@@ -22577,7 +22580,7 @@ var useColumns$1 = (function (form) {
22577
22580
  }, "\u9879\u76EE\u540D\u79F0"),
22578
22581
  key: 'itemName',
22579
22582
  render: function render(_, record) {
22580
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemName') && model !== 'prefab') {
22583
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('itemName') && model !== 'prefab') {
22581
22584
  return /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement("div", {
22582
22585
  style: {
22583
22586
  display: 'flex'
@@ -22687,7 +22690,7 @@ var useColumns$1 = (function (form) {
22687
22690
  key: 'itemModelName',
22688
22691
  width: 119,
22689
22692
  render: function render(_, record) {
22690
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemModelName') && model !== 'prefab') {
22693
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('itemModelName') && model !== 'prefab') {
22691
22694
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('itemModelName', {
22692
22695
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
22693
22696
  rules: getReplenishRules('itemModelName')
@@ -22774,7 +22777,7 @@ var useColumns$1 = (function (form) {
22774
22777
  key: 'unit',
22775
22778
  width: 70,
22776
22779
  render: function render(_, record) {
22777
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('unit') && model !== 'prefab') {
22780
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('unit') && model !== 'prefab') {
22778
22781
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('unit', {
22779
22782
  initialValue: editGood.unit,
22780
22783
  rules: getReplenishRules('unit')
@@ -22832,7 +22835,7 @@ var useColumns$1 = (function (form) {
22832
22835
  align: 'right',
22833
22836
  width: 149,
22834
22837
  render: function render(value, record) {
22835
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('quantity') && model !== 'prefab') {
22838
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('quantity') && model !== 'prefab') {
22836
22839
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
22837
22840
  initialValue: nonScientificNotation(editGood.quantity),
22838
22841
  getValueFromEvent: onNumberValueChange,
@@ -22927,7 +22930,7 @@ var useColumns$1 = (function (form) {
22927
22930
  align: 'right',
22928
22931
  width: 149,
22929
22932
  render: function render(value, record) {
22930
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceIncludeTax') && model !== 'prefab') {
22933
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('priceIncludeTax') && model !== 'prefab') {
22931
22934
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
22932
22935
  initialValue: nonScientificNotation(editGood.priceIncludeTax),
22933
22936
  getValueFromEvent: onNumberValueChange,
@@ -23002,7 +23005,7 @@ var useColumns$1 = (function (form) {
23002
23005
  align: 'right',
23003
23006
  width: 149,
23004
23007
  render: function render(value, record) {
23005
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceExcludeTax') && model !== 'prefab') {
23008
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('priceExcludeTax') && model !== 'prefab') {
23006
23009
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
23007
23010
  initialValue: nonScientificNotation(editGood.priceExcludeTax),
23008
23011
  getValueFromEvent: onNumberValueChange,
@@ -23077,7 +23080,7 @@ var useColumns$1 = (function (form) {
23077
23080
  width: 119,
23078
23081
  align: 'right',
23079
23082
  render: function render(value, record) {
23080
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountIncludeTax') && model !== 'prefab') {
23083
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('lineAmountIncludeTax') && model !== 'prefab') {
23081
23084
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
23082
23085
  initialValue: editGood.lineAmountIncludeTax,
23083
23086
  getValueFromEvent: onNumberValueChange,
@@ -23165,7 +23168,7 @@ var useColumns$1 = (function (form) {
23165
23168
  align: 'right',
23166
23169
  width: 119,
23167
23170
  render: function render(value, record) {
23168
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountExcludeTax') && model !== 'prefab') {
23171
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('lineAmountExcludeTax') && model !== 'prefab') {
23169
23172
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
23170
23173
  initialValue: editGood.lineAmountExcludeTax,
23171
23174
  getValueFromEvent: onNumberValueChange,
@@ -23228,7 +23231,7 @@ var useColumns$1 = (function (form) {
23228
23231
  align: 'right',
23229
23232
  width: 70,
23230
23233
  render: function render(value, record) {
23231
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
23234
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
23232
23235
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('taxRate', {
23233
23236
  initialValue: editGood.taxRate,
23234
23237
  rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
@@ -23557,9 +23560,9 @@ var useOnRow$1 = (function () {
23557
23560
  return _context2.abrupt("return");
23558
23561
 
23559
23562
  case 2:
23560
- editGood = controller.state.goodsListState.editGood;
23563
+ editGood = controller.state.goodsListState.editGood; // 正常行可编辑全部字段;折扣行和被折扣行仅允许编辑税额。
23561
23564
 
23562
- if (!(record.lineAttribute !== LineAttributeType$1.正常)) {
23565
+ if (!(record.lineAttribute !== LineAttributeType$1.正常 && record.lineAttribute !== LineAttributeType$1.折扣行 && record.lineAttribute !== LineAttributeType$1.被折扣行)) {
23563
23566
  _context2.next = 5;
23564
23567
  break;
23565
23568
  }
@@ -29296,21 +29299,20 @@ var Main$5 = function Main(props) {
29296
29299
  key = _React$useState2[0],
29297
29300
  setKey = _React$useState2[1];
29298
29301
 
29299
- useToGenerateId(controller);
29300
- React.useEffect(function () {
29301
- setKey(key + 1);
29302
- }, [controller]);
29303
- var editGood = controller.useMemo(function (s) {
29304
- return s.goodsListState.editGood;
29305
- }, []);
29306
- var goodsList = controller.useMemo(function (s) {
29307
- return s.goodsListState.goodsList;
29308
- }, []);
29309
- React.useEffect(function () {
29310
- if (props.onEditGoodChange) {
29311
- props.onEditGoodChange(editGood, goodsList);
29312
- }
29313
- }, [editGood, props.onEditGoodChange]);
29302
+ useToGenerateId(controller); // React.useEffect(() => { setKey(key + 1) }, [controller]);
29303
+ // const editGood = controller.useMemo(s => s.goodsListState.editGood, []);
29304
+ // const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
29305
+ // React.useEffect(() => {
29306
+ // if (props.onEditGoodChange) {
29307
+ // props.onEditGoodChange(editGood);
29308
+ // }
29309
+ // }, [editGood, props.onEditGoodChange]);
29310
+ // React.useEffect(() => {
29311
+ // if (props.onGoodsListChange) {
29312
+ // props.onGoodsListChange(goodsList);
29313
+ // }
29314
+ // }, [goodsList, props.onGoodsListChange]);
29315
+
29314
29316
  return /*#__PURE__*/React.createElement(InvoiceContext.Provider, {
29315
29317
  key: key,
29316
29318
  value: controller
@@ -29373,9 +29375,14 @@ var Digtal = function Digtal(props) {
29373
29375
  }, []);
29374
29376
  React.useEffect(function () {
29375
29377
  if (props.onEditGoodChange) {
29376
- props.onEditGoodChange(editGood, goodsList);
29378
+ props.onEditGoodChange(editGood);
29379
+ }
29380
+ }, [editGood, props.onEditGoodChange]);
29381
+ React.useEffect(function () {
29382
+ if (props.onGoodsListChange) {
29383
+ props.onGoodsListChange(goodsList);
29377
29384
  }
29378
- }, [editGood, goodsList, props.onEditGoodChange]);
29385
+ }, [goodsList, props.onGoodsListChange]);
29379
29386
  return /*#__PURE__*/React.createElement(InvoiceContext.Provider, {
29380
29387
  key: key,
29381
29388
  value: controller
package/dist/index.js CHANGED
@@ -13903,7 +13903,7 @@ var useColumns = (function (form) {
13903
13903
  key: 'itemCode',
13904
13904
  width: 119,
13905
13905
  render: function render(_, record) {
13906
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
13906
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
13907
13907
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemCode', {
13908
13908
  initialValue: editGood.itemCode,
13909
13909
  rules: [].concat(_toConsumableArray(getReplenishRules('itemCode')), [{
@@ -13949,7 +13949,7 @@ var useColumns = (function (form) {
13949
13949
  }, "\u9879\u76EE\u540D\u79F0"),
13950
13950
  key: 'itemName',
13951
13951
  render: function render(_, record) {
13952
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
13952
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
13953
13953
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, /*#__PURE__*/React__default['default'].createElement("div", {
13954
13954
  style: {
13955
13955
  display: 'flex'
@@ -14052,7 +14052,7 @@ var useColumns = (function (form) {
14052
14052
  key: 'itemModelName',
14053
14053
  width: 119,
14054
14054
  render: function render(_, record) {
14055
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14055
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14056
14056
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemModelName', {
14057
14057
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
14058
14058
  rules: getReplenishRules('itemModelName')
@@ -14139,7 +14139,7 @@ var useColumns = (function (form) {
14139
14139
  key: 'unit',
14140
14140
  width: 70,
14141
14141
  render: function render(_, record) {
14142
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14142
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14143
14143
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('unit', {
14144
14144
  initialValue: editGood.unit,
14145
14145
  rules: getReplenishRules('unit')
@@ -14197,7 +14197,7 @@ var useColumns = (function (form) {
14197
14197
  align: 'right',
14198
14198
  width: 149,
14199
14199
  render: function render(value, record) {
14200
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14200
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14201
14201
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
14202
14202
  initialValue: nonScientificNotation(editGood.quantity),
14203
14203
  getValueFromEvent: onNumberValueChange,
@@ -14292,7 +14292,7 @@ var useColumns = (function (form) {
14292
14292
  align: 'right',
14293
14293
  width: 149,
14294
14294
  render: function render(value, record) {
14295
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14295
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14296
14296
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
14297
14297
  initialValue: nonScientificNotation(editGood.priceIncludeTax, 8),
14298
14298
  getValueFromEvent: onNumberValueChange,
@@ -14388,7 +14388,7 @@ var useColumns = (function (form) {
14388
14388
  align: 'right',
14389
14389
  width: 149,
14390
14390
  render: function render(value, record) {
14391
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14391
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14392
14392
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
14393
14393
  initialValue: nonScientificNotation(editGood.priceExcludeTax, 8),
14394
14394
  getValueFromEvent: onNumberValueChange,
@@ -14483,7 +14483,7 @@ var useColumns = (function (form) {
14483
14483
  width: 119,
14484
14484
  align: 'right',
14485
14485
  render: function render(value, record) {
14486
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14486
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14487
14487
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
14488
14488
  initialValue: editGood.lineAmountIncludeTax,
14489
14489
  getValueFromEvent: onNumberValueChange,
@@ -14571,7 +14571,7 @@ var useColumns = (function (form) {
14571
14571
  align: 'right',
14572
14572
  width: 119,
14573
14573
  render: function render(value, record) {
14574
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
14574
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && model !== 'prefab') {
14575
14575
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
14576
14576
  initialValue: editGood.lineAmountExcludeTax,
14577
14577
  getValueFromEvent: onNumberValueChange,
@@ -14634,7 +14634,7 @@ var useColumns = (function (form) {
14634
14634
  align: 'right',
14635
14635
  width: 75,
14636
14636
  render: function render(value, record) {
14637
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !(model === 'prefab' && calculateType === '3')) {
14637
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !(model === 'prefab' && calculateType === '3')) {
14638
14638
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('taxRate', {
14639
14639
  initialValue: editGood.taxRate,
14640
14640
  rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
@@ -14693,6 +14693,8 @@ var useColumns = (function (form) {
14693
14693
  }, {
14694
14694
  validator: function () {
14695
14695
  var _validator8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_, taxAmountValue, callback) {
14696
+ var _getFieldValue, _getFieldValue2;
14697
+
14696
14698
  var amount, taxRate, amountNum, taxRateNum, taxAmountNum, calculatedTaxAmount, roundedCalc, roundedInput, diff;
14697
14699
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
14698
14700
  while (1) {
@@ -14702,8 +14704,9 @@ var useColumns = (function (form) {
14702
14704
  return controller.wait();
14703
14705
 
14704
14706
  case 2:
14705
- amount = getFieldValue(isTaxIncluded ? 'lineAmountIncludeTax' : 'lineAmountExcludeTax');
14706
- taxRate = getFieldValue('taxRate');
14707
+ // 折扣行/被折扣行仅渲染税额输入框,其他字段为只读,需从当前编辑行读取金额和税率。
14708
+ amount = (_getFieldValue = getFieldValue(isTaxIncluded ? 'lineAmountIncludeTax' : 'lineAmountExcludeTax')) !== null && _getFieldValue !== void 0 ? _getFieldValue : isTaxIncluded ? editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax : editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax;
14709
+ taxRate = (_getFieldValue2 = getFieldValue('taxRate')) !== null && _getFieldValue2 !== void 0 ? _getFieldValue2 : editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
14707
14710
 
14708
14711
  if (!(!amount || amount === '' || !taxRate || taxRate === '' || !taxAmountValue || taxAmountValue === '')) {
14709
14712
  _context15.next = 6;
@@ -15091,9 +15094,9 @@ var useOnRow = (function () {
15091
15094
  return _context2.abrupt("return");
15092
15095
 
15093
15096
  case 4:
15094
- editGood = controller.state.goodsListState.editGood;
15097
+ editGood = controller.state.goodsListState.editGood; // 正常行可编辑全部字段;折扣行和被折扣行仅允许编辑税额。
15095
15098
 
15096
- if (!(record.lineAttribute !== LineAttributeType$1.正常)) {
15099
+ if (!(record.lineAttribute !== LineAttributeType$1.正常 && record.lineAttribute !== LineAttributeType$1.折扣行 && record.lineAttribute !== LineAttributeType$1.被折扣行)) {
15097
15100
  _context2.next = 7;
15098
15101
  break;
15099
15102
  }
@@ -22587,7 +22590,7 @@ var useColumns$1 = (function (form) {
22587
22590
  }, "\u9879\u76EE\u540D\u79F0"),
22588
22591
  key: 'itemName',
22589
22592
  render: function render(_, record) {
22590
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemName') && model !== 'prefab') {
22593
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('itemName') && model !== 'prefab') {
22591
22594
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, /*#__PURE__*/React__default['default'].createElement("div", {
22592
22595
  style: {
22593
22596
  display: 'flex'
@@ -22697,7 +22700,7 @@ var useColumns$1 = (function (form) {
22697
22700
  key: 'itemModelName',
22698
22701
  width: 119,
22699
22702
  render: function render(_, record) {
22700
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemModelName') && model !== 'prefab') {
22703
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('itemModelName') && model !== 'prefab') {
22701
22704
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemModelName', {
22702
22705
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
22703
22706
  rules: getReplenishRules('itemModelName')
@@ -22784,7 +22787,7 @@ var useColumns$1 = (function (form) {
22784
22787
  key: 'unit',
22785
22788
  width: 70,
22786
22789
  render: function render(_, record) {
22787
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('unit') && model !== 'prefab') {
22790
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('unit') && model !== 'prefab') {
22788
22791
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('unit', {
22789
22792
  initialValue: editGood.unit,
22790
22793
  rules: getReplenishRules('unit')
@@ -22842,7 +22845,7 @@ var useColumns$1 = (function (form) {
22842
22845
  align: 'right',
22843
22846
  width: 149,
22844
22847
  render: function render(value, record) {
22845
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('quantity') && model !== 'prefab') {
22848
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('quantity') && model !== 'prefab') {
22846
22849
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('quantity', {
22847
22850
  initialValue: nonScientificNotation(editGood.quantity),
22848
22851
  getValueFromEvent: onNumberValueChange,
@@ -22937,7 +22940,7 @@ var useColumns$1 = (function (form) {
22937
22940
  align: 'right',
22938
22941
  width: 149,
22939
22942
  render: function render(value, record) {
22940
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceIncludeTax') && model !== 'prefab') {
22943
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('priceIncludeTax') && model !== 'prefab') {
22941
22944
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
22942
22945
  initialValue: nonScientificNotation(editGood.priceIncludeTax),
22943
22946
  getValueFromEvent: onNumberValueChange,
@@ -23012,7 +23015,7 @@ var useColumns$1 = (function (form) {
23012
23015
  align: 'right',
23013
23016
  width: 149,
23014
23017
  render: function render(value, record) {
23015
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceExcludeTax') && model !== 'prefab') {
23018
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('priceExcludeTax') && model !== 'prefab') {
23016
23019
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
23017
23020
  initialValue: nonScientificNotation(editGood.priceExcludeTax),
23018
23021
  getValueFromEvent: onNumberValueChange,
@@ -23087,7 +23090,7 @@ var useColumns$1 = (function (form) {
23087
23090
  width: 119,
23088
23091
  align: 'right',
23089
23092
  render: function render(value, record) {
23090
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountIncludeTax') && model !== 'prefab') {
23093
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('lineAmountIncludeTax') && model !== 'prefab') {
23091
23094
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
23092
23095
  initialValue: editGood.lineAmountIncludeTax,
23093
23096
  getValueFromEvent: onNumberValueChange,
@@ -23175,7 +23178,7 @@ var useColumns$1 = (function (form) {
23175
23178
  align: 'right',
23176
23179
  width: 119,
23177
23180
  render: function render(value, record) {
23178
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountExcludeTax') && model !== 'prefab') {
23181
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('lineAmountExcludeTax') && model !== 'prefab') {
23179
23182
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
23180
23183
  initialValue: editGood.lineAmountExcludeTax,
23181
23184
  getValueFromEvent: onNumberValueChange,
@@ -23238,7 +23241,7 @@ var useColumns$1 = (function (form) {
23238
23241
  align: 'right',
23239
23242
  width: 70,
23240
23243
  render: function render(value, record) {
23241
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
23244
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && record.lineAttribute === LineAttributeType$1.正常 && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
23242
23245
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('taxRate', {
23243
23246
  initialValue: editGood.taxRate,
23244
23247
  rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
@@ -23567,9 +23570,9 @@ var useOnRow$1 = (function () {
23567
23570
  return _context2.abrupt("return");
23568
23571
 
23569
23572
  case 2:
23570
- editGood = controller.state.goodsListState.editGood;
23573
+ editGood = controller.state.goodsListState.editGood; // 正常行可编辑全部字段;折扣行和被折扣行仅允许编辑税额。
23571
23574
 
23572
- if (!(record.lineAttribute !== LineAttributeType$1.正常)) {
23575
+ if (!(record.lineAttribute !== LineAttributeType$1.正常 && record.lineAttribute !== LineAttributeType$1.折扣行 && record.lineAttribute !== LineAttributeType$1.被折扣行)) {
23573
23576
  _context2.next = 5;
23574
23577
  break;
23575
23578
  }
@@ -29306,21 +29309,20 @@ var Main$5 = function Main(props) {
29306
29309
  key = _React$useState2[0],
29307
29310
  setKey = _React$useState2[1];
29308
29311
 
29309
- useToGenerateId(controller);
29310
- React__default['default'].useEffect(function () {
29311
- setKey(key + 1);
29312
- }, [controller]);
29313
- var editGood = controller.useMemo(function (s) {
29314
- return s.goodsListState.editGood;
29315
- }, []);
29316
- var goodsList = controller.useMemo(function (s) {
29317
- return s.goodsListState.goodsList;
29318
- }, []);
29319
- React__default['default'].useEffect(function () {
29320
- if (props.onEditGoodChange) {
29321
- props.onEditGoodChange(editGood, goodsList);
29322
- }
29323
- }, [editGood, props.onEditGoodChange]);
29312
+ useToGenerateId(controller); // React.useEffect(() => { setKey(key + 1) }, [controller]);
29313
+ // const editGood = controller.useMemo(s => s.goodsListState.editGood, []);
29314
+ // const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
29315
+ // React.useEffect(() => {
29316
+ // if (props.onEditGoodChange) {
29317
+ // props.onEditGoodChange(editGood);
29318
+ // }
29319
+ // }, [editGood, props.onEditGoodChange]);
29320
+ // React.useEffect(() => {
29321
+ // if (props.onGoodsListChange) {
29322
+ // props.onGoodsListChange(goodsList);
29323
+ // }
29324
+ // }, [goodsList, props.onGoodsListChange]);
29325
+
29324
29326
  return /*#__PURE__*/React__default['default'].createElement(InvoiceContext.Provider, {
29325
29327
  key: key,
29326
29328
  value: controller
@@ -29383,9 +29385,14 @@ var Digtal = function Digtal(props) {
29383
29385
  }, []);
29384
29386
  React__default['default'].useEffect(function () {
29385
29387
  if (props.onEditGoodChange) {
29386
- props.onEditGoodChange(editGood, goodsList);
29388
+ props.onEditGoodChange(editGood);
29389
+ }
29390
+ }, [editGood, props.onEditGoodChange]);
29391
+ React__default['default'].useEffect(function () {
29392
+ if (props.onGoodsListChange) {
29393
+ props.onGoodsListChange(goodsList);
29387
29394
  }
29388
- }, [editGood, goodsList, props.onEditGoodChange]);
29395
+ }, [goodsList, props.onGoodsListChange]);
29389
29396
  return /*#__PURE__*/React__default['default'].createElement(InvoiceContext.Provider, {
29390
29397
  key: key,
29391
29398
  value: controller