kts-component-invoice-operate 2.0.21 → 3.0.0

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.
Files changed (29) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +2 -0
  2. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.d.ts +1 -1
  3. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +5 -2
  4. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +5 -2
  5. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +5 -2
  6. package/dist/Invoice/ui/GoodsList/hook/useToGenerateId/index.d.ts +3 -0
  7. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
  8. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -1
  9. package/dist/index.esm.js +901 -1027
  10. package/dist/index.js +900 -1026
  11. package/docs-dist/umi.js +1 -1
  12. package/package.json +1 -1
  13. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +3 -0
  14. package/src/Invoice/index.tsx +15 -18
  15. package/src/Invoice/tools/idGenerator/index.ts +1 -1
  16. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +1 -1
  17. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +22 -29
  18. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.tsx +5 -1
  19. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +33 -10
  20. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +19 -7
  21. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +11 -5
  22. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +52 -18
  23. package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +13 -0
  24. package/src/Invoice/ui/GoodsList/index.tsx +17 -3
  25. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +1 -1
  26. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +10 -39
  27. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +11 -2
  28. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +2 -2
  29. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +58 -63
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
2
2
  import React, { createElement } from 'react';
3
3
  import GreyReactBox, { decorator } from 'grey-react-box';
4
4
  import { chain as chain$1, bignumber, create, all } from 'mathjs';
5
- import { message, Form, Input, Icon, Tag, Select, Table, Button, Switch, Tooltip, Menu, Typography, Drawer, Dropdown, AutoComplete, Spin, Checkbox, Descriptions, Empty, Divider, Popover, Tree, Modal, Row, Col } from 'kts-components-antd-x3';
5
+ import { message, Form, Input, Icon, Tag, Select, Table, Button, Switch, Tooltip, Typography, Menu, Dropdown, AutoComplete, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover, Tree, Modal, Row, Col } from 'kts-components-antd-x3';
6
6
  import { v4 } from 'uuid';
7
7
  import classnames from 'classnames';
8
8
  import { Input as Input$1, NumberPicker } from '@formily/antd-components';
@@ -1216,7 +1216,7 @@ var delGood = /*#__PURE__*/(function () {
1216
1216
  };
1217
1217
  })();
1218
1218
 
1219
- var id = 1;
1219
+ var id = new Date().getTime();
1220
1220
  var idGenerator = (function () {
1221
1221
  return ++id;
1222
1222
  });
@@ -2125,7 +2125,6 @@ var AddRowButton = (function () {
2125
2125
  })), [controller]);
2126
2126
  if (model === 'prefab') return React.createElement(React.Fragment, null);
2127
2127
  return React.createElement(Button, {
2128
- icon: "plus-circle",
2129
2128
  onClick: onClick,
2130
2129
  disabled: disabled
2131
2130
  }, "\u6DFB\u52A0\u884C");
@@ -2354,118 +2353,48 @@ function TableRow(props) {
2354
2353
  }));
2355
2354
  }
2356
2355
 
2357
- var useDelRowButton = (function () {
2356
+ var _defs$1, _path$2;
2357
+
2358
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
2359
+
2360
+ function SvgSpot(props) {
2361
+ return /*#__PURE__*/createElement("svg", _extends$2({
2362
+ className: "spot_svg__icon",
2363
+ viewBox: "0 0 1024 1024",
2364
+ xmlns: "http://www.w3.org/2000/svg"
2365
+ }, props), _defs$1 || (_defs$1 = /*#__PURE__*/createElement("defs", null, /*#__PURE__*/createElement("style", null))), _path$2 || (_path$2 = /*#__PURE__*/createElement("path", {
2366
+ d: "M416 512a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0zM416 96.64a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0zM416 927.36a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0z"
2367
+ })));
2368
+ }
2369
+
2370
+ var useDelItem = (function (goods) {
2358
2371
  var controller = Invoice.useInvoiceController();
2359
2372
  var model = controller.useMemo(function (s) {
2360
2373
  return s.model;
2361
2374
  }, []);
2362
- /** 是否禁用 */
2363
-
2364
- var disabled = controller.useMemo(function (s) {
2365
- if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
2366
- return s.goodsListState.selectedGoodIndex.some(function (e) {
2367
- var good = s.goodsListState.goodsMap.get(e);
2368
- if (!good) return true;
2369
- return good.lineAttribute !== LineAttributeType$1.正常;
2370
- });
2371
- }, []);
2372
2375
  var onClick = React.useCallback(function () {
2373
- controller.pipeline( /*#__PURE__*/function () {
2374
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2375
- var goodsList;
2376
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2377
- while (1) {
2378
- switch (_context.prev = _context.next) {
2379
- case 0:
2380
- goodsList = s.goodsListState.goodsList.filter(function (e) {
2381
- return s.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
2382
- });
2383
-
2384
- if (s.goodsListState.editGood) {
2385
- if (s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0) {
2386
- controller.setEditGood();
2387
- }
2388
- }
2376
+ controller.delGood(goods.$index);
2377
+ }, [controller, goods.$index]);
2389
2378
 
2390
- s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
2391
- goodsList: goodsList,
2392
- selectedGoodIndex: []
2393
- });
2379
+ if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
2380
+ return undefined;
2381
+ }
2394
2382
 
2395
- case 3:
2396
- case "end":
2397
- return _context.stop();
2398
- }
2399
- }
2400
- }, _callee);
2401
- }));
2383
+ if (!(model !== 'prefab')) {
2384
+ return undefined;
2385
+ }
2402
2386
 
2403
- return function (_x) {
2404
- return _ref.apply(this, arguments);
2405
- };
2406
- }())();
2407
- }, [controller]);
2408
- var menuItem = React.useMemo(function () {
2409
- if (model === 'prefab') return React.createElement(React.Fragment, null);
2410
- return React.createElement(Menu.Item, {
2411
- key: "1",
2412
- onClick: onClick,
2413
- disabled: disabled
2414
- }, "\u5220\u9664\u884C");
2415
- }, [model, onClick, disabled]);
2416
2387
  return {
2417
- menuItem: menuItem
2418
- };
2419
- });
2420
-
2421
- /** 延迟函数 */
2422
- var lazyFn = (function (fn) {
2423
- var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
2424
- // let timer: any = 0;
2425
- // return (...par: any[]) => {
2426
- // if (timer === 0) {
2427
- // timer = setTimeout(() => {
2428
- // fn.apply(null, par);
2429
- // timer = 0;
2430
- // }, delayed);
2431
- // }
2432
- // }
2433
- var timer;
2434
- return function () {
2435
- for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
2436
- par[_key] = arguments[_key];
2437
- }
2438
-
2439
- if (timer) return;
2440
- timer = setTimeout(function () {
2441
- timer = undefined;
2442
- fn.apply(null, par);
2443
- }, delayed);
2444
- };
2445
- });
2446
-
2447
- var math = create(all, {
2448
- number: 'BigNumber',
2449
- precision: 20
2450
- });
2451
- var evaluate = (function (expr) {
2452
- var fractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
2453
- return parseFloat(math.evaluate(expr).toFixed(fractionDigits));
2388
+ key: 'delItem',
2389
+ title: '删除',
2390
+ onClick: onClick
2391
+ }; // return React.useMemo(() => {
2392
+ // return <Menu.Item key="delItem" onClick={onClick}><Text strong type="danger">删除</Text></Menu.Item>
2393
+ // }, [onClick])
2454
2394
  });
2455
2395
 
2456
- var css_248z$5 = ".kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-body {\n flex: 1;\n overflow: auto;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-footer {\n flex: none;\n}\n";
2457
- styleInject(css_248z$5);
2458
-
2459
2396
  var Text = Typography.Text;
2460
-
2461
- var _create = create(all, {
2462
- number: 'BigNumber',
2463
- precision: 20
2464
- }),
2465
- chain = _create.chain;
2466
-
2467
- var useAddDiscountRowButton = (function () {
2468
- /** 控制器 */
2397
+ var useAddDiscount = (function (goods) {
2469
2398
  var controller = Invoice.useInvoiceController();
2470
2399
  var model = controller.useMemo(function (s) {
2471
2400
  return s.model;
@@ -2475,92 +2404,61 @@ var useAddDiscountRowButton = (function () {
2475
2404
  var isAddDiscount = controller.useMemo(function (s) {
2476
2405
  return s.goodsListState.isAddDiscount;
2477
2406
  }, []);
2478
- /** 是否开启抽屉 */
2479
-
2480
- var visible = controller.useMemo(function (s) {
2481
- return s.goodsListState.discountGoodIndex.length > 0;
2482
- }, []);
2483
- /** 是否禁用 按钮 */
2484
-
2485
- var disabled = controller.useMemo(function (s) {
2486
- if (s.goodsListState.selectedGoodIndex.length <= 0) {
2487
- return true;
2488
- }
2489
-
2490
- return s.goodsListState.selectedGoodIndex.some(function (e) {
2491
- var good = s.goodsListState.goodsMap.get(e);
2492
- if (!good) return true;
2493
- return good.lineAttribute !== LineAttributeType$1.正常;
2494
- });
2495
- }, []);
2496
- /** 关闭抽屉 */
2497
-
2498
- var onClose = React.useCallback(function () {
2499
- controller.pipeline( /*#__PURE__*/function () {
2500
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2501
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2502
- while (1) {
2503
- switch (_context.prev = _context.next) {
2504
- case 0:
2505
- s.goodsListState.discountGoodIndex = [];
2506
-
2507
- case 1:
2508
- case "end":
2509
- return _context.stop();
2510
- }
2511
- }
2512
- }, _callee);
2513
- }));
2514
-
2515
- return function (_x) {
2516
- return _ref.apply(this, arguments);
2517
- };
2518
- }())();
2519
- }, []);
2520
2407
  /** 点击了 添加折扣行 按钮 */
2521
2408
 
2522
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2523
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2409
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2410
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2524
2411
  while (1) {
2525
- switch (_context3.prev = _context3.next) {
2412
+ switch (_context2.prev = _context2.next) {
2526
2413
  case 0:
2527
- _context3.next = 2;
2414
+ _context2.next = 2;
2528
2415
  return controller.saveEditGood();
2529
2416
 
2530
2417
  case 2:
2531
- _context3.next = 4;
2418
+ _context2.next = 4;
2532
2419
  return controller.wait();
2533
2420
 
2534
2421
  case 4:
2535
- _context3.next = 6;
2536
- return controller.pipeline( /*#__PURE__*/function () {
2537
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
2538
- var isOk;
2539
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2422
+ _context2.next = 6;
2423
+ return controller.run( /*#__PURE__*/function () {
2424
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2425
+ var err, key;
2426
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2540
2427
  while (1) {
2541
- switch (_context2.prev = _context2.next) {
2428
+ switch (_context.prev = _context.next) {
2542
2429
  case 0:
2543
- isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
2430
+ if (!s.goodsListState.form) {
2431
+ _context.next = 11;
2432
+ break;
2433
+ }
2544
2434
 
2545
- if (!isOk) {
2546
- _context2.next = 4;
2435
+ err = s.goodsListState.form.getFieldsError();
2436
+ _context.t0 = _regeneratorRuntime().keys(err);
2437
+
2438
+ case 3:
2439
+ if ((_context.t1 = _context.t0()).done) {
2440
+ _context.next = 11;
2547
2441
  break;
2548
2442
  }
2549
2443
 
2550
- message.error({
2551
- content: '不能给编辑状态的行增加折扣!',
2552
- key: '不能给编辑状态的行增加折扣!'
2553
- });
2554
- return _context2.abrupt("return");
2444
+ key = _context.t1.value;
2555
2445
 
2556
- case 4:
2557
- isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
2558
- var good = s.goodsListState.goodsMap.get($index);
2559
- return !good || good.taxRate === 0 && !good.taxFreeType;
2560
- });
2446
+ if (err[key]) {
2447
+ _context.next = 7;
2448
+ break;
2449
+ }
2561
2450
 
2562
- if (!isOk) {
2563
- _context2.next = 8;
2451
+ return _context.abrupt("continue", 3);
2452
+
2453
+ case 7:
2454
+ message.error(err[key][0]);
2455
+ return _context.abrupt("return");
2456
+
2457
+ case 11:
2458
+ goods = s.goodsListState.goodsMap.get(goods.$index);
2459
+
2460
+ if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2461
+ _context.next = 15;
2564
2462
  break;
2565
2463
  }
2566
2464
 
@@ -2568,16 +2466,11 @@ var useAddDiscountRowButton = (function () {
2568
2466
  content: '零税率需要设置免税类型,请在赋码中设置!',
2569
2467
  key: '零税率需要设置免税类型,请在赋码中设置!'
2570
2468
  });
2571
- return _context2.abrupt("return");
2572
-
2573
- case 8:
2574
- isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
2575
- var good = s.goodsListState.goodsMap.get($index);
2576
- return "".concat(good === null || good === void 0 ? void 0 : good.lineAmountIncludeTax) === '0';
2577
- });
2469
+ return _context.abrupt("return");
2578
2470
 
2579
- if (!isOk) {
2580
- _context2.next = 12;
2471
+ case 15:
2472
+ if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2473
+ _context.next = 18;
2581
2474
  break;
2582
2475
  }
2583
2476
 
@@ -2585,579 +2478,23 @@ var useAddDiscountRowButton = (function () {
2585
2478
  content: '金额为0不能添加折扣行',
2586
2479
  key: '金额为0不能添加折扣行'
2587
2480
  });
2588
- return _context2.abrupt("return");
2481
+ return _context.abrupt("return");
2589
2482
 
2590
- case 12:
2591
- s.goodsListState.discountGoodIndex = s.goodsListState.selectedGoodIndex.slice();
2483
+ case 18:
2484
+ s.goodsListState.discountGoodIndex = [goods.$index];
2592
2485
 
2593
- case 13:
2486
+ case 19:
2594
2487
  case "end":
2595
- return _context2.stop();
2488
+ return _context.stop();
2596
2489
  }
2597
2490
  }
2598
- }, _callee2);
2599
- }));
2600
-
2601
- return function (_x2) {
2602
- return _ref3.apply(this, arguments);
2603
- };
2604
- }())();
2605
-
2606
- case 6:
2607
- case "end":
2608
- return _context3.stop();
2609
- }
2610
- }
2611
- }, _callee3);
2612
- })), [controller]);
2613
- var menuItem = React.useMemo(function () {
2614
- return model === 'prefab' ? React.createElement(React.Fragment, null) : isAddDiscount !== false ? React.createElement(Menu.Item, {
2615
- key: "0",
2616
- onClick: onClick,
2617
- disabled: disabled
2618
- }, "\u6DFB\u52A0\u6298\u6263\u884C") : undefined;
2619
- }, [isAddDiscount, disabled, onClick]);
2620
- var drawer = React.useMemo(function () {
2621
- return React.createElement(Drawer, {
2622
- className: "kts-invoice-operate-goods-list-add-discount-row",
2623
- width: 540,
2624
- title: "\u6DFB\u52A0\u6298\u6263\u884C",
2625
- placement: "right",
2626
- destroyOnClose: true,
2627
- onClose: onClose,
2628
- visible: visible
2629
- }, React.createElement(DrawerBody, null));
2630
- }, [visible, onClose]);
2631
- return {
2632
- menuItem: menuItem,
2633
- drawer: drawer
2634
- };
2635
- });
2636
- var DrawerBody = decorator(Form.create())(function (props) {
2637
- var form = props.form;
2638
- var getFieldDecorator = form.getFieldDecorator;
2639
- var controller = Invoice.useInvoiceController();
2640
- /** 选中的货物索引列表 */
2641
-
2642
- var discountGoodIndex = controller.useMemo(function (s) {
2643
- return s.goodsListState.discountGoodIndex;
2644
- }, []);
2645
- /** 金额合计 */
2646
-
2647
- var lineAmountSum = controller.useMemo(function (s) {
2648
- var sum = chain(0);
2649
-
2650
- if (s.goodsListState.isTaxIncluded) {
2651
- s.goodsListState.discountGoodIndex.forEach(function (e) {
2652
- var goods = s.goodsListState.goodsMap.get(e);
2653
- sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountIncludeTax) || 0);
2654
- });
2655
- } else {
2656
- s.goodsListState.discountGoodIndex.forEach(function (e) {
2657
- var goods = s.goodsListState.goodsMap.get(e);
2658
- sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountExcludeTax) || 0);
2659
- });
2660
- }
2661
-
2662
- return sum.done();
2663
- }, []);
2664
- /** 关闭抽屉 */
2665
-
2666
- var onClose = React.useCallback(function () {
2667
- controller.pipeline( /*#__PURE__*/function () {
2668
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
2669
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2670
- while (1) {
2671
- switch (_context4.prev = _context4.next) {
2672
- case 0:
2673
- s.goodsListState.discountGoodIndex = [];
2674
-
2675
- case 1:
2676
- case "end":
2677
- return _context4.stop();
2678
- }
2679
- }
2680
- }, _callee4);
2681
- }));
2682
-
2683
- return function (_x3) {
2684
- return _ref4.apply(this, arguments);
2685
- };
2686
- }())();
2687
- }, []);
2688
- /** 点击了保存 */
2689
-
2690
- var onClickSave = React.useCallback(function () {
2691
- form.validateFields(function (err, values) {
2692
- if (err) return;
2693
- var discolineAmountunt = parseFloat(parseFloat(values.discolineAmountunt).toFixed(2));
2694
- var discount = parseFloat(parseFloat(values.discount).toFixed(4));
2695
- var indexList = discountGoodIndex;
2696
- controller.pipeline( /*#__PURE__*/function () {
2697
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
2698
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2699
- while (1) {
2700
- switch (_context5.prev = _context5.next) {
2701
- case 0:
2702
- s.goodsListState.discountGoodIndex = [];
2703
-
2704
- case 1:
2705
- case "end":
2706
- return _context5.stop();
2707
- }
2708
- }
2709
- }, _callee5);
2710
- }));
2711
-
2712
- return function (_x4) {
2713
- return _ref5.apply(this, arguments);
2714
- };
2715
- }())();
2716
- controller.addGoodDiscount({
2717
- indexList: indexList,
2718
- discount: discount,
2719
- discolineAmountunt: discolineAmountunt
2720
- });
2721
- });
2722
- }, [controller, form, discountGoodIndex]);
2723
- /** 折扣率变化 */
2724
-
2725
- var onChangeDiscount = React.useCallback(lazyFn(function (e) {
2726
- form.validateFields(function (err, values) {
2727
- if (err && err.discount) return;
2728
- var discolineAmountunt = evaluate("".concat(lineAmountSum, " * (").concat(values.discount, "/100)")).toFixed(2);
2729
- form.setFieldsValue({
2730
- discolineAmountunt: discolineAmountunt
2731
- });
2732
- });
2733
- }, 300), [form, lineAmountSum]);
2734
- /** 折扣变化 */
2735
-
2736
- var onChangeDiscolineAmountunt = React.useCallback(lazyFn(function (e) {
2737
- form.validateFields(function (err, values) {
2738
- if (err && err.discolineAmountunt) return;
2739
- var discolineAmountunt = parseFloat(values.discolineAmountunt).toFixed(2);
2740
- var discount = evaluate("(".concat(discolineAmountunt, " / ").concat(lineAmountSum, ") * 100")).toFixed(4);
2741
- form.setFieldsValue({
2742
- discount: discount
2743
- });
2744
- });
2745
- }, 300), [form, lineAmountSum]);
2746
- return React.createElement(React.Fragment, null, React.createElement("div", {
2747
- className: "add-discount-row-body"
2748
- }, React.createElement("p", null, "\u5F53\u524D\u9009\u62E9", React.createElement(Text, {
2749
- type: "danger"
2750
- }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React.createElement(Text, {
2751
- type: "danger"
2752
- }, lineAmountSum.toFixed(2))), React.createElement(Form.Item, {
2753
- label: "\u6298\u6263\u7387\uFF1A"
2754
- }, getFieldDecorator('discount', {
2755
- rules: [{
2756
- required: true,
2757
- message: '请输入折扣金额'
2758
- }, {
2759
- pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
2760
- message: '请输入数字'
2761
- }, {
2762
- validator: function validator(_, value, callback) {
2763
- var _value$match;
2764
-
2765
- if (!value) {
2766
- callback();
2767
- return;
2768
- }
2769
-
2770
- if (!((_value$match = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match === void 0 ? void 0 : _value$match.length)) {
2771
- callback();
2772
- return;
2773
- }
2774
-
2775
- if (parseFloat(value) > 100 || parseFloat(value) < 0) {
2776
- callback('请输入大于0小于100的数字');
2777
- }
2778
-
2779
- callback();
2780
- }
2781
- }]
2782
- })(React.createElement(Input, {
2783
- placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E100\u7684\u6570\u5B57",
2784
- suffix: "%",
2785
- onChange: onChangeDiscount
2786
- }))), React.createElement(Form.Item, {
2787
- label: "\u6298\u6263\u91D1\u989D\uFF1A"
2788
- }, getFieldDecorator('discolineAmountunt', {
2789
- rules: [{
2790
- required: true,
2791
- message: '请输入折扣金额'
2792
- }, {
2793
- pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
2794
- message: '请输入数字'
2795
- }, {
2796
- validator: function validator(_, value, callback) {
2797
- var _value$match2;
2798
-
2799
- if (!value) {
2800
- callback();
2801
- return;
2802
- }
2803
-
2804
- if (!((_value$match2 = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match2 === void 0 ? void 0 : _value$match2.length)) {
2805
- callback();
2806
- return;
2807
- }
2808
-
2809
- if (parseFloat(value) > lineAmountSum || parseFloat(value) < 0) {
2810
- callback('请输入大于0小于金额合计的数字');
2811
- }
2812
-
2813
- callback();
2814
- }
2815
- }]
2816
- })(React.createElement(Input, {
2817
- placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E\u91D1\u989D\u5408\u8BA1\u7684\u6570\u5B57",
2818
- suffix: "\xA5",
2819
- onChange: onChangeDiscolineAmountunt
2820
- })))), React.createElement("div", {
2821
- className: "add-discount-row-footer"
2822
- }, React.createElement(Button, {
2823
- block: true,
2824
- style: {
2825
- marginBottom: 12
2826
- },
2827
- onClick: onClose
2828
- }, "\u53D6\u6D88"), React.createElement(Button, {
2829
- type: "primary",
2830
- block: true,
2831
- onClick: onClickSave
2832
- }, "\u4FDD\u5B58")));
2833
- });
2834
-
2835
- var keys = {};
2836
- /**
2837
- * 有冷却时间的函数
2838
- * @param fn 方法
2839
- * @param key 方法key
2840
- * @param delayed 冷却时间
2841
- */
2842
-
2843
- var coolingFn = (function () {
2844
- var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
2845
- var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
2846
- var fn = arguments.length > 2 ? arguments[2] : undefined;
2847
-
2848
- if (keys[key]) {
2849
- return;
2850
- } else {
2851
- fn();
2852
- keys[key] = setTimeout(function () {
2853
- delete keys[key];
2854
- }, delayed);
2855
- }
2856
- });
2857
-
2858
- /** 拆分全称加简称 */
2859
- var getSN = function getSN(value) {
2860
- if (!value) return undefined;
2861
- var arr = value.match(/\*[^*]+\*/);
2862
-
2863
- if (arr && arr[0]) {
2864
- return {
2865
- shorthand: arr[0].split('*')[1],
2866
- full: value.replace(arr[0], '')
2867
- };
2868
- } else {
2869
- return {
2870
- shorthand: undefined,
2871
- full: value
2872
- };
2873
- }
2874
- };
2875
- /** 组合全称加简称 */
2876
-
2877
- var getItemName = function getItemName(value) {
2878
- if (value.shorthand) {
2879
- return "*".concat(value.shorthand, "*").concat(value.full);
2880
- } else {
2881
- return value.full;
2882
- }
2883
- };
2884
- /** 设置简称 */
2885
-
2886
- var setShorthand = function setShorthand(name, shorthand) {
2887
- if (!name) return undefined;
2888
- var sn = getSN(name);
2889
- if (!sn) return undefined;
2890
- sn.shorthand = shorthand || '';
2891
- return getItemName(sn);
2892
- };
2893
-
2894
- var useCommodityComparisonButton = (function () {
2895
- var controller = Invoice.useInvoiceController();
2896
-
2897
- var _controller$useMemo = controller.useMemo(function (s) {
2898
- return s.goodsListState.productComparison;
2899
- }, []),
2900
- onComply = _controller$useMemo.onComply;
2901
- /** 是否禁用 */
2902
-
2903
-
2904
- var disabled = controller.useMemo(function (s) {
2905
- return s.goodsListState.selectedGoodIndex.length <= 0;
2906
- }, []);
2907
- /** 点击了 */
2908
-
2909
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2910
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2911
- while (1) {
2912
- switch (_context2.prev = _context2.next) {
2913
- case 0:
2914
- _context2.next = 2;
2915
- return controller.saveEditGood();
2916
-
2917
- case 2:
2918
- _context2.next = 4;
2919
- return controller.wait();
2920
-
2921
- case 4:
2922
- _context2.next = 6;
2923
- return controller.run( /*#__PURE__*/function () {
2924
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2925
- var _s$goodsListState, _s$goodsListState$pro;
2926
-
2927
- var goods, newGoods;
2928
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2929
- while (1) {
2930
- switch (_context.prev = _context.next) {
2931
- case 0:
2932
- if (!(s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0)) {
2933
- _context.next = 3;
2934
- break;
2935
- }
2936
-
2937
- coolingFn('不能给正在编辑的货物执行商品对照', 3000, function () {
2938
- message.error('不能给正在编辑的货物执行商品对照');
2939
- });
2940
- return _context.abrupt("return");
2941
-
2942
- case 3:
2943
- if ((_s$goodsListState = s.goodsListState) === null || _s$goodsListState === void 0 ? void 0 : (_s$goodsListState$pro = _s$goodsListState.productComparison) === null || _s$goodsListState$pro === void 0 ? void 0 : _s$goodsListState$pro.onComply) {
2944
- _context.next = 5;
2945
- break;
2946
- }
2947
-
2948
- return _context.abrupt("return");
2949
-
2950
- case 5:
2951
- goods = s.goodsListState.selectedGoodIndex.map(function (e) {
2952
- var _getSN, _getSN2;
2953
-
2954
- var t = s.goodsListState.goodsMap.get(e);
2955
- if (!t) return undefined;
2956
- return _objectSpread2(_objectSpread2({}, t), {}, {
2957
- itemName: (_getSN = getSN(t.itemName)) === null || _getSN === void 0 ? void 0 : _getSN.full,
2958
- itemNameSelf: (_getSN2 = getSN(t.itemNameSelf)) === null || _getSN2 === void 0 ? void 0 : _getSN2.full
2959
- });
2960
- }).filter(function (e) {
2961
- return !!e;
2962
- }); // 比对后的商品
2963
-
2964
- _context.next = 8;
2965
- return s.goodsListState.productComparison.onComply(goods);
2966
-
2967
- case 8:
2968
- newGoods = _context.sent;
2969
- newGoods.forEach(function (e) {
2970
- var _getSN3, _getSN4;
2971
-
2972
- var vt = s.goodsListState.goodsMap.get(e.$index);
2973
- if (!vt) return undefined;
2974
- vt.itemName = e.itemName ? setShorthand(e.itemName, (_getSN3 = getSN(vt.itemName)) === null || _getSN3 === void 0 ? void 0 : _getSN3.shorthand) : vt.itemName;
2975
- vt.itemNameSelf = e.itemNameSelf ? setShorthand(e.itemNameSelf, (_getSN4 = getSN(vt.itemNameSelf)) === null || _getSN4 === void 0 ? void 0 : _getSN4.shorthand) : vt.itemNameSelf;
2976
- vt.itemModelName = e.itemModelName ? e.itemModelName : vt.itemModelName;
2977
- vt.itemModelNameSelf = e.itemModelNameSelf ? e.itemModelNameSelf : vt.itemModelNameSelf;
2978
- vt.itemCode = e.itemCode ? e.itemCode : vt.itemCode;
2979
- vt.itemCodeSelf = e.itemCodeSelf ? e.itemCodeSelf : vt.itemCodeSelf;
2980
- });
2981
-
2982
- case 10:
2983
- case "end":
2984
- return _context.stop();
2985
- }
2986
- }
2987
- }, _callee);
2988
- }));
2989
-
2990
- return function (_x) {
2991
- return _ref2.apply(this, arguments);
2992
- };
2993
- }());
2994
-
2995
- case 6:
2996
- case "end":
2997
- return _context2.stop();
2998
- }
2999
- }
3000
- }, _callee2);
3001
- })), []);
3002
- var menuItem = React.useMemo(function () {
3003
- // 没用 执行商品对照 的方法 不显示按钮
3004
- if (!onComply) return React.createElement(React.Fragment, null);
3005
- return React.createElement(Menu.Item, {
3006
- key: "3",
3007
- disabled: disabled,
3008
- onClick: onClick
3009
- }, "\u5546\u54C1\u6620\u5C04");
3010
- }, [disabled, onClick, onComply]);
3011
- return {
3012
- menuItem: menuItem
3013
- };
3014
- });
3015
-
3016
- function BulkMenu() {
3017
- /** 删除行 */
3018
- var delRowButton = useDelRowButton();
3019
- /** 添加折扣行 */
3020
-
3021
- var addDiscountRowButton = useAddDiscountRowButton();
3022
- /** 执行商品对照 */
3023
-
3024
- var commodityComparisonButton = useCommodityComparisonButton();
3025
- var menu = React.createElement(Menu, null, delRowButton.menuItem, addDiscountRowButton.menuItem, commodityComparisonButton.menuItem);
3026
- return React.createElement(React.Fragment, null, React.createElement(Dropdown, {
3027
- overlay: menu
3028
- }, React.createElement(Button, null, "\u6279\u91CF\u64CD\u4F5C\u884C")), addDiscountRowButton.drawer);
3029
- }
3030
-
3031
- var _defs$1, _path$2;
3032
-
3033
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
3034
-
3035
- function SvgSpot(props) {
3036
- return /*#__PURE__*/createElement("svg", _extends$2({
3037
- className: "spot_svg__icon",
3038
- viewBox: "0 0 1024 1024",
3039
- xmlns: "http://www.w3.org/2000/svg"
3040
- }, props), _defs$1 || (_defs$1 = /*#__PURE__*/createElement("defs", null, /*#__PURE__*/createElement("style", null))), _path$2 || (_path$2 = /*#__PURE__*/createElement("path", {
3041
- d: "M416 512a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0zM416 96.64a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0zM416 927.36a1.5 1.5 0 10192 0 1.5 1.5 0 10-192 0z"
3042
- })));
3043
- }
3044
-
3045
- var Text$1 = Typography.Text;
3046
- var useDelItem = (function (goods) {
3047
- var controller = Invoice.useInvoiceController();
3048
- var onClick = React.useCallback(function () {
3049
- controller.delGood(goods.$index);
3050
- }, [controller, goods.$index]);
3051
-
3052
- if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
3053
- return undefined;
3054
- }
3055
-
3056
- return React.useMemo(function () {
3057
- return React.createElement(Menu.Item, {
3058
- key: "delItem",
3059
- onClick: onClick
3060
- }, React.createElement(Text$1, {
3061
- strong: true,
3062
- type: "danger"
3063
- }, "\u5220\u9664"));
3064
- }, [onClick]);
3065
- });
3066
-
3067
- var Text$2 = Typography.Text;
3068
- var useAddDiscount = (function (goods) {
3069
- var controller = Invoice.useInvoiceController();
3070
- /** 点击了 添加折扣行 按钮 */
3071
-
3072
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3073
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3074
- while (1) {
3075
- switch (_context2.prev = _context2.next) {
3076
- case 0:
3077
- _context2.next = 2;
3078
- return controller.saveEditGood();
3079
-
3080
- case 2:
3081
- _context2.next = 4;
3082
- return controller.wait();
3083
-
3084
- case 4:
3085
- _context2.next = 6;
3086
- return controller.pipeline( /*#__PURE__*/function () {
3087
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
3088
- var err, key;
3089
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3090
- while (1) {
3091
- switch (_context.prev = _context.next) {
3092
- case 0:
3093
- if (!s.goodsListState.form) {
3094
- _context.next = 11;
3095
- break;
3096
- }
3097
-
3098
- err = s.goodsListState.form.getFieldsError();
3099
- _context.t0 = _regeneratorRuntime().keys(err);
3100
-
3101
- case 3:
3102
- if ((_context.t1 = _context.t0()).done) {
3103
- _context.next = 11;
3104
- break;
3105
- }
3106
-
3107
- key = _context.t1.value;
3108
-
3109
- if (err[key]) {
3110
- _context.next = 7;
3111
- break;
3112
- }
3113
-
3114
- return _context.abrupt("continue", 3);
3115
-
3116
- case 7:
3117
- message.error(err[key][0]);
3118
- return _context.abrupt("return");
3119
-
3120
- case 11:
3121
- goods = s.goodsListState.goodsMap.get(goods.$index);
3122
-
3123
- if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
3124
- _context.next = 15;
3125
- break;
3126
- }
3127
-
3128
- message.error({
3129
- content: '零税率需要设置免税类型,请在赋码中设置!',
3130
- key: '零税率需要设置免税类型,请在赋码中设置!'
3131
- });
3132
- return _context.abrupt("return");
3133
-
3134
- case 15:
3135
- if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
3136
- _context.next = 18;
3137
- break;
3138
- }
3139
-
3140
- message.error({
3141
- content: '金额为0不能添加折扣行',
3142
- key: '金额为0不能添加折扣行'
3143
- });
3144
- return _context.abrupt("return");
3145
-
3146
- case 18:
3147
- s.goodsListState.discountGoodIndex = [goods.$index];
3148
-
3149
- case 19:
3150
- case "end":
3151
- return _context.stop();
3152
- }
3153
- }
3154
- }, _callee);
2491
+ }, _callee);
3155
2492
  }));
3156
2493
 
3157
2494
  return function (_x) {
3158
2495
  return _ref2.apply(this, arguments);
3159
2496
  };
3160
- }())();
2497
+ }());
3161
2498
 
3162
2499
  case 6:
3163
2500
  case "end":
@@ -3171,20 +2508,77 @@ var useAddDiscount = (function (goods) {
3171
2508
  return undefined;
3172
2509
  }
3173
2510
 
3174
- return React.useMemo(function () {
3175
- if (goods.lineAttribute !== LineAttributeType$1.正常) {
3176
- return undefined;
3177
- }
2511
+ if (!(model !== 'prefab')) {
2512
+ return undefined;
2513
+ }
3178
2514
 
3179
- return React.createElement(Menu.Item, {
3180
- key: "addDiscount",
3181
- onClick: onClick
3182
- }, React.createElement(Text$2, {
3183
- strong: true
3184
- }, "\u6DFB\u52A0\u6298\u6263\u884C"));
3185
- }, [onClick, goods.lineAttribute]);
2515
+ if (!(isAddDiscount !== false)) {
2516
+ return undefined;
2517
+ }
2518
+
2519
+ if (goods.lineAttribute !== LineAttributeType$1.正常) {
2520
+ return undefined;
2521
+ }
2522
+
2523
+ return {
2524
+ key: 'addDiscount',
2525
+ title: '折扣',
2526
+ onClick: onClick
2527
+ }; // return React.useMemo(() => {
2528
+ // if (goods.lineAttribute !== LineAttributeType.正常) {
2529
+ // return undefined
2530
+ // }
2531
+ // return (
2532
+ // <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
2533
+ // );
2534
+ // }, [onClick, goods.lineAttribute]);
2535
+ });
2536
+
2537
+ var math = create(all, {
2538
+ number: 'BigNumber',
2539
+ precision: 20
2540
+ });
2541
+ var evaluate = (function (expr) {
2542
+ var fractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
2543
+ return parseFloat(math.evaluate(expr).toFixed(fractionDigits));
3186
2544
  });
3187
2545
 
2546
+ /** 拆分全称加简称 */
2547
+ var getSN = function getSN(value) {
2548
+ if (!value) return undefined;
2549
+ var arr = value.match(/\*[^*]+\*/);
2550
+
2551
+ if (arr && arr[0]) {
2552
+ return {
2553
+ shorthand: arr[0].split('*')[1],
2554
+ full: value.replace(arr[0], '')
2555
+ };
2556
+ } else {
2557
+ return {
2558
+ shorthand: undefined,
2559
+ full: value
2560
+ };
2561
+ }
2562
+ };
2563
+ /** 组合全称加简称 */
2564
+
2565
+ var getItemName = function getItemName(value) {
2566
+ if (value.shorthand) {
2567
+ return "*".concat(value.shorthand, "*").concat(value.full);
2568
+ } else {
2569
+ return value.full;
2570
+ }
2571
+ };
2572
+ /** 设置简称 */
2573
+
2574
+ var setShorthand = function setShorthand(name, shorthand) {
2575
+ if (!name) return undefined;
2576
+ var sn = getSN(name);
2577
+ if (!sn) return undefined;
2578
+ sn.shorthand = shorthand || '';
2579
+ return getItemName(sn);
2580
+ };
2581
+
3188
2582
  //! moment.js
3189
2583
  //! version : 2.29.3
3190
2584
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -3590,12 +2984,12 @@ function Locale(config) {
3590
2984
  }
3591
2985
  }
3592
2986
 
3593
- var keys$1;
2987
+ var keys;
3594
2988
 
3595
2989
  if (Object.keys) {
3596
- keys$1 = Object.keys;
2990
+ keys = Object.keys;
3597
2991
  } else {
3598
- keys$1 = function (obj) {
2992
+ keys = function (obj) {
3599
2993
  var i,
3600
2994
  res = [];
3601
2995
  for (i in obj) {
@@ -5443,7 +4837,7 @@ function getLocale(key) {
5443
4837
  }
5444
4838
 
5445
4839
  function listLocales() {
5446
- return keys$1(locales);
4840
+ return keys(locales);
5447
4841
  }
5448
4842
 
5449
4843
  function checkOverflow(m) {
@@ -8863,7 +8257,7 @@ hooks.HTML5_FMT = {
8863
8257
 
8864
8258
  /** 延迟函数 */
8865
8259
 
8866
- var lazyFn$1 = function lazyFn(fn) {
8260
+ var lazyFn = function lazyFn(fn) {
8867
8261
  var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
8868
8262
  var timer;
8869
8263
  return function () {
@@ -8903,7 +8297,7 @@ var promptErr = function promptErr(err) {
8903
8297
  /** 数量改变了 */
8904
8298
 
8905
8299
 
8906
- var onChangeQuantity = lazyFn$1(function (controller, form, record) {
8300
+ var onChangeQuantity = lazyFn(function (controller, form, record) {
8907
8301
  form.validateFields( /*#__PURE__*/function () {
8908
8302
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err, values) {
8909
8303
  var quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
@@ -9052,7 +8446,7 @@ var onChangeQuantity = lazyFn$1(function (controller, form, record) {
9052
8446
  }, 1000);
9053
8447
  /** 单价(含税) */
9054
8448
 
9055
- var onChangePriceIncludeTax = lazyFn$1(function (controller, form, record) {
8449
+ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
9056
8450
  form.validateFields( /*#__PURE__*/function () {
9057
8451
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(err, values) {
9058
8452
  var priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
@@ -9151,7 +8545,7 @@ var onChangePriceIncludeTax = lazyFn$1(function (controller, form, record) {
9151
8545
  }, 1000);
9152
8546
  /** 单价(不含税) */
9153
8547
 
9154
- var onChangePriceExcludeTax = lazyFn$1(function (controller, form, record) {
8548
+ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
9155
8549
  form.validateFields( /*#__PURE__*/function () {
9156
8550
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
9157
8551
  var priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
@@ -9250,7 +8644,7 @@ var onChangePriceExcludeTax = lazyFn$1(function (controller, form, record) {
9250
8644
  }, 1000);
9251
8645
  /** 金额(含税) */
9252
8646
 
9253
- var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record) {
8647
+ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
9254
8648
  form.validateFields( /*#__PURE__*/function () {
9255
8649
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
9256
8650
  var lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
@@ -9342,7 +8736,7 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
9342
8736
  }, 1000);
9343
8737
  /** 金额(不含税) */
9344
8738
 
9345
- var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record) {
8739
+ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
9346
8740
  form.validateFields( /*#__PURE__*/function () {
9347
8741
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(err, values) {
9348
8742
  var lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
@@ -9434,7 +8828,7 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
9434
8828
  }, 1000);
9435
8829
  /** 税率 */
9436
8830
 
9437
- var onChangeTaxRate = lazyFn$1(function (controller, form, record) {
8831
+ var onChangeTaxRate = lazyFn(function (controller, form, record) {
9438
8832
  form.validateFields( /*#__PURE__*/function () {
9439
8833
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
9440
8834
  var taxRate;
@@ -9820,161 +9214,73 @@ var onChangeItemName = /*#__PURE__*/function () {
9820
9214
  break;
9821
9215
  }
9822
9216
 
9823
- _context12.next = 17;
9824
- return controller.setEditGood({
9825
- itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
9826
- });
9827
-
9828
- case 17:
9829
- case "end":
9830
- return _context12.stop();
9831
- }
9832
- }
9833
- }, _callee12);
9834
- }));
9835
-
9836
- return function (_x25) {
9837
- return _ref13.apply(this, arguments);
9838
- };
9839
- }());
9840
-
9841
- case 1:
9842
- case "end":
9843
- return _context13.stop();
9844
- }
9845
- }
9846
- }, _callee13);
9847
- }));
9848
-
9849
- return function onChangeItemName(_x22, _x23, _x24) {
9850
- return _ref12.apply(this, arguments);
9851
- };
9852
- }();
9853
-
9854
- var useEndowCode = (function (goods) {
9855
- var controller = Invoice.useInvoiceController();
9856
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9857
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9858
- while (1) {
9859
- switch (_context.prev = _context.next) {
9860
- case 0:
9861
- endowCode(controller, goods);
9862
-
9863
- case 1:
9864
- case "end":
9865
- return _context.stop();
9866
- }
9867
- }
9868
- }, _callee);
9869
- })), [controller, goods]); // return React.useMemo(() => {
9870
- // return (
9871
- // <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
9872
- // );
9873
- // }, [goods.lineAttribute, onClick])
9874
-
9875
- return React.useMemo(function () {
9876
- return React.createElement(Button, {
9877
- key: "endowCode",
9878
- type: "link",
9879
- onClick: onClick
9880
- }, "\u8D4B\u7801");
9881
- }, [goods.lineAttribute, onClick]);
9882
- });
9883
-
9884
- var Text$3 = Typography.Text;
9885
- var useAddComparison = (function (goods) {
9886
- var controller = Invoice.useInvoiceController();
9887
- var productComparison = controller.useMemo(function (s) {
9888
- return s.goodsListState.productComparison;
9889
- }, []);
9890
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9891
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9892
- while (1) {
9893
- switch (_context2.prev = _context2.next) {
9894
- case 0:
9895
- _context2.next = 2;
9896
- return controller.saveEditGood();
9897
-
9898
- case 2:
9899
- _context2.next = 4;
9900
- return controller.wait();
9901
-
9902
- case 4:
9903
- _context2.next = 6;
9904
- return controller.run( /*#__PURE__*/function () {
9905
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
9906
- var err, key;
9907
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9908
- while (1) {
9909
- switch (_context.prev = _context.next) {
9910
- case 0:
9911
- if (!s.goodsListState.form) {
9912
- _context.next = 11;
9913
- break;
9914
- }
9915
-
9916
- err = s.goodsListState.form.getFieldsError();
9917
- _context.t0 = _regeneratorRuntime().keys(err);
9918
-
9919
- case 3:
9920
- if ((_context.t1 = _context.t0()).done) {
9921
- _context.next = 11;
9922
- break;
9923
- }
9924
-
9925
- key = _context.t1.value;
9926
-
9927
- if (err[key]) {
9928
- _context.next = 7;
9929
- break;
9930
- }
9931
-
9932
- return _context.abrupt("continue", 3);
9933
-
9934
- case 7:
9935
- message.error(err[key][0]);
9936
- return _context.abrupt("return");
9937
-
9938
- case 11:
9939
- s.goodsListState.addComparisonIndex = goods.$index;
9217
+ _context12.next = 17;
9218
+ return controller.setEditGood({
9219
+ itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
9220
+ });
9940
9221
 
9941
- case 12:
9222
+ case 17:
9942
9223
  case "end":
9943
- return _context.stop();
9224
+ return _context12.stop();
9944
9225
  }
9945
9226
  }
9946
- }, _callee);
9227
+ }, _callee12);
9947
9228
  }));
9948
9229
 
9949
- return function (_x) {
9950
- return _ref2.apply(this, arguments);
9230
+ return function (_x25) {
9231
+ return _ref13.apply(this, arguments);
9951
9232
  };
9952
9233
  }());
9953
9234
 
9954
- case 6:
9235
+ case 1:
9955
9236
  case "end":
9956
- return _context2.stop();
9237
+ return _context13.stop();
9957
9238
  }
9958
9239
  }
9959
- }, _callee2);
9960
- })), [controller, goods.$index]);
9961
- return React.useMemo(function () {
9962
- if (productComparison.onComply) {
9963
- return React.createElement(Menu.Item, {
9964
- key: "delItem",
9965
- onClick: onClick
9966
- }, React.createElement(Text$3, {
9967
- strong: true
9968
- }, "\u6DFB\u52A0\u5546\u54C1\u5BF9\u7167"));
9969
- } else {
9970
- return React.createElement(React.Fragment, null);
9971
- }
9972
- }, [onClick, productComparison]);
9240
+ }, _callee13);
9241
+ }));
9242
+
9243
+ return function onChangeItemName(_x22, _x23, _x24) {
9244
+ return _ref12.apply(this, arguments);
9245
+ };
9246
+ }();
9247
+
9248
+ var useEndowCode = (function (goods) {
9249
+ var controller = Invoice.useInvoiceController();
9250
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9251
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9252
+ while (1) {
9253
+ switch (_context.prev = _context.next) {
9254
+ case 0:
9255
+ endowCode(controller, goods);
9256
+
9257
+ case 1:
9258
+ case "end":
9259
+ return _context.stop();
9260
+ }
9261
+ }
9262
+ }, _callee);
9263
+ })), [controller, goods]);
9264
+ return {
9265
+ key: 'endowCode',
9266
+ title: '赋码',
9267
+ onClick: onClick
9268
+ }; // return React.useMemo(() => {
9269
+ // return (
9270
+ // <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
9271
+ // );
9272
+ // }, [goods.lineAttribute, onClick])
9273
+ // return React.useMemo(() => {
9274
+ // return (
9275
+ // <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
9276
+ // );
9277
+ // }, [goods.lineAttribute, onClick])
9973
9278
  });
9974
9279
 
9975
- var css_248z$6 = ".ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:focus,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu {\n font-size: 16px;\n color: #000;\n text-align: center;\n padding: 0;\n}\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu.ktsAnt3x-dropdown-open {\n background: #ebebeb;\n border-radius: 9999px;\n}\n";
9976
- styleInject(css_248z$6);
9280
+ var css_248z$5 = ".ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:focus,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu {\n font-size: 16px;\n color: #000;\n text-align: center;\n padding: 0;\n}\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu.ktsAnt3x-dropdown-open {\n background: #ebebeb;\n border-radius: 9999px;\n}\n";
9281
+ styleInject(css_248z$5);
9977
9282
 
9283
+ var Text$1 = Typography.Text;
9978
9284
  var RowMenu = (function (props) {
9979
9285
  var controller = Invoice.useInvoiceController();
9980
9286
  var model = controller.useMemo(function (s) {
@@ -9990,16 +9296,16 @@ var RowMenu = (function (props) {
9990
9296
  }, []);
9991
9297
  var delItem = useDelItem(props.goods);
9992
9298
  var addDiscount = useAddDiscount(props.goods);
9993
- var endowCode = useEndowCode(props.goods);
9994
- var addComparison = useAddComparison(props.goods);
9299
+ var endowCode = useEndowCode(props.goods); // const addComparison = useAddComparison(props.goods);
9300
+
9995
9301
  var itemList = React.useMemo(function () {
9996
9302
  var arr = [];
9997
- model !== 'prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
9303
+ endowCode && arr.push(endowCode); // 赋码
9998
9304
 
9999
- arr.push(addComparison); // 添加商品对照
10000
- // endowCode && arr.push(endowCode); // 赋码
9305
+ addDiscount && arr.push(addDiscount); // 添加折扣行
10001
9306
 
10002
- model !== 'prefab' && delItem && arr.push(delItem); // 删除
9307
+ delItem && arr.push(delItem); // 删除
9308
+ // addComparison && arr.push(addComparison); // 添加商品对照
10003
9309
 
10004
9310
  if (!goodsMenuExpand || goodsMenuExpand.length === 0) return arr;
10005
9311
  arr.unshift(React.createElement(Menu.Divider, {
@@ -10013,13 +9319,51 @@ var RowMenu = (function (props) {
10013
9319
 
10014
9320
  return arr;
10015
9321
  }, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model, isAddDiscount]);
9322
+ var overlay = React.useMemo(function () {
9323
+ if (itemList.length <= 2) {
9324
+ return undefined;
9325
+ }
9326
+
9327
+ return React.createElement(Menu, null, itemList.slice(2).map(function (e) {
9328
+ return React.createElement(Menu.Item, {
9329
+ key: e.key,
9330
+ onClick: e.onClick
9331
+ }, React.createElement(Text$1, {
9332
+ strong: true
9333
+ }, e.title));
9334
+ }));
9335
+ }, [itemList]);
9336
+ var buttonList = React.useMemo(function () {
9337
+ return React.createElement("div", {
9338
+ style: {
9339
+ flex: 1,
9340
+ textAlign: 'left',
9341
+ display: 'flex',
9342
+ gap: 10
9343
+ }
9344
+ }, itemList.slice(0, 2).map(function (e) {
9345
+ return React.createElement(Button, {
9346
+ key: e.key,
9347
+ type: 'link',
9348
+ onClick: e.onClick,
9349
+ style: {
9350
+ padding: 0
9351
+ }
9352
+ }, e.title);
9353
+ }));
9354
+ }, [itemList]);
10016
9355
 
10017
9356
  if (itemList.length === 0) {
10018
9357
  return React.createElement(React.Fragment, null);
10019
9358
  }
10020
9359
 
10021
- return React.createElement("span", null, endowCode, React.createElement(Dropdown, {
10022
- overlay: React.createElement(Menu, null, itemList),
9360
+ return React.createElement("span", {
9361
+ style: {
9362
+ padding: '0 0 0 10px',
9363
+ display: 'flex'
9364
+ }
9365
+ }, buttonList, overlay && React.createElement(Dropdown, {
9366
+ overlay: overlay,
10023
9367
  trigger: ['click']
10024
9368
  }, React.createElement(Button, {
10025
9369
  className: "kts-invoice-operate-goods-list-columns-row-menu ant-btn-icon-only",
@@ -10029,7 +9373,7 @@ var RowMenu = (function (props) {
10029
9373
  }))));
10030
9374
  });
10031
9375
 
10032
- var Text$4 = Typography.Text;
9376
+ var Text$2 = Typography.Text;
10033
9377
  var useColumns = (function (form) {
10034
9378
  var getFieldDecorator = form.getFieldDecorator,
10035
9379
  getFieldValue = form.getFieldValue;
@@ -10080,14 +9424,24 @@ var useColumns = (function (form) {
10080
9424
 
10081
9425
  var columns = React.useMemo(function () {
10082
9426
  return [{
10083
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9427
+ title: '序号',
9428
+ key: 'serialNo',
9429
+ dataIndex: 'serialNo',
9430
+ width: 50,
9431
+ render: function render(e) {
9432
+ return React.createElement("span", {
9433
+ style: {
9434
+ padding: '0 10px'
9435
+ }
9436
+ }, e);
9437
+ }
9438
+ }, {
9439
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10084
9440
  type: "danger"
10085
- }, "*"), "\u8D27\u7269\u540D\u79F0"),
9441
+ }, "*"), "\u9879\u76EE\u540D\u79F0"),
10086
9442
  key: 'itemName',
10087
9443
  render: function render(_, record) {
10088
9444
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10089
- var _editGood$itemName;
10090
-
10091
9445
  return React.createElement(Form.Item, null, React.createElement("div", {
10092
9446
  style: {
10093
9447
  display: 'flex'
@@ -10144,13 +9498,9 @@ var useColumns = (function (form) {
10144
9498
  }
10145
9499
  })), React.createElement("div", {
10146
9500
  className: "kts-invoice-operate-goods-list-able-list-itemName-import"
10147
- }, !((_editGood$itemName = editGood.itemName) === null || _editGood$itemName === void 0 ? void 0 : _editGood$itemName.match(/\*[^*]+\*/)) && React.createElement(Button, {
10148
- onClick: function onClick() {
10149
- endowCode(controller, record);
10150
- },
10151
- type: "link",
10152
- icon: "file-add"
10153
- }), controller.getGoodsList && React.createElement(Button, {
9501
+ }, controller.getGoodsList && React.createElement(Tooltip, {
9502
+ title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F"
9503
+ }, React.createElement(Button, {
10154
9504
  onClick: controller.pipeline( /*#__PURE__*/function () {
10155
9505
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
10156
9506
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -10173,7 +9523,7 @@ var useColumns = (function (form) {
10173
9523
  }()),
10174
9524
  type: "link",
10175
9525
  icon: "plus-circle"
10176
- }))));
9526
+ })))));
10177
9527
  } else {
10178
9528
  return React.createElement(MyItemNameDiv, {
10179
9529
  valueT: formatSearch(record.itemNameSelf, searchValue),
@@ -10278,7 +9628,11 @@ var useColumns = (function (form) {
10278
9628
  }()
10279
9629
  })));
10280
9630
  } else {
10281
- return record.unit;
9631
+ return React.createElement("span", {
9632
+ style: {
9633
+ padding: '0 10px'
9634
+ }
9635
+ }, record.unit);
10282
9636
  }
10283
9637
  }
10284
9638
  }, {
@@ -10498,7 +9852,7 @@ var useColumns = (function (form) {
10498
9852
  }
10499
9853
  }
10500
9854
  }, {
10501
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9855
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10502
9856
  type: "danger"
10503
9857
  }, "*"), "\u91D1\u989D(\u542B\u7A0E)"),
10504
9858
  dataIndex: 'lineAmountIncludeTax',
@@ -10585,7 +9939,7 @@ var useColumns = (function (form) {
10585
9939
  }
10586
9940
  }
10587
9941
  }, {
10588
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9942
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10589
9943
  type: "danger"
10590
9944
  }, "*"), "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
10591
9945
  dataIndex: 'lineAmountExcludeTax',
@@ -10647,9 +10001,9 @@ var useColumns = (function (form) {
10647
10001
  }
10648
10002
  }
10649
10003
  }, {
10650
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
10004
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10651
10005
  type: "danger"
10652
- }, "*"), "\u7A0E\u7387"),
10006
+ }, "*"), "\u7A0E\u7387%"),
10653
10007
  dataIndex: 'taxRate',
10654
10008
  key: 'taxRate',
10655
10009
  align: 'right',
@@ -10715,10 +10069,9 @@ var useColumns = (function (form) {
10715
10069
  }
10716
10070
  }, {
10717
10071
  title: '操作',
10718
- dataIndex: 'operating',
10719
10072
  key: 'operating',
10720
- width: 120,
10721
- align: 'center',
10073
+ align: 'right',
10074
+ width: 110,
10722
10075
  render: function render(_value, record) {
10723
10076
  return React.createElement(RowMenu, {
10724
10077
  key: record.lineAttribute,
@@ -11340,154 +10693,654 @@ var useRowSelection = (function () {
11340
10693
  var goods = s.goodsListState.goodsMap.get($index);
11341
10694
  if (!goods || goods.lineAttribute === LineAttributeType$1.正常) return; // 数组位置
11342
10695
 
11343
- var t = s.goodsListState.goodsList.indexOf(goods);
11344
- goods.lineAttribute === LineAttributeType$1.折扣行 ? t-- : t++;
11345
- var i = s.goodsListState.goodsList[t].$index;
10696
+ var t = s.goodsListState.goodsList.indexOf(goods);
10697
+ goods.lineAttribute === LineAttributeType$1.折扣行 ? t-- : t++;
10698
+ var i = s.goodsListState.goodsList[t].$index;
10699
+
10700
+ if (selected) {
10701
+ if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = [].concat(_toConsumableArray(s.goodsListState.selectedGoodIndex), [i]);
10702
+ } else {
10703
+ if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(function (e) {
10704
+ return e !== $index;
10705
+ });
10706
+ }
10707
+ });
10708
+
10709
+ case 1:
10710
+ case "end":
10711
+ return _context7.stop();
10712
+ }
10713
+ }
10714
+ }, _callee7);
10715
+ }));
10716
+
10717
+ return function (_x8) {
10718
+ return _ref8.apply(this, arguments);
10719
+ };
10720
+ }())();
10721
+
10722
+ case 4:
10723
+ case "end":
10724
+ return _context8.stop();
10725
+ }
10726
+ }
10727
+ }, _callee8);
10728
+ }));
10729
+
10730
+ return function (_x7) {
10731
+ return _ref7.apply(this, arguments);
10732
+ };
10733
+ }(), [controller]);
10734
+ React.useEffect(function () {
10735
+ sortOut(true);
10736
+ }, [sortOut, goodsList]);
10737
+ return {
10738
+ columnWidth: 45,
10739
+ columnTitle: columnTitle,
10740
+ onSelect: onSelect,
10741
+ selectedRowKeys: selectedRowKeys
10742
+ };
10743
+ });
10744
+
10745
+ var css_248z$6 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n";
10746
+ styleInject(css_248z$6);
10747
+
10748
+ var keys$1 = {};
10749
+ /**
10750
+ * 有冷却时间的函数
10751
+ * @param fn 方法
10752
+ * @param key 方法key
10753
+ * @param delayed 冷却时间
10754
+ */
10755
+
10756
+ var coolingFn = (function () {
10757
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
10758
+ var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
10759
+ var fn = arguments.length > 2 ? arguments[2] : undefined;
10760
+
10761
+ if (keys$1[key]) {
10762
+ return;
10763
+ } else {
10764
+ fn();
10765
+ keys$1[key] = setTimeout(function () {
10766
+ delete keys$1[key];
10767
+ }, delayed);
10768
+ }
10769
+ });
10770
+
10771
+ var useEndowCodeButton = (function () {
10772
+ var controller = Invoice.useInvoiceController();
10773
+ /** 是否禁用 */
10774
+
10775
+ var disabled = controller.useMemo(function (s) {
10776
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
10777
+ }, []);
10778
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10779
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10780
+ while (1) {
10781
+ switch (_context2.prev = _context2.next) {
10782
+ case 0:
10783
+ _context2.next = 2;
10784
+ return controller.saveEditGood();
10785
+
10786
+ case 2:
10787
+ _context2.next = 4;
10788
+ return controller.wait();
10789
+
10790
+ case 4:
10791
+ _context2.next = 6;
10792
+ return controller.pipeline( /*#__PURE__*/function () {
10793
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10794
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10795
+ while (1) {
10796
+ switch (_context.prev = _context.next) {
10797
+ case 0:
10798
+ if (!(s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0)) {
10799
+ _context.next = 3;
10800
+ break;
10801
+ }
10802
+
10803
+ coolingFn('不能给正在编辑的货物赋码', 3000, function () {
10804
+ message.error('不能给正在编辑的货物赋码');
10805
+ });
10806
+ return _context.abrupt("return");
10807
+
10808
+ case 3:
10809
+ if (!s.goodsListState.selectedGoodIndex.map(function (e) {
10810
+ return s.goodsListState.goodsMap.get(e);
10811
+ }).some(function (e, _, arr) {
10812
+ var _arr$;
10813
+
10814
+ return (e === null || e === void 0 ? void 0 : e.taxRate) !== ((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$.taxRate);
10815
+ })) {
10816
+ _context.next = 6;
10817
+ break;
10818
+ }
10819
+
10820
+ coolingFn('商品税率不一致不能操作批量赋码', 3000, function () {
10821
+ message.error('商品税率不一致不能操作批量赋码');
10822
+ });
10823
+ return _context.abrupt("return");
10824
+
10825
+ case 6:
10826
+ // 设置赋码
10827
+ s.goodsListState.endowCode.endowcodeGoodIndex = s.goodsListState.selectedGoodIndex;
10828
+
10829
+ case 7:
10830
+ case "end":
10831
+ return _context.stop();
10832
+ }
10833
+ }
10834
+ }, _callee);
10835
+ }));
10836
+
10837
+ return function (_x) {
10838
+ return _ref2.apply(this, arguments);
10839
+ };
10840
+ }())();
10841
+
10842
+ case 6:
10843
+ case "end":
10844
+ return _context2.stop();
10845
+ }
10846
+ }
10847
+ }, _callee2);
10848
+ })), [controller]);
10849
+ var menuItem = React.useMemo(function () {
10850
+ return React.createElement(Menu.Item, {
10851
+ key: "2",
10852
+ onClick: onClick,
10853
+ disabled: disabled
10854
+ }, "\u6279\u91CF\u8D4B\u7801");
10855
+ }, [onClick, disabled]);
10856
+ var button = React.useMemo(function () {
10857
+ return React.createElement(Button, {
10858
+ onClick: onClick,
10859
+ disabled: disabled
10860
+ }, "\u6279\u91CF\u8D4B\u7801");
10861
+ }, [onClick, disabled]);
10862
+ return {
10863
+ menuItem: menuItem,
10864
+ button: button
10865
+ };
10866
+ });
10867
+
10868
+ var useDelRowButton = (function () {
10869
+ var controller = Invoice.useInvoiceController();
10870
+ var model = controller.useMemo(function (s) {
10871
+ return s.model;
10872
+ }, []);
10873
+ /** 是否禁用 */
11346
10874
 
11347
- if (selected) {
11348
- if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = [].concat(_toConsumableArray(s.goodsListState.selectedGoodIndex), [i]);
11349
- } else {
11350
- if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(function (e) {
11351
- return e !== $index;
11352
- });
11353
- }
11354
- });
10875
+ var disabled = controller.useMemo(function (s) {
10876
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
10877
+ return s.goodsListState.selectedGoodIndex.some(function (e) {
10878
+ var good = s.goodsListState.goodsMap.get(e);
10879
+ if (!good) return true;
10880
+ return good.lineAttribute !== LineAttributeType$1.正常;
10881
+ });
10882
+ }, []);
10883
+ var onClick = React.useCallback(function () {
10884
+ controller.pipeline( /*#__PURE__*/function () {
10885
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10886
+ var goodsList;
10887
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10888
+ while (1) {
10889
+ switch (_context.prev = _context.next) {
10890
+ case 0:
10891
+ goodsList = s.goodsListState.goodsList.filter(function (e) {
10892
+ return s.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
10893
+ });
11355
10894
 
11356
- case 1:
11357
- case "end":
11358
- return _context7.stop();
11359
- }
11360
- }
11361
- }, _callee7);
11362
- }));
10895
+ if (s.goodsListState.editGood) {
10896
+ if (s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0) {
10897
+ controller.setEditGood();
10898
+ }
10899
+ }
11363
10900
 
11364
- return function (_x8) {
11365
- return _ref8.apply(this, arguments);
11366
- };
11367
- }())();
10901
+ s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
10902
+ goodsList: goodsList,
10903
+ selectedGoodIndex: []
10904
+ });
11368
10905
 
11369
- case 4:
11370
- case "end":
11371
- return _context8.stop();
10906
+ case 3:
10907
+ case "end":
10908
+ return _context.stop();
10909
+ }
11372
10910
  }
11373
- }
11374
- }, _callee8);
11375
- }));
10911
+ }, _callee);
10912
+ }));
11376
10913
 
11377
- return function (_x7) {
11378
- return _ref7.apply(this, arguments);
11379
- };
11380
- }(), [controller]);
11381
- React.useEffect(function () {
11382
- sortOut(true);
11383
- }, [sortOut, goodsList]);
10914
+ return function (_x) {
10915
+ return _ref.apply(this, arguments);
10916
+ };
10917
+ }())();
10918
+ }, [controller]);
10919
+ var menuItem = React.useMemo(function () {
10920
+ if (model === 'prefab') return React.createElement(React.Fragment, null);
10921
+ return React.createElement(Menu.Item, {
10922
+ key: "1",
10923
+ onClick: onClick,
10924
+ disabled: disabled
10925
+ }, "\u5220\u9664\u884C");
10926
+ }, [model, onClick, disabled]);
10927
+ var button = React.useMemo(function () {
10928
+ if (model === 'prefab') return React.createElement(React.Fragment, null);
10929
+ return React.createElement(Button, {
10930
+ onClick: onClick,
10931
+ disabled: disabled
10932
+ }, "\u6279\u91CF\u5220\u9664");
10933
+ }, [model, onClick, disabled]);
11384
10934
  return {
11385
- columnWidth: 45,
11386
- columnTitle: columnTitle,
11387
- onSelect: onSelect,
11388
- selectedRowKeys: selectedRowKeys
10935
+ button: button,
10936
+ menuItem: menuItem
10937
+ };
10938
+ });
10939
+
10940
+ /** 延迟函数 */
10941
+ var lazyFn$1 = (function (fn) {
10942
+ var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
10943
+ // let timer: any = 0;
10944
+ // return (...par: any[]) => {
10945
+ // if (timer === 0) {
10946
+ // timer = setTimeout(() => {
10947
+ // fn.apply(null, par);
10948
+ // timer = 0;
10949
+ // }, delayed);
10950
+ // }
10951
+ // }
10952
+ var timer;
10953
+ return function () {
10954
+ for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
10955
+ par[_key] = arguments[_key];
10956
+ }
10957
+
10958
+ if (timer) return;
10959
+ timer = setTimeout(function () {
10960
+ timer = undefined;
10961
+ fn.apply(null, par);
10962
+ }, delayed);
11389
10963
  };
11390
10964
  });
11391
10965
 
11392
- var css_248z$7 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n";
10966
+ var css_248z$7 = ".kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-body {\n flex: 1;\n overflow: auto;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-footer {\n flex: none;\n}\n";
11393
10967
  styleInject(css_248z$7);
11394
10968
 
11395
- var useEndowCodeButton = (function () {
10969
+ var Text$3 = Typography.Text;
10970
+
10971
+ var _create = create(all, {
10972
+ number: 'BigNumber',
10973
+ precision: 20
10974
+ }),
10975
+ chain = _create.chain;
10976
+
10977
+ var useAddDiscountRowButton = (function () {
10978
+ /** 控制器 */
11396
10979
  var controller = Invoice.useInvoiceController();
11397
- /** 是否禁用 */
10980
+ var model = controller.useMemo(function (s) {
10981
+ return s.model;
10982
+ }, []);
10983
+ /** 是否能添加折扣行 */
10984
+
10985
+ var isAddDiscount = controller.useMemo(function (s) {
10986
+ return s.goodsListState.isAddDiscount;
10987
+ }, []);
10988
+ /** 是否开启抽屉 */
10989
+
10990
+ var visible = controller.useMemo(function (s) {
10991
+ return s.goodsListState.discountGoodIndex.length > 0;
10992
+ }, []);
10993
+ /** 是否禁用 按钮 */
11398
10994
 
11399
10995
  var disabled = controller.useMemo(function (s) {
11400
- if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
10996
+ if (s.goodsListState.selectedGoodIndex.length <= 0) {
10997
+ return true;
10998
+ }
10999
+
11000
+ return s.goodsListState.selectedGoodIndex.some(function (e) {
11001
+ var good = s.goodsListState.goodsMap.get(e);
11002
+ if (!good) return true;
11003
+ return good.lineAttribute !== LineAttributeType$1.正常;
11004
+ });
11401
11005
  }, []);
11402
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
11403
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11006
+ /** 关闭抽屉 */
11007
+
11008
+ var onClose = React.useCallback(function () {
11009
+ controller.pipeline( /*#__PURE__*/function () {
11010
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11011
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11012
+ while (1) {
11013
+ switch (_context.prev = _context.next) {
11014
+ case 0:
11015
+ s.goodsListState.discountGoodIndex = [];
11016
+
11017
+ case 1:
11018
+ case "end":
11019
+ return _context.stop();
11020
+ }
11021
+ }
11022
+ }, _callee);
11023
+ }));
11024
+
11025
+ return function (_x) {
11026
+ return _ref.apply(this, arguments);
11027
+ };
11028
+ }())();
11029
+ }, []);
11030
+ /** 点击了 添加折扣行 按钮 */
11031
+
11032
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
11033
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11404
11034
  while (1) {
11405
- switch (_context2.prev = _context2.next) {
11035
+ switch (_context3.prev = _context3.next) {
11406
11036
  case 0:
11407
- _context2.next = 2;
11037
+ _context3.next = 2;
11408
11038
  return controller.saveEditGood();
11409
11039
 
11410
11040
  case 2:
11411
- _context2.next = 4;
11041
+ _context3.next = 4;
11412
11042
  return controller.wait();
11413
11043
 
11414
11044
  case 4:
11415
- _context2.next = 6;
11045
+ _context3.next = 6;
11416
11046
  return controller.pipeline( /*#__PURE__*/function () {
11417
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11418
- return _regeneratorRuntime().wrap(function _callee$(_context) {
11047
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
11048
+ var isOk;
11049
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11419
11050
  while (1) {
11420
- switch (_context.prev = _context.next) {
11051
+ switch (_context2.prev = _context2.next) {
11421
11052
  case 0:
11422
- if (!(s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0)) {
11423
- _context.next = 3;
11053
+ isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
11054
+
11055
+ if (!isOk) {
11056
+ _context2.next = 4;
11424
11057
  break;
11425
11058
  }
11426
11059
 
11427
- coolingFn('不能给正在编辑的货物赋码', 3000, function () {
11428
- message.error('不能给正在编辑的货物赋码');
11060
+ message.error({
11061
+ content: '不能给编辑状态的行增加折扣!',
11062
+ key: '不能给编辑状态的行增加折扣!'
11429
11063
  });
11430
- return _context.abrupt("return");
11064
+ return _context2.abrupt("return");
11431
11065
 
11432
- case 3:
11433
- if (!s.goodsListState.selectedGoodIndex.map(function (e) {
11434
- return s.goodsListState.goodsMap.get(e);
11435
- }).some(function (e, _, arr) {
11436
- var _arr$;
11066
+ case 4:
11067
+ isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
11068
+ var good = s.goodsListState.goodsMap.get($index);
11069
+ return !good || good.taxRate === 0 && !good.taxFreeType;
11070
+ });
11437
11071
 
11438
- return (e === null || e === void 0 ? void 0 : e.taxRate) !== ((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$.taxRate);
11439
- })) {
11440
- _context.next = 6;
11072
+ if (!isOk) {
11073
+ _context2.next = 8;
11441
11074
  break;
11442
11075
  }
11443
11076
 
11444
- coolingFn('商品税率不一致不能操作批量赋码', 3000, function () {
11445
- message.error('商品税率不一致不能操作批量赋码');
11077
+ message.error({
11078
+ content: '零税率需要设置免税类型,请在赋码中设置!',
11079
+ key: '零税率需要设置免税类型,请在赋码中设置!'
11080
+ });
11081
+ return _context2.abrupt("return");
11082
+
11083
+ case 8:
11084
+ isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
11085
+ var good = s.goodsListState.goodsMap.get($index);
11086
+ return "".concat(good === null || good === void 0 ? void 0 : good.lineAmountIncludeTax) === '0';
11087
+ });
11088
+
11089
+ if (!isOk) {
11090
+ _context2.next = 12;
11091
+ break;
11092
+ }
11093
+
11094
+ message.error({
11095
+ content: '金额为0不能添加折扣行',
11096
+ key: '金额为0不能添加折扣行'
11446
11097
  });
11447
- return _context.abrupt("return");
11098
+ return _context2.abrupt("return");
11448
11099
 
11449
- case 6:
11450
- // 设置赋码
11451
- s.goodsListState.endowCode.endowcodeGoodIndex = s.goodsListState.selectedGoodIndex;
11100
+ case 12:
11101
+ s.goodsListState.discountGoodIndex = s.goodsListState.selectedGoodIndex.slice();
11452
11102
 
11453
- case 7:
11103
+ case 13:
11454
11104
  case "end":
11455
- return _context.stop();
11105
+ return _context2.stop();
11456
11106
  }
11457
11107
  }
11458
- }, _callee);
11108
+ }, _callee2);
11459
11109
  }));
11460
11110
 
11461
- return function (_x) {
11462
- return _ref2.apply(this, arguments);
11111
+ return function (_x2) {
11112
+ return _ref3.apply(this, arguments);
11463
11113
  };
11464
11114
  }())();
11465
11115
 
11466
11116
  case 6:
11467
11117
  case "end":
11468
- return _context2.stop();
11118
+ return _context3.stop();
11469
11119
  }
11470
11120
  }
11471
- }, _callee2);
11121
+ }, _callee3);
11472
11122
  })), [controller]);
11473
11123
  var menuItem = React.useMemo(function () {
11474
- return React.createElement(Menu.Item, {
11475
- key: "2",
11476
- onClick: onClick,
11477
- disabled: disabled
11478
- }, "\u6279\u91CF\u8D4B\u7801");
11479
- }, [onClick, disabled]);
11480
- var buuton = React.useMemo(function () {
11481
- return React.createElement(Button, {
11124
+ return model === 'prefab' ? React.createElement(React.Fragment, null) : isAddDiscount !== false ? React.createElement(Menu.Item, {
11125
+ key: "0",
11482
11126
  onClick: onClick,
11483
11127
  disabled: disabled
11484
- }, "\u6279\u91CF\u8D4B\u7801");
11485
- }, [onClick, disabled]);
11128
+ }, "\u6DFB\u52A0\u6298\u6263\u884C") : undefined;
11129
+ }, [isAddDiscount, disabled, onClick]);
11130
+ var drawer = React.useMemo(function () {
11131
+ return React.createElement(Drawer, {
11132
+ className: "kts-invoice-operate-goods-list-add-discount-row",
11133
+ width: 540,
11134
+ title: "\u6DFB\u52A0\u6298\u6263\u884C",
11135
+ placement: "right",
11136
+ destroyOnClose: true,
11137
+ onClose: onClose,
11138
+ visible: visible
11139
+ }, React.createElement(DrawerBody, null));
11140
+ }, [visible, onClose]);
11486
11141
  return {
11487
11142
  menuItem: menuItem,
11488
- buuton: buuton
11143
+ drawer: drawer
11489
11144
  };
11490
11145
  });
11146
+ var DrawerBody = decorator(Form.create())(function (props) {
11147
+ var form = props.form;
11148
+ var getFieldDecorator = form.getFieldDecorator;
11149
+ var controller = Invoice.useInvoiceController();
11150
+ /** 选中的货物索引列表 */
11151
+
11152
+ var discountGoodIndex = controller.useMemo(function (s) {
11153
+ return s.goodsListState.discountGoodIndex;
11154
+ }, []);
11155
+ /** 金额合计 */
11156
+
11157
+ var lineAmountSum = controller.useMemo(function (s) {
11158
+ var sum = chain(0);
11159
+
11160
+ if (s.goodsListState.isTaxIncluded) {
11161
+ s.goodsListState.discountGoodIndex.forEach(function (e) {
11162
+ var goods = s.goodsListState.goodsMap.get(e);
11163
+ sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountIncludeTax) || 0);
11164
+ });
11165
+ } else {
11166
+ s.goodsListState.discountGoodIndex.forEach(function (e) {
11167
+ var goods = s.goodsListState.goodsMap.get(e);
11168
+ sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountExcludeTax) || 0);
11169
+ });
11170
+ }
11171
+
11172
+ return sum.done();
11173
+ }, []);
11174
+ /** 关闭抽屉 */
11175
+
11176
+ var onClose = React.useCallback(function () {
11177
+ controller.pipeline( /*#__PURE__*/function () {
11178
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
11179
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11180
+ while (1) {
11181
+ switch (_context4.prev = _context4.next) {
11182
+ case 0:
11183
+ s.goodsListState.discountGoodIndex = [];
11184
+
11185
+ case 1:
11186
+ case "end":
11187
+ return _context4.stop();
11188
+ }
11189
+ }
11190
+ }, _callee4);
11191
+ }));
11192
+
11193
+ return function (_x3) {
11194
+ return _ref4.apply(this, arguments);
11195
+ };
11196
+ }())();
11197
+ }, []);
11198
+ /** 点击了保存 */
11199
+
11200
+ var onClickSave = React.useCallback(function () {
11201
+ form.validateFields(function (err, values) {
11202
+ if (err) return;
11203
+ var discolineAmountunt = parseFloat(parseFloat(values.discolineAmountunt).toFixed(2));
11204
+ var discount = parseFloat(parseFloat(values.discount).toFixed(4));
11205
+ var indexList = discountGoodIndex;
11206
+ controller.pipeline( /*#__PURE__*/function () {
11207
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
11208
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11209
+ while (1) {
11210
+ switch (_context5.prev = _context5.next) {
11211
+ case 0:
11212
+ s.goodsListState.discountGoodIndex = [];
11213
+
11214
+ case 1:
11215
+ case "end":
11216
+ return _context5.stop();
11217
+ }
11218
+ }
11219
+ }, _callee5);
11220
+ }));
11221
+
11222
+ return function (_x4) {
11223
+ return _ref5.apply(this, arguments);
11224
+ };
11225
+ }())();
11226
+ controller.addGoodDiscount({
11227
+ indexList: indexList,
11228
+ discount: discount,
11229
+ discolineAmountunt: discolineAmountunt
11230
+ });
11231
+ });
11232
+ }, [controller, form, discountGoodIndex]);
11233
+ /** 折扣率变化 */
11234
+
11235
+ var onChangeDiscount = React.useCallback(lazyFn$1(function (e) {
11236
+ form.validateFields(function (err, values) {
11237
+ if (err && err.discount) return;
11238
+ var discolineAmountunt = evaluate("".concat(lineAmountSum, " * (").concat(values.discount, "/100)")).toFixed(2);
11239
+ form.setFieldsValue({
11240
+ discolineAmountunt: discolineAmountunt
11241
+ });
11242
+ });
11243
+ }, 300), [form, lineAmountSum]);
11244
+ /** 折扣变化 */
11245
+
11246
+ var onChangeDiscolineAmountunt = React.useCallback(lazyFn$1(function (e) {
11247
+ form.validateFields(function (err, values) {
11248
+ if (err && err.discolineAmountunt) return;
11249
+ var discolineAmountunt = parseFloat(values.discolineAmountunt).toFixed(2);
11250
+ var discount = evaluate("(".concat(discolineAmountunt, " / ").concat(lineAmountSum, ") * 100")).toFixed(4);
11251
+ form.setFieldsValue({
11252
+ discount: discount
11253
+ });
11254
+ });
11255
+ }, 300), [form, lineAmountSum]);
11256
+ return React.createElement(React.Fragment, null, React.createElement("div", {
11257
+ className: "add-discount-row-body"
11258
+ }, React.createElement("p", null, "\u5F53\u524D\u9009\u62E9", React.createElement(Text$3, {
11259
+ type: "danger"
11260
+ }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React.createElement(Text$3, {
11261
+ type: "danger"
11262
+ }, lineAmountSum.toFixed(2))), React.createElement(Form.Item, {
11263
+ label: "\u6298\u6263\u7387\uFF1A"
11264
+ }, getFieldDecorator('discount', {
11265
+ rules: [{
11266
+ required: true,
11267
+ message: '请输入折扣金额'
11268
+ }, {
11269
+ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
11270
+ message: '请输入数字'
11271
+ }, {
11272
+ validator: function validator(_, value, callback) {
11273
+ var _value$match;
11274
+
11275
+ if (!value) {
11276
+ callback();
11277
+ return;
11278
+ }
11279
+
11280
+ if (!((_value$match = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match === void 0 ? void 0 : _value$match.length)) {
11281
+ callback();
11282
+ return;
11283
+ }
11284
+
11285
+ if (parseFloat(value) > 100 || parseFloat(value) < 0) {
11286
+ callback('请输入大于0小于100的数字');
11287
+ }
11288
+
11289
+ callback();
11290
+ }
11291
+ }]
11292
+ })(React.createElement(Input, {
11293
+ placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E100\u7684\u6570\u5B57",
11294
+ suffix: "%",
11295
+ onChange: onChangeDiscount
11296
+ }))), React.createElement(Form.Item, {
11297
+ label: "\u6298\u6263\u91D1\u989D\uFF1A"
11298
+ }, getFieldDecorator('discolineAmountunt', {
11299
+ rules: [{
11300
+ required: true,
11301
+ message: '请输入折扣金额'
11302
+ }, {
11303
+ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
11304
+ message: '请输入数字'
11305
+ }, {
11306
+ validator: function validator(_, value, callback) {
11307
+ var _value$match2;
11308
+
11309
+ if (!value) {
11310
+ callback();
11311
+ return;
11312
+ }
11313
+
11314
+ if (!((_value$match2 = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match2 === void 0 ? void 0 : _value$match2.length)) {
11315
+ callback();
11316
+ return;
11317
+ }
11318
+
11319
+ if (parseFloat(value) > lineAmountSum || parseFloat(value) < 0) {
11320
+ callback('请输入大于0小于金额合计的数字');
11321
+ }
11322
+
11323
+ callback();
11324
+ }
11325
+ }]
11326
+ })(React.createElement(Input, {
11327
+ placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E\u91D1\u989D\u5408\u8BA1\u7684\u6570\u5B57",
11328
+ suffix: "\xA5",
11329
+ onChange: onChangeDiscolineAmountunt
11330
+ })))), React.createElement("div", {
11331
+ className: "add-discount-row-footer"
11332
+ }, React.createElement(Button, {
11333
+ block: true,
11334
+ style: {
11335
+ marginBottom: 12
11336
+ },
11337
+ onClick: onClose
11338
+ }, "\u53D6\u6D88"), React.createElement(Button, {
11339
+ type: "primary",
11340
+ block: true,
11341
+ onClick: onClickSave
11342
+ }, "\u4FDD\u5B58")));
11343
+ });
11491
11344
 
11492
11345
  var GoodsList = /*#__PURE__*/function (_React$Component) {
11493
11346
  _inherits(GoodsList, _React$Component);
@@ -11539,6 +11392,12 @@ var Main = decorator(Form.create())(function (props) {
11539
11392
  /** 批量赋码 */
11540
11393
 
11541
11394
  var endowCodeButton = useEndowCodeButton();
11395
+ /** 批量删除 */
11396
+
11397
+ var delRowButton = useDelRowButton();
11398
+ /** 添加折扣行 */
11399
+
11400
+ var addDiscountRowButton = useAddDiscountRowButton();
11542
11401
  /** 清空自动赋码缓存 */
11543
11402
 
11544
11403
  React.useEffect(function () {
@@ -11696,7 +11555,7 @@ var Main = decorator(Form.create())(function (props) {
11696
11555
  className: "kts-invoice-operate-goods-list-able"
11697
11556
  }, React.createElement("div", {
11698
11557
  className: "kts-invoice-operate-goods-list-able-list"
11699
- }, React.createElement(AddRowButton, null), React.createElement(BulkMenu, null), endowCodeButton.buuton, React.createElement(Search, null)), React.createElement("div", {
11558
+ }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, addDiscountRowButton.drawer, React.createElement(Search, null)), React.createElement("div", {
11700
11559
  className: "kts-invoice-operate-goods-list-able-extend"
11701
11560
  }, props.menuExpansion, React.createElement(DescribeSwitch, null), React.createElement(TaxIncludedSwitch, null))), React.createElement("div", {
11702
11561
  className: classnames('kts-invoice-operate-goods-list-table', {
@@ -11728,6 +11587,19 @@ var Main = decorator(Form.create())(function (props) {
11728
11587
  })), React.createElement("div", null, React.createElement(Statistics, null)));
11729
11588
  });
11730
11589
 
11590
+ /** 更新 商品序号 */
11591
+
11592
+ function useToGenerateId(controller) {
11593
+ var goodsList = controller.useMemo(function (s) {
11594
+ return s.goodsListState.goodsList;
11595
+ }, []);
11596
+ React.useEffect(function () {
11597
+ goodsList.forEach(function (e, i) {
11598
+ e.serialNo = i + 1;
11599
+ });
11600
+ }, [goodsList]);
11601
+ }
11602
+
11731
11603
  var css_248z$8 = ".kts-invoice-operate-seller {\n display: flex;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message {\n flex: 1;\n display: flex;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .ktsAnt3x-descriptions-item-label {\n width: 179px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list {\n width: 100%;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-view {\n border: none;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-label {\n padding: 0 10px;\n font-size: 12px;\n background-color: #fff;\n line-height: 30px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-label::before {\n content: '*';\n position: relative;\n color: red;\n font-weight: bold;\n margin-right: 2px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-content {\n padding: 0;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input {\n box-shadow: none;\n border-color: #fff;\n border-radius: 0;\n padding: 0 10px;\n font-size: 12px;\n line-height: 30px;\n width: 100%;\n height: 30px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input:hover {\n border: 1 solid;\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input,\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input:hover {\n background-color: #fff;\n border: 1 solid;\n border-color: #f5222d;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-form-item-control {\n line-height: 0;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-message .kts-invoice-operate-seller-message-list .ktsAnt3x-form-explain {\n position: absolute;\n right: 5px;\n top: 6px;\n z-index: 10;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-remarks {\n border-left: 1px solid #dcdcdc;\n display: flex;\n flex: none;\n width: 458px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-remarks-value {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-remarks-value textarea {\n flex: 1;\n margin-bottom: 0;\n border: none;\n border-radius: 0;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-title {\n flex: none;\n width: 30px;\n height: 100%;\n text-align: center;\n border-right: 1px solid #dcdcdc;\n display: table;\n padding: 0 5px;\n}\n.kts-invoice-operate-seller .kts-invoice-operate-seller-title label {\n display: table-cell;\n vertical-align: middle;\n}\n";
11732
11604
  styleInject(css_248z$8);
11733
11605
 
@@ -12199,7 +12071,7 @@ function interval(i, t) {
12199
12071
  var css_248z$a = ".kts-invoice-operate-buyer {\n display: flex;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message {\n flex: 1;\n display: flex;\n position: relative;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .ktsAnt3x-descriptions-item-label {\n width: 179px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list {\n width: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-view {\n border: none;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-label {\n padding: 0 10px;\n font-size: 12px;\n background-color: #fff;\n line-height: 30px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content {\n padding: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input {\n box-shadow: none;\n border-color: #fff;\n border-radius: 0;\n padding: 0 10px;\n font-size: 12px;\n line-height: 30px;\n width: 100%;\n height: 100%;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .ktsAnt3x-input:hover {\n border: 1 solid;\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input,\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-descriptions-item-content .has-error .ktsAnt3x-input:hover {\n background-color: #fff;\n border: 1 solid;\n border-color: #f5222d;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-control {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-item-children .ktsAnt3x-btn {\n line-height: 0;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-list .ktsAnt3x-form-explain {\n position: absolute;\n left: 5px;\n top: 6px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-message .kts-invoice-operate-buyer-message-Import {\n position: absolute;\n right: 0px;\n top: 0px;\n z-index: 10;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-password {\n border-left: 1px solid #dcdcdc;\n display: flex;\n flex: none;\n width: 458px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title {\n flex: none;\n width: 30px;\n height: 100%;\n text-align: center;\n border-right: 1px solid #dcdcdc;\n display: table;\n padding: 0 5px;\n}\n.kts-invoice-operate-buyer .kts-invoice-operate-buyer-title label {\n display: table-cell;\n vertical-align: middle;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover {\n padding-top: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-inner-content {\n padding: 6px 0;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overflow-x: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .ktsAnt3x-popover-arrow {\n display: none;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content {\n width: 567px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block {\n padding: 14px 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-block label {\n display: block;\n font-size: 12px;\n color: #666666;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued {\n padding: 0;\n margin: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued li {\n list-style: none;\n width: 50%;\n float: left;\n margin-bottom: 20px;\n padding: 0 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-recently-issued::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company {\n padding: 0;\n margin: 0;\n font-size: 12px;\n padding: 10px;\n font-weight: bold;\n color: #000000;\n cursor: pointer;\n transition: background 0.4s;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:hover {\n background: #e6e6e6e6;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company:last-child {\n margin-bottom: 0;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company li {\n list-style: none;\n width: 50%;\n float: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 10px;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content .kts-invoice-operate-buyer-name-content-select-company::after {\n content: \".\";\n display: block;\n height: 0;\n clear: left;\n visibility: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag {\n line-height: 1;\n padding: 4px 12px;\n background: #F3F3F3;\n border-radius: 9999px;\n font-size: 12px;\n font-weight: bold;\n color: #000;\n cursor: pointer;\n transition: background 0.4s;\n display: inline-block;\n max-width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.ktsAnt3x-popover.kts-invoice-operate-buyer-name-popover .kts-invoice-operate-buyer-name-content-tag:hover {\n background: #e6e6e6e6;\n}\n";
12200
12072
  styleInject(css_248z$a);
12201
12073
 
12202
- var Text$5 = Typography.Text;
12074
+ var Text$4 = Typography.Text;
12203
12075
 
12204
12076
  var Buyer$1 = /*#__PURE__*/function (_React$Component) {
12205
12077
  _inherits(Buyer, _React$Component);
@@ -12313,7 +12185,7 @@ var Main$2 = decorator(Form.create())(function (props) {
12313
12185
  if (e.options.rules.some(function (e) {
12314
12186
  return e.required;
12315
12187
  })) {
12316
- return React.createElement(React.Fragment, null, React.createElement(Text$5, {
12188
+ return React.createElement(React.Fragment, null, React.createElement(Text$4, {
12317
12189
  type: "danger"
12318
12190
  }, "*"), e.label);
12319
12191
  } else {
@@ -13525,7 +13397,7 @@ function AddComparisonDrawer() {
13525
13397
  good.itemName = shorthand ? "*".concat(shorthand, "*").concat(values.itemName) : values.itemName;
13526
13398
  good.itemNameSelf = shorthand ? "*".concat(shorthand, "*").concat(values.itemNameSelf) : values.itemNameSelf;
13527
13399
 
13528
- if (good.lineAttribute === LineAttributeType$1.正常) {
13400
+ if (good.lineAttribute !== LineAttributeType$1.折扣行) {
13529
13401
  good.itemModelName = values.itemModelName;
13530
13402
  good.itemModelNameSelf = values.itemModelNameSelf;
13531
13403
  }
@@ -13692,9 +13564,11 @@ var Main$3 = function Main(props) {
13692
13564
  key = _React$useState2[0],
13693
13565
  setKey = _React$useState2[1];
13694
13566
 
13567
+ useToGenerateId(controller);
13695
13568
  React.useEffect(function () {
13696
13569
  setKey(key + 1);
13697
13570
  }, [controller]);
13571
+ React.useEffect(function () {}, []);
13698
13572
  return React.createElement(InvoiceContext.Provider, {
13699
13573
  key: key,
13700
13574
  value: controller