kts-component-invoice-operate 3.2.18 → 3.2.20
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/index.d.ts +3 -0
- package/dist/index.esm.js +95 -7
- package/dist/index.js +92 -4
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/AutoComplete/index.ts +8 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +4 -0
- package/src/Invoice/_test/setDataSource/index.tsx +52 -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 +40 -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';
|
|
@@ -1080,6 +1080,13 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
|
|
|
1080
1080
|
this.rulesMap = void 0;
|
|
1081
1081
|
});
|
|
1082
1082
|
|
|
1083
|
+
/** 自动补全 */
|
|
1084
|
+
var AutoComplete = /*#__PURE__*/_createClass(function AutoComplete() {
|
|
1085
|
+
_classCallCheck(this, AutoComplete);
|
|
1086
|
+
|
|
1087
|
+
this.onItemNameSearch = void 0;
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1083
1090
|
var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
|
|
1084
1091
|
_classCallCheck(this, InvoiceControllerState);
|
|
1085
1092
|
|
|
@@ -1094,6 +1101,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
1094
1101
|
this.priceIntegerDigit = void 0;
|
|
1095
1102
|
this.rootElement = null;
|
|
1096
1103
|
this.typeModalProps = void 0;
|
|
1104
|
+
this.autoComplete = new AutoComplete();
|
|
1097
1105
|
});
|
|
1098
1106
|
|
|
1099
1107
|
/**
|
|
@@ -10145,15 +10153,76 @@ var TitleText = (function (props) {
|
|
|
10145
10153
|
}, "*") : React.createElement(React.Fragment, null), children);
|
|
10146
10154
|
});
|
|
10147
10155
|
|
|
10148
|
-
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";
|
|
10149
10157
|
styleInject(css_248z$6);
|
|
10150
10158
|
|
|
10151
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
|
+
|
|
10152
10170
|
var onChange = React.useCallback(function (e) {
|
|
10153
10171
|
var event = _objectSpread2({}, e);
|
|
10154
10172
|
|
|
10155
10173
|
props.onChange && props.onChange(event);
|
|
10156
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
|
+
})[0];
|
|
10224
|
+
good && ((_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.setFieldsValue(removeNullUndefined(good)));
|
|
10225
|
+
}, [options, controller]);
|
|
10157
10226
|
return React.createElement("div", {
|
|
10158
10227
|
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
10159
10228
|
}, props.shorthand && React.createElement("span", {
|
|
@@ -10161,14 +10230,34 @@ function ItemNameInput(props) {
|
|
|
10161
10230
|
alignSelf: 'center',
|
|
10162
10231
|
fontSize: 12
|
|
10163
10232
|
}
|
|
10164
|
-
}, "*", 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, {
|
|
10165
10242
|
style: {
|
|
10166
10243
|
height: '100%',
|
|
10167
10244
|
border: 'none'
|
|
10168
10245
|
},
|
|
10169
10246
|
value: props.value,
|
|
10170
10247
|
onChange: onChange
|
|
10171
|
-
}));
|
|
10248
|
+
})));
|
|
10249
|
+
}
|
|
10250
|
+
|
|
10251
|
+
function removeNullUndefined(obj) {
|
|
10252
|
+
var filteredObj = {};
|
|
10253
|
+
|
|
10254
|
+
for (var key in obj) {
|
|
10255
|
+
if (obj[key] !== null && obj[key] !== undefined) {
|
|
10256
|
+
filteredObj[key] = obj[key];
|
|
10257
|
+
}
|
|
10258
|
+
}
|
|
10259
|
+
|
|
10260
|
+
return filteredObj;
|
|
10172
10261
|
}
|
|
10173
10262
|
|
|
10174
10263
|
/** 拆分全称加简称 */
|
|
@@ -10475,7 +10564,7 @@ var useColumns = (function (form) {
|
|
|
10475
10564
|
return React.createElement(Form.Item, null, getFieldDecorator('unit', {
|
|
10476
10565
|
initialValue: editGood.unit,
|
|
10477
10566
|
rules: getReplenishRules('unit')
|
|
10478
|
-
})(React.createElement(AutoComplete, {
|
|
10567
|
+
})(React.createElement(AutoComplete$2, {
|
|
10479
10568
|
style: {
|
|
10480
10569
|
width: '100%'
|
|
10481
10570
|
},
|
|
@@ -19438,7 +19527,6 @@ var ImportGoodsDrawer = (function () {
|
|
|
19438
19527
|
return s.goodsListState.importGoods.topExpand;
|
|
19439
19528
|
}, []);
|
|
19440
19529
|
var onClose = React.useCallback(function () {
|
|
19441
|
-
console.log('===> 关闭抽屉');
|
|
19442
19530
|
controller.pipeline( /*#__PURE__*/function () {
|
|
19443
19531
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
19444
19532
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,13 @@ var Stakeholder = /*#__PURE__*/_createClass(function Stakeholder() {
|
|
|
1090
1090
|
this.rulesMap = void 0;
|
|
1091
1091
|
});
|
|
1092
1092
|
|
|
1093
|
+
/** 自动补全 */
|
|
1094
|
+
var AutoComplete = /*#__PURE__*/_createClass(function AutoComplete() {
|
|
1095
|
+
_classCallCheck(this, AutoComplete);
|
|
1096
|
+
|
|
1097
|
+
this.onItemNameSearch = void 0;
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1093
1100
|
var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
|
|
1094
1101
|
_classCallCheck(this, InvoiceControllerState);
|
|
1095
1102
|
|
|
@@ -1104,6 +1111,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
1104
1111
|
this.priceIntegerDigit = void 0;
|
|
1105
1112
|
this.rootElement = null;
|
|
1106
1113
|
this.typeModalProps = void 0;
|
|
1114
|
+
this.autoComplete = new AutoComplete();
|
|
1107
1115
|
});
|
|
1108
1116
|
|
|
1109
1117
|
/**
|
|
@@ -10155,15 +10163,76 @@ var TitleText = (function (props) {
|
|
|
10155
10163
|
}, "*") : React__default['default'].createElement(React__default['default'].Fragment, null), children);
|
|
10156
10164
|
});
|
|
10157
10165
|
|
|
10158
|
-
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";
|
|
10159
10167
|
styleInject(css_248z$6);
|
|
10160
10168
|
|
|
10161
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
|
+
|
|
10162
10180
|
var onChange = React__default['default'].useCallback(function (e) {
|
|
10163
10181
|
var event = _objectSpread2({}, e);
|
|
10164
10182
|
|
|
10165
10183
|
props.onChange && props.onChange(event);
|
|
10166
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
|
+
})[0];
|
|
10234
|
+
good && ((_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.setFieldsValue(removeNullUndefined(good)));
|
|
10235
|
+
}, [options, controller]);
|
|
10167
10236
|
return React__default['default'].createElement("div", {
|
|
10168
10237
|
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
10169
10238
|
}, props.shorthand && React__default['default'].createElement("span", {
|
|
@@ -10171,14 +10240,34 @@ function ItemNameInput(props) {
|
|
|
10171
10240
|
alignSelf: 'center',
|
|
10172
10241
|
fontSize: 12
|
|
10173
10242
|
}
|
|
10174
|
-
}, "*", 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, {
|
|
10175
10252
|
style: {
|
|
10176
10253
|
height: '100%',
|
|
10177
10254
|
border: 'none'
|
|
10178
10255
|
},
|
|
10179
10256
|
value: props.value,
|
|
10180
10257
|
onChange: onChange
|
|
10181
|
-
}));
|
|
10258
|
+
})));
|
|
10259
|
+
}
|
|
10260
|
+
|
|
10261
|
+
function removeNullUndefined(obj) {
|
|
10262
|
+
var filteredObj = {};
|
|
10263
|
+
|
|
10264
|
+
for (var key in obj) {
|
|
10265
|
+
if (obj[key] !== null && obj[key] !== undefined) {
|
|
10266
|
+
filteredObj[key] = obj[key];
|
|
10267
|
+
}
|
|
10268
|
+
}
|
|
10269
|
+
|
|
10270
|
+
return filteredObj;
|
|
10182
10271
|
}
|
|
10183
10272
|
|
|
10184
10273
|
/** 拆分全称加简称 */
|
|
@@ -19448,7 +19537,6 @@ var ImportGoodsDrawer = (function () {
|
|
|
19448
19537
|
return s.goodsListState.importGoods.topExpand;
|
|
19449
19538
|
}, []);
|
|
19450
19539
|
var onClose = React__default['default'].useCallback(function () {
|
|
19451
|
-
console.log('===> 关闭抽屉');
|
|
19452
19540
|
controller.pipeline( /*#__PURE__*/function () {
|
|
19453
19541
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
19454
19542
|
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,57 @@ 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
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
"itemName": "呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵",
|
|
26
|
+
"taxClassificationCode": "1010112070000000000",
|
|
27
|
+
"itemModelName": null,
|
|
28
|
+
"shorthand": "蔬菜",
|
|
29
|
+
"taxRate": undefined
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"itemName": "稻谷",
|
|
33
|
+
"taxClassificationCode": "1010101040000000000",
|
|
34
|
+
"itemModelName": null,
|
|
35
|
+
"shorthand": "谷物",
|
|
36
|
+
"taxRate": 3
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"itemName": "苹果",
|
|
40
|
+
"taxClassificationCode": "1090111090000000000",
|
|
41
|
+
"itemModelName": null,
|
|
42
|
+
"shorthand": "小型起重设备",
|
|
43
|
+
"taxRate": null
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"itemName": "银丝",
|
|
47
|
+
"taxClassificationCode": "1080411120000000000",
|
|
48
|
+
"itemModelName": null,
|
|
49
|
+
"shorthand": "金属制品",
|
|
50
|
+
"taxRate": 3
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"itemName": "布料",
|
|
54
|
+
"taxClassificationCode": "1100101011100000000",
|
|
55
|
+
"itemModelName": null,
|
|
56
|
+
"shorthand": "发电",
|
|
57
|
+
"taxRate": 2
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"itemName": "苹果",
|
|
61
|
+
"taxClassificationCode": "1010115010100000000",
|
|
62
|
+
"itemModelName": null,
|
|
63
|
+
"shorthand": "水果",
|
|
64
|
+
"taxRate": 3
|
|
65
|
+
}
|
|
66
|
+
] as any
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
19
70
|
updateInvoiceNo = this.pipeline(async s => {
|
|
20
71
|
return '--';
|
|
21
72
|
})
|
|
@@ -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,58 @@
|
|
|
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)[0];
|
|
34
|
+
good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(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
|
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
function removeNullUndefined(obj: Record<string, any>): Record<string, any> {
|
|
49
|
+
const filteredObj: Record<string, any> = {};
|
|
50
|
+
|
|
51
|
+
for (const key in obj) {
|
|
52
|
+
if (obj[key] !== null && obj[key] !== undefined) {
|
|
53
|
+
filteredObj[key] = obj[key];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return filteredObj;
|
|
58
|
+
}
|
|
@@ -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
|
|