kts-component-invoice-operate 2.0.22 → 3.0.1

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 (45) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.d.ts +1 -1
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +3 -1
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +5 -5
  4. package/dist/Invoice/InvoiceController/fns/addGoodDiscount.d.ts +1 -1
  5. package/dist/Invoice/InvoiceController/fns/delGood.d.ts +1 -1
  6. package/dist/Invoice/InvoiceController/index.d.ts +1 -1
  7. package/dist/Invoice/index.d.ts +1 -1
  8. package/dist/Invoice/tools/idGenerator/index.d.ts +1 -1
  9. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.d.ts +1 -1
  10. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +5 -2
  11. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +5 -2
  12. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +5 -2
  13. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -1
  14. package/dist/Invoice/ui/GoodsList/hook/useToGenerateId/index.d.ts +3 -0
  15. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
  16. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -1
  17. package/dist/index.esm.js +915 -1038
  18. package/dist/index.js +914 -1037
  19. package/docs-dist/umi.css +2 -3
  20. package/docs-dist/umi.js +1 -1
  21. package/package.json +1 -1
  22. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +1 -1
  23. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +4 -1
  24. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +5 -5
  25. package/src/Invoice/InvoiceController/fns/addGoodDiscount.ts +1 -1
  26. package/src/Invoice/InvoiceController/fns/delGood.ts +2 -4
  27. package/src/Invoice/index.tsx +13 -18
  28. package/src/Invoice/tools/idGenerator/index.ts +3 -2
  29. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +1 -1
  30. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +22 -29
  31. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/{useAddComparison → _useAddComparison}/index.tsx +5 -1
  32. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +34 -11
  33. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +19 -7
  34. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +11 -5
  35. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +53 -19
  36. package/src/Invoice/ui/GoodsList/hook/useOnRow/index.tsx +0 -1
  37. package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +9 -0
  38. package/src/Invoice/ui/GoodsList/index.less +5 -1
  39. package/src/Invoice/ui/GoodsList/index.tsx +17 -3
  40. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +1 -1
  41. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +10 -39
  42. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +11 -2
  43. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.tsx +2 -2
  44. package/src/Invoice/ui/GoodsList/ui/TableRow/index.tsx +13 -4
  45. 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,9 +1216,8 @@ var delGood = /*#__PURE__*/(function () {
1216
1216
  };
1217
1217
  })();
1218
1218
 
1219
- var id = 1;
1220
1219
  var idGenerator = (function () {
1221
- return ++id;
1220
+ return v4();
1222
1221
  });
1223
1222
 
1224
1223
  /** 格式化 保留2位小数 */
@@ -2125,7 +2124,6 @@ var AddRowButton = (function () {
2125
2124
  })), [controller]);
2126
2125
  if (model === 'prefab') return React.createElement(React.Fragment, null);
2127
2126
  return React.createElement(Button, {
2128
- icon: "plus-circle",
2129
2127
  onClick: onClick,
2130
2128
  disabled: disabled
2131
2129
  }, "\u6DFB\u52A0\u884C");
@@ -2344,128 +2342,67 @@ function TableRow(props) {
2344
2342
  var goodsMap = controller.useMemo(function (s) {
2345
2343
  return s.goodsListState.goodsMap;
2346
2344
  }, []);
2347
- var isR = React.useMemo(function () {
2345
+ var discount = React.useMemo(function () {
2348
2346
  var i = goodsMap.get(props['data-row-key']);
2349
- if (!i) return false;
2350
- return i.lineAttribute !== LineAttributeType$1.正常;
2347
+ if (!i) return undefined;
2348
+
2349
+ if (i.lineAttribute === LineAttributeType$1.折扣行) {
2350
+ return 'kts-invoice-operate-goods-be-discount';
2351
+ } else if (i.lineAttribute === LineAttributeType$1.被折扣行) {
2352
+ return 'kts-invoice-operate-goods-discount';
2353
+ } else {
2354
+ return undefined;
2355
+ }
2351
2356
  }, [props['data-row-key'], goodsMap]);
2352
- return React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
2353
- className: "".concat(isR ? 'kts-invoice-operate-goods-discount ' : '').concat(props.className)
2354
- }));
2357
+ return (// <tr {...props} className={`${isR ? 'kts-invoice-operate-goods-discount ' : ''}${props.className}`} />
2358
+ React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
2359
+ className: classnames(props.className, discount)
2360
+ }))
2361
+ );
2355
2362
  }
2356
2363
 
2357
- var useDelRowButton = (function () {
2364
+ var _defs$1, _path$2;
2365
+
2366
+ 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); }
2367
+
2368
+ function SvgSpot(props) {
2369
+ return /*#__PURE__*/createElement("svg", _extends$2({
2370
+ className: "spot_svg__icon",
2371
+ viewBox: "0 0 1024 1024",
2372
+ xmlns: "http://www.w3.org/2000/svg"
2373
+ }, props), _defs$1 || (_defs$1 = /*#__PURE__*/createElement("defs", null, /*#__PURE__*/createElement("style", null))), _path$2 || (_path$2 = /*#__PURE__*/createElement("path", {
2374
+ 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"
2375
+ })));
2376
+ }
2377
+
2378
+ var useDelItem = (function (goods) {
2358
2379
  var controller = Invoice.useInvoiceController();
2359
2380
  var model = controller.useMemo(function (s) {
2360
2381
  return s.model;
2361
2382
  }, []);
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
2383
  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
- }
2384
+ controller.delGood(goods.$index);
2385
+ }, [controller, goods.$index]);
2389
2386
 
2390
- s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
2391
- goodsList: goodsList,
2392
- selectedGoodIndex: []
2393
- });
2387
+ if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
2388
+ return undefined;
2389
+ }
2394
2390
 
2395
- case 3:
2396
- case "end":
2397
- return _context.stop();
2398
- }
2399
- }
2400
- }, _callee);
2401
- }));
2391
+ if (!(model !== 'prefab')) {
2392
+ return undefined;
2393
+ }
2402
2394
 
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
2395
  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));
2396
+ key: 'delItem',
2397
+ title: '删除',
2398
+ onClick: onClick
2399
+ }; // return React.useMemo(() => {
2400
+ // return <Menu.Item key="delItem" onClick={onClick}><Text strong type="danger">删除</Text></Menu.Item>
2401
+ // }, [onClick])
2454
2402
  });
2455
2403
 
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
2404
  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
- /** 控制器 */
2405
+ var useAddDiscount = (function (goods) {
2469
2406
  var controller = Invoice.useInvoiceController();
2470
2407
  var model = controller.useMemo(function (s) {
2471
2408
  return s.model;
@@ -2475,92 +2412,61 @@ var useAddDiscountRowButton = (function () {
2475
2412
  var isAddDiscount = controller.useMemo(function (s) {
2476
2413
  return s.goodsListState.isAddDiscount;
2477
2414
  }, []);
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
2415
  /** 点击了 添加折扣行 按钮 */
2521
2416
 
2522
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2523
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2417
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2418
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2524
2419
  while (1) {
2525
- switch (_context3.prev = _context3.next) {
2420
+ switch (_context2.prev = _context2.next) {
2526
2421
  case 0:
2527
- _context3.next = 2;
2528
- return controller.saveEditGood();
2422
+ _context2.next = 2;
2423
+ return controller.wait();
2529
2424
 
2530
2425
  case 2:
2531
- _context3.next = 4;
2532
- return controller.wait();
2426
+ _context2.next = 4;
2427
+ return controller.saveEditGood();
2533
2428
 
2534
2429
  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) {
2430
+ _context2.next = 6;
2431
+ return controller.run( /*#__PURE__*/function () {
2432
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2433
+ var err, key;
2434
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2540
2435
  while (1) {
2541
- switch (_context2.prev = _context2.next) {
2436
+ switch (_context.prev = _context.next) {
2542
2437
  case 0:
2543
- isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
2438
+ if (!s.goodsListState.form) {
2439
+ _context.next = 11;
2440
+ break;
2441
+ }
2544
2442
 
2545
- if (!isOk) {
2546
- _context2.next = 4;
2443
+ err = s.goodsListState.form.getFieldsError();
2444
+ _context.t0 = _regeneratorRuntime().keys(err);
2445
+
2446
+ case 3:
2447
+ if ((_context.t1 = _context.t0()).done) {
2448
+ _context.next = 11;
2547
2449
  break;
2548
2450
  }
2549
2451
 
2550
- message.error({
2551
- content: '不能给编辑状态的行增加折扣!',
2552
- key: '不能给编辑状态的行增加折扣!'
2553
- });
2554
- return _context2.abrupt("return");
2452
+ key = _context.t1.value;
2555
2453
 
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
- });
2454
+ if (err[key]) {
2455
+ _context.next = 7;
2456
+ break;
2457
+ }
2561
2458
 
2562
- if (!isOk) {
2563
- _context2.next = 8;
2459
+ return _context.abrupt("continue", 3);
2460
+
2461
+ case 7:
2462
+ message.error(err[key][0]);
2463
+ return _context.abrupt("return");
2464
+
2465
+ case 11:
2466
+ goods = s.goodsListState.goodsMap.get(goods.$index);
2467
+
2468
+ if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2469
+ _context.next = 15;
2564
2470
  break;
2565
2471
  }
2566
2472
 
@@ -2568,16 +2474,11 @@ var useAddDiscountRowButton = (function () {
2568
2474
  content: '零税率需要设置免税类型,请在赋码中设置!',
2569
2475
  key: '零税率需要设置免税类型,请在赋码中设置!'
2570
2476
  });
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
- });
2477
+ return _context.abrupt("return");
2578
2478
 
2579
- if (!isOk) {
2580
- _context2.next = 12;
2479
+ case 15:
2480
+ if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2481
+ _context.next = 18;
2581
2482
  break;
2582
2483
  }
2583
2484
 
@@ -2585,566 +2486,10 @@ var useAddDiscountRowButton = (function () {
2585
2486
  content: '金额为0不能添加折扣行',
2586
2487
  key: '金额为0不能添加折扣行'
2587
2488
  });
2588
- return _context2.abrupt("return");
2489
+ return _context.abrupt("return");
2589
2490
 
2590
- case 12:
2591
- s.goodsListState.discountGoodIndex = s.goodsListState.selectedGoodIndex.slice();
2592
-
2593
- case 13:
2594
- case "end":
2595
- return _context2.stop();
2596
- }
2597
- }
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];
2491
+ case 18:
2492
+ s.goodsListState.discountGoodIndex = [goods.$index];
3148
2493
 
3149
2494
  case 19:
3150
2495
  case "end":
@@ -3157,7 +2502,7 @@ var useAddDiscount = (function (goods) {
3157
2502
  return function (_x) {
3158
2503
  return _ref2.apply(this, arguments);
3159
2504
  };
3160
- }())();
2505
+ }());
3161
2506
 
3162
2507
  case 6:
3163
2508
  case "end":
@@ -3171,20 +2516,77 @@ var useAddDiscount = (function (goods) {
3171
2516
  return undefined;
3172
2517
  }
3173
2518
 
3174
- return React.useMemo(function () {
3175
- if (goods.lineAttribute !== LineAttributeType$1.正常) {
3176
- return undefined;
3177
- }
2519
+ if (!(model !== 'prefab')) {
2520
+ return undefined;
2521
+ }
3178
2522
 
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]);
2523
+ if (!(isAddDiscount !== false)) {
2524
+ return undefined;
2525
+ }
2526
+
2527
+ if (goods.lineAttribute !== LineAttributeType$1.正常) {
2528
+ return undefined;
2529
+ }
2530
+
2531
+ return {
2532
+ key: 'addDiscount',
2533
+ title: '折扣',
2534
+ onClick: onClick
2535
+ }; // return React.useMemo(() => {
2536
+ // if (goods.lineAttribute !== LineAttributeType.正常) {
2537
+ // return undefined
2538
+ // }
2539
+ // return (
2540
+ // <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
2541
+ // );
2542
+ // }, [onClick, goods.lineAttribute]);
2543
+ });
2544
+
2545
+ var math = create(all, {
2546
+ number: 'BigNumber',
2547
+ precision: 20
2548
+ });
2549
+ var evaluate = (function (expr) {
2550
+ var fractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
2551
+ return parseFloat(math.evaluate(expr).toFixed(fractionDigits));
3186
2552
  });
3187
2553
 
2554
+ /** 拆分全称加简称 */
2555
+ var getSN = function getSN(value) {
2556
+ if (!value) return undefined;
2557
+ var arr = value.match(/\*[^*]+\*/);
2558
+
2559
+ if (arr && arr[0]) {
2560
+ return {
2561
+ shorthand: arr[0].split('*')[1],
2562
+ full: value.replace(arr[0], '')
2563
+ };
2564
+ } else {
2565
+ return {
2566
+ shorthand: undefined,
2567
+ full: value
2568
+ };
2569
+ }
2570
+ };
2571
+ /** 组合全称加简称 */
2572
+
2573
+ var getItemName = function getItemName(value) {
2574
+ if (value.shorthand) {
2575
+ return "*".concat(value.shorthand, "*").concat(value.full);
2576
+ } else {
2577
+ return value.full;
2578
+ }
2579
+ };
2580
+ /** 设置简称 */
2581
+
2582
+ var setShorthand = function setShorthand(name, shorthand) {
2583
+ if (!name) return undefined;
2584
+ var sn = getSN(name);
2585
+ if (!sn) return undefined;
2586
+ sn.shorthand = shorthand || '';
2587
+ return getItemName(sn);
2588
+ };
2589
+
3188
2590
  //! moment.js
3189
2591
  //! version : 2.29.3
3190
2592
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -3590,12 +2992,12 @@ function Locale(config) {
3590
2992
  }
3591
2993
  }
3592
2994
 
3593
- var keys$1;
2995
+ var keys;
3594
2996
 
3595
2997
  if (Object.keys) {
3596
- keys$1 = Object.keys;
2998
+ keys = Object.keys;
3597
2999
  } else {
3598
- keys$1 = function (obj) {
3000
+ keys = function (obj) {
3599
3001
  var i,
3600
3002
  res = [];
3601
3003
  for (i in obj) {
@@ -5443,7 +4845,7 @@ function getLocale(key) {
5443
4845
  }
5444
4846
 
5445
4847
  function listLocales() {
5446
- return keys$1(locales);
4848
+ return keys(locales);
5447
4849
  }
5448
4850
 
5449
4851
  function checkOverflow(m) {
@@ -8863,7 +8265,7 @@ hooks.HTML5_FMT = {
8863
8265
 
8864
8266
  /** 延迟函数 */
8865
8267
 
8866
- var lazyFn$1 = function lazyFn(fn) {
8268
+ var lazyFn = function lazyFn(fn) {
8867
8269
  var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
8868
8270
  var timer;
8869
8271
  return function () {
@@ -8903,7 +8305,7 @@ var promptErr = function promptErr(err) {
8903
8305
  /** 数量改变了 */
8904
8306
 
8905
8307
 
8906
- var onChangeQuantity = lazyFn$1(function (controller, form, record) {
8308
+ var onChangeQuantity = lazyFn(function (controller, form, record) {
8907
8309
  form.validateFields( /*#__PURE__*/function () {
8908
8310
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err, values) {
8909
8311
  var quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
@@ -9052,7 +8454,7 @@ var onChangeQuantity = lazyFn$1(function (controller, form, record) {
9052
8454
  }, 1000);
9053
8455
  /** 单价(含税) */
9054
8456
 
9055
- var onChangePriceIncludeTax = lazyFn$1(function (controller, form, record) {
8457
+ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
9056
8458
  form.validateFields( /*#__PURE__*/function () {
9057
8459
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(err, values) {
9058
8460
  var priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
@@ -9151,7 +8553,7 @@ var onChangePriceIncludeTax = lazyFn$1(function (controller, form, record) {
9151
8553
  }, 1000);
9152
8554
  /** 单价(不含税) */
9153
8555
 
9154
- var onChangePriceExcludeTax = lazyFn$1(function (controller, form, record) {
8556
+ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
9155
8557
  form.validateFields( /*#__PURE__*/function () {
9156
8558
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
9157
8559
  var priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
@@ -9250,7 +8652,7 @@ var onChangePriceExcludeTax = lazyFn$1(function (controller, form, record) {
9250
8652
  }, 1000);
9251
8653
  /** 金额(含税) */
9252
8654
 
9253
- var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record) {
8655
+ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
9254
8656
  form.validateFields( /*#__PURE__*/function () {
9255
8657
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
9256
8658
  var lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
@@ -9342,7 +8744,7 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
9342
8744
  }, 1000);
9343
8745
  /** 金额(不含税) */
9344
8746
 
9345
- var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record) {
8747
+ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
9346
8748
  form.validateFields( /*#__PURE__*/function () {
9347
8749
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(err, values) {
9348
8750
  var lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
@@ -9434,7 +8836,7 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
9434
8836
  }, 1000);
9435
8837
  /** 税率 */
9436
8838
 
9437
- var onChangeTaxRate = lazyFn$1(function (controller, form, record) {
8839
+ var onChangeTaxRate = lazyFn(function (controller, form, record) {
9438
8840
  form.validateFields( /*#__PURE__*/function () {
9439
8841
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
9440
8842
  var taxRate;
@@ -9673,11 +9075,11 @@ var endowCode = /*#__PURE__*/function () {
9673
9075
  switch (_context11.prev = _context11.next) {
9674
9076
  case 0:
9675
9077
  _context11.next = 2;
9676
- return controller.saveEditGood();
9078
+ return controller.wait();
9677
9079
 
9678
9080
  case 2:
9679
9081
  _context11.next = 4;
9680
- return controller.wait();
9082
+ return controller.saveEditGood();
9681
9083
 
9682
9084
  case 4:
9683
9085
  _context11.next = 6;
@@ -9830,151 +9232,63 @@ var onChangeItemName = /*#__PURE__*/function () {
9830
9232
  return _context12.stop();
9831
9233
  }
9832
9234
  }
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;
9940
-
9941
- case 12:
9942
- case "end":
9943
- return _context.stop();
9944
- }
9945
- }
9946
- }, _callee);
9235
+ }, _callee12);
9947
9236
  }));
9948
9237
 
9949
- return function (_x) {
9950
- return _ref2.apply(this, arguments);
9238
+ return function (_x25) {
9239
+ return _ref13.apply(this, arguments);
9951
9240
  };
9952
9241
  }());
9953
9242
 
9954
- case 6:
9243
+ case 1:
9955
9244
  case "end":
9956
- return _context2.stop();
9245
+ return _context13.stop();
9957
9246
  }
9958
9247
  }
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]);
9248
+ }, _callee13);
9249
+ }));
9250
+
9251
+ return function onChangeItemName(_x22, _x23, _x24) {
9252
+ return _ref12.apply(this, arguments);
9253
+ };
9254
+ }();
9255
+
9256
+ var useEndowCode = (function (goods) {
9257
+ var controller = Invoice.useInvoiceController();
9258
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9259
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9260
+ while (1) {
9261
+ switch (_context.prev = _context.next) {
9262
+ case 0:
9263
+ endowCode(controller, goods);
9264
+
9265
+ case 1:
9266
+ case "end":
9267
+ return _context.stop();
9268
+ }
9269
+ }
9270
+ }, _callee);
9271
+ })), [controller, goods]);
9272
+ return {
9273
+ key: 'endowCode',
9274
+ title: '赋码',
9275
+ onClick: onClick
9276
+ }; // return React.useMemo(() => {
9277
+ // return (
9278
+ // <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
9279
+ // );
9280
+ // }, [goods.lineAttribute, onClick])
9281
+ // return React.useMemo(() => {
9282
+ // return (
9283
+ // <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
9284
+ // );
9285
+ // }, [goods.lineAttribute, onClick])
9973
9286
  });
9974
9287
 
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);
9288
+ 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";
9289
+ styleInject(css_248z$5);
9977
9290
 
9291
+ var Text$1 = Typography.Text;
9978
9292
  var RowMenu = (function (props) {
9979
9293
  var controller = Invoice.useInvoiceController();
9980
9294
  var model = controller.useMemo(function (s) {
@@ -9990,16 +9304,16 @@ var RowMenu = (function (props) {
9990
9304
  }, []);
9991
9305
  var delItem = useDelItem(props.goods);
9992
9306
  var addDiscount = useAddDiscount(props.goods);
9993
- var endowCode = useEndowCode(props.goods);
9994
- var addComparison = useAddComparison(props.goods);
9307
+ var endowCode = useEndowCode(props.goods); // const addComparison = useAddComparison(props.goods);
9308
+
9995
9309
  var itemList = React.useMemo(function () {
9996
9310
  var arr = [];
9997
- model !== 'prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
9311
+ endowCode && arr.push(endowCode); // 赋码
9998
9312
 
9999
- props.goods.lineAttribute !== LineAttributeType$1.折扣行 && arr.push(addComparison); // 添加商品对照
10000
- // endowCode && arr.push(endowCode); // 赋码
9313
+ addDiscount && arr.push(addDiscount); // 添加折扣行
10001
9314
 
10002
- model !== 'prefab' && delItem && arr.push(delItem); // 删除
9315
+ delItem && arr.push(delItem); // 删除
9316
+ // addComparison && arr.push(addComparison); // 添加商品对照
10003
9317
 
10004
9318
  if (!goodsMenuExpand || goodsMenuExpand.length === 0) return arr;
10005
9319
  arr.unshift(React.createElement(Menu.Divider, {
@@ -10013,13 +9327,51 @@ var RowMenu = (function (props) {
10013
9327
 
10014
9328
  return arr;
10015
9329
  }, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model, isAddDiscount]);
9330
+ var overlay = React.useMemo(function () {
9331
+ if (itemList.length <= 2) {
9332
+ return undefined;
9333
+ }
9334
+
9335
+ return React.createElement(Menu, null, itemList.slice(2).map(function (e) {
9336
+ return React.createElement(Menu.Item, {
9337
+ key: e.key,
9338
+ onClick: e.onClick
9339
+ }, React.createElement(Text$1, {
9340
+ strong: true
9341
+ }, e.title));
9342
+ }));
9343
+ }, [itemList]);
9344
+ var buttonList = React.useMemo(function () {
9345
+ return React.createElement("div", {
9346
+ style: {
9347
+ flex: 1,
9348
+ textAlign: 'left',
9349
+ display: 'flex',
9350
+ gap: 10
9351
+ }
9352
+ }, itemList.slice(0, 2).map(function (e) {
9353
+ return React.createElement(Button, {
9354
+ key: e.key,
9355
+ type: 'link',
9356
+ onClick: e.onClick,
9357
+ style: {
9358
+ padding: 0
9359
+ }
9360
+ }, e.title);
9361
+ }));
9362
+ }, [itemList]);
10016
9363
 
10017
9364
  if (itemList.length === 0) {
10018
9365
  return React.createElement(React.Fragment, null);
10019
9366
  }
10020
9367
 
10021
- return React.createElement("span", null, endowCode, React.createElement(Dropdown, {
10022
- overlay: React.createElement(Menu, null, itemList),
9368
+ return React.createElement("span", {
9369
+ style: {
9370
+ padding: '0 0 0 10px',
9371
+ display: 'flex'
9372
+ }
9373
+ }, buttonList, overlay && React.createElement(Dropdown, {
9374
+ overlay: overlay,
10023
9375
  trigger: ['click']
10024
9376
  }, React.createElement(Button, {
10025
9377
  className: "kts-invoice-operate-goods-list-columns-row-menu ant-btn-icon-only",
@@ -10029,7 +9381,7 @@ var RowMenu = (function (props) {
10029
9381
  }))));
10030
9382
  });
10031
9383
 
10032
- var Text$4 = Typography.Text;
9384
+ var Text$2 = Typography.Text;
10033
9385
  var useColumns = (function (form) {
10034
9386
  var getFieldDecorator = form.getFieldDecorator,
10035
9387
  getFieldValue = form.getFieldValue;
@@ -10080,14 +9432,24 @@ var useColumns = (function (form) {
10080
9432
 
10081
9433
  var columns = React.useMemo(function () {
10082
9434
  return [{
10083
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9435
+ title: '序号',
9436
+ key: 'serialNo',
9437
+ dataIndex: 'serialNo',
9438
+ width: 50,
9439
+ render: function render(e) {
9440
+ return React.createElement("span", {
9441
+ style: {
9442
+ padding: '0 10px'
9443
+ }
9444
+ }, e);
9445
+ }
9446
+ }, {
9447
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10084
9448
  type: "danger"
10085
- }, "*"), "\u8D27\u7269\u540D\u79F0"),
9449
+ }, "*"), "\u9879\u76EE\u540D\u79F0"),
10086
9450
  key: 'itemName',
10087
9451
  render: function render(_, record) {
10088
9452
  if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
10089
- var _editGood$itemName;
10090
-
10091
9453
  return React.createElement(Form.Item, null, React.createElement("div", {
10092
9454
  style: {
10093
9455
  display: 'flex'
@@ -10144,13 +9506,9 @@ var useColumns = (function (form) {
10144
9506
  }
10145
9507
  })), React.createElement("div", {
10146
9508
  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, {
9509
+ }, controller.getGoodsList && React.createElement(Tooltip, {
9510
+ title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F"
9511
+ }, React.createElement(Button, {
10154
9512
  onClick: controller.pipeline( /*#__PURE__*/function () {
10155
9513
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
10156
9514
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -10173,7 +9531,7 @@ var useColumns = (function (form) {
10173
9531
  }()),
10174
9532
  type: "link",
10175
9533
  icon: "plus-circle"
10176
- }))));
9534
+ })))));
10177
9535
  } else {
10178
9536
  return React.createElement(MyItemNameDiv, {
10179
9537
  valueT: formatSearch(record.itemNameSelf, searchValue),
@@ -10278,7 +9636,11 @@ var useColumns = (function (form) {
10278
9636
  }()
10279
9637
  })));
10280
9638
  } else {
10281
- return record.unit;
9639
+ return React.createElement("span", {
9640
+ style: {
9641
+ padding: '0 10px'
9642
+ }
9643
+ }, record.unit);
10282
9644
  }
10283
9645
  }
10284
9646
  }, {
@@ -10498,7 +9860,7 @@ var useColumns = (function (form) {
10498
9860
  }
10499
9861
  }
10500
9862
  }, {
10501
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9863
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10502
9864
  type: "danger"
10503
9865
  }, "*"), "\u91D1\u989D(\u542B\u7A0E)"),
10504
9866
  dataIndex: 'lineAmountIncludeTax',
@@ -10585,7 +9947,7 @@ var useColumns = (function (form) {
10585
9947
  }
10586
9948
  }
10587
9949
  }, {
10588
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
9950
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10589
9951
  type: "danger"
10590
9952
  }, "*"), "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
10591
9953
  dataIndex: 'lineAmountExcludeTax',
@@ -10647,9 +10009,9 @@ var useColumns = (function (form) {
10647
10009
  }
10648
10010
  }
10649
10011
  }, {
10650
- title: React.createElement(React.Fragment, null, React.createElement(Text$4, {
10012
+ title: React.createElement(React.Fragment, null, React.createElement(Text$2, {
10651
10013
  type: "danger"
10652
- }, "*"), "\u7A0E\u7387"),
10014
+ }, "*"), "\u7A0E\u7387%"),
10653
10015
  dataIndex: 'taxRate',
10654
10016
  key: 'taxRate',
10655
10017
  align: 'right',
@@ -10715,10 +10077,9 @@ var useColumns = (function (form) {
10715
10077
  }
10716
10078
  }, {
10717
10079
  title: '操作',
10718
- dataIndex: 'operating',
10719
10080
  key: 'operating',
10720
- width: 120,
10721
- align: 'center',
10081
+ align: 'right',
10082
+ width: 110,
10722
10083
  render: function render(_value, record) {
10723
10084
  return React.createElement(RowMenu, {
10724
10085
  key: record.lineAttribute,
@@ -10949,7 +10310,7 @@ var useOnRow = (function () {
10949
10310
 
10950
10311
  case 5:
10951
10312
  if (!editGood) {
10952
- _context2.next = 16;
10313
+ _context2.next = 14;
10953
10314
  break;
10954
10315
  }
10955
10316
 
@@ -10966,10 +10327,6 @@ var useOnRow = (function () {
10966
10327
 
10967
10328
  case 10:
10968
10329
  _context2.next = 12;
10969
- return controller.wait();
10970
-
10971
- case 12:
10972
- _context2.next = 14;
10973
10330
  return controller.pipeline( /*#__PURE__*/function () {
10974
10331
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10975
10332
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -10999,15 +10356,15 @@ var useOnRow = (function () {
10999
10356
  };
11000
10357
  }())();
11001
10358
 
11002
- case 14:
11003
- _context2.next = 18;
10359
+ case 12:
10360
+ _context2.next = 16;
11004
10361
  break;
11005
10362
 
11006
- case 16:
11007
- _context2.next = 18;
10363
+ case 14:
10364
+ _context2.next = 16;
11008
10365
  return controller.setEditGood(record);
11009
10366
 
11010
- case 18:
10367
+ case 16:
11011
10368
  case "end":
11012
10369
  return _context2.stop();
11013
10370
  }
@@ -11340,154 +10697,654 @@ var useRowSelection = (function () {
11340
10697
  var goods = s.goodsListState.goodsMap.get($index);
11341
10698
  if (!goods || goods.lineAttribute === LineAttributeType$1.正常) return; // 数组位置
11342
10699
 
11343
- var t = s.goodsListState.goodsList.indexOf(goods);
11344
- goods.lineAttribute === LineAttributeType$1.折扣行 ? t-- : t++;
11345
- var i = s.goodsListState.goodsList[t].$index;
10700
+ var t = s.goodsListState.goodsList.indexOf(goods);
10701
+ goods.lineAttribute === LineAttributeType$1.折扣行 ? t-- : t++;
10702
+ var i = s.goodsListState.goodsList[t].$index;
10703
+
10704
+ if (selected) {
10705
+ if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = [].concat(_toConsumableArray(s.goodsListState.selectedGoodIndex), [i]);
10706
+ } else {
10707
+ if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(function (e) {
10708
+ return e !== $index;
10709
+ });
10710
+ }
10711
+ });
10712
+
10713
+ case 1:
10714
+ case "end":
10715
+ return _context7.stop();
10716
+ }
10717
+ }
10718
+ }, _callee7);
10719
+ }));
10720
+
10721
+ return function (_x8) {
10722
+ return _ref8.apply(this, arguments);
10723
+ };
10724
+ }())();
10725
+
10726
+ case 4:
10727
+ case "end":
10728
+ return _context8.stop();
10729
+ }
10730
+ }
10731
+ }, _callee8);
10732
+ }));
10733
+
10734
+ return function (_x7) {
10735
+ return _ref7.apply(this, arguments);
10736
+ };
10737
+ }(), [controller]);
10738
+ React.useEffect(function () {
10739
+ sortOut(true);
10740
+ }, [sortOut, goodsList]);
10741
+ return {
10742
+ columnWidth: 45,
10743
+ columnTitle: columnTitle,
10744
+ onSelect: onSelect,
10745
+ selectedRowKeys: selectedRowKeys
10746
+ };
10747
+ });
10748
+
10749
+ 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-be-discount,\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-be-discount {\n color: #D9001B;\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";
10750
+ styleInject(css_248z$6);
10751
+
10752
+ var keys$1 = {};
10753
+ /**
10754
+ * 有冷却时间的函数
10755
+ * @param fn 方法
10756
+ * @param key 方法key
10757
+ * @param delayed 冷却时间
10758
+ */
10759
+
10760
+ var coolingFn = (function () {
10761
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
10762
+ var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
10763
+ var fn = arguments.length > 2 ? arguments[2] : undefined;
10764
+
10765
+ if (keys$1[key]) {
10766
+ return;
10767
+ } else {
10768
+ fn();
10769
+ keys$1[key] = setTimeout(function () {
10770
+ delete keys$1[key];
10771
+ }, delayed);
10772
+ }
10773
+ });
10774
+
10775
+ var useEndowCodeButton = (function () {
10776
+ var controller = Invoice.useInvoiceController();
10777
+ /** 是否禁用 */
10778
+
10779
+ var disabled = controller.useMemo(function (s) {
10780
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
10781
+ }, []);
10782
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10783
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10784
+ while (1) {
10785
+ switch (_context2.prev = _context2.next) {
10786
+ case 0:
10787
+ _context2.next = 2;
10788
+ return controller.saveEditGood();
10789
+
10790
+ case 2:
10791
+ _context2.next = 4;
10792
+ return controller.wait();
10793
+
10794
+ case 4:
10795
+ _context2.next = 6;
10796
+ return controller.pipeline( /*#__PURE__*/function () {
10797
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10798
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10799
+ while (1) {
10800
+ switch (_context.prev = _context.next) {
10801
+ case 0:
10802
+ if (!(s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0)) {
10803
+ _context.next = 3;
10804
+ break;
10805
+ }
10806
+
10807
+ coolingFn('不能给正在编辑的货物赋码', 3000, function () {
10808
+ message.error('不能给正在编辑的货物赋码');
10809
+ });
10810
+ return _context.abrupt("return");
10811
+
10812
+ case 3:
10813
+ if (!s.goodsListState.selectedGoodIndex.map(function (e) {
10814
+ return s.goodsListState.goodsMap.get(e);
10815
+ }).some(function (e, _, arr) {
10816
+ var _arr$;
10817
+
10818
+ return (e === null || e === void 0 ? void 0 : e.taxRate) !== ((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$.taxRate);
10819
+ })) {
10820
+ _context.next = 6;
10821
+ break;
10822
+ }
10823
+
10824
+ coolingFn('商品税率不一致不能操作批量赋码', 3000, function () {
10825
+ message.error('商品税率不一致不能操作批量赋码');
10826
+ });
10827
+ return _context.abrupt("return");
10828
+
10829
+ case 6:
10830
+ // 设置赋码
10831
+ s.goodsListState.endowCode.endowcodeGoodIndex = s.goodsListState.selectedGoodIndex;
10832
+
10833
+ case 7:
10834
+ case "end":
10835
+ return _context.stop();
10836
+ }
10837
+ }
10838
+ }, _callee);
10839
+ }));
10840
+
10841
+ return function (_x) {
10842
+ return _ref2.apply(this, arguments);
10843
+ };
10844
+ }())();
10845
+
10846
+ case 6:
10847
+ case "end":
10848
+ return _context2.stop();
10849
+ }
10850
+ }
10851
+ }, _callee2);
10852
+ })), [controller]);
10853
+ var menuItem = React.useMemo(function () {
10854
+ return React.createElement(Menu.Item, {
10855
+ key: "2",
10856
+ onClick: onClick,
10857
+ disabled: disabled
10858
+ }, "\u6279\u91CF\u8D4B\u7801");
10859
+ }, [onClick, disabled]);
10860
+ var button = React.useMemo(function () {
10861
+ return React.createElement(Button, {
10862
+ onClick: onClick,
10863
+ disabled: disabled
10864
+ }, "\u6279\u91CF\u8D4B\u7801");
10865
+ }, [onClick, disabled]);
10866
+ return {
10867
+ menuItem: menuItem,
10868
+ button: button
10869
+ };
10870
+ });
10871
+
10872
+ var useDelRowButton = (function () {
10873
+ var controller = Invoice.useInvoiceController();
10874
+ var model = controller.useMemo(function (s) {
10875
+ return s.model;
10876
+ }, []);
10877
+ /** 是否禁用 */
11346
10878
 
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
- });
10879
+ var disabled = controller.useMemo(function (s) {
10880
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
10881
+ return s.goodsListState.selectedGoodIndex.some(function (e) {
10882
+ var good = s.goodsListState.goodsMap.get(e);
10883
+ if (!good) return true;
10884
+ return good.lineAttribute !== LineAttributeType$1.正常;
10885
+ });
10886
+ }, []);
10887
+ var onClick = React.useCallback(function () {
10888
+ controller.pipeline( /*#__PURE__*/function () {
10889
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10890
+ var goodsList;
10891
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10892
+ while (1) {
10893
+ switch (_context.prev = _context.next) {
10894
+ case 0:
10895
+ goodsList = s.goodsListState.goodsList.filter(function (e) {
10896
+ return s.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
10897
+ });
11355
10898
 
11356
- case 1:
11357
- case "end":
11358
- return _context7.stop();
11359
- }
11360
- }
11361
- }, _callee7);
11362
- }));
10899
+ if (s.goodsListState.editGood) {
10900
+ if (s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0) {
10901
+ controller.setEditGood();
10902
+ }
10903
+ }
11363
10904
 
11364
- return function (_x8) {
11365
- return _ref8.apply(this, arguments);
11366
- };
11367
- }())();
10905
+ s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
10906
+ goodsList: goodsList,
10907
+ selectedGoodIndex: []
10908
+ });
11368
10909
 
11369
- case 4:
11370
- case "end":
11371
- return _context8.stop();
10910
+ case 3:
10911
+ case "end":
10912
+ return _context.stop();
10913
+ }
11372
10914
  }
11373
- }
11374
- }, _callee8);
11375
- }));
10915
+ }, _callee);
10916
+ }));
11376
10917
 
11377
- return function (_x7) {
11378
- return _ref7.apply(this, arguments);
11379
- };
11380
- }(), [controller]);
11381
- React.useEffect(function () {
11382
- sortOut(true);
11383
- }, [sortOut, goodsList]);
10918
+ return function (_x) {
10919
+ return _ref.apply(this, arguments);
10920
+ };
10921
+ }())();
10922
+ }, [controller]);
10923
+ var menuItem = React.useMemo(function () {
10924
+ if (model === 'prefab') return React.createElement(React.Fragment, null);
10925
+ return React.createElement(Menu.Item, {
10926
+ key: "1",
10927
+ onClick: onClick,
10928
+ disabled: disabled
10929
+ }, "\u5220\u9664\u884C");
10930
+ }, [model, onClick, disabled]);
10931
+ var button = React.useMemo(function () {
10932
+ if (model === 'prefab') return React.createElement(React.Fragment, null);
10933
+ return React.createElement(Button, {
10934
+ onClick: onClick,
10935
+ disabled: disabled
10936
+ }, "\u6279\u91CF\u5220\u9664");
10937
+ }, [model, onClick, disabled]);
11384
10938
  return {
11385
- columnWidth: 45,
11386
- columnTitle: columnTitle,
11387
- onSelect: onSelect,
11388
- selectedRowKeys: selectedRowKeys
10939
+ button: button,
10940
+ menuItem: menuItem
10941
+ };
10942
+ });
10943
+
10944
+ /** 延迟函数 */
10945
+ var lazyFn$1 = (function (fn) {
10946
+ var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
10947
+ // let timer: any = 0;
10948
+ // return (...par: any[]) => {
10949
+ // if (timer === 0) {
10950
+ // timer = setTimeout(() => {
10951
+ // fn.apply(null, par);
10952
+ // timer = 0;
10953
+ // }, delayed);
10954
+ // }
10955
+ // }
10956
+ var timer;
10957
+ return function () {
10958
+ for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
10959
+ par[_key] = arguments[_key];
10960
+ }
10961
+
10962
+ if (timer) return;
10963
+ timer = setTimeout(function () {
10964
+ timer = undefined;
10965
+ fn.apply(null, par);
10966
+ }, delayed);
11389
10967
  };
11390
10968
  });
11391
10969
 
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";
10970
+ 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
10971
  styleInject(css_248z$7);
11394
10972
 
11395
- var useEndowCodeButton = (function () {
10973
+ var Text$3 = Typography.Text;
10974
+
10975
+ var _create = create(all, {
10976
+ number: 'BigNumber',
10977
+ precision: 20
10978
+ }),
10979
+ chain = _create.chain;
10980
+
10981
+ var useAddDiscountRowButton = (function () {
10982
+ /** 控制器 */
11396
10983
  var controller = Invoice.useInvoiceController();
11397
- /** 是否禁用 */
10984
+ var model = controller.useMemo(function (s) {
10985
+ return s.model;
10986
+ }, []);
10987
+ /** 是否能添加折扣行 */
10988
+
10989
+ var isAddDiscount = controller.useMemo(function (s) {
10990
+ return s.goodsListState.isAddDiscount;
10991
+ }, []);
10992
+ /** 是否开启抽屉 */
10993
+
10994
+ var visible = controller.useMemo(function (s) {
10995
+ return s.goodsListState.discountGoodIndex.length > 0;
10996
+ }, []);
10997
+ /** 是否禁用 按钮 */
11398
10998
 
11399
10999
  var disabled = controller.useMemo(function (s) {
11400
- if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
11000
+ if (s.goodsListState.selectedGoodIndex.length <= 0) {
11001
+ return true;
11002
+ }
11003
+
11004
+ return s.goodsListState.selectedGoodIndex.some(function (e) {
11005
+ var good = s.goodsListState.goodsMap.get(e);
11006
+ if (!good) return true;
11007
+ return good.lineAttribute !== LineAttributeType$1.正常;
11008
+ });
11401
11009
  }, []);
11402
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
11403
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11010
+ /** 关闭抽屉 */
11011
+
11012
+ var onClose = React.useCallback(function () {
11013
+ controller.pipeline( /*#__PURE__*/function () {
11014
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11015
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11016
+ while (1) {
11017
+ switch (_context.prev = _context.next) {
11018
+ case 0:
11019
+ s.goodsListState.discountGoodIndex = [];
11020
+
11021
+ case 1:
11022
+ case "end":
11023
+ return _context.stop();
11024
+ }
11025
+ }
11026
+ }, _callee);
11027
+ }));
11028
+
11029
+ return function (_x) {
11030
+ return _ref.apply(this, arguments);
11031
+ };
11032
+ }())();
11033
+ }, []);
11034
+ /** 点击了 添加折扣行 按钮 */
11035
+
11036
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
11037
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11404
11038
  while (1) {
11405
- switch (_context2.prev = _context2.next) {
11039
+ switch (_context3.prev = _context3.next) {
11406
11040
  case 0:
11407
- _context2.next = 2;
11041
+ _context3.next = 2;
11408
11042
  return controller.saveEditGood();
11409
11043
 
11410
11044
  case 2:
11411
- _context2.next = 4;
11045
+ _context3.next = 4;
11412
11046
  return controller.wait();
11413
11047
 
11414
11048
  case 4:
11415
- _context2.next = 6;
11049
+ _context3.next = 6;
11416
11050
  return controller.pipeline( /*#__PURE__*/function () {
11417
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11418
- return _regeneratorRuntime().wrap(function _callee$(_context) {
11051
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
11052
+ var isOk;
11053
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11419
11054
  while (1) {
11420
- switch (_context.prev = _context.next) {
11055
+ switch (_context2.prev = _context2.next) {
11421
11056
  case 0:
11422
- if (!(s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0)) {
11423
- _context.next = 3;
11057
+ isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
11058
+
11059
+ if (!isOk) {
11060
+ _context2.next = 4;
11424
11061
  break;
11425
11062
  }
11426
11063
 
11427
- coolingFn('不能给正在编辑的货物赋码', 3000, function () {
11428
- message.error('不能给正在编辑的货物赋码');
11064
+ message.error({
11065
+ content: '不能给编辑状态的行增加折扣!',
11066
+ key: '不能给编辑状态的行增加折扣!'
11429
11067
  });
11430
- return _context.abrupt("return");
11068
+ return _context2.abrupt("return");
11431
11069
 
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$;
11070
+ case 4:
11071
+ isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
11072
+ var good = s.goodsListState.goodsMap.get($index);
11073
+ return !good || good.taxRate === 0 && !good.taxFreeType;
11074
+ });
11437
11075
 
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;
11076
+ if (!isOk) {
11077
+ _context2.next = 8;
11441
11078
  break;
11442
11079
  }
11443
11080
 
11444
- coolingFn('商品税率不一致不能操作批量赋码', 3000, function () {
11445
- message.error('商品税率不一致不能操作批量赋码');
11081
+ message.error({
11082
+ content: '零税率需要设置免税类型,请在赋码中设置!',
11083
+ key: '零税率需要设置免税类型,请在赋码中设置!'
11084
+ });
11085
+ return _context2.abrupt("return");
11086
+
11087
+ case 8:
11088
+ isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
11089
+ var good = s.goodsListState.goodsMap.get($index);
11090
+ return "".concat(good === null || good === void 0 ? void 0 : good.lineAmountIncludeTax) === '0';
11091
+ });
11092
+
11093
+ if (!isOk) {
11094
+ _context2.next = 12;
11095
+ break;
11096
+ }
11097
+
11098
+ message.error({
11099
+ content: '金额为0不能添加折扣行',
11100
+ key: '金额为0不能添加折扣行'
11446
11101
  });
11447
- return _context.abrupt("return");
11102
+ return _context2.abrupt("return");
11448
11103
 
11449
- case 6:
11450
- // 设置赋码
11451
- s.goodsListState.endowCode.endowcodeGoodIndex = s.goodsListState.selectedGoodIndex;
11104
+ case 12:
11105
+ s.goodsListState.discountGoodIndex = s.goodsListState.selectedGoodIndex.slice();
11452
11106
 
11453
- case 7:
11107
+ case 13:
11454
11108
  case "end":
11455
- return _context.stop();
11109
+ return _context2.stop();
11456
11110
  }
11457
11111
  }
11458
- }, _callee);
11112
+ }, _callee2);
11459
11113
  }));
11460
11114
 
11461
- return function (_x) {
11462
- return _ref2.apply(this, arguments);
11115
+ return function (_x2) {
11116
+ return _ref3.apply(this, arguments);
11463
11117
  };
11464
11118
  }())();
11465
11119
 
11466
11120
  case 6:
11467
11121
  case "end":
11468
- return _context2.stop();
11122
+ return _context3.stop();
11469
11123
  }
11470
11124
  }
11471
- }, _callee2);
11125
+ }, _callee3);
11472
11126
  })), [controller]);
11473
11127
  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, {
11128
+ return model === 'prefab' ? React.createElement(React.Fragment, null) : isAddDiscount !== false ? React.createElement(Menu.Item, {
11129
+ key: "0",
11482
11130
  onClick: onClick,
11483
11131
  disabled: disabled
11484
- }, "\u6279\u91CF\u8D4B\u7801");
11485
- }, [onClick, disabled]);
11132
+ }, "\u6DFB\u52A0\u6298\u6263\u884C") : undefined;
11133
+ }, [isAddDiscount, disabled, onClick]);
11134
+ var drawer = React.useMemo(function () {
11135
+ return React.createElement(Drawer, {
11136
+ className: "kts-invoice-operate-goods-list-add-discount-row",
11137
+ width: 540,
11138
+ title: "\u6DFB\u52A0\u6298\u6263\u884C",
11139
+ placement: "right",
11140
+ destroyOnClose: true,
11141
+ onClose: onClose,
11142
+ visible: visible
11143
+ }, React.createElement(DrawerBody, null));
11144
+ }, [visible, onClose]);
11486
11145
  return {
11487
11146
  menuItem: menuItem,
11488
- buuton: buuton
11147
+ drawer: drawer
11489
11148
  };
11490
11149
  });
11150
+ var DrawerBody = decorator(Form.create())(function (props) {
11151
+ var form = props.form;
11152
+ var getFieldDecorator = form.getFieldDecorator;
11153
+ var controller = Invoice.useInvoiceController();
11154
+ /** 选中的货物索引列表 */
11155
+
11156
+ var discountGoodIndex = controller.useMemo(function (s) {
11157
+ return s.goodsListState.discountGoodIndex;
11158
+ }, []);
11159
+ /** 金额合计 */
11160
+
11161
+ var lineAmountSum = controller.useMemo(function (s) {
11162
+ var sum = chain(0);
11163
+
11164
+ if (s.goodsListState.isTaxIncluded) {
11165
+ s.goodsListState.discountGoodIndex.forEach(function (e) {
11166
+ var goods = s.goodsListState.goodsMap.get(e);
11167
+ sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountIncludeTax) || 0);
11168
+ });
11169
+ } else {
11170
+ s.goodsListState.discountGoodIndex.forEach(function (e) {
11171
+ var goods = s.goodsListState.goodsMap.get(e);
11172
+ sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountExcludeTax) || 0);
11173
+ });
11174
+ }
11175
+
11176
+ return sum.done();
11177
+ }, []);
11178
+ /** 关闭抽屉 */
11179
+
11180
+ var onClose = React.useCallback(function () {
11181
+ controller.pipeline( /*#__PURE__*/function () {
11182
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
11183
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11184
+ while (1) {
11185
+ switch (_context4.prev = _context4.next) {
11186
+ case 0:
11187
+ s.goodsListState.discountGoodIndex = [];
11188
+
11189
+ case 1:
11190
+ case "end":
11191
+ return _context4.stop();
11192
+ }
11193
+ }
11194
+ }, _callee4);
11195
+ }));
11196
+
11197
+ return function (_x3) {
11198
+ return _ref4.apply(this, arguments);
11199
+ };
11200
+ }())();
11201
+ }, []);
11202
+ /** 点击了保存 */
11203
+
11204
+ var onClickSave = React.useCallback(function () {
11205
+ form.validateFields(function (err, values) {
11206
+ if (err) return;
11207
+ var discolineAmountunt = parseFloat(parseFloat(values.discolineAmountunt).toFixed(2));
11208
+ var discount = parseFloat(parseFloat(values.discount).toFixed(4));
11209
+ var indexList = discountGoodIndex;
11210
+ controller.pipeline( /*#__PURE__*/function () {
11211
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
11212
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11213
+ while (1) {
11214
+ switch (_context5.prev = _context5.next) {
11215
+ case 0:
11216
+ s.goodsListState.discountGoodIndex = [];
11217
+
11218
+ case 1:
11219
+ case "end":
11220
+ return _context5.stop();
11221
+ }
11222
+ }
11223
+ }, _callee5);
11224
+ }));
11225
+
11226
+ return function (_x4) {
11227
+ return _ref5.apply(this, arguments);
11228
+ };
11229
+ }())();
11230
+ controller.addGoodDiscount({
11231
+ indexList: indexList,
11232
+ discount: discount,
11233
+ discolineAmountunt: discolineAmountunt
11234
+ });
11235
+ });
11236
+ }, [controller, form, discountGoodIndex]);
11237
+ /** 折扣率变化 */
11238
+
11239
+ var onChangeDiscount = React.useCallback(lazyFn$1(function (e) {
11240
+ form.validateFields(function (err, values) {
11241
+ if (err && err.discount) return;
11242
+ var discolineAmountunt = evaluate("".concat(lineAmountSum, " * (").concat(values.discount, "/100)")).toFixed(2);
11243
+ form.setFieldsValue({
11244
+ discolineAmountunt: discolineAmountunt
11245
+ });
11246
+ });
11247
+ }, 300), [form, lineAmountSum]);
11248
+ /** 折扣变化 */
11249
+
11250
+ var onChangeDiscolineAmountunt = React.useCallback(lazyFn$1(function (e) {
11251
+ form.validateFields(function (err, values) {
11252
+ if (err && err.discolineAmountunt) return;
11253
+ var discolineAmountunt = parseFloat(values.discolineAmountunt).toFixed(2);
11254
+ var discount = evaluate("(".concat(discolineAmountunt, " / ").concat(lineAmountSum, ") * 100")).toFixed(4);
11255
+ form.setFieldsValue({
11256
+ discount: discount
11257
+ });
11258
+ });
11259
+ }, 300), [form, lineAmountSum]);
11260
+ return React.createElement(React.Fragment, null, React.createElement("div", {
11261
+ className: "add-discount-row-body"
11262
+ }, React.createElement("p", null, "\u5F53\u524D\u9009\u62E9", React.createElement(Text$3, {
11263
+ type: "danger"
11264
+ }, discountGoodIndex.length), "\u884C\u88AB\u6298\u6263\u5546\u54C1\u884C\uFF0C\u91D1\u989D\u5408\u8BA1\xA5", React.createElement(Text$3, {
11265
+ type: "danger"
11266
+ }, lineAmountSum.toFixed(2))), React.createElement(Form.Item, {
11267
+ label: "\u6298\u6263\u7387\uFF1A"
11268
+ }, getFieldDecorator('discount', {
11269
+ rules: [{
11270
+ required: true,
11271
+ message: '请输入折扣金额'
11272
+ }, {
11273
+ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
11274
+ message: '请输入数字'
11275
+ }, {
11276
+ validator: function validator(_, value, callback) {
11277
+ var _value$match;
11278
+
11279
+ if (!value) {
11280
+ callback();
11281
+ return;
11282
+ }
11283
+
11284
+ if (!((_value$match = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match === void 0 ? void 0 : _value$match.length)) {
11285
+ callback();
11286
+ return;
11287
+ }
11288
+
11289
+ if (parseFloat(value) > 100 || parseFloat(value) < 0) {
11290
+ callback('请输入大于0小于100的数字');
11291
+ }
11292
+
11293
+ callback();
11294
+ }
11295
+ }]
11296
+ })(React.createElement(Input, {
11297
+ placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E100\u7684\u6570\u5B57",
11298
+ suffix: "%",
11299
+ onChange: onChangeDiscount
11300
+ }))), React.createElement(Form.Item, {
11301
+ label: "\u6298\u6263\u91D1\u989D\uFF1A"
11302
+ }, getFieldDecorator('discolineAmountunt', {
11303
+ rules: [{
11304
+ required: true,
11305
+ message: '请输入折扣金额'
11306
+ }, {
11307
+ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
11308
+ message: '请输入数字'
11309
+ }, {
11310
+ validator: function validator(_, value, callback) {
11311
+ var _value$match2;
11312
+
11313
+ if (!value) {
11314
+ callback();
11315
+ return;
11316
+ }
11317
+
11318
+ if (!((_value$match2 = value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)) === null || _value$match2 === void 0 ? void 0 : _value$match2.length)) {
11319
+ callback();
11320
+ return;
11321
+ }
11322
+
11323
+ if (parseFloat(value) > lineAmountSum || parseFloat(value) < 0) {
11324
+ callback('请输入大于0小于金额合计的数字');
11325
+ }
11326
+
11327
+ callback();
11328
+ }
11329
+ }]
11330
+ })(React.createElement(Input, {
11331
+ placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E\u91D1\u989D\u5408\u8BA1\u7684\u6570\u5B57",
11332
+ suffix: "\xA5",
11333
+ onChange: onChangeDiscolineAmountunt
11334
+ })))), React.createElement("div", {
11335
+ className: "add-discount-row-footer"
11336
+ }, React.createElement(Button, {
11337
+ block: true,
11338
+ style: {
11339
+ marginBottom: 12
11340
+ },
11341
+ onClick: onClose
11342
+ }, "\u53D6\u6D88"), React.createElement(Button, {
11343
+ type: "primary",
11344
+ block: true,
11345
+ onClick: onClickSave
11346
+ }, "\u4FDD\u5B58")));
11347
+ });
11491
11348
 
11492
11349
  var GoodsList = /*#__PURE__*/function (_React$Component) {
11493
11350
  _inherits(GoodsList, _React$Component);
@@ -11539,6 +11396,12 @@ var Main = decorator(Form.create())(function (props) {
11539
11396
  /** 批量赋码 */
11540
11397
 
11541
11398
  var endowCodeButton = useEndowCodeButton();
11399
+ /** 批量删除 */
11400
+
11401
+ var delRowButton = useDelRowButton();
11402
+ /** 添加折扣行 */
11403
+
11404
+ var addDiscountRowButton = useAddDiscountRowButton();
11542
11405
  /** 清空自动赋码缓存 */
11543
11406
 
11544
11407
  React.useEffect(function () {
@@ -11696,7 +11559,7 @@ var Main = decorator(Form.create())(function (props) {
11696
11559
  className: "kts-invoice-operate-goods-list-able"
11697
11560
  }, React.createElement("div", {
11698
11561
  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", {
11562
+ }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, addDiscountRowButton.drawer, React.createElement(Search, null)), React.createElement("div", {
11700
11563
  className: "kts-invoice-operate-goods-list-able-extend"
11701
11564
  }, props.menuExpansion, React.createElement(DescribeSwitch, null), React.createElement(TaxIncludedSwitch, null))), React.createElement("div", {
11702
11565
  className: classnames('kts-invoice-operate-goods-list-table', {
@@ -11728,6 +11591,19 @@ var Main = decorator(Form.create())(function (props) {
11728
11591
  })), React.createElement("div", null, React.createElement(Statistics, null)));
11729
11592
  });
11730
11593
 
11594
+ /** 更新 商品序号 */
11595
+
11596
+ function useToGenerateId(controller) {
11597
+ var goodsList = controller.useMemo(function (s) {
11598
+ return s.goodsListState.goodsList;
11599
+ }, []);
11600
+ React.useEffect(function () {
11601
+ goodsList.forEach(function (e, i) {
11602
+ e.serialNo = i + 1;
11603
+ });
11604
+ }, [goodsList]);
11605
+ }
11606
+
11731
11607
  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
11608
  styleInject(css_248z$8);
11733
11609
 
@@ -12199,7 +12075,7 @@ function interval(i, t) {
12199
12075
  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
12076
  styleInject(css_248z$a);
12201
12077
 
12202
- var Text$5 = Typography.Text;
12078
+ var Text$4 = Typography.Text;
12203
12079
 
12204
12080
  var Buyer$1 = /*#__PURE__*/function (_React$Component) {
12205
12081
  _inherits(Buyer, _React$Component);
@@ -12313,7 +12189,7 @@ var Main$2 = decorator(Form.create())(function (props) {
12313
12189
  if (e.options.rules.some(function (e) {
12314
12190
  return e.required;
12315
12191
  })) {
12316
- return React.createElement(React.Fragment, null, React.createElement(Text$5, {
12192
+ return React.createElement(React.Fragment, null, React.createElement(Text$4, {
12317
12193
  type: "danger"
12318
12194
  }, "*"), e.label);
12319
12195
  } else {
@@ -13692,6 +13568,7 @@ var Main$3 = function Main(props) {
13692
13568
  key = _React$useState2[0],
13693
13569
  setKey = _React$useState2[1];
13694
13570
 
13571
+ useToGenerateId(controller);
13695
13572
  React.useEffect(function () {
13696
13573
  setKey(key + 1);
13697
13574
  }, [controller]);