kts-component-invoice-operate 3.1.13 → 3.1.14

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.
@@ -42,6 +42,8 @@ export default interface IGood {
42
42
  taxAmount?: number;
43
43
  /** 税收分类编码 */
44
44
  taxClassificationCode?: string;
45
+ /** 商品和服务分类简称 */
46
+ shorthand?: string;
45
47
  /** 是否享受优惠政策 */
46
48
  favouredPolicyMark?: number;
47
49
  /** 优惠政策类型 */
@@ -12,3 +12,5 @@ export declare const getItemName: (value: ISN) => string;
12
12
  export declare const setFull: (name?: string, full?: string) => string | undefined;
13
13
  /** 设置简称 */
14
14
  export declare const setShorthand: (name?: string, shorthand?: string) => string | undefined;
15
+ /** 组合全称加简称 */
16
+ export declare const getItemNameWithShorthand: (value: ISN) => string;
@@ -3,4 +3,5 @@ import './index.less';
3
3
  export default function ItemNameInput(props: {
4
4
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
5
5
  value?: string;
6
+ shorthand?: string;
6
7
  }): JSX.Element;
package/dist/index.esm.js CHANGED
@@ -2327,39 +2327,6 @@ var evaluate = (function (expr) {
2327
2327
  return parseFloat(math.evaluate(expr).toFixed(fractionDigits));
2328
2328
  });
2329
2329
 
2330
- /** 拆分全称加简称 */
2331
- var getSN = function getSN(value) {
2332
- if (!value) return undefined;
2333
- var arr = value.match(/\*[^*]+\*/);
2334
- if (arr && arr[0]) {
2335
- return {
2336
- shorthand: arr[0].split('*')[1],
2337
- full: value.replace(arr[0], '')
2338
- };
2339
- } else {
2340
- return {
2341
- shorthand: undefined,
2342
- full: value
2343
- };
2344
- }
2345
- };
2346
- /** 组合全称加简称 */
2347
- var getItemName = function getItemName(value) {
2348
- if (value.shorthand) {
2349
- return "*".concat(value.shorthand, "*").concat(value.full);
2350
- } else {
2351
- return value.full;
2352
- }
2353
- };
2354
- /** 设置简称 */
2355
- var setShorthand = function setShorthand(name, shorthand) {
2356
- if (!name) return undefined;
2357
- var sn = getSN(name);
2358
- if (!sn) return undefined;
2359
- sn.shorthand = shorthand || '';
2360
- return getItemName(sn);
2361
- };
2362
-
2363
2330
  //! moment.js
2364
2331
  //! version : 2.29.4
2365
2332
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -8863,50 +8830,48 @@ var onChangeItemName = /*#__PURE__*/function () {
8863
8830
  case 0:
8864
8831
  controller.run( /*#__PURE__*/function () {
8865
8832
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
8866
- var _getSN$shorthand, _getSN;
8867
- var value, shorthand;
8833
+ var value;
8868
8834
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
8869
8835
  while (1) switch (_context14.prev = _context14.next) {
8870
8836
  case 0:
8871
8837
  value = form.getFieldsValue().itemName;
8872
- shorthand = (_getSN$shorthand = (_getSN = getSN(value)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand) !== null && _getSN$shorthand !== void 0 ? _getSN$shorthand : '';
8873
8838
  if (!s.goodsListState.isMyShow) {
8874
- _context14.next = 11;
8839
+ _context14.next = 10;
8875
8840
  break;
8876
8841
  }
8877
- _context14.next = 5;
8842
+ _context14.next = 4;
8878
8843
  return controller.setEditGood({
8879
8844
  itemNameSelf: value
8880
8845
  });
8881
- case 5:
8846
+ case 4:
8882
8847
  _context14.t0 = record.itemName;
8883
8848
  if (!_context14.t0) {
8884
- _context14.next = 9;
8849
+ _context14.next = 8;
8885
8850
  break;
8886
8851
  }
8887
- _context14.next = 9;
8852
+ _context14.next = 8;
8888
8853
  return controller.setEditGood({
8889
- itemName: setShorthand(record.itemName, shorthand)
8854
+ itemName: record.itemName
8890
8855
  });
8891
- case 9:
8892
- _context14.next = 17;
8856
+ case 8:
8857
+ _context14.next = 16;
8893
8858
  break;
8894
- case 11:
8895
- _context14.next = 13;
8859
+ case 10:
8860
+ _context14.next = 12;
8896
8861
  return controller.setEditGood({
8897
8862
  itemName: value
8898
8863
  });
8899
- case 13:
8864
+ case 12:
8900
8865
  _context14.t1 = record.itemNameSelf;
8901
8866
  if (!_context14.t1) {
8902
- _context14.next = 17;
8867
+ _context14.next = 16;
8903
8868
  break;
8904
8869
  }
8905
- _context14.next = 17;
8870
+ _context14.next = 16;
8906
8871
  return controller.setEditGood({
8907
- itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
8872
+ itemNameSelf: record.itemNameSelf
8908
8873
  });
8909
- case 17:
8874
+ case 16:
8910
8875
  case "end":
8911
8876
  return _context14.stop();
8912
8877
  }
@@ -9063,40 +9028,50 @@ var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: f
9063
9028
  styleInject(css_248z$6);
9064
9029
 
9065
9030
  function ItemNameInput(props) {
9066
- var _getShorthand = getShorthand(props.value),
9067
- shorthand = _getShorthand.shorthand,
9068
- fullName = _getShorthand.fullName;
9069
9031
  var onChange = React.useCallback(function (e) {
9070
9032
  var event = _objectSpread2({}, e);
9071
- event.target.value = shorthand ? "*".concat(shorthand, "*").concat(e.target.value) : e.target.value;
9072
9033
  props.onChange && props.onChange(event);
9073
9034
  }, []);
9074
9035
  return /*#__PURE__*/React.createElement("div", {
9075
9036
  className: 'kts-invoice-operate-goods-list-itemName-input'
9076
- }, shorthand && /*#__PURE__*/React.createElement("span", {
9037
+ }, props.shorthand && /*#__PURE__*/React.createElement("span", {
9077
9038
  style: {
9078
9039
  alignSelf: 'center',
9079
9040
  fontSize: 12
9080
9041
  }
9081
- }, "*", shorthand, "*"), /*#__PURE__*/React.createElement(Input, {
9042
+ }, "*", props.shorthand, "*"), /*#__PURE__*/React.createElement(Input, {
9082
9043
  style: {
9083
9044
  height: '100%',
9084
9045
  border: 'none'
9085
9046
  },
9086
- value: fullName,
9047
+ value: props.value,
9087
9048
  onChange: onChange
9088
9049
  }));
9089
9050
  }
9090
- /** 提取简称 */
9091
- var getShorthand = function getShorthand(value) {
9092
- if (!value) return {};
9051
+
9052
+ /** 拆分全称加简称 */
9053
+ var getSN = function getSN(value) {
9054
+ if (!value) return undefined;
9093
9055
  var arr = value.match(/\*[^*]+\*/);
9094
- var shorthand = arr ? arr[0].split('*')[1] : '';
9095
- var fullName = shorthand ? value.replace("*".concat(shorthand, "*"), '') : value;
9096
- return {
9097
- shorthand: shorthand,
9098
- fullName: fullName
9099
- };
9056
+ if (arr && arr[0]) {
9057
+ return {
9058
+ shorthand: arr[0].split('*')[1],
9059
+ full: value.replace(arr[0], '')
9060
+ };
9061
+ } else {
9062
+ return {
9063
+ shorthand: undefined,
9064
+ full: value
9065
+ };
9066
+ }
9067
+ };
9068
+ /** 组合全称加简称 */
9069
+ var getItemNameWithShorthand = function getItemNameWithShorthand(value) {
9070
+ if (value.shorthand) {
9071
+ return "*".concat(value.shorthand, "*").concat(value.full);
9072
+ } else {
9073
+ return value.full;
9074
+ }
9100
9075
  };
9101
9076
 
9102
9077
  var useColumns = (function (form) {
@@ -9238,6 +9213,7 @@ var useColumns = (function (form) {
9238
9213
  }()
9239
9214
  }])
9240
9215
  })( /*#__PURE__*/React.createElement(ItemNameInput, {
9216
+ shorthand: editGood.shorthand,
9241
9217
  onChange: function onChange() {
9242
9218
  onChangeItemName(controller, form, record);
9243
9219
  }
@@ -9267,8 +9243,14 @@ var useColumns = (function (form) {
9267
9243
  })))));
9268
9244
  } else {
9269
9245
  return /*#__PURE__*/React.createElement(MyItemNameDiv, {
9270
- valueT: formatSearch(record.itemNameSelf, searchValue),
9271
- valueF: formatSearch(record.itemName, searchValue),
9246
+ valueT: formatSearch(getItemNameWithShorthand({
9247
+ shorthand: record.shorthand,
9248
+ full: record.itemNameSelf || ''
9249
+ }), searchValue),
9250
+ valueF: formatSearch(getItemNameWithShorthand({
9251
+ shorthand: record.shorthand,
9252
+ full: record.itemName || ''
9253
+ }), searchValue),
9272
9254
  isMyShow: isMyShow
9273
9255
  });
9274
9256
  }
@@ -11889,7 +11871,7 @@ var DrawerBody$2 = function DrawerBody() {
11889
11871
  }
11890
11872
  // 中间数据
11891
11873
  between = _objectSpread2({}, record);
11892
- between.itemName = getItemName$1(record, s.goodsListState.editGood);
11874
+ between.itemName = getItemName(record, s.goodsListState.editGood);
11893
11875
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
11894
11876
  // 设置编辑货物
11895
11877
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
@@ -11944,27 +11926,26 @@ var getPriceExcludeTax = function getPriceExcludeTax(s, record, calculatingDigit
11944
11926
  return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")), calculatingDigits);
11945
11927
  };
11946
11928
  // 获取我方名称
11947
- var getItemName$1 = function getItemName(record, editGood) {
11948
- var _getSN;
11949
- var shorthand;
11950
- shorthand = record.shorthand;
11951
- if (shorthand) {
11952
- return "*".concat(shorthand, "*").concat(record.itemName);
11953
- }
11954
- shorthand = (_getSN = getSN(editGood.itemName)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand;
11955
- if (shorthand) {
11956
- return "*".concat(shorthand, "*").concat(record.itemNameSelf);
11957
- }
11929
+ var getItemName = function getItemName(record, editGood) {
11930
+ // let shorthand;
11931
+ // shorthand = record.shorthand;
11932
+ // if (shorthand) {
11933
+ // return `*${shorthand}*${record.itemName}`;
11934
+ // }
11935
+ // shorthand = getSN(editGood.itemName)?.shorthand;
11936
+ // if (shorthand) {
11937
+ // return `*${shorthand}*${record.itemNameSelf}`;
11938
+ // }
11958
11939
  return record.itemName;
11959
11940
  };
11960
11941
  // 获取他方名称
11961
11942
  var getItemNameOther = function getItemNameOther(record, editGood) {
11962
- if (!editGood.itemName) return editGood.itemName;
11963
- var shorthand;
11964
- shorthand = record.shorthand;
11965
- if (shorthand) {
11966
- return "*".concat(shorthand, "*").concat(record.itemNameSelf);
11967
- }
11943
+ // if (!editGood.itemName) return editGood.itemName;
11944
+ // let shorthand;
11945
+ // shorthand = record.shorthand;
11946
+ // if (shorthand) {
11947
+ // return `*${shorthand}*${record.itemNameSelf}`;
11948
+ // }
11968
11949
  return record.itemName;
11969
11950
  };
11970
11951
 
@@ -12414,8 +12395,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12414
12395
  }); // 赋码
12415
12396
  endowCodeGood.forEach(function (good) {
12416
12397
  if (!good) return;
12417
- good.itemName = setShorthand(good.itemName, values.shorthand);
12418
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
12398
+ good.shorthand = values.shorthand;
12419
12399
  good.taxClassificationCode = values.taxClassificationCode;
12420
12400
  good.taxRate = values.taxRate;
12421
12401
  good.taxFreeType = values.taxFreeType;
@@ -12508,7 +12488,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12508
12488
  name: "shorthand",
12509
12489
  type: "string",
12510
12490
  readOnly: true,
12511
- default: getShorthand$1(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName),
12491
+ default: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.shorthand,
12512
12492
  title: "\u5546\u54C1\u548C\u670D\u52A1\u5206\u7C7B\u7B80\u79F0"
12513
12493
  }), /*#__PURE__*/React.createElement(SchemaMarkupField, {
12514
12494
  name: "taxRate",
@@ -12600,16 +12580,6 @@ var components = {
12600
12580
  string: Input$1,
12601
12581
  number: NumberPicker
12602
12582
  };
12603
- /** 提取简称 */
12604
- var getShorthand$1 = function getShorthand(value) {
12605
- if (!value) return ' ';
12606
- var arr = value.match(/\*[^*]+\*/);
12607
- if (arr) {
12608
- return arr[0].split('*')[1];
12609
- } else {
12610
- return ' ';
12611
- }
12612
- };
12613
12583
 
12614
12584
  function AddComparisonDrawer() {
12615
12585
  var _Form$useForm = Form$1.useForm(),
package/dist/index.js CHANGED
@@ -2337,39 +2337,6 @@ var evaluate = (function (expr) {
2337
2337
  return parseFloat(math.evaluate(expr).toFixed(fractionDigits));
2338
2338
  });
2339
2339
 
2340
- /** 拆分全称加简称 */
2341
- var getSN = function getSN(value) {
2342
- if (!value) return undefined;
2343
- var arr = value.match(/\*[^*]+\*/);
2344
- if (arr && arr[0]) {
2345
- return {
2346
- shorthand: arr[0].split('*')[1],
2347
- full: value.replace(arr[0], '')
2348
- };
2349
- } else {
2350
- return {
2351
- shorthand: undefined,
2352
- full: value
2353
- };
2354
- }
2355
- };
2356
- /** 组合全称加简称 */
2357
- var getItemName = function getItemName(value) {
2358
- if (value.shorthand) {
2359
- return "*".concat(value.shorthand, "*").concat(value.full);
2360
- } else {
2361
- return value.full;
2362
- }
2363
- };
2364
- /** 设置简称 */
2365
- var setShorthand = function setShorthand(name, shorthand) {
2366
- if (!name) return undefined;
2367
- var sn = getSN(name);
2368
- if (!sn) return undefined;
2369
- sn.shorthand = shorthand || '';
2370
- return getItemName(sn);
2371
- };
2372
-
2373
2340
  //! moment.js
2374
2341
  //! version : 2.29.4
2375
2342
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -8873,50 +8840,48 @@ var onChangeItemName = /*#__PURE__*/function () {
8873
8840
  case 0:
8874
8841
  controller.run( /*#__PURE__*/function () {
8875
8842
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
8876
- var _getSN$shorthand, _getSN;
8877
- var value, shorthand;
8843
+ var value;
8878
8844
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
8879
8845
  while (1) switch (_context14.prev = _context14.next) {
8880
8846
  case 0:
8881
8847
  value = form.getFieldsValue().itemName;
8882
- shorthand = (_getSN$shorthand = (_getSN = getSN(value)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand) !== null && _getSN$shorthand !== void 0 ? _getSN$shorthand : '';
8883
8848
  if (!s.goodsListState.isMyShow) {
8884
- _context14.next = 11;
8849
+ _context14.next = 10;
8885
8850
  break;
8886
8851
  }
8887
- _context14.next = 5;
8852
+ _context14.next = 4;
8888
8853
  return controller.setEditGood({
8889
8854
  itemNameSelf: value
8890
8855
  });
8891
- case 5:
8856
+ case 4:
8892
8857
  _context14.t0 = record.itemName;
8893
8858
  if (!_context14.t0) {
8894
- _context14.next = 9;
8859
+ _context14.next = 8;
8895
8860
  break;
8896
8861
  }
8897
- _context14.next = 9;
8862
+ _context14.next = 8;
8898
8863
  return controller.setEditGood({
8899
- itemName: setShorthand(record.itemName, shorthand)
8864
+ itemName: record.itemName
8900
8865
  });
8901
- case 9:
8902
- _context14.next = 17;
8866
+ case 8:
8867
+ _context14.next = 16;
8903
8868
  break;
8904
- case 11:
8905
- _context14.next = 13;
8869
+ case 10:
8870
+ _context14.next = 12;
8906
8871
  return controller.setEditGood({
8907
8872
  itemName: value
8908
8873
  });
8909
- case 13:
8874
+ case 12:
8910
8875
  _context14.t1 = record.itemNameSelf;
8911
8876
  if (!_context14.t1) {
8912
- _context14.next = 17;
8877
+ _context14.next = 16;
8913
8878
  break;
8914
8879
  }
8915
- _context14.next = 17;
8880
+ _context14.next = 16;
8916
8881
  return controller.setEditGood({
8917
- itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
8882
+ itemNameSelf: record.itemNameSelf
8918
8883
  });
8919
- case 17:
8884
+ case 16:
8920
8885
  case "end":
8921
8886
  return _context14.stop();
8922
8887
  }
@@ -9073,40 +9038,50 @@ var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: f
9073
9038
  styleInject(css_248z$6);
9074
9039
 
9075
9040
  function ItemNameInput(props) {
9076
- var _getShorthand = getShorthand(props.value),
9077
- shorthand = _getShorthand.shorthand,
9078
- fullName = _getShorthand.fullName;
9079
9041
  var onChange = React__default['default'].useCallback(function (e) {
9080
9042
  var event = _objectSpread2({}, e);
9081
- event.target.value = shorthand ? "*".concat(shorthand, "*").concat(e.target.value) : e.target.value;
9082
9043
  props.onChange && props.onChange(event);
9083
9044
  }, []);
9084
9045
  return /*#__PURE__*/React__default['default'].createElement("div", {
9085
9046
  className: 'kts-invoice-operate-goods-list-itemName-input'
9086
- }, shorthand && /*#__PURE__*/React__default['default'].createElement("span", {
9047
+ }, props.shorthand && /*#__PURE__*/React__default['default'].createElement("span", {
9087
9048
  style: {
9088
9049
  alignSelf: 'center',
9089
9050
  fontSize: 12
9090
9051
  }
9091
- }, "*", shorthand, "*"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Input, {
9052
+ }, "*", props.shorthand, "*"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Input, {
9092
9053
  style: {
9093
9054
  height: '100%',
9094
9055
  border: 'none'
9095
9056
  },
9096
- value: fullName,
9057
+ value: props.value,
9097
9058
  onChange: onChange
9098
9059
  }));
9099
9060
  }
9100
- /** 提取简称 */
9101
- var getShorthand = function getShorthand(value) {
9102
- if (!value) return {};
9061
+
9062
+ /** 拆分全称加简称 */
9063
+ var getSN = function getSN(value) {
9064
+ if (!value) return undefined;
9103
9065
  var arr = value.match(/\*[^*]+\*/);
9104
- var shorthand = arr ? arr[0].split('*')[1] : '';
9105
- var fullName = shorthand ? value.replace("*".concat(shorthand, "*"), '') : value;
9106
- return {
9107
- shorthand: shorthand,
9108
- fullName: fullName
9109
- };
9066
+ if (arr && arr[0]) {
9067
+ return {
9068
+ shorthand: arr[0].split('*')[1],
9069
+ full: value.replace(arr[0], '')
9070
+ };
9071
+ } else {
9072
+ return {
9073
+ shorthand: undefined,
9074
+ full: value
9075
+ };
9076
+ }
9077
+ };
9078
+ /** 组合全称加简称 */
9079
+ var getItemNameWithShorthand = function getItemNameWithShorthand(value) {
9080
+ if (value.shorthand) {
9081
+ return "*".concat(value.shorthand, "*").concat(value.full);
9082
+ } else {
9083
+ return value.full;
9084
+ }
9110
9085
  };
9111
9086
 
9112
9087
  var useColumns = (function (form) {
@@ -9248,6 +9223,7 @@ var useColumns = (function (form) {
9248
9223
  }()
9249
9224
  }])
9250
9225
  })( /*#__PURE__*/React__default['default'].createElement(ItemNameInput, {
9226
+ shorthand: editGood.shorthand,
9251
9227
  onChange: function onChange() {
9252
9228
  onChangeItemName(controller, form, record);
9253
9229
  }
@@ -9277,8 +9253,14 @@ var useColumns = (function (form) {
9277
9253
  })))));
9278
9254
  } else {
9279
9255
  return /*#__PURE__*/React__default['default'].createElement(MyItemNameDiv, {
9280
- valueT: formatSearch(record.itemNameSelf, searchValue),
9281
- valueF: formatSearch(record.itemName, searchValue),
9256
+ valueT: formatSearch(getItemNameWithShorthand({
9257
+ shorthand: record.shorthand,
9258
+ full: record.itemNameSelf || ''
9259
+ }), searchValue),
9260
+ valueF: formatSearch(getItemNameWithShorthand({
9261
+ shorthand: record.shorthand,
9262
+ full: record.itemName || ''
9263
+ }), searchValue),
9282
9264
  isMyShow: isMyShow
9283
9265
  });
9284
9266
  }
@@ -11899,7 +11881,7 @@ var DrawerBody$2 = function DrawerBody() {
11899
11881
  }
11900
11882
  // 中间数据
11901
11883
  between = _objectSpread2({}, record);
11902
- between.itemName = getItemName$1(record, s.goodsListState.editGood);
11884
+ between.itemName = getItemName(record, s.goodsListState.editGood);
11903
11885
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
11904
11886
  // 设置编辑货物
11905
11887
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
@@ -11954,27 +11936,26 @@ var getPriceExcludeTax = function getPriceExcludeTax(s, record, calculatingDigit
11954
11936
  return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")), calculatingDigits);
11955
11937
  };
11956
11938
  // 获取我方名称
11957
- var getItemName$1 = function getItemName(record, editGood) {
11958
- var _getSN;
11959
- var shorthand;
11960
- shorthand = record.shorthand;
11961
- if (shorthand) {
11962
- return "*".concat(shorthand, "*").concat(record.itemName);
11963
- }
11964
- shorthand = (_getSN = getSN(editGood.itemName)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand;
11965
- if (shorthand) {
11966
- return "*".concat(shorthand, "*").concat(record.itemNameSelf);
11967
- }
11939
+ var getItemName = function getItemName(record, editGood) {
11940
+ // let shorthand;
11941
+ // shorthand = record.shorthand;
11942
+ // if (shorthand) {
11943
+ // return `*${shorthand}*${record.itemName}`;
11944
+ // }
11945
+ // shorthand = getSN(editGood.itemName)?.shorthand;
11946
+ // if (shorthand) {
11947
+ // return `*${shorthand}*${record.itemNameSelf}`;
11948
+ // }
11968
11949
  return record.itemName;
11969
11950
  };
11970
11951
  // 获取他方名称
11971
11952
  var getItemNameOther = function getItemNameOther(record, editGood) {
11972
- if (!editGood.itemName) return editGood.itemName;
11973
- var shorthand;
11974
- shorthand = record.shorthand;
11975
- if (shorthand) {
11976
- return "*".concat(shorthand, "*").concat(record.itemNameSelf);
11977
- }
11953
+ // if (!editGood.itemName) return editGood.itemName;
11954
+ // let shorthand;
11955
+ // shorthand = record.shorthand;
11956
+ // if (shorthand) {
11957
+ // return `*${shorthand}*${record.itemNameSelf}`;
11958
+ // }
11978
11959
  return record.itemName;
11979
11960
  };
11980
11961
 
@@ -12424,8 +12405,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12424
12405
  }); // 赋码
12425
12406
  endowCodeGood.forEach(function (good) {
12426
12407
  if (!good) return;
12427
- good.itemName = setShorthand(good.itemName, values.shorthand);
12428
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
12408
+ good.shorthand = values.shorthand;
12429
12409
  good.taxClassificationCode = values.taxClassificationCode;
12430
12410
  good.taxRate = values.taxRate;
12431
12411
  good.taxFreeType = values.taxFreeType;
@@ -12518,7 +12498,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12518
12498
  name: "shorthand",
12519
12499
  type: "string",
12520
12500
  readOnly: true,
12521
- default: getShorthand$1(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName),
12501
+ default: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.shorthand,
12522
12502
  title: "\u5546\u54C1\u548C\u670D\u52A1\u5206\u7C7B\u7B80\u79F0"
12523
12503
  }), /*#__PURE__*/React__default['default'].createElement(antd.SchemaMarkupField, {
12524
12504
  name: "taxRate",
@@ -12610,16 +12590,6 @@ var components = {
12610
12590
  string: antdComponents.Input,
12611
12591
  number: antdComponents.NumberPicker
12612
12592
  };
12613
- /** 提取简称 */
12614
- var getShorthand$1 = function getShorthand(value) {
12615
- if (!value) return ' ';
12616
- var arr = value.match(/\*[^*]+\*/);
12617
- if (arr) {
12618
- return arr[0].split('*')[1];
12619
- } else {
12620
- return ' ';
12621
- }
12622
- };
12623
12593
 
12624
12594
  function AddComparisonDrawer() {
12625
12595
  var _Form$useForm = ktsXui.Form.useForm(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.1.13",
3
+ "version": "3.1.14",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -64,6 +64,9 @@ export default interface IGood {
64
64
  /** 税收分类编码 */
65
65
  taxClassificationCode?: string;
66
66
 
67
+ /** 商品和服务分类简称 */
68
+ shorthand?: string;
69
+
67
70
  /** 是否享受优惠政策 */
68
71
  favouredPolicyMark?: number;
69
72
 
@@ -44,4 +44,13 @@ export const setShorthand = (name?:string, shorthand?:string) => {
44
44
  if(!sn) return undefined;
45
45
  sn.shorthand = shorthand || '';
46
46
  return getItemName(sn);
47
+ }
48
+
49
+ /** 组合全称加简称 */
50
+ export const getItemNameWithShorthand = (value: ISN) => {
51
+ if (value.shorthand) {
52
+ return `*${value.shorthand}*${value.full}`;
53
+ } else {
54
+ return value.full;
55
+ }
47
56
  }
@@ -8,7 +8,6 @@ import { LineAttributeType } from '../../InvoiceController';
8
8
  import IGood from '../../InvoiceController/InvoiceControllerState/GoodsListState/IGood';
9
9
  import { countTaxAmount } from '../../tools/calculate';
10
10
  import { bytesLnegth, cutStr } from '../../tools/strringFn';
11
- import { setShorthand } from '../../tools/itemName';
12
11
  import {
13
12
  SchemaForm,
14
13
  FormButtonGroup,
@@ -302,9 +301,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
302
301
  endowCodeGood.forEach(good => {
303
302
  if (!good) return;
304
303
 
305
- good.itemName = setShorthand(good.itemName, values.shorthand);
306
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
307
-
304
+ good.shorthand = values.shorthand;
308
305
  good.taxClassificationCode = values.taxClassificationCode;
309
306
  good.taxRate = values.taxRate;
310
307
  good.taxFreeType = values.taxFreeType;
@@ -368,7 +365,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
368
365
  name="shorthand"
369
366
  type="string"
370
367
  readOnly
371
- default={getShorthand(defaultValue?.itemName)}
368
+ default={defaultValue?.shorthand}
372
369
  title="商品和服务分类简称"
373
370
  />
374
371
  <Field
@@ -432,14 +429,3 @@ const components = {
432
429
  string: Input,
433
430
  number: NumberPicker,
434
431
  };
435
-
436
- /** 提取简称 */
437
- const getShorthand = (value?: string) => {
438
- if (!value) return ' ';
439
- const arr = value.match(/\*[^*]+\*/);
440
- if (arr) {
441
- return arr[0].split('*')[1];
442
- } else {
443
- return ' ';
444
- }
445
- };
@@ -7,7 +7,6 @@
7
7
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
8
8
  import InvoiceController, { IGood, LineAttributeType } from '../../../../../InvoiceController';
9
9
  import evaluate from '../../../../../tools/evaluate';
10
- import { getSN, setShorthand } from '../../../../../tools/itemName';
11
10
  import { message } from 'kts-components-antd-x3'
12
11
  import { format2, format15, countTaxAmount, countAmountExcludeTax, countPrice } from '../../../../../tools/calculate';
13
12
  import moment from 'moment';
@@ -501,14 +500,13 @@ export const endowCode = async (controller: InvoiceController, goods: IGood) =>
501
500
  export const onChangeItemName = async (controller: InvoiceController, form: WrappedFormUtils<any>, record: IGood) => {
502
501
  controller.run(async s => {
503
502
  const value = form.getFieldsValue().itemName;
504
- const shorthand = getSN(value)?.shorthand ?? '';
505
503
 
506
504
  if (s.goodsListState.isMyShow) {
507
505
  await controller.setEditGood({ itemNameSelf: value });
508
- record.itemName && await controller.setEditGood({ itemName: setShorthand(record.itemName, shorthand) });
506
+ record.itemName && await controller.setEditGood({ itemName: record.itemName });
509
507
  } else {
510
508
  await controller.setEditGood({ itemName: value });
511
- record.itemNameSelf && await controller.setEditGood({ itemNameSelf: setShorthand(record.itemNameSelf, shorthand) });
509
+ record.itemNameSelf && await controller.setEditGood({ itemNameSelf: record.itemNameSelf });
512
510
  }
513
511
  })
514
512
  }
@@ -16,6 +16,7 @@ import {
16
16
  onChangeTaxRate,
17
17
  onChangeItemName,
18
18
  } from './autoFillFn';
19
+ import { getItemNameWithShorthand } from '../../../../tools/itemName';
19
20
 
20
21
  export default (form: WrappedFormUtils) => {
21
22
  const { getFieldDecorator, getFieldValue } = form;
@@ -106,6 +107,7 @@ export default (form: WrappedFormUtils) => {
106
107
  ]
107
108
  })(
108
109
  <ItemNameInput
110
+ shorthand={editGood.shorthand}
109
111
  onChange={() => {
110
112
  onChangeItemName(controller, form, record);
111
113
  }}
@@ -128,8 +130,8 @@ export default (form: WrappedFormUtils) => {
128
130
  } else {
129
131
  return (
130
132
  <MyItemNameDiv
131
- valueT={formatSearch(record.itemNameSelf, searchValue)}
132
- valueF={formatSearch(record.itemName, searchValue)}
133
+ valueT={formatSearch(getItemNameWithShorthand({shorthand: record.shorthand, full: record.itemNameSelf || ''}), searchValue)}
134
+ valueF={formatSearch(getItemNameWithShorthand({shorthand: record.shorthand, full: record.itemName || ''}), searchValue)}
133
135
  isMyShow={isMyShow}
134
136
  />
135
137
  )
@@ -3,32 +3,17 @@ import { Input } from 'kts-components-antd-x3';
3
3
  import React, { ChangeEvent } from 'react';
4
4
  import './index.less';
5
5
 
6
- export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string }) {
7
-
8
- const { shorthand, fullName } = getShorthand(props.value);
6
+ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, shorthand?: string }) {
9
7
 
10
8
  const onChange = React.useCallback((e: ChangeEvent<HTMLInputElement>) => {
11
9
  const event = { ...e };
12
- event.target.value = shorthand ? `*${shorthand}*${e.target.value}` : e.target.value
13
10
  props.onChange && props.onChange(event);
14
11
  }, [])
15
12
 
16
13
  return (
17
14
  <div className='kts-invoice-operate-goods-list-itemName-input'>
18
- {shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{shorthand}*</span>}
19
- <Input style={{ height: '100%', border: 'none' }} value={fullName} onChange={onChange} />
15
+ {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
16
+ <Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
20
17
  </div>
21
18
  )
22
19
  }
23
-
24
- /** 提取简称 */
25
- const getShorthand = (value?: string) => {
26
- if (!value) return {};
27
- const arr = value.match(/\*[^*]+\*/);
28
-
29
- const shorthand = arr ? arr[0].split('*')[1] : '';
30
- const fullName = shorthand ? value.replace(`*${shorthand}*`, '') : value;
31
-
32
- return { shorthand, fullName }
33
- };
34
-
@@ -3,7 +3,6 @@ import { Drawer, Table } from 'kts-components-antd-x3';
3
3
  import Invoice from '../../';
4
4
  import { updateUnitPriceExcludingTax, updateUnitPriceTax, dutyFree, format15 } from '../GoodsList/hook/useColumns/autoFillFn';
5
5
  import { countAmountIncludeTax } from '../../tools/calculate'
6
- import { getSN } from '../../tools/itemName'
7
6
  import { IGood } from '../../InvoiceController';
8
7
  import evaluate from '../../tools/evaluate';
9
8
 
@@ -115,7 +114,6 @@ const DrawerBody = () => {
115
114
  }
116
115
 
117
116
  s.goodsListState.importGoods.isVisibleDrawer = false;
118
-
119
117
  s.goodsListState.isTaxIncluded
120
118
  ? updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
121
119
  : updateUnitPriceTax(controller, s.goodsListState.form, record)
@@ -145,31 +143,31 @@ const getPriceExcludeTax = (s: IGood, record: any, calculatingDigits?: number) =
145
143
  // 获取我方名称
146
144
  const getItemName = (record: any, editGood: IGood) => {
147
145
 
148
- let shorthand;
146
+ // let shorthand;
149
147
 
150
- shorthand = record.shorthand;
151
- if (shorthand) {
152
- return `*${shorthand}*${record.itemName}`;
153
- }
148
+ // shorthand = record.shorthand;
149
+ // if (shorthand) {
150
+ // return `*${shorthand}*${record.itemName}`;
151
+ // }
154
152
 
155
- shorthand = getSN(editGood.itemName)?.shorthand;
156
- if (shorthand) {
157
- return `*${shorthand}*${record.itemNameSelf}`;
158
- }
153
+ // shorthand = getSN(editGood.itemName)?.shorthand;
154
+ // if (shorthand) {
155
+ // return `*${shorthand}*${record.itemNameSelf}`;
156
+ // }
159
157
 
160
158
  return record.itemName;
161
159
  }
162
160
 
163
161
  // 获取他方名称
164
162
  const getItemNameOther = (record: any, editGood: IGood) => {
165
- if (!editGood.itemName) return editGood.itemName;
163
+ // if (!editGood.itemName) return editGood.itemName;
166
164
 
167
- let shorthand;
165
+ // let shorthand;
168
166
 
169
- shorthand = record.shorthand;
170
- if (shorthand) {
171
- return `*${shorthand}*${record.itemNameSelf}`;
172
- }
167
+ // shorthand = record.shorthand;
168
+ // if (shorthand) {
169
+ // return `*${shorthand}*${record.itemNameSelf}`;
170
+ // }
173
171
 
174
172
  return record.itemName;
175
173
  }