kts-component-invoice-operate 3.2.248 → 3.2.249

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
@@ -10294,7 +10294,8 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10294
10294
  between.lineAmountIncludeTax = record.lineAmountIncludeTax;
10295
10295
  between.lineAmountExcludeTax = record.lineAmountExcludeTax;
10296
10296
  between.taxRate = record.taxRate;
10297
- between.taxAmount = record.taxAmount; // 设置编辑货物
10297
+ between.taxAmount = record.taxAmount;
10298
+ between.mtzlDm = undefined; // 设置编辑货物
10298
10299
 
10299
10300
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
10300
10301
 
@@ -10325,22 +10326,41 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10325
10326
 
10326
10327
 
10327
10328
  if (!s.goodsListState.isTaxIncluded) {
10328
- _context.next = 29;
10329
+ _context.next = 30;
10329
10330
  break;
10330
10331
  }
10331
10332
 
10332
- _context.next = 27;
10333
+ _context.next = 28;
10333
10334
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
10334
10335
 
10335
- case 27:
10336
- _context.next = 31;
10336
+ case 28:
10337
+ _context.next = 32;
10337
10338
  break;
10338
10339
 
10339
- case 29:
10340
- _context.next = 31;
10340
+ case 30:
10341
+ _context.next = 32;
10341
10342
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
10342
10343
 
10343
- case 31:
10344
+ case 32:
10345
+ if (!s.goodsListState.isValidateMeiTan) {
10346
+ _context.next = 38;
10347
+ break;
10348
+ }
10349
+
10350
+ _context.next = 35;
10351
+ return s.goodsListState.verifyMeiTanFn(record);
10352
+
10353
+ case 35:
10354
+ _context.t0 = _context.sent;
10355
+
10356
+ if (!(_context.t0 === true)) {
10357
+ _context.next = 38;
10358
+ break;
10359
+ }
10360
+
10361
+ s.goodsListState.meiTanGoodIndex = [editGood.$index];
10362
+
10363
+ case 38:
10344
10364
  case "end":
10345
10365
  return _context.stop();
10346
10366
  }
@@ -31279,7 +31299,12 @@ var MeiTanModal = (function () {
31279
31299
  var _React$useState = React.useState(null),
31280
31300
  _React$useState2 = _slicedToArray(_React$useState, 2),
31281
31301
  mainOption = _React$useState2[0],
31282
- setMainOption = _React$useState2[1]; // 监听煤炭种类变化
31302
+ setMainOption = _React$useState2[1];
31303
+
31304
+ var _React$useState3 = React.useState(null),
31305
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
31306
+ subOption = _React$useState4[0],
31307
+ setSubOption = _React$useState4[1]; // 监听煤炭种类变化
31283
31308
 
31284
31309
 
31285
31310
  var mtzlDm = Form$2.useWatch('mtzlDm', form);
@@ -31298,8 +31323,9 @@ var MeiTanModal = (function () {
31298
31323
  mtzlDm: undefined
31299
31324
  });
31300
31325
  setMainOption(null);
31326
+ setSubOption(null);
31301
31327
 
31302
- case 3:
31328
+ case 4:
31303
31329
  case "end":
31304
31330
  return _context.stop();
31305
31331
  }
@@ -31319,7 +31345,7 @@ var MeiTanModal = (function () {
31319
31345
 
31320
31346
 
31321
31347
  var onFinish = function onFinish(values) {
31322
- console.log('煤炭种类:', values);
31348
+ // console.log('煤炭种类:', values);
31323
31349
  controller.pipeline( /*#__PURE__*/function () {
31324
31350
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
31325
31351
  var _s$goodsListState$mei;
@@ -31329,7 +31355,9 @@ var MeiTanModal = (function () {
31329
31355
  while (1) {
31330
31356
  switch (_context2.prev = _context2.next) {
31331
31357
  case 0:
31332
- mtzl = values.mtzlDm;
31358
+ mtzl = subOption || mainOption || undefined; //values.mtzlDm;
31359
+
31360
+ console.log('煤炭种类', mtzl);
31333
31361
  goods = ((_s$goodsListState$mei = s.goodsListState.meiTanGoodIndex) === null || _s$goodsListState$mei === void 0 ? void 0 : _s$goodsListState$mei.map(function (e) {
31334
31362
  return s.goodsListState.goodsMap.get(e);
31335
31363
  })) || [];
@@ -31350,7 +31378,7 @@ var MeiTanModal = (function () {
31350
31378
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
31351
31379
  onClose();
31352
31380
 
31353
- case 7:
31381
+ case 8:
31354
31382
  case "end":
31355
31383
  return _context2.stop();
31356
31384
  }
@@ -31372,7 +31400,7 @@ var MeiTanModal = (function () {
31372
31400
  return Promise.reject(new Error('请选择选项')); // callback('请选择选项');
31373
31401
  }
31374
31402
 
31375
- if (value === '0200') {
31403
+ if (value === '0200' && !subOption) {
31376
31404
  return Promise.reject(new Error('请选择长协煤的子选项'));
31377
31405
  }
31378
31406
 
@@ -31383,17 +31411,18 @@ var MeiTanModal = (function () {
31383
31411
  var value = e.target.value;
31384
31412
  setMainOption(value);
31385
31413
 
31386
- if (value === 'A' || value === 'C') {
31387
- form.setFieldsValue({
31388
- mtzlDm: value
31389
- });
31390
- } else if (value === 'B') {
31391
- form.setFieldsValue({
31392
- mtzlDm: undefined
31393
- }); // 清空option,等待选择子选项
31414
+ if (value === '0100' || value === '0300') {
31415
+ //form.setFieldsValue({ mtzlDm: value });
31416
+ setSubOption(null);
31394
31417
  }
31395
31418
  };
31396
31419
 
31420
+ var handleSubOptionChange = function handleSubOptionChange(e) {
31421
+ var value = e.target.value;
31422
+ setSubOption(value);
31423
+ form.validateFields();
31424
+ };
31425
+
31397
31426
  return /*#__PURE__*/React.createElement(Modal$2, {
31398
31427
  title: "\u6E29\u99A8\u63D0\u793A",
31399
31428
  destroyOnClose: true,
@@ -31457,12 +31486,8 @@ var MeiTanModal = (function () {
31457
31486
  color: 'red'
31458
31487
  }
31459
31488
  }, "*"), "\u8BF7\u9009\u62E9\u534F\u8BAE\u671F\u9650\uFF1A"), /*#__PURE__*/React.createElement(Radio$1.Group, {
31460
- value: mtzlDm,
31461
- onChange: function onChange(e) {
31462
- return form.setFieldsValue({
31463
- mtzlDm: e.target.value
31464
- });
31465
- }
31489
+ value: subOption,
31490
+ onChange: handleSubOptionChange
31466
31491
  }, /*#__PURE__*/React.createElement(Space$1, {
31467
31492
  direction: "vertical"
31468
31493
  }, /*#__PURE__*/React.createElement(Radio$1, {
package/dist/index.js CHANGED
@@ -10304,7 +10304,8 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10304
10304
  between.lineAmountIncludeTax = record.lineAmountIncludeTax;
10305
10305
  between.lineAmountExcludeTax = record.lineAmountExcludeTax;
10306
10306
  between.taxRate = record.taxRate;
10307
- between.taxAmount = record.taxAmount; // 设置编辑货物
10307
+ between.taxAmount = record.taxAmount;
10308
+ between.mtzlDm = undefined; // 设置编辑货物
10308
10309
 
10309
10310
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
10310
10311
 
@@ -10335,22 +10336,41 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10335
10336
 
10336
10337
 
10337
10338
  if (!s.goodsListState.isTaxIncluded) {
10338
- _context.next = 29;
10339
+ _context.next = 30;
10339
10340
  break;
10340
10341
  }
10341
10342
 
10342
- _context.next = 27;
10343
+ _context.next = 28;
10343
10344
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
10344
10345
 
10345
- case 27:
10346
- _context.next = 31;
10346
+ case 28:
10347
+ _context.next = 32;
10347
10348
  break;
10348
10349
 
10349
- case 29:
10350
- _context.next = 31;
10350
+ case 30:
10351
+ _context.next = 32;
10351
10352
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
10352
10353
 
10353
- case 31:
10354
+ case 32:
10355
+ if (!s.goodsListState.isValidateMeiTan) {
10356
+ _context.next = 38;
10357
+ break;
10358
+ }
10359
+
10360
+ _context.next = 35;
10361
+ return s.goodsListState.verifyMeiTanFn(record);
10362
+
10363
+ case 35:
10364
+ _context.t0 = _context.sent;
10365
+
10366
+ if (!(_context.t0 === true)) {
10367
+ _context.next = 38;
10368
+ break;
10369
+ }
10370
+
10371
+ s.goodsListState.meiTanGoodIndex = [editGood.$index];
10372
+
10373
+ case 38:
10354
10374
  case "end":
10355
10375
  return _context.stop();
10356
10376
  }
@@ -31289,7 +31309,12 @@ var MeiTanModal = (function () {
31289
31309
  var _React$useState = React__default['default'].useState(null),
31290
31310
  _React$useState2 = _slicedToArray(_React$useState, 2),
31291
31311
  mainOption = _React$useState2[0],
31292
- setMainOption = _React$useState2[1]; // 监听煤炭种类变化
31312
+ setMainOption = _React$useState2[1];
31313
+
31314
+ var _React$useState3 = React__default['default'].useState(null),
31315
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
31316
+ subOption = _React$useState4[0],
31317
+ setSubOption = _React$useState4[1]; // 监听煤炭种类变化
31293
31318
 
31294
31319
 
31295
31320
  var mtzlDm = ktsComponentsAntdX4.Form.useWatch('mtzlDm', form);
@@ -31308,8 +31333,9 @@ var MeiTanModal = (function () {
31308
31333
  mtzlDm: undefined
31309
31334
  });
31310
31335
  setMainOption(null);
31336
+ setSubOption(null);
31311
31337
 
31312
- case 3:
31338
+ case 4:
31313
31339
  case "end":
31314
31340
  return _context.stop();
31315
31341
  }
@@ -31329,7 +31355,7 @@ var MeiTanModal = (function () {
31329
31355
 
31330
31356
 
31331
31357
  var onFinish = function onFinish(values) {
31332
- console.log('煤炭种类:', values);
31358
+ // console.log('煤炭种类:', values);
31333
31359
  controller.pipeline( /*#__PURE__*/function () {
31334
31360
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
31335
31361
  var _s$goodsListState$mei;
@@ -31339,7 +31365,9 @@ var MeiTanModal = (function () {
31339
31365
  while (1) {
31340
31366
  switch (_context2.prev = _context2.next) {
31341
31367
  case 0:
31342
- mtzl = values.mtzlDm;
31368
+ mtzl = subOption || mainOption || undefined; //values.mtzlDm;
31369
+
31370
+ console.log('煤炭种类', mtzl);
31343
31371
  goods = ((_s$goodsListState$mei = s.goodsListState.meiTanGoodIndex) === null || _s$goodsListState$mei === void 0 ? void 0 : _s$goodsListState$mei.map(function (e) {
31344
31372
  return s.goodsListState.goodsMap.get(e);
31345
31373
  })) || [];
@@ -31360,7 +31388,7 @@ var MeiTanModal = (function () {
31360
31388
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
31361
31389
  onClose();
31362
31390
 
31363
- case 7:
31391
+ case 8:
31364
31392
  case "end":
31365
31393
  return _context2.stop();
31366
31394
  }
@@ -31382,7 +31410,7 @@ var MeiTanModal = (function () {
31382
31410
  return Promise.reject(new Error('请选择选项')); // callback('请选择选项');
31383
31411
  }
31384
31412
 
31385
- if (value === '0200') {
31413
+ if (value === '0200' && !subOption) {
31386
31414
  return Promise.reject(new Error('请选择长协煤的子选项'));
31387
31415
  }
31388
31416
 
@@ -31393,17 +31421,18 @@ var MeiTanModal = (function () {
31393
31421
  var value = e.target.value;
31394
31422
  setMainOption(value);
31395
31423
 
31396
- if (value === 'A' || value === 'C') {
31397
- form.setFieldsValue({
31398
- mtzlDm: value
31399
- });
31400
- } else if (value === 'B') {
31401
- form.setFieldsValue({
31402
- mtzlDm: undefined
31403
- }); // 清空option,等待选择子选项
31424
+ if (value === '0100' || value === '0300') {
31425
+ //form.setFieldsValue({ mtzlDm: value });
31426
+ setSubOption(null);
31404
31427
  }
31405
31428
  };
31406
31429
 
31430
+ var handleSubOptionChange = function handleSubOptionChange(e) {
31431
+ var value = e.target.value;
31432
+ setSubOption(value);
31433
+ form.validateFields();
31434
+ };
31435
+
31407
31436
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX4.Modal, {
31408
31437
  title: "\u6E29\u99A8\u63D0\u793A",
31409
31438
  destroyOnClose: true,
@@ -31467,12 +31496,8 @@ var MeiTanModal = (function () {
31467
31496
  color: 'red'
31468
31497
  }
31469
31498
  }, "*"), "\u8BF7\u9009\u62E9\u534F\u8BAE\u671F\u9650\uFF1A"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX4.Radio.Group, {
31470
- value: mtzlDm,
31471
- onChange: function onChange(e) {
31472
- return form.setFieldsValue({
31473
- mtzlDm: e.target.value
31474
- });
31475
- }
31499
+ value: subOption,
31500
+ onChange: handleSubOptionChange
31476
31501
  }, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX4.Space, {
31477
31502
  direction: "vertical"
31478
31503
  }, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX4.Radio, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.248",
3
+ "version": "3.2.249",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -76,6 +76,48 @@ class MyInvoiceController extends InvoiceController {
76
76
  this.state.autoComplete.onItemNameSearch = async (value: any) => {
77
77
  console.log('===> onItemNameSearch')
78
78
  const data = [
79
+ {
80
+ "attributeVOList": null,
81
+ "productName": '原煤',
82
+ "brandName": null,
83
+ "buyGroupCode": null,
84
+ "buyGroupId": null,
85
+ "buyGroupName": null,
86
+ "categoryId": 2073,
87
+ "categoryName": "通用",
88
+ "companyId": "41daec4c-baa2-451f-b756-e26067b8657c",
89
+ "createTime": "2021-09-10 15:45:43.0",
90
+ "enjoyPreferentialPolicies": 0,
91
+ "factoryCode": null,
92
+ "factoryId": null,
93
+ "factoryName": null,
94
+ "id": 146200,
95
+ "internalNumber": "发动机盖",
96
+ "isUalityInspection": null,
97
+ "name": "原煤",
98
+ "preferentialPoliciesType": null,
99
+ "priceAmount": 50,
100
+ "procurementCycle": 0,
101
+ "shorthand": "发动机",
102
+ "specification": "abc",
103
+ "spuCode": "6000001738252675",
104
+ "status": 1,
105
+ "taxCategoryCode": "1020101000000000000",
106
+ "taxExemptionType": "",
107
+ "taxId": 11,
108
+ "taxRate": null,
109
+ "unitId": 30,
110
+ "unitName": "件",
111
+ "itemType": "通用",
112
+ "itemNo": "6000001738252675",
113
+ "itemName": "原煤",
114
+ "itemCode": "123123",
115
+ "itemModelName": "abc",
116
+ "unit": "件",
117
+ "priceIncludeTax": 50,
118
+ "priceExcludeTax": 50,
119
+ "taxClassificationCode": "1020101000000000000"
120
+ },
79
121
  {
80
122
  "taxCategoryCode": "1090111090000000000",
81
123
  "productName": "uuuuuu",
@@ -6,7 +6,7 @@ import { countAmountIncludeTax } from '../../tools/calculate';
6
6
  /**
7
7
  * 删除一个货物
8
8
  */
9
- export default async (s: InvoiceControllerState, record: any, controller:any) => {
9
+ export default async (s: InvoiceControllerState, record: any, controller: any) => {
10
10
  Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
11
11
 
12
12
  // 没用 被编辑的货物 和 form 就退出
@@ -18,7 +18,7 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
18
18
  record.lineAmountIncludeTax = undefined;
19
19
 
20
20
  // 中间数据
21
- const between: any = {...record };
21
+ const between: any = { ...record };
22
22
 
23
23
  between.itemCode = record.itemCode;
24
24
  between.shorthand = record.shorthand;
@@ -32,6 +32,7 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
32
32
  between.lineAmountExcludeTax = record.lineAmountExcludeTax;
33
33
  between.taxRate = record.taxRate;
34
34
  between.taxAmount = record.taxAmount;
35
+ between.mtzlDm = undefined;
35
36
 
36
37
  // 设置编辑货物
37
38
  const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
@@ -68,6 +69,12 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
68
69
  s.goodsListState.isTaxIncluded
69
70
  ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
70
71
  : await updateUnitPriceTax(controller, s.goodsListState.form, record)
72
+
73
+ if (s.goodsListState.isValidateMeiTan) {
74
+ if (await s.goodsListState.verifyMeiTanFn(record) === true) {
75
+ s.goodsListState.meiTanGoodIndex = [editGood.$index];
76
+ }
77
+ }
71
78
  }
72
79
 
73
80
  /** 货物单价,不含税 */
@@ -28,39 +28,39 @@ class MyInvoiceController extends InvoiceController {
28
28
  this.state.autoComplete.onItemNameBlur = async (value: any) => {
29
29
  console.log(value, 'onBuyerNameBlur - Blur');
30
30
 
31
- return new Promise((resolve, reject)=> {
32
- resolve([
33
- {
34
- "taxCategoryCode": "1030206030000000000",
35
- "productName": "醋及醋代用品",
36
- "shorthand": "调味品",
37
- "id": null,
38
- "specification": null,
39
- "createTime": null,
40
- "status": 1,
41
- "versionCode": "48.0",
42
- "version": "32.0",
43
- "startTime": "20190401",
44
- "endTime": null,
45
- "cargo": null,
46
- "desc": null,
47
- "taxRate": "13%",
48
- "keyword": "食醋、米醋、酒醋、啤酒醋、麦芽醋、酒精醋、水果醋、醋精",
49
- "summarizedItem": "N",
50
- "countCode": null,
51
- "customsItem": null,
52
- "updateTime": null,
53
- "hzx": null,
54
- "children": null,
55
- "vatspecialManagement": "",
56
- "pid": "1030206000000000000",
57
- "vatpolicyBasis": null,
58
- "vatspecialManagementCode": "",
59
- "gstpolicyBasisCode": null,
60
- "gstspecialManagement": null,
61
- "gstpolicyBasis": null
62
- }
63
- ]);
31
+ return new Promise((resolve, reject) => {
32
+ resolve([
33
+ {
34
+ "taxCategoryCode": "1030206030000000000",
35
+ "productName": "醋及醋代用品",
36
+ "shorthand": "调味品",
37
+ "id": null,
38
+ "specification": null,
39
+ "createTime": null,
40
+ "status": 1,
41
+ "versionCode": "48.0",
42
+ "version": "32.0",
43
+ "startTime": "20190401",
44
+ "endTime": null,
45
+ "cargo": null,
46
+ "desc": null,
47
+ "taxRate": "13%",
48
+ "keyword": "食醋、米醋、酒醋、啤酒醋、麦芽醋、酒精醋、水果醋、醋精",
49
+ "summarizedItem": "N",
50
+ "countCode": null,
51
+ "customsItem": null,
52
+ "updateTime": null,
53
+ "hzx": null,
54
+ "children": null,
55
+ "vatspecialManagement": "",
56
+ "pid": "1030206000000000000",
57
+ "vatpolicyBasis": null,
58
+ "vatspecialManagementCode": "",
59
+ "gstpolicyBasisCode": null,
60
+ "gstspecialManagement": null,
61
+ "gstpolicyBasis": null
62
+ }
63
+ ]);
64
64
 
65
65
  });
66
66
  //
@@ -127,19 +127,74 @@ class MyInvoiceController extends InvoiceController {
127
127
  "specialGoodsMark": "",
128
128
  "createTime": "2023-03-22 17:09:32",
129
129
  "updateTime": "2023-03-22 17:09:32"
130
- }
130
+ },
131
+ {
132
+ "attributeVOList": null,
133
+ "productName": '原煤',
134
+ "name": null,
135
+ "productCode": "0003",
136
+ "shorthand": "小型起重设备",
137
+ "id": "10881474649024102400167947617243",
138
+ "specification": null,
139
+ "categoryId": "10688389540499947520167487266471",
140
+ "categoryName": "水果",
141
+ "internalNumber": null,
142
+ "taxCategoryName": "轻小型起重设备配套件",
143
+ "referenceAmount": null,
144
+ "priceAmount": 200.000,
145
+ "taxId": null,
146
+ "taxRate": null,
147
+ "brandName": null,
148
+ "buyGroupCode": null,
149
+ "buyGroupId": null,
150
+ "buyGroupName": null,
151
+ "categoryId": 2073,
152
+ "categoryName": "通用",
153
+ "companyId": "41daec4c-baa2-451f-b756-e26067b8657c",
154
+ "createTime": "2021-09-10 15:45:43.0",
155
+ "enjoyPreferentialPolicies": 0,
156
+ "factoryCode": null,
157
+ "factoryId": null,
158
+ "factoryName": null,
159
+ "id": 146200,
160
+ "internalNumber": "发动机盖",
161
+ "isUalityInspection": null,
162
+ "name": "原煤",
163
+ "preferentialPoliciesType": null,
164
+ "priceAmount": 50,
165
+ "procurementCycle": 0,
166
+ "shorthand": "煤炭",
167
+ "specification": "abc",
168
+ "spuCode": "6000001738252675",
169
+ "status": 1,
170
+ "taxCategoryCode": "1020101000000000000",
171
+ "taxExemptionType": "",
172
+ "taxId": 11,
173
+ "taxRate": null,
174
+ "unitId": 30,
175
+ "unitName": "件",
176
+ "itemType": "通用",
177
+ "itemNo": "6000001738252675",
178
+ "itemName": "原煤",
179
+ "itemCode": "123123",
180
+ "itemModelName": "abc",
181
+ "unit": "件",
182
+ "priceIncludeTax": 50,
183
+ "priceExcludeTax": 50,
184
+ "taxClassificationCode": "1020101000000000000"
185
+ },
131
186
  ];
132
187
 
133
- return data.map((item: any) =>{
188
+ return data.map((item: any) => {
134
189
  return {
135
190
  ...data,
136
- itemName:item.productName,
137
- taxClassificationCode:item.taxCategoryCode,
138
- itemModelName:item.specification,
139
- shorthand:item.shorthand,
140
- priceIncludeTax:item.priceAmount,
141
- unit:item.unitName,
142
- taxRate:item.taxRate,
191
+ itemName: item.productName,
192
+ taxClassificationCode: item.taxCategoryCode,
193
+ itemModelName: item.specification,
194
+ shorthand: item.shorthand,
195
+ priceIncludeTax: item.priceAmount,
196
+ unit: item.unitName,
197
+ taxRate: item.taxRate,
143
198
  }
144
199
  })
145
200
  };
@@ -147,7 +202,7 @@ class MyInvoiceController extends InvoiceController {
147
202
  this.state.goodsListState.endowCode.onSearchTaxClassificationCode = async (value: any) => {
148
203
  console.log(value, 'value-onSearchTaxClassificationCode');
149
204
 
150
- if(value === '1020199000000000000') {
205
+ if (value === '1020199000000000000') {
151
206
  return [
152
207
  {
153
208
  "taxCategoryCode": "1020199000000000000",
@@ -217,7 +272,7 @@ class MyInvoiceController extends InvoiceController {
217
272
 
218
273
  this.state.goodsListState.endowCode.onLoadTaxClassificationCode = async (value: any) => {
219
274
  console.log(value, 'value-onSearchTaxClassificationCode');
220
- if(value === '1020199000000000000') {
275
+ if (value === '1020199000000000000') {
221
276
  return [
222
277
  {
223
278
  "taxCategoryCode": "1020199000000000000",
@@ -251,7 +306,7 @@ class MyInvoiceController extends InvoiceController {
251
306
  },
252
307
  ]
253
308
  }
254
- if(value === '3000000000000000000') {
309
+ if (value === '3000000000000000000') {
255
310
  return [
256
311
  {
257
312
  "taxCategoryCode": "3060000000000000000",
@@ -464,7 +519,7 @@ class MyInvoiceController extends InvoiceController {
464
519
  "gstpolicyBasis": null
465
520
  }
466
521
  ]
467
- } else if(value === '3060000000000000000') {
522
+ } else if (value === '3060000000000000000') {
468
523
  return [
469
524
  {
470
525
  "taxCategoryCode": "3060100000000000000",
@@ -587,7 +642,7 @@ class MyInvoiceController extends InvoiceController {
587
642
  "gstpolicyBasis": null
588
643
  }
589
644
  ]
590
- }else {
645
+ } else {
591
646
  return [
592
647
  {
593
648
  "taxCategoryCode": "3000000000000000000",
@@ -929,7 +984,7 @@ const getMok = async (current: number = 1) => {
929
984
  "taxCategoryCode": "1010301010000000000",
930
985
  "taxExemptionType": "1",
931
986
  "taxId": 1,
932
- "taxRate":null,
987
+ "taxRate": null,
933
988
  "unitId": null,
934
989
  "unitName": null,
935
990
  "itemType": "通用",
@@ -969,7 +1024,7 @@ const getMok = async (current: number = 1) => {
969
1024
  "taxCategoryCode": null,
970
1025
  "taxExemptionType": null,
971
1026
  "taxId": null,
972
- "taxRate":null,
1027
+ "taxRate": null,
973
1028
  "unitId": 362,
974
1029
  "unitName": "年",
975
1030
  "itemType": "分类cc>1",
@@ -1009,7 +1064,7 @@ const getMok = async (current: number = 1) => {
1009
1064
  "taxCategoryCode": "1060301020100000000",
1010
1065
  "taxExemptionType": null,
1011
1066
  "taxId": null,
1012
- "taxRate":null,
1067
+ "taxRate": null,
1013
1068
  "unitId": null,
1014
1069
  "unitName": null,
1015
1070
  "itemType": "通用",
@@ -1049,7 +1104,7 @@ const getMok = async (current: number = 1) => {
1049
1104
  "taxCategoryCode": "1010107010000000000",
1050
1105
  "taxExemptionType": "3",
1051
1106
  "taxId": 1,
1052
- "taxRate":null,
1107
+ "taxRate": null,
1053
1108
  "unitId": 32,
1054
1109
  "unitName": "把",
1055
1110
  "itemType": "通用",
@@ -1089,7 +1144,7 @@ const getMok = async (current: number = 1) => {
1089
1144
  "taxCategoryCode": "1000000000000000000",
1090
1145
  "taxExemptionType": null,
1091
1146
  "taxId": null,
1092
- "taxRate":null,
1147
+ "taxRate": null,
1093
1148
  "unitId": 11,
1094
1149
  "unitName": "包",
1095
1150
  "itemType": "通用",
@@ -1129,7 +1184,7 @@ const getMok = async (current: number = 1) => {
1129
1184
  "taxCategoryCode": "233WD5FG00911",
1130
1185
  "taxExemptionType": null,
1131
1186
  "taxId": null,
1132
- "taxRate":null,
1187
+ "taxRate": null,
1133
1188
  "unitId": 11,
1134
1189
  "unitName": "包",
1135
1190
  "itemType": "通用",
@@ -1169,7 +1224,7 @@ const getMok = async (current: number = 1) => {
1169
1224
  "taxCategoryCode": "233WD5FG00911",
1170
1225
  "taxExemptionType": null,
1171
1226
  "taxId": null,
1172
- "taxRate":null,
1227
+ "taxRate": null,
1173
1228
  "unitId": 11,
1174
1229
  "unitName": "包",
1175
1230
  "itemType": "通用",
@@ -1209,7 +1264,7 @@ const getMok = async (current: number = 1) => {
1209
1264
  "taxCategoryCode": "233WD5FG00911",
1210
1265
  "taxExemptionType": null,
1211
1266
  "taxId": null,
1212
- "taxRate":null,
1267
+ "taxRate": null,
1213
1268
  "unitId": 11,
1214
1269
  "unitName": "包",
1215
1270
  "itemType": "通用",
@@ -12,6 +12,7 @@ export default () => {
12
12
  const [form] = Form.useForm();
13
13
 
14
14
  const [mainOption, setMainOption] = React.useState(null);
15
+ const [subOption, setSubOption] = React.useState(null);
15
16
  // 监听煤炭种类变化
16
17
  const mtzlDm = Form.useWatch('mtzlDm', form);
17
18
 
@@ -22,6 +23,7 @@ export default () => {
22
23
  s.goodsListState.meiTanGoodIndex = [];
23
24
  form.setFieldsValue({ mtzlDm: undefined });
24
25
  setMainOption(null);
26
+ setSubOption(null);
25
27
  })();
26
28
  }, [controller]);
27
29
 
@@ -32,10 +34,11 @@ export default () => {
32
34
 
33
35
  // 表单
34
36
  const onFinish = (values: any) => {
35
- console.log('煤炭种类:', values);
37
+ // console.log('煤炭种类:', values);
36
38
 
37
39
  controller.pipeline(async (s) => {
38
- const mtzl = values.mtzlDm;
40
+ const mtzl = subOption || mainOption || undefined; //values.mtzlDm;
41
+ console.log('煤炭种类', mtzl)
39
42
  const goods = s.goodsListState.meiTanGoodIndex?.map(e => s.goodsListState.goodsMap.get(e)) || [];
40
43
  const editGood = s.goodsListState.editGood;
41
44
  const editGoodIndex = editGood?.$index;
@@ -55,14 +58,14 @@ export default () => {
55
58
  };
56
59
 
57
60
  // 自定义校验规则
58
- const validateOption = (_:any, value: any, callback: any) => {
61
+ const validateOption = (_: any, value: any, callback: any) => {
59
62
  console.log('自定义校验规则:', value);
60
63
  if (!value) {
61
64
  return Promise.reject(new Error('请选择选项'));
62
65
  // callback('请选择选项');
63
66
  }
64
67
 
65
- if (value === '0200') {
68
+ if (value === '0200' && !subOption) {
66
69
  return Promise.reject(new Error('请选择长协煤的子选项'));
67
70
  }
68
71
 
@@ -72,13 +75,21 @@ export default () => {
72
75
  const handleMainOptionChange = (e: any) => {
73
76
  const value = e.target.value;
74
77
  setMainOption(value);
75
- if (value === 'A' || value === 'C') {
76
- form.setFieldsValue({ mtzlDm: value });
77
- } else if (value === 'B') {
78
- form.setFieldsValue({ mtzlDm: undefined }); // 清空option,等待选择子选项
78
+ if (value === '0100' || value === '0300') {
79
+ //form.setFieldsValue({ mtzlDm: value });
80
+ setSubOption(null);
81
+ } else if (value === '0200') {
82
+ //form.setFieldsValue({ mtzlDm: undefined }); // 清空option,等待选择子选项
83
+ // setSubOption(null);
79
84
  }
80
85
  };
81
86
 
87
+ const handleSubOptionChange = (e: any) => {
88
+ const value = e.target.value;
89
+ setSubOption(value);
90
+ form.validateFields();
91
+ };
92
+
82
93
  return (
83
94
  <Modal
84
95
  title="温馨提示"
@@ -132,7 +143,7 @@ export default () => {
132
143
  <div style={{ marginBottom: 8, color: '#666', fontSize: 14 }}>
133
144
  <span style={{ color: 'red' }}>*</span>请选择协议期限:
134
145
  </div>
135
- <Radio.Group value={mtzlDm} onChange={(e) => form.setFieldsValue({ mtzlDm: e.target.value })}>
146
+ <Radio.Group value={subOption} onChange={handleSubOptionChange}>
136
147
  <Space direction="vertical">
137
148
  <Radio value="0201">协议期不足半年</Radio>
138
149
  <Radio value="0202">协议期在半年至一年之间</Radio>