kts-component-invoice-operate 3.2.17 → 3.2.19
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.
- package/d.dio +0 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.d.ts +6 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +3 -0
- package/dist/index.esm.js +88 -7
- package/dist/index.js +85 -4
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +8 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +4 -0
- package/src/Invoice/_test/setDataSource/index.tsx +13 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.less +9 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +27 -1
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +4 -1
- package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +0 -1
package/d.dio
ADDED
|
File without changes
|
|
@@ -2,6 +2,7 @@ import GoodsListState from './GoodsListState';
|
|
|
2
2
|
import BuyerState from './BuyerState';
|
|
3
3
|
import Stakeholder from './Stakeholder';
|
|
4
4
|
import { IInvoiceTypeModalProps } from '../../../InvoiceTypeModal';
|
|
5
|
+
import AutoComplete from './AutoComplete';
|
|
5
6
|
export default class InvoiceControllerState {
|
|
6
7
|
/**
|
|
7
8
|
* 组件模式
|
|
@@ -41,4 +42,6 @@ export default class InvoiceControllerState {
|
|
|
41
42
|
rootElement?: HTMLDivElement | null;
|
|
42
43
|
/** 发票类型选择窗口 */
|
|
43
44
|
typeModalProps?: IInvoiceTypeModalProps;
|
|
45
|
+
/** 自动补全 */
|
|
46
|
+
autoComplete: AutoComplete;
|
|
44
47
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -2,9 +2,9 @@ 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, 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, 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, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Input as Input$1,
|
|
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
8
|
import classnames from 'classnames';
|
|
9
9
|
import { Table } from 'kts-components-antd-x4-v4';
|
|
10
10
|
import { Input as Input$2, NumberPicker } from '@formily/antd-components';
|
|
@@ -1015,6 +1015,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1015
1015
|
this.importGoods = new ImportGoods();
|
|
1016
1016
|
this.productComparison = new ProductComparison();
|
|
1017
1017
|
this.isVisibleDrawer = false;
|
|
1018
|
+
this.isMergeDetails = false;
|
|
1018
1019
|
this.addComparisonIndex = void 0;
|
|
1019
1020
|
});
|
|
1020
1021
|
|
|
@@ -1079,6 +1080,13 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
|
|
|
1079
1080
|
this.rulesMap = void 0;
|
|
1080
1081
|
});
|
|
1081
1082
|
|
|
1083
|
+
/** 自动补全 */
|
|
1084
|
+
var AutoComplete = /*#__PURE__*/_createClass(function AutoComplete() {
|
|
1085
|
+
_classCallCheck(this, AutoComplete);
|
|
1086
|
+
|
|
1087
|
+
this.onItemNameSearch = void 0;
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1082
1090
|
var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
|
|
1083
1091
|
_classCallCheck(this, InvoiceControllerState);
|
|
1084
1092
|
|
|
@@ -1093,6 +1101,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
1093
1101
|
this.priceIntegerDigit = void 0;
|
|
1094
1102
|
this.rootElement = null;
|
|
1095
1103
|
this.typeModalProps = void 0;
|
|
1104
|
+
this.autoComplete = new AutoComplete();
|
|
1096
1105
|
});
|
|
1097
1106
|
|
|
1098
1107
|
/**
|
|
@@ -10144,15 +10153,76 @@ var TitleText = (function (props) {
|
|
|
10144
10153
|
}, "*") : React.createElement(React.Fragment, null), children);
|
|
10145
10154
|
});
|
|
10146
10155
|
|
|
10147
|
-
var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 10px;\n height: 31px;\n}\n.has-error .kts-invoice-operate-goods-list-itemName-input {\n border: 1px solid #f5222d;\n}\n";
|
|
10156
|
+
var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 10px;\n height: 31px;\n}\n.kts-invoice-operate-goods-list-itemName-input .ktsAntX-select {\n width: 100%;\n}\n.kts-invoice-operate-goods-list-itemName-input .ktsAntX-select .ktsAntX-select-selector {\n height: 100%;\n}\n.has-error .kts-invoice-operate-goods-list-itemName-input {\n border: 1px solid #f5222d;\n}\n";
|
|
10148
10157
|
styleInject(css_248z$6);
|
|
10149
10158
|
|
|
10150
10159
|
function ItemNameInput(props) {
|
|
10160
|
+
var controller = Invoice.useInvoiceController();
|
|
10161
|
+
var autoComplete = controller.useMemo(function (s) {
|
|
10162
|
+
return s.autoComplete;
|
|
10163
|
+
}, []);
|
|
10164
|
+
|
|
10165
|
+
var _React$useState = React.useState([]),
|
|
10166
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
10167
|
+
options = _React$useState2[0],
|
|
10168
|
+
setOptions = _React$useState2[1];
|
|
10169
|
+
|
|
10151
10170
|
var onChange = React.useCallback(function (e) {
|
|
10152
10171
|
var event = _objectSpread2({}, e);
|
|
10153
10172
|
|
|
10154
10173
|
props.onChange && props.onChange(event);
|
|
10155
10174
|
}, []);
|
|
10175
|
+
var onSearch = React.useCallback( /*#__PURE__*/function () {
|
|
10176
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
|
|
10177
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10178
|
+
while (1) {
|
|
10179
|
+
switch (_context.prev = _context.next) {
|
|
10180
|
+
case 0:
|
|
10181
|
+
_context.prev = 0;
|
|
10182
|
+
|
|
10183
|
+
if (!autoComplete.onItemNameSearch) {
|
|
10184
|
+
_context.next = 7;
|
|
10185
|
+
break;
|
|
10186
|
+
}
|
|
10187
|
+
|
|
10188
|
+
_context.t0 = setOptions;
|
|
10189
|
+
_context.next = 5;
|
|
10190
|
+
return autoComplete.onItemNameSearch(searchText);
|
|
10191
|
+
|
|
10192
|
+
case 5:
|
|
10193
|
+
_context.t1 = _context.sent;
|
|
10194
|
+
(0, _context.t0)(_context.t1);
|
|
10195
|
+
|
|
10196
|
+
case 7:
|
|
10197
|
+
_context.next = 13;
|
|
10198
|
+
break;
|
|
10199
|
+
|
|
10200
|
+
case 9:
|
|
10201
|
+
_context.prev = 9;
|
|
10202
|
+
_context.t2 = _context["catch"](0);
|
|
10203
|
+
setOptions([]);
|
|
10204
|
+
throw _context.t2;
|
|
10205
|
+
|
|
10206
|
+
case 13:
|
|
10207
|
+
case "end":
|
|
10208
|
+
return _context.stop();
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
}, _callee, null, [[0, 9]]);
|
|
10212
|
+
}));
|
|
10213
|
+
|
|
10214
|
+
return function (_x) {
|
|
10215
|
+
return _ref.apply(this, arguments);
|
|
10216
|
+
};
|
|
10217
|
+
}(), [autoComplete.onItemNameSearch]);
|
|
10218
|
+
var onChangeAutoComplete = React.useCallback(function (itemName) {
|
|
10219
|
+
var _controller$state$goo;
|
|
10220
|
+
|
|
10221
|
+
var good = options.filter(function (e) {
|
|
10222
|
+
return e.itemName === itemName;
|
|
10223
|
+
});
|
|
10224
|
+
(_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.setFieldsValue(good);
|
|
10225
|
+
}, [options, controller]);
|
|
10156
10226
|
return React.createElement("div", {
|
|
10157
10227
|
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
10158
10228
|
}, props.shorthand && React.createElement("span", {
|
|
@@ -10160,14 +10230,22 @@ function ItemNameInput(props) {
|
|
|
10160
10230
|
alignSelf: 'center',
|
|
10161
10231
|
fontSize: 12
|
|
10162
10232
|
}
|
|
10163
|
-
}, "*", props.shorthand, "*"), React.createElement(
|
|
10233
|
+
}, "*", props.shorthand, "*"), React.createElement(AutoComplete$1, {
|
|
10234
|
+
onSearch: onSearch,
|
|
10235
|
+
options: options.map(function (e) {
|
|
10236
|
+
return {
|
|
10237
|
+
value: e.itemName
|
|
10238
|
+
};
|
|
10239
|
+
}),
|
|
10240
|
+
onChange: onChangeAutoComplete
|
|
10241
|
+
}, React.createElement(Input, {
|
|
10164
10242
|
style: {
|
|
10165
10243
|
height: '100%',
|
|
10166
10244
|
border: 'none'
|
|
10167
10245
|
},
|
|
10168
10246
|
value: props.value,
|
|
10169
10247
|
onChange: onChange
|
|
10170
|
-
}));
|
|
10248
|
+
})));
|
|
10171
10249
|
}
|
|
10172
10250
|
|
|
10173
10251
|
/** 拆分全称加简称 */
|
|
@@ -10474,7 +10552,7 @@ var useColumns = (function (form) {
|
|
|
10474
10552
|
return React.createElement(Form.Item, null, getFieldDecorator('unit', {
|
|
10475
10553
|
initialValue: editGood.unit,
|
|
10476
10554
|
rules: getReplenishRules('unit')
|
|
10477
|
-
})(React.createElement(AutoComplete, {
|
|
10555
|
+
})(React.createElement(AutoComplete$2, {
|
|
10478
10556
|
style: {
|
|
10479
10557
|
width: '100%'
|
|
10480
10558
|
},
|
|
@@ -12291,6 +12369,9 @@ function useMergeDetails() {
|
|
|
12291
12369
|
var goodsList = controller.useMemo(function (s) {
|
|
12292
12370
|
return s.goodsListState.goodsList;
|
|
12293
12371
|
}, []);
|
|
12372
|
+
var isMergeDetails = controller.useMemo(function (s) {
|
|
12373
|
+
return s.goodsListState.isMergeDetails;
|
|
12374
|
+
}, []);
|
|
12294
12375
|
var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12295
12376
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12296
12377
|
while (1) {
|
|
@@ -12315,6 +12396,7 @@ function useMergeDetails() {
|
|
|
12315
12396
|
}, _callee);
|
|
12316
12397
|
})), []);
|
|
12317
12398
|
var button = React.useMemo(function () {
|
|
12399
|
+
if (!isMergeDetails) return React.createElement(React.Fragment, null);
|
|
12318
12400
|
return React.createElement(Button, {
|
|
12319
12401
|
onClick: onClick,
|
|
12320
12402
|
disabled: goodsList.length <= 1
|
|
@@ -19433,7 +19515,6 @@ var ImportGoodsDrawer = (function () {
|
|
|
19433
19515
|
return s.goodsListState.importGoods.topExpand;
|
|
19434
19516
|
}, []);
|
|
19435
19517
|
var onClose = React.useCallback(function () {
|
|
19436
|
-
console.log('===> 关闭抽屉');
|
|
19437
19518
|
controller.pipeline( /*#__PURE__*/function () {
|
|
19438
19519
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
19439
19520
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
package/dist/index.js
CHANGED
|
@@ -1025,6 +1025,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1025
1025
|
this.importGoods = new ImportGoods();
|
|
1026
1026
|
this.productComparison = new ProductComparison();
|
|
1027
1027
|
this.isVisibleDrawer = false;
|
|
1028
|
+
this.isMergeDetails = false;
|
|
1028
1029
|
this.addComparisonIndex = void 0;
|
|
1029
1030
|
});
|
|
1030
1031
|
|
|
@@ -1089,6 +1090,13 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
|
|
|
1089
1090
|
this.rulesMap = void 0;
|
|
1090
1091
|
});
|
|
1091
1092
|
|
|
1093
|
+
/** 自动补全 */
|
|
1094
|
+
var AutoComplete = /*#__PURE__*/_createClass(function AutoComplete() {
|
|
1095
|
+
_classCallCheck(this, AutoComplete);
|
|
1096
|
+
|
|
1097
|
+
this.onItemNameSearch = void 0;
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1092
1100
|
var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
|
|
1093
1101
|
_classCallCheck(this, InvoiceControllerState);
|
|
1094
1102
|
|
|
@@ -1103,6 +1111,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
1103
1111
|
this.priceIntegerDigit = void 0;
|
|
1104
1112
|
this.rootElement = null;
|
|
1105
1113
|
this.typeModalProps = void 0;
|
|
1114
|
+
this.autoComplete = new AutoComplete();
|
|
1106
1115
|
});
|
|
1107
1116
|
|
|
1108
1117
|
/**
|
|
@@ -10154,15 +10163,76 @@ var TitleText = (function (props) {
|
|
|
10154
10163
|
}, "*") : React__default['default'].createElement(React__default['default'].Fragment, null), children);
|
|
10155
10164
|
});
|
|
10156
10165
|
|
|
10157
|
-
var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 10px;\n height: 31px;\n}\n.has-error .kts-invoice-operate-goods-list-itemName-input {\n border: 1px solid #f5222d;\n}\n";
|
|
10166
|
+
var css_248z$6 = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 10px;\n height: 31px;\n}\n.kts-invoice-operate-goods-list-itemName-input .ktsAntX-select {\n width: 100%;\n}\n.kts-invoice-operate-goods-list-itemName-input .ktsAntX-select .ktsAntX-select-selector {\n height: 100%;\n}\n.has-error .kts-invoice-operate-goods-list-itemName-input {\n border: 1px solid #f5222d;\n}\n";
|
|
10158
10167
|
styleInject(css_248z$6);
|
|
10159
10168
|
|
|
10160
10169
|
function ItemNameInput(props) {
|
|
10170
|
+
var controller = Invoice.useInvoiceController();
|
|
10171
|
+
var autoComplete = controller.useMemo(function (s) {
|
|
10172
|
+
return s.autoComplete;
|
|
10173
|
+
}, []);
|
|
10174
|
+
|
|
10175
|
+
var _React$useState = React__default['default'].useState([]),
|
|
10176
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
10177
|
+
options = _React$useState2[0],
|
|
10178
|
+
setOptions = _React$useState2[1];
|
|
10179
|
+
|
|
10161
10180
|
var onChange = React__default['default'].useCallback(function (e) {
|
|
10162
10181
|
var event = _objectSpread2({}, e);
|
|
10163
10182
|
|
|
10164
10183
|
props.onChange && props.onChange(event);
|
|
10165
10184
|
}, []);
|
|
10185
|
+
var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
|
|
10186
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
|
|
10187
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10188
|
+
while (1) {
|
|
10189
|
+
switch (_context.prev = _context.next) {
|
|
10190
|
+
case 0:
|
|
10191
|
+
_context.prev = 0;
|
|
10192
|
+
|
|
10193
|
+
if (!autoComplete.onItemNameSearch) {
|
|
10194
|
+
_context.next = 7;
|
|
10195
|
+
break;
|
|
10196
|
+
}
|
|
10197
|
+
|
|
10198
|
+
_context.t0 = setOptions;
|
|
10199
|
+
_context.next = 5;
|
|
10200
|
+
return autoComplete.onItemNameSearch(searchText);
|
|
10201
|
+
|
|
10202
|
+
case 5:
|
|
10203
|
+
_context.t1 = _context.sent;
|
|
10204
|
+
(0, _context.t0)(_context.t1);
|
|
10205
|
+
|
|
10206
|
+
case 7:
|
|
10207
|
+
_context.next = 13;
|
|
10208
|
+
break;
|
|
10209
|
+
|
|
10210
|
+
case 9:
|
|
10211
|
+
_context.prev = 9;
|
|
10212
|
+
_context.t2 = _context["catch"](0);
|
|
10213
|
+
setOptions([]);
|
|
10214
|
+
throw _context.t2;
|
|
10215
|
+
|
|
10216
|
+
case 13:
|
|
10217
|
+
case "end":
|
|
10218
|
+
return _context.stop();
|
|
10219
|
+
}
|
|
10220
|
+
}
|
|
10221
|
+
}, _callee, null, [[0, 9]]);
|
|
10222
|
+
}));
|
|
10223
|
+
|
|
10224
|
+
return function (_x) {
|
|
10225
|
+
return _ref.apply(this, arguments);
|
|
10226
|
+
};
|
|
10227
|
+
}(), [autoComplete.onItemNameSearch]);
|
|
10228
|
+
var onChangeAutoComplete = React__default['default'].useCallback(function (itemName) {
|
|
10229
|
+
var _controller$state$goo;
|
|
10230
|
+
|
|
10231
|
+
var good = options.filter(function (e) {
|
|
10232
|
+
return e.itemName === itemName;
|
|
10233
|
+
});
|
|
10234
|
+
(_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.setFieldsValue(good);
|
|
10235
|
+
}, [options, controller]);
|
|
10166
10236
|
return React__default['default'].createElement("div", {
|
|
10167
10237
|
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
10168
10238
|
}, props.shorthand && React__default['default'].createElement("span", {
|
|
@@ -10170,14 +10240,22 @@ function ItemNameInput(props) {
|
|
|
10170
10240
|
alignSelf: 'center',
|
|
10171
10241
|
fontSize: 12
|
|
10172
10242
|
}
|
|
10173
|
-
}, "*", props.shorthand, "*"), React__default['default'].createElement(
|
|
10243
|
+
}, "*", props.shorthand, "*"), React__default['default'].createElement(ktsXui.AutoComplete, {
|
|
10244
|
+
onSearch: onSearch,
|
|
10245
|
+
options: options.map(function (e) {
|
|
10246
|
+
return {
|
|
10247
|
+
value: e.itemName
|
|
10248
|
+
};
|
|
10249
|
+
}),
|
|
10250
|
+
onChange: onChangeAutoComplete
|
|
10251
|
+
}, React__default['default'].createElement(ktsComponentsAntdX3.Input, {
|
|
10174
10252
|
style: {
|
|
10175
10253
|
height: '100%',
|
|
10176
10254
|
border: 'none'
|
|
10177
10255
|
},
|
|
10178
10256
|
value: props.value,
|
|
10179
10257
|
onChange: onChange
|
|
10180
|
-
}));
|
|
10258
|
+
})));
|
|
10181
10259
|
}
|
|
10182
10260
|
|
|
10183
10261
|
/** 拆分全称加简称 */
|
|
@@ -12301,6 +12379,9 @@ function useMergeDetails() {
|
|
|
12301
12379
|
var goodsList = controller.useMemo(function (s) {
|
|
12302
12380
|
return s.goodsListState.goodsList;
|
|
12303
12381
|
}, []);
|
|
12382
|
+
var isMergeDetails = controller.useMemo(function (s) {
|
|
12383
|
+
return s.goodsListState.isMergeDetails;
|
|
12384
|
+
}, []);
|
|
12304
12385
|
var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12305
12386
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12306
12387
|
while (1) {
|
|
@@ -12325,6 +12406,7 @@ function useMergeDetails() {
|
|
|
12325
12406
|
}, _callee);
|
|
12326
12407
|
})), []);
|
|
12327
12408
|
var button = React__default['default'].useMemo(function () {
|
|
12409
|
+
if (!isMergeDetails) return React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
12328
12410
|
return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
12329
12411
|
onClick: onClick,
|
|
12330
12412
|
disabled: goodsList.length <= 1
|
|
@@ -19443,7 +19525,6 @@ var ImportGoodsDrawer = (function () {
|
|
|
19443
19525
|
return s.goodsListState.importGoods.topExpand;
|
|
19444
19526
|
}, []);
|
|
19445
19527
|
var onClose = React__default['default'].useCallback(function () {
|
|
19446
|
-
console.log('===> 关闭抽屉');
|
|
19447
19528
|
controller.pipeline( /*#__PURE__*/function () {
|
|
19448
19529
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
19449
19530
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import GoodsListState from './GoodsListState';
|
|
|
2
2
|
import BuyerState from './BuyerState';
|
|
3
3
|
import Stakeholder from './Stakeholder';
|
|
4
4
|
import { IInvoiceTypeModalProps } from '../../../InvoiceTypeModal';
|
|
5
|
+
import AutoComplete from './AutoComplete';
|
|
5
6
|
|
|
6
7
|
export default class InvoiceControllerState {
|
|
7
8
|
|
|
@@ -53,4 +54,7 @@ export default class InvoiceControllerState {
|
|
|
53
54
|
|
|
54
55
|
/** 发票类型选择窗口 */
|
|
55
56
|
typeModalProps?: IInvoiceTypeModalProps;
|
|
57
|
+
|
|
58
|
+
/** 自动补全 */
|
|
59
|
+
autoComplete = new AutoComplete();
|
|
56
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Invoice from '../..';
|
|
3
3
|
|
|
4
4
|
const InvoiceController = Invoice.InvoiceController;
|
|
5
5
|
|
|
@@ -16,6 +16,18 @@ export default () => {
|
|
|
16
16
|
* 继承 InvoiceController 并重写需要重写的方法
|
|
17
17
|
*/
|
|
18
18
|
class MyInvoiceController extends InvoiceController {
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.state.autoComplete.onItemNameSearch = async text => {
|
|
23
|
+
const sum: { value: string }[] = []
|
|
24
|
+
for (let index = 0; index < 10; index++) {
|
|
25
|
+
sum.push({ value: `xxxx${index}` })
|
|
26
|
+
}
|
|
27
|
+
return sum;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
updateInvoiceNo = this.pipeline(async s => {
|
|
20
32
|
return '--';
|
|
21
33
|
})
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
flex : 1;
|
|
4
4
|
padding-left: 10px;
|
|
5
5
|
height : 31px;
|
|
6
|
+
|
|
7
|
+
.ktsAntX-select {
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
.ktsAntX-select-selector{
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
6
14
|
}
|
|
7
15
|
|
|
8
|
-
.has-error .kts-invoice-operate-goods-list-itemName-input{
|
|
16
|
+
.has-error .kts-invoice-operate-goods-list-itemName-input {
|
|
9
17
|
border: 1px solid #f5222d;
|
|
10
18
|
}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
|
|
2
2
|
import { Input } from 'kts-components-antd-x3';
|
|
3
3
|
import React, { ChangeEvent } from 'react';
|
|
4
|
+
import { AutoComplete } from 'kts-xui';
|
|
5
|
+
import { IGood, Invoice } from '../../../../../../../..';
|
|
4
6
|
import './index.less';
|
|
5
7
|
|
|
6
8
|
export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, shorthand?: string }) {
|
|
7
9
|
|
|
10
|
+
const controller = Invoice.useInvoiceController();
|
|
11
|
+
|
|
12
|
+
const autoComplete = controller.useMemo(s => s.autoComplete, [])
|
|
13
|
+
|
|
14
|
+
const [options, setOptions] = React.useState<IGood[]>([])
|
|
15
|
+
|
|
8
16
|
const onChange = React.useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
|
9
17
|
const event = { ...e };
|
|
10
18
|
props.onChange && props.onChange(event);
|
|
11
19
|
}, [])
|
|
12
20
|
|
|
21
|
+
const onSearch = React.useCallback(async (searchText: string) => {
|
|
22
|
+
try {
|
|
23
|
+
if (autoComplete.onItemNameSearch) {
|
|
24
|
+
setOptions(await autoComplete.onItemNameSearch(searchText))
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
setOptions([])
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}, [autoComplete.onItemNameSearch])
|
|
31
|
+
|
|
32
|
+
const onChangeAutoComplete = React.useCallback(itemName => {
|
|
33
|
+
const good = options.filter(e=>e.itemName === itemName);
|
|
34
|
+
controller.state.goodsListState.form?.setFieldsValue(good);
|
|
35
|
+
}, [options, controller])
|
|
36
|
+
|
|
13
37
|
return (
|
|
14
38
|
<div className='kts-invoice-operate-goods-list-itemName-input'>
|
|
15
39
|
{props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
|
|
16
|
-
<
|
|
40
|
+
<AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
|
|
41
|
+
<Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
|
|
42
|
+
</AutoComplete>
|
|
17
43
|
</div>
|
|
18
44
|
)
|
|
19
45
|
}
|
|
@@ -10,13 +10,16 @@ export default function useMergeDetails() {
|
|
|
10
10
|
|
|
11
11
|
const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const isMergeDetails = controller.useMemo(s => s.goodsListState.isMergeDetails, []);
|
|
14
|
+
|
|
15
|
+
const onClick = React.useCallback(async () => {
|
|
14
16
|
await controller.saveEditGood();
|
|
15
17
|
await controller.wait();
|
|
16
18
|
await controller.mergeDetails();
|
|
17
19
|
}, [])
|
|
18
20
|
|
|
19
21
|
const button = React.useMemo(() => {
|
|
22
|
+
if (!isMergeDetails) return <></>;
|
|
20
23
|
return (
|
|
21
24
|
<Button
|
|
22
25
|
onClick={onClick}
|
|
@@ -14,7 +14,6 @@ export default () => {
|
|
|
14
14
|
const topExpand = controller.useMemo(s => s.goodsListState.importGoods.topExpand, []);
|
|
15
15
|
|
|
16
16
|
const onClose = React.useCallback(() => {
|
|
17
|
-
console.log('===> 关闭抽屉');
|
|
18
17
|
controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = false })();
|
|
19
18
|
}, [controller]);
|
|
20
19
|
|