kts-component-invoice-operate 3.2.247 → 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.
@@ -58,4 +58,6 @@ export default interface IGood {
58
58
  children?: IGood[];
59
59
  cd?: number;
60
60
  remarks?: string;
61
+ /** 煤炭种类 */
62
+ mtzlDm?: string;
61
63
  }
@@ -93,4 +93,10 @@ export default class GoodsListState {
93
93
  drag: Drag;
94
94
  /** 商品校验是否关闭,默认开启 */
95
95
  isValidateGood: boolean;
96
+ /** 煤炭类校验是否关闭,默认开启 */
97
+ isValidateMeiTan: boolean;
98
+ /** 煤炭种类赋值商品索引 */
99
+ meiTanGoodIndex?: string[];
100
+ /** 煤炭时校验函数 */
101
+ verifyMeiTanFn: (record: any) => Promise<boolean>;
96
102
  }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import './index.less';
3
+ declare const _default: () => JSX.Element;
4
+ export default _default;
package/dist/index.esm.js CHANGED
@@ -8,7 +8,7 @@ import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete
8
8
  import classnames from 'classnames';
9
9
  import { Table } from 'kts-components-antd-x4-v4';
10
10
  import { render } from 'react-dom';
11
- import { DatePicker, Row as Row$1, Col as Col$1, Input as Input$2, Cascader, Select as Select$2 } from 'kts-components-antd-x4';
11
+ import { DatePicker, Row as Row$1, Col as Col$1, Input as Input$2, Cascader, Select as Select$2, Form as Form$2, Modal as Modal$2, Space as Space$1, Radio as Radio$1 } from 'kts-components-antd-x4';
12
12
  import { Input as Input$3, NumberPicker } from '@formily/antd-components';
13
13
  import { createAsyncFormActions, FormEffectHooks, SchemaForm, FormButtonGroup, SchemaMarkupField } from '@formily/antd';
14
14
 
@@ -1176,6 +1176,40 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1176
1176
  this.addComparisonIndex = void 0;
1177
1177
  this.drag = new Drag();
1178
1178
  this.isValidateGood = true;
1179
+ this.isValidateMeiTan = true;
1180
+ this.meiTanGoodIndex = [];
1181
+
1182
+ this.verifyMeiTanFn = /*#__PURE__*/function () {
1183
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record) {
1184
+ var taxClassificationCode;
1185
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1186
+ while (1) {
1187
+ switch (_context.prev = _context.next) {
1188
+ case 0:
1189
+ taxClassificationCode = record.taxClassificationCode;
1190
+
1191
+ if (!(taxClassificationCode === '1020101000000000000' || taxClassificationCode === '1020102000000000000' || taxClassificationCode === '1020199000000000000')) {
1192
+ _context.next = 3;
1193
+ break;
1194
+ }
1195
+
1196
+ return _context.abrupt("return", true);
1197
+
1198
+ case 3:
1199
+ return _context.abrupt("return", false);
1200
+
1201
+ case 4:
1202
+ case "end":
1203
+ return _context.stop();
1204
+ }
1205
+ }
1206
+ }, _callee);
1207
+ }));
1208
+
1209
+ return function (_x) {
1210
+ return _ref.apply(this, arguments);
1211
+ };
1212
+ }();
1179
1213
  });
1180
1214
 
1181
1215
  var FreightListState = /*#__PURE__*/_createClass(function FreightListState() {
@@ -10260,7 +10294,8 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10260
10294
  between.lineAmountIncludeTax = record.lineAmountIncludeTax;
10261
10295
  between.lineAmountExcludeTax = record.lineAmountExcludeTax;
10262
10296
  between.taxRate = record.taxRate;
10263
- between.taxAmount = record.taxAmount; // 设置编辑货物
10297
+ between.taxAmount = record.taxAmount;
10298
+ between.mtzlDm = undefined; // 设置编辑货物
10264
10299
 
10265
10300
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between);
10266
10301
 
@@ -10291,22 +10326,41 @@ var importGoodsDrawer = /*#__PURE__*/(function () {
10291
10326
 
10292
10327
 
10293
10328
  if (!s.goodsListState.isTaxIncluded) {
10294
- _context.next = 29;
10329
+ _context.next = 30;
10295
10330
  break;
10296
10331
  }
10297
10332
 
10298
- _context.next = 27;
10333
+ _context.next = 28;
10299
10334
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
10300
10335
 
10301
- case 27:
10302
- _context.next = 31;
10336
+ case 28:
10337
+ _context.next = 32;
10303
10338
  break;
10304
10339
 
10305
- case 29:
10306
- _context.next = 31;
10340
+ case 30:
10341
+ _context.next = 32;
10307
10342
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
10308
10343
 
10309
- 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:
10310
10364
  case "end":
10311
10365
  return _context.stop();
10312
10366
  }
@@ -29866,7 +29920,8 @@ var DrawerBody$2 = function DrawerBody() {
29866
29920
 
29867
29921
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), {}, {
29868
29922
  itemModelName: undefined,
29869
- itemModelNameSelf: undefined
29923
+ itemModelNameSelf: undefined,
29924
+ mtzlDm: undefined
29870
29925
  }, between);
29871
29926
 
29872
29927
  if (editGood.taxRate) {
@@ -29916,6 +29971,25 @@ var DrawerBody$2 = function DrawerBody() {
29916
29971
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
29917
29972
 
29918
29973
  case 28:
29974
+ if (!s.goodsListState.isValidateMeiTan) {
29975
+ _context2.next = 34;
29976
+ break;
29977
+ }
29978
+
29979
+ _context2.next = 31;
29980
+ return s.goodsListState.verifyMeiTanFn(record);
29981
+
29982
+ case 31:
29983
+ _context2.t1 = _context2.sent;
29984
+
29985
+ if (!(_context2.t1 === true)) {
29986
+ _context2.next = 34;
29987
+ break;
29988
+ }
29989
+
29990
+ s.goodsListState.meiTanGoodIndex = [editGood.$index];
29991
+
29992
+ case 34:
29919
29993
  case "end":
29920
29994
  return _context2.stop();
29921
29995
  }
@@ -30802,7 +30876,9 @@ var DrawerBody$3 = function DrawerBody(props) {
30802
30876
  good.taxRate = values.taxRate;
30803
30877
  good.taxFreeType = values.taxFreeType;
30804
30878
  good.favouredPolicyMark = values.favouredPolicyMark;
30805
- good.favouredPolicyName = values.favouredPolicyName; // 无论是否含税,都保持价税合计不变
30879
+ good.favouredPolicyName = values.favouredPolicyName;
30880
+ good.mtzlDm = undefined; //设置成空
30881
+ // 无论是否含税,都保持价税合计不变
30806
30882
 
30807
30883
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
30808
30884
 
@@ -30817,10 +30893,30 @@ var DrawerBody$3 = function DrawerBody(props) {
30817
30893
 
30818
30894
  good.goodsTaxRateList = goodsTaxRateList;
30819
30895
  });
30820
- s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
30896
+ s.goodsListState.goodsList = s.goodsListState.goodsList.slice(); // 煤炭类判断
30897
+
30898
+ if (!s.goodsListState.isValidateMeiTan) {
30899
+ _context15.next = 9;
30900
+ break;
30901
+ }
30902
+
30903
+ _context15.next = 6;
30904
+ return s.goodsListState.verifyMeiTanFn(values);
30905
+
30906
+ case 6:
30907
+ _context15.t0 = _context15.sent;
30908
+
30909
+ if (!(_context15.t0 === true)) {
30910
+ _context15.next = 9;
30911
+ break;
30912
+ }
30913
+
30914
+ s.goodsListState.meiTanGoodIndex = s.goodsListState.endowCode.endowcodeGoodIndex.slice();
30915
+
30916
+ case 9:
30821
30917
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
30822
30918
 
30823
- case 4:
30919
+ case 10:
30824
30920
  case "end":
30825
30921
  return _context15.stop();
30826
30922
  }
@@ -31190,6 +31286,223 @@ function AddComparisonDrawer() {
31190
31286
  // })
31191
31287
  // }
31192
31288
 
31289
+ var css_248z$A = ".kts-invoice-operate-meitan-modal {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-meitan-modal .kts-invoice-operate-meitan-title {\n line-height: 30px;\n}\n.kts-invoice-operate-meitan-modal .kts-invoice-operate-meitan-title .kts-invoice-operate-meitan-title2 {\n margin-left: 24px;\n}\n.kts-invoice-operate-meitan-modal .kts-invoice-operate-meitan-content {\n margin-top: 20px;\n padding: 20px;\n background-color: #f9fafd;\n}\n.kts-invoice-operate-meitan-modal .kts-invoice-operate-meitan-content .content-item {\n background-color: #fff;\n margin: 20px 24px;\n padding: 20px;\n}\n.kts-invoice-operate-meitan-modal .ktsAntX-space-item {\n margin: 5px 0;\n}\n.kts-invoice-operate-meitan-modal .ktsAntX-form-item-explain {\n margin-top: 20px;\n}\n.kts-invoice-operate-meitan-button {\n display: flex!important;\n justify-content: center;\n align-items: center;\n padding: 2px 20px!important;\n}\n";
31290
+ styleInject(css_248z$A);
31291
+
31292
+ var MeiTanModal = (function () {
31293
+ var controller = Invoice.useInvoiceController();
31294
+
31295
+ var _Form$useForm = Form$2.useForm(),
31296
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
31297
+ form = _Form$useForm2[0];
31298
+
31299
+ var _React$useState = React.useState(null),
31300
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31301
+ mainOption = _React$useState2[0],
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]; // 监听煤炭种类变化
31308
+
31309
+
31310
+ var mtzlDm = Form$2.useWatch('mtzlDm', form);
31311
+ var visible = controller.useMemo(function (s) {
31312
+ return s.goodsListState.meiTanGoodIndex && s.goodsListState.meiTanGoodIndex.length > 0;
31313
+ }, []);
31314
+ var onClose = React.useCallback(function () {
31315
+ controller.pipeline( /*#__PURE__*/function () {
31316
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
31317
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
31318
+ while (1) {
31319
+ switch (_context.prev = _context.next) {
31320
+ case 0:
31321
+ s.goodsListState.meiTanGoodIndex = [];
31322
+ form.setFieldsValue({
31323
+ mtzlDm: undefined
31324
+ });
31325
+ setMainOption(null);
31326
+ setSubOption(null);
31327
+
31328
+ case 4:
31329
+ case "end":
31330
+ return _context.stop();
31331
+ }
31332
+ }
31333
+ }, _callee);
31334
+ }));
31335
+
31336
+ return function (_x) {
31337
+ return _ref.apply(this, arguments);
31338
+ };
31339
+ }())();
31340
+ }, [controller]); // 提交表单
31341
+
31342
+ var onSubmit = function onSubmit() {
31343
+ form.submit();
31344
+ }; // 表单
31345
+
31346
+
31347
+ var onFinish = function onFinish(values) {
31348
+ // console.log('煤炭种类:', values);
31349
+ controller.pipeline( /*#__PURE__*/function () {
31350
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
31351
+ var _s$goodsListState$mei;
31352
+
31353
+ var mtzl, goods, editGood, editGoodIndex;
31354
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
31355
+ while (1) {
31356
+ switch (_context2.prev = _context2.next) {
31357
+ case 0:
31358
+ mtzl = subOption || mainOption || undefined; //values.mtzlDm;
31359
+
31360
+ console.log('煤炭种类', mtzl);
31361
+ goods = ((_s$goodsListState$mei = s.goodsListState.meiTanGoodIndex) === null || _s$goodsListState$mei === void 0 ? void 0 : _s$goodsListState$mei.map(function (e) {
31362
+ return s.goodsListState.goodsMap.get(e);
31363
+ })) || [];
31364
+ editGood = s.goodsListState.editGood;
31365
+ editGoodIndex = editGood === null || editGood === void 0 ? void 0 : editGood.$index;
31366
+ goods.forEach(function (g) {
31367
+ if (!g) return;
31368
+
31369
+ if (g.lineAttribute === LineAttributeType$1.被折扣行 || g.lineAttribute === LineAttributeType$1.正常) {
31370
+ g.mtzlDm = mtzl;
31371
+
31372
+ if (editGood && editGoodIndex === g.$index) {
31373
+ // 编辑行
31374
+ editGood.mtzlDm = mtzl;
31375
+ }
31376
+ }
31377
+ });
31378
+ s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
31379
+ onClose();
31380
+
31381
+ case 8:
31382
+ case "end":
31383
+ return _context2.stop();
31384
+ }
31385
+ }
31386
+ }, _callee2);
31387
+ }));
31388
+
31389
+ return function (_x2) {
31390
+ return _ref2.apply(this, arguments);
31391
+ };
31392
+ }())();
31393
+ }; // 自定义校验规则
31394
+
31395
+
31396
+ var validateOption = function validateOption(_, value, callback) {
31397
+ console.log('自定义校验规则:', value);
31398
+
31399
+ if (!value) {
31400
+ return Promise.reject(new Error('请选择选项')); // callback('请选择选项');
31401
+ }
31402
+
31403
+ if (value === '0200' && !subOption) {
31404
+ return Promise.reject(new Error('请选择长协煤的子选项'));
31405
+ }
31406
+
31407
+ return Promise.resolve();
31408
+ };
31409
+
31410
+ var handleMainOptionChange = function handleMainOptionChange(e) {
31411
+ var value = e.target.value;
31412
+ setMainOption(value);
31413
+
31414
+ if (value === '0100' || value === '0300') {
31415
+ //form.setFieldsValue({ mtzlDm: value });
31416
+ setSubOption(null);
31417
+ }
31418
+ };
31419
+
31420
+ var handleSubOptionChange = function handleSubOptionChange(e) {
31421
+ var value = e.target.value;
31422
+ setSubOption(value);
31423
+ form.validateFields();
31424
+ };
31425
+
31426
+ return /*#__PURE__*/React.createElement(Modal$2, {
31427
+ title: "\u6E29\u99A8\u63D0\u793A",
31428
+ destroyOnClose: true,
31429
+ width: 700,
31430
+ onCancel: onClose,
31431
+ visible: visible,
31432
+ footer: /*#__PURE__*/React.createElement(Space$1, {
31433
+ align: 'end',
31434
+ style: {
31435
+ paddingRight: 20
31436
+ }
31437
+ }, /*#__PURE__*/React.createElement(Button$1, {
31438
+ onClick: onClose,
31439
+ className: 'kts-invoice-operate-meitan-button'
31440
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button$1, {
31441
+ type: "primary",
31442
+ onClick: onSubmit,
31443
+ className: 'kts-invoice-operate-meitan-button'
31444
+ }, "\u786E\u5B9A"))
31445
+ }, /*#__PURE__*/React.createElement("div", {
31446
+ className: 'kts-invoice-operate-meitan-modal'
31447
+ }, /*#__PURE__*/React.createElement("div", {
31448
+ className: 'kts-invoice-operate-meitan-title'
31449
+ }, /*#__PURE__*/React.createElement("div", null, "\u5C0A\u656C\u7684\u7EB3\u7A0E\u4EBA:"), /*#__PURE__*/React.createElement("div", {
31450
+ className: 'kts-invoice-operate-meitan-title2'
31451
+ }, "\u60A8\u9009\u62E9\u4E86\u201C\u7164\u70AD\u201D\u7C7B\u5546\u54C1\u7F16\u7801\uFF0C\u8BF7\u6839\u636E\u771F\u5B9E\u4E1A\u52A1\u60C5\u51B5\u9009\u62E9 \u201C\u7164\u70AD\u79CD\u7C7B\u201D\uFF1A")), /*#__PURE__*/React.createElement("div", {
31452
+ className: 'kts-invoice-operate-meitan-content'
31453
+ }, /*#__PURE__*/React.createElement(Form$2, {
31454
+ form: form,
31455
+ layout: "vertical",
31456
+ initialValues: {
31457
+ mtzlDm: null
31458
+ },
31459
+ onFinish: onFinish
31460
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
31461
+ name: "mtzlDm",
31462
+ label: "",
31463
+ rules: [// { required: true , message: '请选择煤炭种类' },
31464
+ {
31465
+ validator: validateOption
31466
+ }]
31467
+ }, /*#__PURE__*/React.createElement(Radio$1.Group, {
31468
+ value: mainOption,
31469
+ onChange: handleMainOptionChange
31470
+ }, /*#__PURE__*/React.createElement(Space$1, {
31471
+ direction: "vertical"
31472
+ }, /*#__PURE__*/React.createElement(Radio$1, {
31473
+ value: "0100"
31474
+ }, "\u653F\u5E9C\u4FDD\u4F9B\u7164"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Radio$1, {
31475
+ value: "0200"
31476
+ }, "\u957F\u534F\u7164"), mainOption === '0200' && /*#__PURE__*/React.createElement("div", {
31477
+ className: 'content-item'
31478
+ }, /*#__PURE__*/React.createElement("div", {
31479
+ style: {
31480
+ marginBottom: 8,
31481
+ color: '#666',
31482
+ fontSize: 14
31483
+ }
31484
+ }, /*#__PURE__*/React.createElement("span", {
31485
+ style: {
31486
+ color: 'red'
31487
+ }
31488
+ }, "*"), "\u8BF7\u9009\u62E9\u534F\u8BAE\u671F\u9650\uFF1A"), /*#__PURE__*/React.createElement(Radio$1.Group, {
31489
+ value: subOption,
31490
+ onChange: handleSubOptionChange
31491
+ }, /*#__PURE__*/React.createElement(Space$1, {
31492
+ direction: "vertical"
31493
+ }, /*#__PURE__*/React.createElement(Radio$1, {
31494
+ value: "0201"
31495
+ }, "\u534F\u8BAE\u671F\u4E0D\u8DB3\u534A\u5E74"), /*#__PURE__*/React.createElement(Radio$1, {
31496
+ value: "0202"
31497
+ }, "\u534F\u8BAE\u671F\u5728\u534A\u5E74\u81F3\u4E00\u5E74\u4E4B\u95F4"), /*#__PURE__*/React.createElement(Radio$1, {
31498
+ value: "0203"
31499
+ }, "\u534F\u8BAE\u671F\u5728\u4E00\u5E74\u81F3\u4E24\u5E74\u4E4B\u95F4"), /*#__PURE__*/React.createElement(Radio$1, {
31500
+ value: "0204"
31501
+ }, "\u534F\u8BAE\u671F\u5728\u4E24\u5E74\u4EE5\u4E0A"))))), /*#__PURE__*/React.createElement(Radio$1, {
31502
+ value: "0300"
31503
+ }, "\u5E02\u573A\u7164"))))))));
31504
+ });
31505
+
31193
31506
  // const config = {
31194
31507
  // number: 'BigNumber',
31195
31508
  // precision: 64,
@@ -31333,7 +31646,7 @@ var Main$6 = function Main(props) {
31333
31646
  /** 销售方 */
31334
31647
  , props.sign || /*#__PURE__*/React.createElement(Sign, null)
31335
31648
  /** 落款 */
31336
- , props.footExpand), /*#__PURE__*/React.createElement(ImportBuyerDrawer, null), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(AddComparisonDrawer, null));
31649
+ , props.footExpand), /*#__PURE__*/React.createElement(ImportBuyerDrawer, null), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(AddComparisonDrawer, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
31337
31650
  };
31338
31651
  /** 数电 */
31339
31652
 
@@ -31389,11 +31702,11 @@ var Digtal = function Digtal(props) {
31389
31702
  /** 特殊信息 */
31390
31703
  , props.sign || /*#__PURE__*/React.createElement(SignDigtal, null)
31391
31704
  /** 落款 */
31392
- ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null));
31705
+ ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
31393
31706
  };
31394
31707
 
31395
- var css_248z$A = ".taxdetailsbox {\n display: flex;\n justify-content: flex-start;\n flex-direction: row;\n}\n.taxdetailsbox .taxrightbox {\n width: 340px;\n position: absolute;\n right: 30px;\n top: 79px;\n bottom: 50px;\n min-height: 300px;\n}\n.taxdetailsbox .taxrightbox .taxdesc {\n height: calc(100vh - 323px);\n min-height: 105px;\n overflow: auto;\n}\n";
31396
- styleInject(css_248z$A);
31708
+ var css_248z$B = ".taxdetailsbox {\n display: flex;\n justify-content: flex-start;\n flex-direction: row;\n}\n.taxdetailsbox .taxrightbox {\n width: 340px;\n position: absolute;\n right: 30px;\n top: 79px;\n bottom: 50px;\n min-height: 300px;\n}\n.taxdetailsbox .taxrightbox .taxdesc {\n height: calc(100vh - 323px);\n min-height: 105px;\n overflow: auto;\n}\n";
31709
+ styleInject(css_248z$B);
31397
31710
 
31398
31711
  function TaxClassificationModal(props) {
31399
31712
  var _props$info6;