kts-component-invoice-operate 3.2.43 → 3.2.45

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.
@@ -17,7 +17,7 @@ export default class InvoiceController extends InvoiceControllerForm {
17
17
  /** 设置当前的编辑货物 */
18
18
  setEditGood: (option?: any) => Promise<any>;
19
19
  /** 保存正在编辑的货物 */
20
- saveEditGood: (option?: undefined) => Promise<any>;
20
+ saveEditGood: (option?: any) => Promise<any>;
21
21
  /** 删除一个货物 */
22
22
  delGood: (option?: string | undefined) => Promise<any>;
23
23
  /** 添加一个货物 */
package/dist/index.esm.js CHANGED
@@ -2,10 +2,10 @@ import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
2
2
  import React, { createElement, createContext, useContext, useEffect, forwardRef, Children, isValidElement } 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 as Icon$1, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover, Table as Table$1, Tree, Modal as Modal$1, Row as Row$1, Col as Col$1 } from 'kts-components-antd-x3';
5
+ import { message, Form, Input, Icon as Icon$1, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover as Popover$1, Table as Table$1, Tree, Modal as Modal$1, Row as Row$1, Col as Col$1 } from 'kts-components-antd-x3';
6
6
  import { v4 } from 'uuid';
7
- import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
8
- import classnames from 'classnames';
7
+ import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
8
+ import classNames from 'classnames';
9
9
  import { Table } from 'kts-components-antd-x4-v4';
10
10
  import { render } from 'react-dom';
11
11
  import { Input as Input$2, NumberPicker } from '@formily/antd-components';
@@ -1786,7 +1786,12 @@ function _mergeDetails() {
1786
1786
  case 26:
1787
1787
  sum.priceIncludeTax = _context.sent;
1788
1788
  // 计算税额
1789
- sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber();
1789
+ sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber(); // 校验数据 是否数量和金额是否同号
1790
+
1791
+ _context.next = 30;
1792
+ return checkSameNumber(sum);
1793
+
1794
+ case 30:
1790
1795
  p = state.goodsListState.goodsList.indexOf(goodsList[0]);
1791
1796
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1792
1797
  return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
@@ -1800,20 +1805,20 @@ function _mergeDetails() {
1800
1805
  state.goodsListState.goodsMap.set(e.$index, e);
1801
1806
  });
1802
1807
  state.goodsListState.selectedGoodIndex = [];
1803
- _context.next = 40;
1808
+ _context.next = 42;
1804
1809
  break;
1805
1810
 
1806
- case 37:
1807
- _context.prev = 37;
1811
+ case 39:
1812
+ _context.prev = 39;
1808
1813
  _context.t0 = _context["catch"](5);
1809
1814
  showError(_context.t0);
1810
1815
 
1811
- case 40:
1816
+ case 42:
1812
1817
  case "end":
1813
1818
  return _context.stop();
1814
1819
  }
1815
1820
  }
1816
- }, _callee, null, [[5, 37]]);
1821
+ }, _callee, null, [[5, 39]]);
1817
1822
  }));
1818
1823
  return _mergeDetails.apply(this, arguments);
1819
1824
  }
@@ -2007,7 +2012,7 @@ function _fillingInformationGood() {
2007
2012
  function checkTaxTate(_x11) {
2008
2013
  return _checkTaxTate.apply(this, arguments);
2009
2014
  }
2010
- /** 显示错误信息 */
2015
+ /** 校验数据 是否数量和金额是否同号 */
2011
2016
 
2012
2017
 
2013
2018
  function _checkTaxTate() {
@@ -2048,6 +2053,56 @@ function _checkTaxTate() {
2048
2053
  return _checkTaxTate.apply(this, arguments);
2049
2054
  }
2050
2055
 
2056
+ function checkSameNumber(_x12) {
2057
+ return _checkSameNumber.apply(this, arguments);
2058
+ }
2059
+ /** 显示错误信息 */
2060
+
2061
+
2062
+ function _checkSameNumber() {
2063
+ _checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(good) {
2064
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2065
+ while (1) {
2066
+ switch (_context9.prev = _context9.next) {
2067
+ case 0:
2068
+ if (good.quantity) {
2069
+ _context9.next = 2;
2070
+ break;
2071
+ }
2072
+
2073
+ return _context9.abrupt("return");
2074
+
2075
+ case 2:
2076
+ if (good.lineAmountExcludeTax) {
2077
+ _context9.next = 5;
2078
+ break;
2079
+ }
2080
+
2081
+ message$1.error('金额不能为空');
2082
+ throw new Error('金额不能为空');
2083
+
2084
+ case 5:
2085
+ if (!(good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0)) {
2086
+ _context9.next = 9;
2087
+ break;
2088
+ }
2089
+
2090
+ return _context9.abrupt("return");
2091
+
2092
+ case 9:
2093
+ message$1.error('金额和数量需要同号');
2094
+ throw new Error('金额和数量需要同号');
2095
+
2096
+ case 11:
2097
+ case "end":
2098
+ return _context9.stop();
2099
+ }
2100
+ }
2101
+ }, _callee9);
2102
+ }));
2103
+ return _checkSameNumber.apply(this, arguments);
2104
+ }
2105
+
2051
2106
  function showError(error) {
2052
2107
  console.log(error);
2053
2108
  message$1.error({
@@ -10133,7 +10188,7 @@ function TableRow(props) {
10133
10188
  bottom: 0
10134
10189
  }
10135
10190
  })) : React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
10136
- className: classnames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
10191
+ className: classNames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
10137
10192
  }));
10138
10193
  }
10139
10194
 
@@ -11840,8 +11895,8 @@ var Icon = /*#__PURE__*/forwardRef(function (props, ref) {
11840
11895
  _React$useContext$pre = _React$useContext.prefixCls,
11841
11896
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
11842
11897
 
11843
- var classString = classnames(prefixCls, className);
11844
- var svgClassString = classnames(_defineProperty$1({}, "".concat(prefixCls, "-spin"), !!spin));
11898
+ var classString = classNames(prefixCls, className);
11899
+ var svgClassString = classNames(_defineProperty$1({}, "".concat(prefixCls, "-spin"), !!spin));
11845
11900
  var svgStyle = rotate ? {
11846
11901
  msTransform: "rotate(".concat(rotate, "deg)"),
11847
11902
  transform: "rotate(".concat(rotate, "deg)")
@@ -11925,6 +11980,12 @@ styleInject(css_248z$9);
11925
11980
 
11926
11981
  function Drag$1(props) {
11927
11982
  var record = props.record;
11983
+
11984
+ var _React$useState = React.useState(false),
11985
+ _React$useState2 = _slicedToArray(_React$useState, 2),
11986
+ open = _React$useState2[0],
11987
+ setOpen = _React$useState2[1];
11988
+
11928
11989
  var controller = Invoice.useInvoiceController();
11929
11990
  var editGood = controller.useMemo(function (s) {
11930
11991
  return s.goodsListState.editGood;
@@ -11933,7 +11994,7 @@ function Drag$1(props) {
11933
11994
  return !!editGood;
11934
11995
  }, [editGood]);
11935
11996
  var onMouseDown = React.useCallback(function () {
11936
- if (!controller || !record) return;
11997
+ if (!controller || !record || disabled) return;
11937
11998
  controller.run( /*#__PURE__*/function () {
11938
11999
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11939
12000
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -12198,33 +12259,44 @@ function Drag$1(props) {
12198
12259
  };
12199
12260
  }());
12200
12261
  }
12201
- }, [controller, record]);
12202
- return React.createElement(Button, {
12203
- type: 'link',
12204
- style: {
12205
- padding: 0
12206
- },
12207
- disabled: disabled,
12208
- onMouseDown: onMouseDown,
12209
- onClick: function onClick(e) {
12210
- e.stopPropagation();
12211
- },
12212
- className: "kts-invoice-operate-goods-list-itemName-drag"
12213
- }, React.createElement(Icon, {
12214
- component: SvgI001
12215
- }));
12262
+ }, [controller, record, disabled]);
12263
+ var renderButton = React.useMemo(function () {
12264
+ return React.createElement(Button, {
12265
+ type: 'link',
12266
+ style: {
12267
+ padding: 0
12268
+ },
12269
+ onMouseDown: onMouseDown,
12270
+ onClick: function onClick(e) {
12271
+ e.stopPropagation();
12272
+ },
12273
+ className: "kts-invoice-operate-goods-list-itemName-drag",
12274
+ onMouseOver: controller.saveEditGood
12275
+ }, React.createElement(Icon, {
12276
+ component: SvgI001
12277
+ }));
12278
+ }, [onMouseDown, controller]);
12279
+
12280
+ if (disabled) {
12281
+ return React.createElement(Popover, {
12282
+ content: '您还有未编辑完成的商品',
12283
+ trigger: 'focus'
12284
+ }, renderButton);
12285
+ } else {
12286
+ return renderButton;
12287
+ }
12216
12288
  }
12217
12289
 
12218
12290
  function DragDiv(props) {
12219
- var _React$useState = React.useState(0),
12220
- _React$useState2 = _slicedToArray(_React$useState, 2),
12221
- x = _React$useState2[0],
12222
- setX = _React$useState2[1];
12223
-
12224
- var _React$useState3 = React.useState(-110),
12291
+ var _React$useState3 = React.useState(0),
12225
12292
  _React$useState4 = _slicedToArray(_React$useState3, 2),
12226
- y = _React$useState4[0],
12227
- setY = _React$useState4[1];
12293
+ x = _React$useState4[0],
12294
+ setX = _React$useState4[1];
12295
+
12296
+ var _React$useState5 = React.useState(-110),
12297
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
12298
+ y = _React$useState6[0],
12299
+ setY = _React$useState6[1];
12228
12300
 
12229
12301
  var div = React.useMemo(function () {
12230
12302
  return window.document.querySelector("[data-row-key=\"".concat(props.$index, "\"]"));
@@ -14727,7 +14799,7 @@ var Main = decorator(Form.create())(function (props) {
14727
14799
  }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, React.createElement(Search, null)), React.createElement("div", {
14728
14800
  className: "kts-invoice-operate-goods-list-able-extend"
14729
14801
  }, props.menuExpansion, React.createElement(DescribeSwitch, null), React.createElement(TaxIncludedSwitch, null))), React.createElement("div", {
14730
- className: classnames('kts-invoice-operate-goods-list-table', {
14802
+ className: classNames('kts-invoice-operate-goods-list-table', {
14731
14803
  'kts-invoice-operate-prefab': isprefab
14732
14804
  })
14733
14805
  }, React.createElement(TableVirtual, {
@@ -15076,7 +15148,7 @@ var BuyerNameInput = (function (props) {
15076
15148
  });
15077
15149
  }
15078
15150
 
15079
- return React.createElement(Popover, {
15151
+ return React.createElement(Popover$1, {
15080
15152
  onVisibleChange: setVisible,
15081
15153
  overlayClassName: 'kts-invoice-operate-buyer-name-popover',
15082
15154
  placement: "bottomLeft",
@@ -15526,7 +15598,7 @@ function SvgPlus(props) {
15526
15598
  })))));
15527
15599
  }
15528
15600
 
15529
- var css_248z$g = ".kts-invoice-operate-invoice-digtal-stakeholder {\n display: flex;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-expand-button {\n cursor: pointer;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div {\n border-right: 2px solid #9F613E;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(even) {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(odd) {\n flex: none;\n text-align: center;\n color: #9F613E;\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n padding: 0 4px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:last-child {\n border-right: none;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form {\n padding: 20px 10px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item {\n display: flex;\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n flex: none;\n font-weight: 500;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label label {\n color: #9F603D;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control-wrapper {\n flex: 1;\n}\n";
15601
+ var css_248z$g = ".kts-invoice-operate-invoice-digtal-stakeholder {\n display: flex;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-expand-button {\n cursor: pointer;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div {\n border-right: 2px solid #9F613E;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(even) {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(odd) {\n flex: none;\n text-align: center;\n color: #9F613E;\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n padding: 0 4px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:last-child {\n border-right: none;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form {\n padding: 20px 10px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAntX-col {\n margin-bottom: 15px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAntX-col:last-child {\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item {\n display: flex;\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n flex: none;\n font-weight: 500;\n line-height: 29px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label label {\n color: #9F603D;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: 1.4;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control-wrapper {\n flex: 1;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder.readOnly .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n line-height: 1.4;\n}\n";
15530
15602
  styleInject(css_248z$g);
15531
15603
 
15532
15604
  var RULES = {
@@ -15640,7 +15712,9 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
15640
15712
  }, [rulesMap, isReadOnly, isReadOnly]);
15641
15713
  controller.useForm('stakeholder', form);
15642
15714
  return React.createElement("div", {
15643
- className: "kts-invoice-operate-invoice-digtal-stakeholder"
15715
+ className: classNames("kts-invoice-operate-invoice-digtal-stakeholder", {
15716
+ readOnly: readOnly
15717
+ })
15644
15718
  }, React.createElement("div", null, '购买方信息'.split('').map(function (e) {
15645
15719
  return React.createElement("span", null, e);
15646
15720
  }), !readOnly && React.createElement(Icon, {
@@ -16706,7 +16780,7 @@ function TableRow$1(props) {
16706
16780
  bottom: 0
16707
16781
  }
16708
16782
  })) : React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
16709
- className: classnames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')
16783
+ className: classNames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')
16710
16784
  }));
16711
16785
  }
16712
16786
 
@@ -20958,7 +21032,7 @@ var Main$3 = decorator(Form.create())(function (props) {
20958
21032
  flex: 1
20959
21033
  }
20960
21034
  }), props.menuExpansion, reselectInvoiceType.button, emptyRefill.button), React.createElement("div", {
20961
- className: classnames('kts-invoice-operate-goods-list-table-digtal')
21035
+ className: classNames('kts-invoice-operate-goods-list-table-digtal')
20962
21036
  }, React.createElement(TableVirtual$1, {
20963
21037
  size: "small",
20964
21038
  rowKey: "$index",
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var mathjs = require('mathjs');
9
9
  var ktsComponentsAntdX3 = require('kts-components-antd-x3');
10
10
  var uuid = require('uuid');
11
11
  var ktsXui = require('kts-xui');
12
- var classnames = require('classnames');
12
+ var classNames = require('classnames');
13
13
  var ktsComponentsAntdX4V4 = require('kts-components-antd-x4-v4');
14
14
  var ReactDOM = require('react-dom');
15
15
  var antdComponents = require('@formily/antd-components');
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
 
20
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
21
  var GreyReactBox__default = /*#__PURE__*/_interopDefaultLegacy(GreyReactBox);
22
- var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
22
+ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
23
23
 
24
24
  function ownKeys(object, enumerableOnly) {
25
25
  var keys = Object.keys(object);
@@ -1796,7 +1796,12 @@ function _mergeDetails() {
1796
1796
  case 26:
1797
1797
  sum.priceIncludeTax = _context.sent;
1798
1798
  // 计算税额
1799
- sum.taxAmount = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).subtract(mathjs.bignumber(sum.lineAmountExcludeTax)).done().toNumber();
1799
+ sum.taxAmount = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).subtract(mathjs.bignumber(sum.lineAmountExcludeTax)).done().toNumber(); // 校验数据 是否数量和金额是否同号
1800
+
1801
+ _context.next = 30;
1802
+ return checkSameNumber(sum);
1803
+
1804
+ case 30:
1800
1805
  p = state.goodsListState.goodsList.indexOf(goodsList[0]);
1801
1806
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1802
1807
  return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
@@ -1810,20 +1815,20 @@ function _mergeDetails() {
1810
1815
  state.goodsListState.goodsMap.set(e.$index, e);
1811
1816
  });
1812
1817
  state.goodsListState.selectedGoodIndex = [];
1813
- _context.next = 40;
1818
+ _context.next = 42;
1814
1819
  break;
1815
1820
 
1816
- case 37:
1817
- _context.prev = 37;
1821
+ case 39:
1822
+ _context.prev = 39;
1818
1823
  _context.t0 = _context["catch"](5);
1819
1824
  showError(_context.t0);
1820
1825
 
1821
- case 40:
1826
+ case 42:
1822
1827
  case "end":
1823
1828
  return _context.stop();
1824
1829
  }
1825
1830
  }
1826
- }, _callee, null, [[5, 37]]);
1831
+ }, _callee, null, [[5, 39]]);
1827
1832
  }));
1828
1833
  return _mergeDetails.apply(this, arguments);
1829
1834
  }
@@ -2017,7 +2022,7 @@ function _fillingInformationGood() {
2017
2022
  function checkTaxTate(_x11) {
2018
2023
  return _checkTaxTate.apply(this, arguments);
2019
2024
  }
2020
- /** 显示错误信息 */
2025
+ /** 校验数据 是否数量和金额是否同号 */
2021
2026
 
2022
2027
 
2023
2028
  function _checkTaxTate() {
@@ -2058,6 +2063,56 @@ function _checkTaxTate() {
2058
2063
  return _checkTaxTate.apply(this, arguments);
2059
2064
  }
2060
2065
 
2066
+ function checkSameNumber(_x12) {
2067
+ return _checkSameNumber.apply(this, arguments);
2068
+ }
2069
+ /** 显示错误信息 */
2070
+
2071
+
2072
+ function _checkSameNumber() {
2073
+ _checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(good) {
2074
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2075
+ while (1) {
2076
+ switch (_context9.prev = _context9.next) {
2077
+ case 0:
2078
+ if (good.quantity) {
2079
+ _context9.next = 2;
2080
+ break;
2081
+ }
2082
+
2083
+ return _context9.abrupt("return");
2084
+
2085
+ case 2:
2086
+ if (good.lineAmountExcludeTax) {
2087
+ _context9.next = 5;
2088
+ break;
2089
+ }
2090
+
2091
+ ktsXui.message.error('金额不能为空');
2092
+ throw new Error('金额不能为空');
2093
+
2094
+ case 5:
2095
+ if (!(good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0)) {
2096
+ _context9.next = 9;
2097
+ break;
2098
+ }
2099
+
2100
+ return _context9.abrupt("return");
2101
+
2102
+ case 9:
2103
+ ktsXui.message.error('金额和数量需要同号');
2104
+ throw new Error('金额和数量需要同号');
2105
+
2106
+ case 11:
2107
+ case "end":
2108
+ return _context9.stop();
2109
+ }
2110
+ }
2111
+ }, _callee9);
2112
+ }));
2113
+ return _checkSameNumber.apply(this, arguments);
2114
+ }
2115
+
2061
2116
  function showError(error) {
2062
2117
  console.log(error);
2063
2118
  ktsXui.message.error({
@@ -10143,7 +10198,7 @@ function TableRow(props) {
10143
10198
  bottom: 0
10144
10199
  }
10145
10200
  })) : React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
10146
- className: classnames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
10201
+ className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
10147
10202
  }));
10148
10203
  }
10149
10204
 
@@ -11850,8 +11905,8 @@ var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
11850
11905
  _React$useContext$pre = _React$useContext.prefixCls,
11851
11906
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
11852
11907
 
11853
- var classString = classnames__default['default'](prefixCls, className);
11854
- var svgClassString = classnames__default['default'](_defineProperty$1({}, "".concat(prefixCls, "-spin"), !!spin));
11908
+ var classString = classNames__default['default'](prefixCls, className);
11909
+ var svgClassString = classNames__default['default'](_defineProperty$1({}, "".concat(prefixCls, "-spin"), !!spin));
11855
11910
  var svgStyle = rotate ? {
11856
11911
  msTransform: "rotate(".concat(rotate, "deg)"),
11857
11912
  transform: "rotate(".concat(rotate, "deg)")
@@ -11935,6 +11990,12 @@ styleInject(css_248z$9);
11935
11990
 
11936
11991
  function Drag$1(props) {
11937
11992
  var record = props.record;
11993
+
11994
+ var _React$useState = React__default['default'].useState(false),
11995
+ _React$useState2 = _slicedToArray(_React$useState, 2),
11996
+ open = _React$useState2[0],
11997
+ setOpen = _React$useState2[1];
11998
+
11938
11999
  var controller = Invoice.useInvoiceController();
11939
12000
  var editGood = controller.useMemo(function (s) {
11940
12001
  return s.goodsListState.editGood;
@@ -11943,7 +12004,7 @@ function Drag$1(props) {
11943
12004
  return !!editGood;
11944
12005
  }, [editGood]);
11945
12006
  var onMouseDown = React__default['default'].useCallback(function () {
11946
- if (!controller || !record) return;
12007
+ if (!controller || !record || disabled) return;
11947
12008
  controller.run( /*#__PURE__*/function () {
11948
12009
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11949
12010
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -12208,33 +12269,44 @@ function Drag$1(props) {
12208
12269
  };
12209
12270
  }());
12210
12271
  }
12211
- }, [controller, record]);
12212
- return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
12213
- type: 'link',
12214
- style: {
12215
- padding: 0
12216
- },
12217
- disabled: disabled,
12218
- onMouseDown: onMouseDown,
12219
- onClick: function onClick(e) {
12220
- e.stopPropagation();
12221
- },
12222
- className: "kts-invoice-operate-goods-list-itemName-drag"
12223
- }, React__default['default'].createElement(Icon, {
12224
- component: SvgI001
12225
- }));
12272
+ }, [controller, record, disabled]);
12273
+ var renderButton = React__default['default'].useMemo(function () {
12274
+ return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
12275
+ type: 'link',
12276
+ style: {
12277
+ padding: 0
12278
+ },
12279
+ onMouseDown: onMouseDown,
12280
+ onClick: function onClick(e) {
12281
+ e.stopPropagation();
12282
+ },
12283
+ className: "kts-invoice-operate-goods-list-itemName-drag",
12284
+ onMouseOver: controller.saveEditGood
12285
+ }, React__default['default'].createElement(Icon, {
12286
+ component: SvgI001
12287
+ }));
12288
+ }, [onMouseDown, controller]);
12289
+
12290
+ if (disabled) {
12291
+ return React__default['default'].createElement(ktsXui.Popover, {
12292
+ content: '您还有未编辑完成的商品',
12293
+ trigger: 'focus'
12294
+ }, renderButton);
12295
+ } else {
12296
+ return renderButton;
12297
+ }
12226
12298
  }
12227
12299
 
12228
12300
  function DragDiv(props) {
12229
- var _React$useState = React__default['default'].useState(0),
12230
- _React$useState2 = _slicedToArray(_React$useState, 2),
12231
- x = _React$useState2[0],
12232
- setX = _React$useState2[1];
12233
-
12234
- var _React$useState3 = React__default['default'].useState(-110),
12301
+ var _React$useState3 = React__default['default'].useState(0),
12235
12302
  _React$useState4 = _slicedToArray(_React$useState3, 2),
12236
- y = _React$useState4[0],
12237
- setY = _React$useState4[1];
12303
+ x = _React$useState4[0],
12304
+ setX = _React$useState4[1];
12305
+
12306
+ var _React$useState5 = React__default['default'].useState(-110),
12307
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
12308
+ y = _React$useState6[0],
12309
+ setY = _React$useState6[1];
12238
12310
 
12239
12311
  var div = React__default['default'].useMemo(function () {
12240
12312
  return window.document.querySelector("[data-row-key=\"".concat(props.$index, "\"]"));
@@ -14737,7 +14809,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
14737
14809
  }, React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, React__default['default'].createElement(Search, null)), React__default['default'].createElement("div", {
14738
14810
  className: "kts-invoice-operate-goods-list-able-extend"
14739
14811
  }, props.menuExpansion, React__default['default'].createElement(DescribeSwitch, null), React__default['default'].createElement(TaxIncludedSwitch, null))), React__default['default'].createElement("div", {
14740
- className: classnames__default['default']('kts-invoice-operate-goods-list-table', {
14812
+ className: classNames__default['default']('kts-invoice-operate-goods-list-table', {
14741
14813
  'kts-invoice-operate-prefab': isprefab
14742
14814
  })
14743
14815
  }, React__default['default'].createElement(TableVirtual, {
@@ -15536,7 +15608,7 @@ function SvgPlus(props) {
15536
15608
  })))));
15537
15609
  }
15538
15610
 
15539
- var css_248z$g = ".kts-invoice-operate-invoice-digtal-stakeholder {\n display: flex;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-expand-button {\n cursor: pointer;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div {\n border-right: 2px solid #9F613E;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(even) {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(odd) {\n flex: none;\n text-align: center;\n color: #9F613E;\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n padding: 0 4px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:last-child {\n border-right: none;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form {\n padding: 20px 10px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item {\n display: flex;\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n flex: none;\n font-weight: 500;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label label {\n color: #9F603D;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control-wrapper {\n flex: 1;\n}\n";
15611
+ var css_248z$g = ".kts-invoice-operate-invoice-digtal-stakeholder {\n display: flex;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-expand-button {\n cursor: pointer;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div {\n border-right: 2px solid #9F613E;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(even) {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:nth-child(odd) {\n flex: none;\n text-align: center;\n color: #9F613E;\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n padding: 0 4px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder > div:last-child {\n border-right: none;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form {\n padding: 20px 10px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAntX-col {\n margin-bottom: 15px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAntX-col:last-child {\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item {\n display: flex;\n margin-bottom: 0;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n flex: none;\n font-weight: 500;\n line-height: 29px;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label label {\n color: #9F603D;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: 1.4;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-control-wrapper {\n flex: 1;\n}\n.kts-invoice-operate-invoice-digtal-stakeholder.readOnly .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {\n line-height: 1.4;\n}\n";
15540
15612
  styleInject(css_248z$g);
15541
15613
 
15542
15614
  var RULES = {
@@ -15650,7 +15722,9 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
15650
15722
  }, [rulesMap, isReadOnly, isReadOnly]);
15651
15723
  controller.useForm('stakeholder', form);
15652
15724
  return React__default['default'].createElement("div", {
15653
- className: "kts-invoice-operate-invoice-digtal-stakeholder"
15725
+ className: classNames__default['default']("kts-invoice-operate-invoice-digtal-stakeholder", {
15726
+ readOnly: readOnly
15727
+ })
15654
15728
  }, React__default['default'].createElement("div", null, '购买方信息'.split('').map(function (e) {
15655
15729
  return React__default['default'].createElement("span", null, e);
15656
15730
  }), !readOnly && React__default['default'].createElement(Icon, {
@@ -16716,7 +16790,7 @@ function TableRow$1(props) {
16716
16790
  bottom: 0
16717
16791
  }
16718
16792
  })) : React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
16719
- className: classnames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')
16793
+ className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')
16720
16794
  }));
16721
16795
  }
16722
16796
 
@@ -20968,7 +21042,7 @@ var Main$3 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function
20968
21042
  flex: 1
20969
21043
  }
20970
21044
  }), props.menuExpansion, reselectInvoiceType.button, emptyRefill.button), React__default['default'].createElement("div", {
20971
- className: classnames__default['default']('kts-invoice-operate-goods-list-table-digtal')
21045
+ className: classNames__default['default']('kts-invoice-operate-goods-list-table-digtal')
20972
21046
  }, React__default['default'].createElement(TableVirtual$1, {
20973
21047
  size: "small",
20974
21048
  rowKey: "$index",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.43",
3
+ "version": "3.2.45",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -15,19 +15,19 @@ export default () => {
15
15
  tag:'成品油',
16
16
  })
17
17
  await controller.formList.get('stakeholder')?.setFieldsValue({
18
- buyerName: '购买方名称',
19
- buyerTaxId: 'xxxxxxxxxx',
20
- buyerAddress: '购买方地址',
21
- buyerPhone: '15800000000',
22
- buyerBank: '购买方开户银行',
23
- buyerAccount: '银行账号',
18
+ buyerName: '国能供应链内蒙古有限公司',
19
+ buyerTaxId: '91150291552838725H',
20
+ buyerAddress: '内蒙古自治区包头稀士高新区总部经济园区9号楼204号',
21
+ buyerPhone: '0472-5368680',
22
+ buyerBank: '11050167360000000932中国银行股份有限公司包头开发区支行',
23
+ buyerAccount: '',
24
24
 
25
- supplierName: '销售方名称',
26
- supplierTaxId: 'xxxxxxxxxxxx',
27
- sellerAddress: '购买方地址',
28
- sellerPhone: '15800000000',
29
- sellerBank: '购买方开户银行',
30
- sellerAccount: '银行账号',
25
+ supplierName: '国星供应链管理(北京)有限公司上海分公司',
26
+ supplierTaxId: '91310230MA1JWA3QX1',
27
+ sellerAddress: '上海市宝山区南镇逸仙路华滋奔腾大厦A座1207室',
28
+ sellerPhone: '13511077832',
29
+ sellerBank: '广发银行股份有限公司上海大柏树支行',
30
+ sellerAccount: '9550880218186900195',
31
31
  })
32
32
  await controller.formList.get('sign')?.setFieldsValue({
33
33
  remark: '备注',
@@ -40,6 +40,9 @@ export default async function mergeDetails(state: InvoiceControllerState) {
40
40
  // 计算税额
41
41
  sum.taxAmount = chain(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber()
42
42
 
43
+ // 校验数据 是否数量和金额是否同号
44
+ await checkSameNumber(sum);
45
+
43
46
  const p = state.goodsListState.goodsList.indexOf(goodsList[0]);
44
47
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0);
45
48
  state.goodsListState.goodsList.splice(p, 0, sum);
@@ -112,6 +115,23 @@ async function checkTaxTate(goodsList: IGood[]) {
112
115
  }
113
116
  }
114
117
 
118
+ /** 校验数据 是否数量和金额是否同号 */
119
+ async function checkSameNumber(good: IGood) {
120
+ if (!good.quantity) return;
121
+
122
+ if (!good.lineAmountExcludeTax) {
123
+ message.error('金额不能为空');
124
+ throw new Error('金额不能为空');
125
+ }
126
+
127
+ if (good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0) {
128
+ return;
129
+ }else{
130
+ message.error('金额和数量需要同号');
131
+ throw new Error('金额和数量需要同号');
132
+ }
133
+ }
134
+
115
135
  /** 显示错误信息 */
116
136
  function showError(error: Error) {
117
137
  console.log(error);
@@ -43,7 +43,7 @@ export default class InvoiceController extends InvoiceControllerForm {
43
43
  setEditGood = this.pipeline(setEditGood);
44
44
 
45
45
  /** 保存正在编辑的货物 */
46
- saveEditGood = this.pipeline(saveEditGood);
46
+ saveEditGood = this.pipeline<any>(saveEditGood);
47
47
 
48
48
  /** 删除一个货物 */
49
49
  delGood = this.pipeline(delGood);
@@ -7,6 +7,7 @@ import { IGood, Invoice } from '../../../../../../../..';
7
7
  import mounting from "../../../../../../../tools/mounting";
8
8
  import { LineAttributeType } from "../../../../../../../InvoiceController";
9
9
  import './index.less';
10
+ import { Popover } from "kts-xui";
10
11
 
11
12
  export interface IDragProps {
12
13
  record: IGood
@@ -16,6 +17,8 @@ export default function Drag(props: IDragProps) {
16
17
 
17
18
  const { record } = props;
18
19
 
20
+ const [open, setOpen] = React.useState(false)
21
+
19
22
  const controller = Invoice.useInvoiceController();
20
23
 
21
24
  const editGood = controller.useMemo(s => s.goodsListState.editGood, []);
@@ -23,7 +26,7 @@ export default function Drag(props: IDragProps) {
23
26
  const disabled = React.useMemo(() => !!editGood, [editGood]);
24
27
 
25
28
  const onMouseDown = React.useCallback(() => {
26
- if (!controller || !record) return;
29
+ if (!controller || !record || disabled) return;
27
30
  controller.run(async s => s.goodsListState.drag.current = record.$index);
28
31
 
29
32
  const rowList = window.document.querySelectorAll<HTMLDivElement>('.kts-invoice-operate-goods-list');
@@ -136,20 +139,32 @@ export default function Drag(props: IDragProps) {
136
139
  s.goodsListState.drag.current = undefined;
137
140
  })
138
141
  }
139
- }, [controller, record])
140
-
141
- return (
142
- <Button
143
- type='link'
144
- style={{ padding: 0 }}
145
- disabled={disabled}
146
- onMouseDown={onMouseDown}
147
- onClick={e => { e.stopPropagation() }}
148
- className={"kts-invoice-operate-goods-list-itemName-drag"}
149
- >
150
- <Icon component={I001Svg} />
151
- </Button>
152
- )
142
+ }, [controller, record, disabled])
143
+
144
+ const renderButton = React.useMemo(() => {
145
+ return (
146
+ <Button
147
+ type='link'
148
+ style={{ padding: 0 }}
149
+ onMouseDown={onMouseDown}
150
+ onClick={e => { e.stopPropagation() }}
151
+ className={"kts-invoice-operate-goods-list-itemName-drag"}
152
+ onMouseOver={controller.saveEditGood}
153
+ >
154
+ <Icon component={I001Svg} />
155
+ </Button>
156
+ )
157
+ }, [onMouseDown, controller])
158
+
159
+ if (disabled) {
160
+ return (
161
+ <Popover content={'您还有未编辑完成的商品'} trigger='focus' >
162
+ {renderButton}
163
+ </Popover>
164
+ )
165
+ } else {
166
+ return renderButton;
167
+ }
153
168
  }
154
169
 
155
170
  function DragDiv(props: IGood) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  display: flex;
4
4
 
5
- .digtal-stakeholder-expand-button{
5
+ .digtal-stakeholder-expand-button {
6
6
  cursor: pointer;
7
7
  }
8
8
 
@@ -36,6 +36,14 @@
36
36
 
37
37
  padding: 20px 10px;
38
38
 
39
+ .ktsAntX-col {
40
+ margin-bottom: 15px;
41
+
42
+ &:last-child {
43
+ margin-bottom: 0;
44
+ }
45
+ }
46
+
39
47
  .ktsAnt3x-row.ktsAnt3x-form-item {
40
48
  display : flex;
41
49
  margin-bottom: 0;
@@ -43,15 +51,26 @@
43
51
  .ktsAnt3x-form-item-label {
44
52
  flex : none;
45
53
  font-weight: 500;
54
+ line-height: 29px;
46
55
 
47
56
  label {
48
57
  color: #9F603D;
49
58
  }
50
59
  }
51
60
 
61
+ .ktsAnt3x-form-item-control {
62
+ line-height: 1.4;
63
+ }
64
+
52
65
  .ktsAnt3x-form-item-control-wrapper {
53
66
  flex: 1;
54
67
  }
55
68
  }
56
69
  }
70
+ }
71
+
72
+ .kts-invoice-operate-invoice-digtal-stakeholder.readOnly {
73
+ .digtal-stakeholder-form .ktsAnt3x-row.ktsAnt3x-form-item .ktsAnt3x-form-item-label {
74
+ line-height: 1.4;
75
+ }
57
76
  }
@@ -13,6 +13,7 @@ import { ReactComponent as PlusSvg } from './svg/plus.svg'
13
13
  import InvoiceController from "../../../InvoiceController";
14
14
  import Invoice from "../../../../Invoice";
15
15
  import './index.less';
16
+ import classNames from 'classnames';
16
17
 
17
18
  const RULES = {
18
19
  companyName: (label: string) => [
@@ -98,7 +99,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
98
99
  controller.useForm('stakeholder', form);
99
100
 
100
101
  return (
101
- <div className="kts-invoice-operate-invoice-digtal-stakeholder" >
102
+ <div className={classNames("kts-invoice-operate-invoice-digtal-stakeholder", { readOnly: readOnly })} >
102
103
  <div>
103
104
  {'购买方信息'.split('').map(e => <span>{e}</span>)}
104
105
  {