kts-component-invoice-operate 3.2.247 → 3.2.248

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() {
@@ -29866,7 +29900,8 @@ var DrawerBody$2 = function DrawerBody() {
29866
29900
 
29867
29901
  editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), {}, {
29868
29902
  itemModelName: undefined,
29869
- itemModelNameSelf: undefined
29903
+ itemModelNameSelf: undefined,
29904
+ mtzlDm: undefined
29870
29905
  }, between);
29871
29906
 
29872
29907
  if (editGood.taxRate) {
@@ -29916,6 +29951,25 @@ var DrawerBody$2 = function DrawerBody() {
29916
29951
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
29917
29952
 
29918
29953
  case 28:
29954
+ if (!s.goodsListState.isValidateMeiTan) {
29955
+ _context2.next = 34;
29956
+ break;
29957
+ }
29958
+
29959
+ _context2.next = 31;
29960
+ return s.goodsListState.verifyMeiTanFn(record);
29961
+
29962
+ case 31:
29963
+ _context2.t1 = _context2.sent;
29964
+
29965
+ if (!(_context2.t1 === true)) {
29966
+ _context2.next = 34;
29967
+ break;
29968
+ }
29969
+
29970
+ s.goodsListState.meiTanGoodIndex = [editGood.$index];
29971
+
29972
+ case 34:
29919
29973
  case "end":
29920
29974
  return _context2.stop();
29921
29975
  }
@@ -30802,7 +30856,9 @@ var DrawerBody$3 = function DrawerBody(props) {
30802
30856
  good.taxRate = values.taxRate;
30803
30857
  good.taxFreeType = values.taxFreeType;
30804
30858
  good.favouredPolicyMark = values.favouredPolicyMark;
30805
- good.favouredPolicyName = values.favouredPolicyName; // 无论是否含税,都保持价税合计不变
30859
+ good.favouredPolicyName = values.favouredPolicyName;
30860
+ good.mtzlDm = undefined; //设置成空
30861
+ // 无论是否含税,都保持价税合计不变
30806
30862
 
30807
30863
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
30808
30864
 
@@ -30817,10 +30873,30 @@ var DrawerBody$3 = function DrawerBody(props) {
30817
30873
 
30818
30874
  good.goodsTaxRateList = goodsTaxRateList;
30819
30875
  });
30820
- s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
30876
+ s.goodsListState.goodsList = s.goodsListState.goodsList.slice(); // 煤炭类判断
30877
+
30878
+ if (!s.goodsListState.isValidateMeiTan) {
30879
+ _context15.next = 9;
30880
+ break;
30881
+ }
30882
+
30883
+ _context15.next = 6;
30884
+ return s.goodsListState.verifyMeiTanFn(values);
30885
+
30886
+ case 6:
30887
+ _context15.t0 = _context15.sent;
30888
+
30889
+ if (!(_context15.t0 === true)) {
30890
+ _context15.next = 9;
30891
+ break;
30892
+ }
30893
+
30894
+ s.goodsListState.meiTanGoodIndex = s.goodsListState.endowCode.endowcodeGoodIndex.slice();
30895
+
30896
+ case 9:
30821
30897
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
30822
30898
 
30823
- case 4:
30899
+ case 10:
30824
30900
  case "end":
30825
30901
  return _context15.stop();
30826
30902
  }
@@ -31190,6 +31266,218 @@ function AddComparisonDrawer() {
31190
31266
  // })
31191
31267
  // }
31192
31268
 
31269
+ 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";
31270
+ styleInject(css_248z$A);
31271
+
31272
+ var MeiTanModal = (function () {
31273
+ var controller = Invoice.useInvoiceController();
31274
+
31275
+ var _Form$useForm = Form$2.useForm(),
31276
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
31277
+ form = _Form$useForm2[0];
31278
+
31279
+ var _React$useState = React.useState(null),
31280
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31281
+ mainOption = _React$useState2[0],
31282
+ setMainOption = _React$useState2[1]; // 监听煤炭种类变化
31283
+
31284
+
31285
+ var mtzlDm = Form$2.useWatch('mtzlDm', form);
31286
+ var visible = controller.useMemo(function (s) {
31287
+ return s.goodsListState.meiTanGoodIndex && s.goodsListState.meiTanGoodIndex.length > 0;
31288
+ }, []);
31289
+ var onClose = React.useCallback(function () {
31290
+ controller.pipeline( /*#__PURE__*/function () {
31291
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
31292
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
31293
+ while (1) {
31294
+ switch (_context.prev = _context.next) {
31295
+ case 0:
31296
+ s.goodsListState.meiTanGoodIndex = [];
31297
+ form.setFieldsValue({
31298
+ mtzlDm: undefined
31299
+ });
31300
+ setMainOption(null);
31301
+
31302
+ case 3:
31303
+ case "end":
31304
+ return _context.stop();
31305
+ }
31306
+ }
31307
+ }, _callee);
31308
+ }));
31309
+
31310
+ return function (_x) {
31311
+ return _ref.apply(this, arguments);
31312
+ };
31313
+ }())();
31314
+ }, [controller]); // 提交表单
31315
+
31316
+ var onSubmit = function onSubmit() {
31317
+ form.submit();
31318
+ }; // 表单
31319
+
31320
+
31321
+ var onFinish = function onFinish(values) {
31322
+ console.log('煤炭种类:', values);
31323
+ controller.pipeline( /*#__PURE__*/function () {
31324
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
31325
+ var _s$goodsListState$mei;
31326
+
31327
+ var mtzl, goods, editGood, editGoodIndex;
31328
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
31329
+ while (1) {
31330
+ switch (_context2.prev = _context2.next) {
31331
+ case 0:
31332
+ mtzl = values.mtzlDm;
31333
+ goods = ((_s$goodsListState$mei = s.goodsListState.meiTanGoodIndex) === null || _s$goodsListState$mei === void 0 ? void 0 : _s$goodsListState$mei.map(function (e) {
31334
+ return s.goodsListState.goodsMap.get(e);
31335
+ })) || [];
31336
+ editGood = s.goodsListState.editGood;
31337
+ editGoodIndex = editGood === null || editGood === void 0 ? void 0 : editGood.$index;
31338
+ goods.forEach(function (g) {
31339
+ if (!g) return;
31340
+
31341
+ if (g.lineAttribute === LineAttributeType$1.被折扣行 || g.lineAttribute === LineAttributeType$1.正常) {
31342
+ g.mtzlDm = mtzl;
31343
+
31344
+ if (editGood && editGoodIndex === g.$index) {
31345
+ // 编辑行
31346
+ editGood.mtzlDm = mtzl;
31347
+ }
31348
+ }
31349
+ });
31350
+ s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
31351
+ onClose();
31352
+
31353
+ case 7:
31354
+ case "end":
31355
+ return _context2.stop();
31356
+ }
31357
+ }
31358
+ }, _callee2);
31359
+ }));
31360
+
31361
+ return function (_x2) {
31362
+ return _ref2.apply(this, arguments);
31363
+ };
31364
+ }())();
31365
+ }; // 自定义校验规则
31366
+
31367
+
31368
+ var validateOption = function validateOption(_, value, callback) {
31369
+ console.log('自定义校验规则:', value);
31370
+
31371
+ if (!value) {
31372
+ return Promise.reject(new Error('请选择选项')); // callback('请选择选项');
31373
+ }
31374
+
31375
+ if (value === '0200') {
31376
+ return Promise.reject(new Error('请选择长协煤的子选项'));
31377
+ }
31378
+
31379
+ return Promise.resolve();
31380
+ };
31381
+
31382
+ var handleMainOptionChange = function handleMainOptionChange(e) {
31383
+ var value = e.target.value;
31384
+ setMainOption(value);
31385
+
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,等待选择子选项
31394
+ }
31395
+ };
31396
+
31397
+ return /*#__PURE__*/React.createElement(Modal$2, {
31398
+ title: "\u6E29\u99A8\u63D0\u793A",
31399
+ destroyOnClose: true,
31400
+ width: 700,
31401
+ onCancel: onClose,
31402
+ visible: visible,
31403
+ footer: /*#__PURE__*/React.createElement(Space$1, {
31404
+ align: 'end',
31405
+ style: {
31406
+ paddingRight: 20
31407
+ }
31408
+ }, /*#__PURE__*/React.createElement(Button$1, {
31409
+ onClick: onClose,
31410
+ className: 'kts-invoice-operate-meitan-button'
31411
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button$1, {
31412
+ type: "primary",
31413
+ onClick: onSubmit,
31414
+ className: 'kts-invoice-operate-meitan-button'
31415
+ }, "\u786E\u5B9A"))
31416
+ }, /*#__PURE__*/React.createElement("div", {
31417
+ className: 'kts-invoice-operate-meitan-modal'
31418
+ }, /*#__PURE__*/React.createElement("div", {
31419
+ className: 'kts-invoice-operate-meitan-title'
31420
+ }, /*#__PURE__*/React.createElement("div", null, "\u5C0A\u656C\u7684\u7EB3\u7A0E\u4EBA:"), /*#__PURE__*/React.createElement("div", {
31421
+ className: 'kts-invoice-operate-meitan-title2'
31422
+ }, "\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", {
31423
+ className: 'kts-invoice-operate-meitan-content'
31424
+ }, /*#__PURE__*/React.createElement(Form$2, {
31425
+ form: form,
31426
+ layout: "vertical",
31427
+ initialValues: {
31428
+ mtzlDm: null
31429
+ },
31430
+ onFinish: onFinish
31431
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
31432
+ name: "mtzlDm",
31433
+ label: "",
31434
+ rules: [// { required: true , message: '请选择煤炭种类' },
31435
+ {
31436
+ validator: validateOption
31437
+ }]
31438
+ }, /*#__PURE__*/React.createElement(Radio$1.Group, {
31439
+ value: mainOption,
31440
+ onChange: handleMainOptionChange
31441
+ }, /*#__PURE__*/React.createElement(Space$1, {
31442
+ direction: "vertical"
31443
+ }, /*#__PURE__*/React.createElement(Radio$1, {
31444
+ value: "0100"
31445
+ }, "\u653F\u5E9C\u4FDD\u4F9B\u7164"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Radio$1, {
31446
+ value: "0200"
31447
+ }, "\u957F\u534F\u7164"), mainOption === '0200' && /*#__PURE__*/React.createElement("div", {
31448
+ className: 'content-item'
31449
+ }, /*#__PURE__*/React.createElement("div", {
31450
+ style: {
31451
+ marginBottom: 8,
31452
+ color: '#666',
31453
+ fontSize: 14
31454
+ }
31455
+ }, /*#__PURE__*/React.createElement("span", {
31456
+ style: {
31457
+ color: 'red'
31458
+ }
31459
+ }, "*"), "\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
+ }
31466
+ }, /*#__PURE__*/React.createElement(Space$1, {
31467
+ direction: "vertical"
31468
+ }, /*#__PURE__*/React.createElement(Radio$1, {
31469
+ value: "0201"
31470
+ }, "\u534F\u8BAE\u671F\u4E0D\u8DB3\u534A\u5E74"), /*#__PURE__*/React.createElement(Radio$1, {
31471
+ value: "0202"
31472
+ }, "\u534F\u8BAE\u671F\u5728\u534A\u5E74\u81F3\u4E00\u5E74\u4E4B\u95F4"), /*#__PURE__*/React.createElement(Radio$1, {
31473
+ value: "0203"
31474
+ }, "\u534F\u8BAE\u671F\u5728\u4E00\u5E74\u81F3\u4E24\u5E74\u4E4B\u95F4"), /*#__PURE__*/React.createElement(Radio$1, {
31475
+ value: "0204"
31476
+ }, "\u534F\u8BAE\u671F\u5728\u4E24\u5E74\u4EE5\u4E0A"))))), /*#__PURE__*/React.createElement(Radio$1, {
31477
+ value: "0300"
31478
+ }, "\u5E02\u573A\u7164"))))))));
31479
+ });
31480
+
31193
31481
  // const config = {
31194
31482
  // number: 'BigNumber',
31195
31483
  // precision: 64,
@@ -31333,7 +31621,7 @@ var Main$6 = function Main(props) {
31333
31621
  /** 销售方 */
31334
31622
  , props.sign || /*#__PURE__*/React.createElement(Sign, null)
31335
31623
  /** 落款 */
31336
- , props.footExpand), /*#__PURE__*/React.createElement(ImportBuyerDrawer, null), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(AddComparisonDrawer, null));
31624
+ , 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
31625
  };
31338
31626
  /** 数电 */
31339
31627
 
@@ -31389,11 +31677,11 @@ var Digtal = function Digtal(props) {
31389
31677
  /** 特殊信息 */
31390
31678
  , props.sign || /*#__PURE__*/React.createElement(SignDigtal, null)
31391
31679
  /** 落款 */
31392
- ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null));
31680
+ ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
31393
31681
  };
31394
31682
 
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);
31683
+ 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";
31684
+ styleInject(css_248z$B);
31397
31685
 
31398
31686
  function TaxClassificationModal(props) {
31399
31687
  var _props$info6;