kts-component-invoice-operate 3.2.35 → 3.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1695,10 +1695,12 @@ var validateFields = function validateFields(form) {
1695
1695
  function getGoodsSearch(goodsList, search, isTaxIncluded) {
1696
1696
  if (!search) return goodsList;
1697
1697
  return goodsList.filter(function (e) {
1698
- var _e$itemName$indexOf, _e$itemName, _e$itemModelName$inde, _e$itemModelName, _e$lineAmountIncludeT, _e$lineAmountExcludeT;
1698
+ var _e$itemName$indexOf, _e$itemName, _e$itemCode$indexOf, _e$itemCode, _e$itemModelName$inde, _e$itemModelName, _e$lineAmountIncludeT, _e$lineAmountExcludeT;
1699
1699
 
1700
1700
  if (((_e$itemName$indexOf = (_e$itemName = e.itemName) === null || _e$itemName === void 0 ? void 0 : _e$itemName.indexOf(search)) !== null && _e$itemName$indexOf !== void 0 ? _e$itemName$indexOf : -1) >= 0) {
1701
1701
  return true;
1702
+ } else if (((_e$itemCode$indexOf = (_e$itemCode = e.itemCode) === null || _e$itemCode === void 0 ? void 0 : _e$itemCode.indexOf(search)) !== null && _e$itemCode$indexOf !== void 0 ? _e$itemCode$indexOf : -1) >= 0) {
1703
+ return true;
1702
1704
  } else if (((_e$itemModelName$inde = (_e$itemModelName = e.itemModelName) === null || _e$itemModelName === void 0 ? void 0 : _e$itemModelName.indexOf(search)) !== null && _e$itemModelName$inde !== void 0 ? _e$itemModelName$inde : -1) >= 0) {
1703
1705
  return true;
1704
1706
  } else if ("".concat(isTaxIncluded ? (_e$lineAmountIncludeT = e.lineAmountIncludeTax) === null || _e$lineAmountIncludeT === void 0 ? void 0 : _e$lineAmountIncludeT.toFixed(2) : (_e$lineAmountExcludeT = e.lineAmountExcludeTax) === null || _e$lineAmountExcludeT === void 0 ? void 0 : _e$lineAmountExcludeT.toFixed(2)).indexOf(search) >= 0) {
@@ -1796,21 +1798,21 @@ function _mergeDetails() {
1796
1798
  state.goodsListState.goodsMap.set(e.$index, e);
1797
1799
  });
1798
1800
  state.goodsListState.selectedGoodIndex = [];
1799
- _context.next = 40;
1801
+ _context.next = 41;
1800
1802
  break;
1801
1803
 
1802
- case 36:
1803
- _context.prev = 36;
1804
+ case 37:
1805
+ _context.prev = 37;
1804
1806
  _context.t0 = _context["catch"](5);
1805
1807
  debugger;
1806
1808
  showError(_context.t0);
1807
1809
 
1808
- case 40:
1810
+ case 41:
1809
1811
  case "end":
1810
1812
  return _context.stop();
1811
1813
  }
1812
1814
  }
1813
- }, _callee, null, [[5, 36]]);
1815
+ }, _callee, null, [[5, 37]]);
1814
1816
  }));
1815
1817
  return _mergeDetails.apply(this, arguments);
1816
1818
  }
@@ -1983,7 +1985,9 @@ function _fillingInformationGood() {
1983
1985
  goods = goodsList[findMaxIndex(goodsList.map(function (e) {
1984
1986
  return e.lineAmountIncludeTax || 0;
1985
1987
  }))];
1986
- return _context7.abrupt("return", _objectSpread2({}, goods));
1988
+ return _context7.abrupt("return", _objectSpread2(_objectSpread2({}, goods), {}, {
1989
+ lineAttribute: LineAttributeType$1.正常
1990
+ }));
1987
1991
 
1988
1992
  case 3:
1989
1993
  case "end":
@@ -9999,6 +10003,9 @@ function Search() {
9999
10003
  var readOnly = controller.useMemo(function (s) {
10000
10004
  return !!s.goodsListState.editGood;
10001
10005
  }, []);
10006
+ var columnshide = controller.useMemo(function (s) {
10007
+ return s.goodsListState.columnshide;
10008
+ }, []);
10002
10009
  /** 是否含税 */
10003
10010
 
10004
10011
  var isTaxIncluded = controller.useMemo(function (s) {
@@ -10062,7 +10069,7 @@ function Search() {
10062
10069
  readOnly: readOnly,
10063
10070
  value: value,
10064
10071
  className: "kts-invoice-operate-goods-list-search",
10065
- placeholder: "\u8BF7\u60A8\u8F93\u5165\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(".concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
10072
+ placeholder: "\u8BF7\u60A8\u8F93\u5165".concat(columnshide.includes('itemCode') ? '' : '商品编码、', "\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(").concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
10066
10073
  prefix: React.createElement(Icon$1, {
10067
10074
  component: SvgMagnifier,
10068
10075
  style: {
@@ -12384,7 +12391,11 @@ var useColumns = (function (form) {
12384
12391
  render: function render(_, record) {
12385
12392
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
12386
12393
  return React.createElement(Form.Item, null, getFieldDecorator('itemCode', {
12387
- initialValue: editGood.itemCode
12394
+ initialValue: editGood.itemCode,
12395
+ rules: [].concat(_toConsumableArray(getReplenishRules('itemCode')), [{
12396
+ pattern: /^.{1,19}$/,
12397
+ message: '商品编码长度不能超过19位'
12398
+ }])
12388
12399
  })(React.createElement(ItemCodeInput, {
12389
12400
  record: record,
12390
12401
  onChange: function () {
@@ -12416,7 +12427,11 @@ var useColumns = (function (form) {
12416
12427
  }()
12417
12428
  })));
12418
12429
  } else {
12419
- return record.itemCode;
12430
+ return React.createElement("span", {
12431
+ style: {
12432
+ padding: '0 10px'
12433
+ }
12434
+ }, record.itemCode);
12420
12435
  }
12421
12436
  }
12422
12437
  }, {
@@ -21214,6 +21229,7 @@ var DrawerBody$2 = function DrawerBody() {
21214
21229
 
21215
21230
  between = _objectSpread2({}, record);
21216
21231
  between.itemName = getItemName(record, s.goodsListState.editGood);
21232
+ between.itemCode = getItemCode(record, s.goodsListState.editGood);
21217
21233
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood); // 设置编辑货物
21218
21234
 
21219
21235
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
@@ -21249,22 +21265,22 @@ var DrawerBody$2 = function DrawerBody() {
21249
21265
  s.goodsListState.importGoods.isVisibleDrawer = false;
21250
21266
 
21251
21267
  if (!s.goodsListState.isTaxIncluded) {
21252
- _context2.next = 25;
21268
+ _context2.next = 26;
21253
21269
  break;
21254
21270
  }
21255
21271
 
21256
- _context2.next = 23;
21272
+ _context2.next = 24;
21257
21273
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
21258
21274
 
21259
- case 23:
21260
- _context2.next = 27;
21275
+ case 24:
21276
+ _context2.next = 28;
21261
21277
  break;
21262
21278
 
21263
- case 25:
21264
- _context2.next = 27;
21279
+ case 26:
21280
+ _context2.next = 28;
21265
21281
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
21266
21282
 
21267
- case 27:
21283
+ case 28:
21268
21284
  case "end":
21269
21285
  return _context2.stop();
21270
21286
  }
@@ -21320,6 +21336,20 @@ var getItemNameOther = function getItemNameOther(record, editGood) {
21320
21336
  // return `*${shorthand}*${record.itemNameSelf}`;
21321
21337
  // }
21322
21338
  return record.itemName;
21339
+ }; // 获取商品编号
21340
+
21341
+
21342
+ var getItemCode = function getItemCode(record, editGood) {
21343
+ // let shorthand;
21344
+ // shorthand = record.shorthand;
21345
+ // if (shorthand) {
21346
+ // return `*${shorthand}*${record.itemName}`;
21347
+ // }
21348
+ // shorthand = getSN(editGood.itemName)?.shorthand;
21349
+ // if (shorthand) {
21350
+ // return `*${shorthand}*${record.itemNameSelf}`;
21351
+ // }
21352
+ return record.productCode;
21323
21353
  };
21324
21354
 
21325
21355
  var css_248z$q = ".kts-invoice-operate-goods-endow-code-button-list {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-endow-code-button-list > button {\n margin-bottom: 10px;\n}\n";
package/dist/index.js CHANGED
@@ -1705,10 +1705,12 @@ var validateFields = function validateFields(form) {
1705
1705
  function getGoodsSearch(goodsList, search, isTaxIncluded) {
1706
1706
  if (!search) return goodsList;
1707
1707
  return goodsList.filter(function (e) {
1708
- var _e$itemName$indexOf, _e$itemName, _e$itemModelName$inde, _e$itemModelName, _e$lineAmountIncludeT, _e$lineAmountExcludeT;
1708
+ var _e$itemName$indexOf, _e$itemName, _e$itemCode$indexOf, _e$itemCode, _e$itemModelName$inde, _e$itemModelName, _e$lineAmountIncludeT, _e$lineAmountExcludeT;
1709
1709
 
1710
1710
  if (((_e$itemName$indexOf = (_e$itemName = e.itemName) === null || _e$itemName === void 0 ? void 0 : _e$itemName.indexOf(search)) !== null && _e$itemName$indexOf !== void 0 ? _e$itemName$indexOf : -1) >= 0) {
1711
1711
  return true;
1712
+ } else if (((_e$itemCode$indexOf = (_e$itemCode = e.itemCode) === null || _e$itemCode === void 0 ? void 0 : _e$itemCode.indexOf(search)) !== null && _e$itemCode$indexOf !== void 0 ? _e$itemCode$indexOf : -1) >= 0) {
1713
+ return true;
1712
1714
  } else if (((_e$itemModelName$inde = (_e$itemModelName = e.itemModelName) === null || _e$itemModelName === void 0 ? void 0 : _e$itemModelName.indexOf(search)) !== null && _e$itemModelName$inde !== void 0 ? _e$itemModelName$inde : -1) >= 0) {
1713
1715
  return true;
1714
1716
  } else if ("".concat(isTaxIncluded ? (_e$lineAmountIncludeT = e.lineAmountIncludeTax) === null || _e$lineAmountIncludeT === void 0 ? void 0 : _e$lineAmountIncludeT.toFixed(2) : (_e$lineAmountExcludeT = e.lineAmountExcludeTax) === null || _e$lineAmountExcludeT === void 0 ? void 0 : _e$lineAmountExcludeT.toFixed(2)).indexOf(search) >= 0) {
@@ -1806,21 +1808,21 @@ function _mergeDetails() {
1806
1808
  state.goodsListState.goodsMap.set(e.$index, e);
1807
1809
  });
1808
1810
  state.goodsListState.selectedGoodIndex = [];
1809
- _context.next = 40;
1811
+ _context.next = 41;
1810
1812
  break;
1811
1813
 
1812
- case 36:
1813
- _context.prev = 36;
1814
+ case 37:
1815
+ _context.prev = 37;
1814
1816
  _context.t0 = _context["catch"](5);
1815
1817
  debugger;
1816
1818
  showError(_context.t0);
1817
1819
 
1818
- case 40:
1820
+ case 41:
1819
1821
  case "end":
1820
1822
  return _context.stop();
1821
1823
  }
1822
1824
  }
1823
- }, _callee, null, [[5, 36]]);
1825
+ }, _callee, null, [[5, 37]]);
1824
1826
  }));
1825
1827
  return _mergeDetails.apply(this, arguments);
1826
1828
  }
@@ -1993,7 +1995,9 @@ function _fillingInformationGood() {
1993
1995
  goods = goodsList[findMaxIndex(goodsList.map(function (e) {
1994
1996
  return e.lineAmountIncludeTax || 0;
1995
1997
  }))];
1996
- return _context7.abrupt("return", _objectSpread2({}, goods));
1998
+ return _context7.abrupt("return", _objectSpread2(_objectSpread2({}, goods), {}, {
1999
+ lineAttribute: LineAttributeType$1.正常
2000
+ }));
1997
2001
 
1998
2002
  case 3:
1999
2003
  case "end":
@@ -10009,6 +10013,9 @@ function Search() {
10009
10013
  var readOnly = controller.useMemo(function (s) {
10010
10014
  return !!s.goodsListState.editGood;
10011
10015
  }, []);
10016
+ var columnshide = controller.useMemo(function (s) {
10017
+ return s.goodsListState.columnshide;
10018
+ }, []);
10012
10019
  /** 是否含税 */
10013
10020
 
10014
10021
  var isTaxIncluded = controller.useMemo(function (s) {
@@ -10072,7 +10079,7 @@ function Search() {
10072
10079
  readOnly: readOnly,
10073
10080
  value: value,
10074
10081
  className: "kts-invoice-operate-goods-list-search",
10075
- placeholder: "\u8BF7\u60A8\u8F93\u5165\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(".concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
10082
+ placeholder: "\u8BF7\u60A8\u8F93\u5165".concat(columnshide.includes('itemCode') ? '' : '商品编码、', "\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(").concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
10076
10083
  prefix: React__default['default'].createElement(ktsComponentsAntdX3.Icon, {
10077
10084
  component: SvgMagnifier,
10078
10085
  style: {
@@ -12394,7 +12401,11 @@ var useColumns = (function (form) {
12394
12401
  render: function render(_, record) {
12395
12402
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
12396
12403
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemCode', {
12397
- initialValue: editGood.itemCode
12404
+ initialValue: editGood.itemCode,
12405
+ rules: [].concat(_toConsumableArray(getReplenishRules('itemCode')), [{
12406
+ pattern: /^.{1,19}$/,
12407
+ message: '商品编码长度不能超过19位'
12408
+ }])
12398
12409
  })(React__default['default'].createElement(ItemCodeInput, {
12399
12410
  record: record,
12400
12411
  onChange: function () {
@@ -12426,7 +12437,11 @@ var useColumns = (function (form) {
12426
12437
  }()
12427
12438
  })));
12428
12439
  } else {
12429
- return record.itemCode;
12440
+ return React__default['default'].createElement("span", {
12441
+ style: {
12442
+ padding: '0 10px'
12443
+ }
12444
+ }, record.itemCode);
12430
12445
  }
12431
12446
  }
12432
12447
  }, {
@@ -21224,6 +21239,7 @@ var DrawerBody$2 = function DrawerBody() {
21224
21239
 
21225
21240
  between = _objectSpread2({}, record);
21226
21241
  between.itemName = getItemName(record, s.goodsListState.editGood);
21242
+ between.itemCode = getItemCode(record, s.goodsListState.editGood);
21227
21243
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood); // 设置编辑货物
21228
21244
 
21229
21245
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
@@ -21259,22 +21275,22 @@ var DrawerBody$2 = function DrawerBody() {
21259
21275
  s.goodsListState.importGoods.isVisibleDrawer = false;
21260
21276
 
21261
21277
  if (!s.goodsListState.isTaxIncluded) {
21262
- _context2.next = 25;
21278
+ _context2.next = 26;
21263
21279
  break;
21264
21280
  }
21265
21281
 
21266
- _context2.next = 23;
21282
+ _context2.next = 24;
21267
21283
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
21268
21284
 
21269
- case 23:
21270
- _context2.next = 27;
21285
+ case 24:
21286
+ _context2.next = 28;
21271
21287
  break;
21272
21288
 
21273
- case 25:
21274
- _context2.next = 27;
21289
+ case 26:
21290
+ _context2.next = 28;
21275
21291
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
21276
21292
 
21277
- case 27:
21293
+ case 28:
21278
21294
  case "end":
21279
21295
  return _context2.stop();
21280
21296
  }
@@ -21330,6 +21346,20 @@ var getItemNameOther = function getItemNameOther(record, editGood) {
21330
21346
  // return `*${shorthand}*${record.itemNameSelf}`;
21331
21347
  // }
21332
21348
  return record.itemName;
21349
+ }; // 获取商品编号
21350
+
21351
+
21352
+ var getItemCode = function getItemCode(record, editGood) {
21353
+ // let shorthand;
21354
+ // shorthand = record.shorthand;
21355
+ // if (shorthand) {
21356
+ // return `*${shorthand}*${record.itemName}`;
21357
+ // }
21358
+ // shorthand = getSN(editGood.itemName)?.shorthand;
21359
+ // if (shorthand) {
21360
+ // return `*${shorthand}*${record.itemNameSelf}`;
21361
+ // }
21362
+ return record.productCode;
21333
21363
  };
21334
21364
 
21335
21365
  var css_248z$q = ".kts-invoice-operate-goods-endow-code-button-list {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-endow-code-button-list > button {\n margin-bottom: 10px;\n}\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.35",
3
+ "version": "3.2.37",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -6,13 +6,15 @@ import IGood from "../InvoiceControllerState/GoodsListState/IGood";
6
6
  * @param goodsList 被搜索列表
7
7
  * @param search 搜索条件
8
8
  * @param isTaxIncluded 是否含税
9
- * @returns
9
+ * @returns
10
10
  */
11
11
  export default function getGoodsSearch(goodsList: IGood[], search: string, isTaxIncluded: boolean) {
12
12
  if (!search) return goodsList;
13
13
  return goodsList.filter(e => {
14
14
  if ((e.itemName?.indexOf(search) ?? -1) >= 0) {
15
15
  return true;
16
+ } else if ((e.itemCode?.indexOf(search) ?? -1) >= 0) {
17
+ return true
16
18
  } else if ((e.itemModelName?.indexOf(search) ?? -1) >= 0) {
17
19
  return true
18
20
  } else if (`${isTaxIncluded ? e.lineAmountIncludeTax?.toFixed(2) : e.lineAmountExcludeTax?.toFixed(2)}`.indexOf(search) >= 0) {
@@ -21,4 +23,4 @@ export default function getGoodsSearch(goodsList: IGood[], search: string, isTax
21
23
  return false;
22
24
  }
23
25
  })
24
- }
26
+ }
@@ -38,7 +38,7 @@ export default async function mergeDetails(state: InvoiceControllerState) {
38
38
  // 计算税额
39
39
  sum.taxAmount = chain(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber()
40
40
 
41
- const p = state.goodsListState.goodsList.indexOf(goodsList[0]);
41
+ const p = state.goodsListState.goodsList.indexOf(goodsList[0]);9
42
42
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0);
43
43
  state.goodsListState.goodsList.splice(p, 0, sum);
44
44
  state.goodsListState.goodsMap = new Map();
@@ -95,7 +95,7 @@ async function fillingInformationGood(goodsList: IGood[], sum: IGood) {
95
95
 
96
96
  const goods = goodsList[findMaxIndex(goodsList.map(e => e.lineAmountIncludeTax || 0))]
97
97
 
98
- return { ...goods };
98
+ return { ...goods, lineAttribute: LineAttributeType.正常 };
99
99
  }
100
100
 
101
101
  /** 存在税率不一样的明细,不能合并 */
@@ -107,6 +107,10 @@ export default (form: WrappedFormUtils) => {
107
107
  <Form.Item>
108
108
  {getFieldDecorator('itemCode', {
109
109
  initialValue: editGood.itemCode,
110
+ rules: [
111
+ ...getReplenishRules('itemCode'),
112
+ { pattern: /^.{1,19}$/, message: '商品编码长度不能超过19位' },
113
+ ]
110
114
  })(
111
115
  <ItemCodeInput
112
116
  record={record}
@@ -119,7 +123,7 @@ export default (form: WrappedFormUtils) => {
119
123
  </Form.Item>
120
124
  )
121
125
  } else {
122
- return record.itemCode
126
+ return <span style={{ padding: '0 10px' }}>{record.itemCode}</span>
123
127
  }
124
128
  }
125
129
  },
@@ -13,6 +13,8 @@ export default function Search() {
13
13
 
14
14
  const readOnly = controller.useMemo(s => !!s.goodsListState.editGood, [])
15
15
 
16
+ const columnshide = controller.useMemo(s => s.goodsListState.columnshide, [])
17
+
16
18
  /** 是否含税 */
17
19
  const isTaxIncluded = controller.useMemo(s => s.goodsListState.isTaxIncluded, [])
18
20
 
@@ -40,7 +42,7 @@ export default function Search() {
40
42
  readOnly={readOnly}
41
43
  value={value}
42
44
  className="kts-invoice-operate-goods-list-search"
43
- placeholder={`请您输入项目名称、规格型号、金额(${isTaxIncluded ? '含税' : '不含税'})搜索`}
45
+ placeholder={`请您输入${columnshide.includes('itemCode') ? '' : '商品编码、'}项目名称、规格型号、金额(${isTaxIncluded ? '含税' : '不含税'})搜索`}
44
46
  prefix={<Icon component={MagnifierSvg} style={{ color: "#b8b8b8" }} />}
45
47
  onChange={e => { setValue(e.target.value); }}
46
48
  onClick={onClick}
@@ -79,6 +79,7 @@ const DrawerBody = () => {
79
79
  // 中间数据
80
80
  const between = { ...record };
81
81
  between.itemName = getItemName(record, s.goodsListState.editGood);
82
+ between.itemCode = getItemCode(record, s.goodsListState.editGood);
82
83
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
83
84
 
84
85
  // 设置编辑货物
@@ -171,4 +172,22 @@ const getItemNameOther = (record: any, editGood: IGood) => {
171
172
  // return `*${shorthand}*${record.itemNameSelf}`;
172
173
  // }
173
174
  return record.itemName;
174
- }
175
+ }
176
+
177
+ // 获取商品编号
178
+ const getItemCode = (record: any, editGood: IGood) => {
179
+
180
+ // let shorthand;
181
+
182
+ // shorthand = record.shorthand;
183
+ // if (shorthand) {
184
+ // return `*${shorthand}*${record.itemName}`;
185
+ // }
186
+
187
+ // shorthand = getSN(editGood.itemName)?.shorthand;
188
+ // if (shorthand) {
189
+ // return `*${shorthand}*${record.itemNameSelf}`;
190
+ // }
191
+
192
+ return record.productCode;
193
+ }