kts-component-invoice-operate 2.0.0 → 2.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 (75) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  2. package/dist/Invoice/InvoiceController/fns/getGoodsSearch.d.ts +2 -0
  3. package/dist/Invoice/InvoiceController/index.d.ts +3 -0
  4. package/dist/Invoice/_test/buyerNameSearch/index.d.ts +0 -1
  5. package/dist/Invoice/_test/deduction/index.d.ts +0 -1
  6. package/dist/Invoice/_test/draft/index.d.ts +0 -1
  7. package/dist/Invoice/_test/easiest/index.d.ts +0 -1
  8. package/dist/Invoice/_test/endowCode/index.d.ts +0 -1
  9. package/dist/Invoice/_test/goodsMenuExpand/index.d.ts +0 -1
  10. package/dist/Invoice/_test/importBuyer/index.d.ts +0 -1
  11. package/dist/Invoice/_test/importGoods/index.d.ts +0 -1
  12. package/dist/Invoice/_test/invoiceType/index.d.ts +0 -1
  13. package/dist/Invoice/_test/isInvoiceNo/index.d.ts +0 -1
  14. package/dist/Invoice/_test/replaceHead/index.d.ts +0 -1
  15. package/dist/Invoice/_test/retrieveData/index.d.ts +0 -1
  16. package/dist/Invoice/_test/seller/index.d.ts +0 -1
  17. package/dist/Invoice/_test/setDataSource/index.d.ts +0 -1
  18. package/dist/Invoice/_test/unit/index.d.ts +0 -1
  19. package/dist/Invoice/ui/AddComparisonDrawer/index.d.ts +1 -1
  20. package/dist/Invoice/ui/Buyer/ui/BuyerNameInput/index.d.ts +0 -1
  21. package/dist/Invoice/ui/Buyer/ui/ImportBuyerButton/index.d.ts +0 -1
  22. package/dist/Invoice/ui/EndowCodeDrawer/index.d.ts +0 -1
  23. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowEditButton/index.d.ts +0 -1
  24. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +0 -1
  25. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +0 -1
  26. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +0 -1
  27. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +0 -1
  28. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.d.ts +0 -1
  29. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowSaveButton/index.d.ts +0 -1
  30. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +0 -1
  31. package/dist/Invoice/ui/GoodsList/ui/AddRowButton/index.d.ts +0 -1
  32. package/dist/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.d.ts +4 -2
  33. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.d.ts +4 -0
  34. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +4 -0
  35. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +4 -0
  36. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/index.d.ts +1 -0
  37. package/dist/Invoice/ui/GoodsList/ui/DescribeSwitch/index.d.ts +0 -1
  38. package/dist/Invoice/ui/GoodsList/ui/Search/index.d.ts +2 -0
  39. package/dist/Invoice/ui/GoodsList/ui/Statistics/index.d.ts +0 -1
  40. package/dist/Invoice/ui/GoodsList/ui/TableRow/index.d.ts +0 -1
  41. package/dist/Invoice/ui/GoodsList/ui/TableVirtual/index.d.ts +0 -1
  42. package/dist/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.d.ts +0 -1
  43. package/dist/Invoice/ui/ImportBuyerDrawer/index.d.ts +0 -1
  44. package/dist/Invoice/ui/ImportGoodsDrawer/index.d.ts +0 -1
  45. package/dist/index.esm.js +715 -457
  46. package/dist/index.js +714 -456
  47. package/package.json +3 -1
  48. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
  49. package/src/Invoice/InvoiceController/fns/getGoodsSearch.ts +17 -0
  50. package/src/Invoice/InvoiceController/index.ts +4 -0
  51. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +154 -158
  52. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +34 -8
  53. package/src/Invoice/ui/GoodsList/hook/useRowSelection/index.tsx +34 -8
  54. package/src/Invoice/ui/GoodsList/index.less +10 -2
  55. package/src/Invoice/ui/GoodsList/index.tsx +17 -21
  56. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +5 -2
  57. package/src/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.less +0 -0
  58. package/src/Invoice/ui/GoodsList/ui/{AddDiscountRowButton → BulkMenu/hooks/useAddDiscountRowButton}/index.tsx +20 -17
  59. package/src/Invoice/ui/GoodsList/ui/{CommodityComparisonButton → BulkMenu/hooks/useCommodityComparisonButton}/index.tsx +17 -11
  60. package/src/Invoice/ui/GoodsList/ui/{DelRowButton → BulkMenu/hooks/useDelRowButton}/index.tsx +15 -7
  61. package/src/Invoice/ui/GoodsList/ui/{EndowCodeButton → BulkMenu/hooks/useEndowCodeButton}/index.tsx +13 -9
  62. package/src/Invoice/ui/GoodsList/ui/BulkMenu/index.tsx +43 -0
  63. package/src/Invoice/ui/GoodsList/ui/Search/icon/magnifier.svg +1 -0
  64. package/src/Invoice/ui/GoodsList/ui/Search/index.less +10 -0
  65. package/src/Invoice/ui/GoodsList/ui/Search/index.tsx +47 -0
  66. package/yarn.e.lock +14331 -0
  67. package/dist/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.d.ts +0 -3
  68. package/dist/Invoice/ui/GoodsList/ui/DelRowButton/index.d.ts +0 -3
  69. package/dist/Invoice/ui/GoodsList/ui/EndowCodeButton/index.d.ts +0 -3
  70. package/docs-dist/404.html +0 -33
  71. package/docs-dist/index.html +0 -33
  72. package/docs-dist/static/auto.a6cd905c.svg +0 -1
  73. package/docs-dist/static/spot.42e620e1.svg +0 -1
  74. package/docs-dist/umi.css +0 -20
  75. package/docs-dist/umi.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -34,6 +34,7 @@
34
34
  "next": "^11.0.1",
35
35
  "nzh": "^1.0.4",
36
36
  "react": "^16.12.0",
37
+ "react-dom": "^16.12.0",
37
38
  "styled-components": "^5.3.0",
38
39
  "uuid": "^8.3.2"
39
40
  },
@@ -44,6 +45,7 @@
44
45
  "dumi": "^1.0.14",
45
46
  "father-build": "^1.17.2",
46
47
  "gh-pages": "^3.0.0",
48
+ "invariant": "^2.2.4",
47
49
  "kts-components": "^1.2.18",
48
50
  "lint-staged": "^10.0.7",
49
51
  "prettier": "^2.2.1",
@@ -40,6 +40,9 @@ export default class GoodsListState {
40
40
  /** 税率列表 */
41
41
  taxRateList: number[] = [0, 3, 5, 6, 9, 13];
42
42
 
43
+ /** 搜索条件 */
44
+ searchValue = '';
45
+
43
46
  /** 货物列表 */
44
47
  goodsList: IGood[] = [];
45
48
 
@@ -0,0 +1,17 @@
1
+
2
+ import IGood from "../InvoiceControllerState/GoodsListState/IGood";
3
+
4
+ export default function getGoodsSearch(goodsList: IGood[], search: string) {
5
+ if (!search) return goodsList;
6
+ return goodsList.filter(e => {
7
+ if ((e.itemName?.indexOf(search) ?? -1) >= 0) {
8
+ return true;
9
+ } else if ((e.itemModelName?.indexOf(search) ?? -1) >= 0) {
10
+ return true
11
+ } else if (`${e.lineAmountIncludeTax}`.indexOf(search) >= 0) {
12
+ return true
13
+ } else {
14
+ return false;
15
+ }
16
+ })
17
+ }
@@ -9,6 +9,7 @@ import delGood from './fns/delGood';
9
9
  import addGoodDiscount from './fns/addGoodDiscount';
10
10
  import addGood from './fns/addGood';
11
11
  import saveEditGood from './fns/saveEditGood';
12
+ import getGoodsSearch from './fns/getGoodsSearch';
12
13
 
13
14
  export { default as InvoiceControllerState } from './InvoiceControllerState';
14
15
  export { default as IGood } from './InvoiceControllerState/GoodsListState/IGood';
@@ -54,4 +55,7 @@ export default class InvoiceController extends InvoiceControllerForm {
54
55
 
55
56
  /** 税收分类编码列表 */
56
57
  getTaxCategoryCodeList?: () => Promise<any>;
58
+
59
+ /** 获取筛选后的列表 */
60
+ getGoodsSearch = getGoodsSearch
57
61
  }
@@ -1,172 +1,168 @@
1
1
 
2
+ import React from "react";
2
3
  import { Row, Col, Input, Drawer, Form, Checkbox, Button } from "kts-components-antd-x3";
4
+ import { WrappedFormUtils } from "kts-components-antd-x3/lib/form/Form";
3
5
  import { FormComponentProps } from "kts-components-antd-x3/lib/form";
4
6
  import { decorator } from "grey-react-box";
5
7
  import { Invoice } from "../../../";
6
8
  import { getSN } from "../../tools/itemName";
7
- import React from "react";
8
- import { WrappedFormUtils } from "kts-components-antd-x3/lib/form/Form";
9
9
 
10
- const AddComparisonDrawer = decorator(
10
+ const AddComparisonDrawer = decorator<{}, FormComponentProps>(
11
11
  Form.create()
12
- )(
13
- (props: FormComponentProps) => {
14
-
15
- const { form } = props;
16
-
17
- const { getFieldDecorator } = form;
18
-
19
- /** 控制器 */
20
- const controller = Invoice.useInvoiceController();
21
-
22
- /** 正在 添加商品对照 的货物索引 */
23
- const addComparisonIndex = controller.useMemo(s => s.goodsListState.addComparisonIndex, []);
24
-
25
- /** 货物字典 */
26
- const goodsMap = controller.useMemo(s => s.goodsListState.goodsMap, []);
27
-
28
- /** 正在 对照 的货物 */
29
- const good = React.useMemo(() => addComparisonIndex ? goodsMap.get(addComparisonIndex) : undefined, [addComparisonIndex])
30
-
31
- /** 关闭对照 */
32
- const onClose = React.useCallback(controller.pipeline<any>(async s => {
33
- s.goodsListState.addComparisonIndex = undefined
34
- }), [controller])
35
-
36
- /** 提交数据 */
37
- const onSubmit = React.useCallback(() => {
38
- controller.run(async s => {
39
- if (!good) return
40
-
41
- const { err, values } = await validateFields(form);
42
- if (err) return;
43
-
44
- const shorthand = s.goodsListState.isMyShow ? getSN(good.itemName)?.shorthand : getSN(good.itemNameOther)?.shorthand;
45
- good.itemCode = values.itemCode;
46
- good.itemCodeOther = values.itemCodeOther;
47
- good.itemName = shorthand ? `*${shorthand}*${values.itemName}` : values.itemName;
48
- good.itemNameOther = shorthand ? `*${shorthand}*${values.itemNameOther}` : values.itemNameOther;
49
- good.itemModelName = values.itemModelName;
50
- good.itemModelNameOther = values.itemModelNameOther;
51
- good.unit = values.unit;
52
- good.unitOther = values.unitOther;
53
- s.goodsListState.addComparisonIndex = undefined;
54
- s.goodsListState.goodsList = [...s.goodsListState.goodsList]
55
-
56
- if (s.goodsListState?.productComparison?.onUpdateComparisonTable && values.isUpdate) {
57
- debugger
58
- await s.goodsListState.productComparison.onUpdateComparisonTable(good, values);
59
- }
60
- })
61
- }, [form, good])
62
-
63
- React.useEffect(() => {
64
- form.resetFields();
65
- if (good) {
66
- form.setFieldsValue({
67
- ...good,
68
- itemName: getSN(good.itemName)?.full,
69
- itemNameOther: getSN(good.itemNameOther)?.full,
70
- })
12
+ )(props => {
13
+
14
+ const { form } = props;
15
+
16
+ const { getFieldDecorator } = form;
17
+
18
+ /** 控制器 */
19
+ const controller = Invoice.useInvoiceController();
20
+
21
+ /** 正在 添加商品对照 的货物索引 */
22
+ const addComparisonIndex = controller.useMemo(s => s.goodsListState.addComparisonIndex, []);
23
+
24
+ /** 货物字典 */
25
+ const goodsMap = controller.useMemo(s => s.goodsListState.goodsMap, []);
26
+
27
+ /** 正在 对照 的货物 */
28
+ const good = React.useMemo(() => addComparisonIndex ? goodsMap.get(addComparisonIndex) : undefined, [addComparisonIndex]);
29
+
30
+ /** 关闭对照 */
31
+ const onClose = React.useCallback(controller.pipeline<any>(async s => { s.goodsListState.addComparisonIndex = undefined }), [controller]);
32
+
33
+ /** 提交数据 */
34
+ const onSubmit = React.useCallback(() => {
35
+ controller.run(async s => {
36
+ if (!good) return
37
+
38
+ const { err, values } = await validateFields(form);
39
+ if (err) return;
40
+
41
+ const shorthand = s.goodsListState.isMyShow ? getSN(good.itemName)?.shorthand : getSN(good.itemNameOther)?.shorthand;
42
+ good.itemCode = values.itemCode;
43
+ good.itemCodeOther = values.itemCodeOther;
44
+ good.itemName = shorthand ? `*${shorthand}*${values.itemName}` : values.itemName;
45
+ good.itemNameOther = shorthand ? `*${shorthand}*${values.itemNameOther}` : values.itemNameOther;
46
+ good.itemModelName = values.itemModelName;
47
+ good.itemModelNameOther = values.itemModelNameOther;
48
+ good.unit = values.unit;
49
+ good.unitOther = values.unitOther;
50
+ s.goodsListState.addComparisonIndex = undefined;
51
+ s.goodsListState.goodsList = [...s.goodsListState.goodsList]
52
+
53
+ if (s.goodsListState?.productComparison?.onUpdateComparisonTable && values.isUpdate) {
54
+ debugger
55
+ await s.goodsListState.productComparison.onUpdateComparisonTable(good, values);
71
56
  }
72
- }, [good])
73
-
74
- return (
75
- <Drawer
76
- width={500}
77
- onClose={onClose}
78
- placement="right"
79
- title="添加商品对照"
80
- visible={!!addComparisonIndex}
81
- drawerStyle={{ display: 'flex', flexDirection: 'column' }}
82
- bodyStyle={{ flex: 1, display: 'flex', flexDirection: 'column' }}
83
- >
84
- <Form layout="vertical" style={{ flex: 1 }} >
85
- <Row gutter={[8, 8]} >
86
- <Col span={12}>
87
- {getFieldDecorator('itemCode', {})(
88
- <Form.Item label="我方商品编码" >
89
- <Input />
90
- </Form.Item>
91
- )}
92
-
93
- </Col>
94
- <Col span={12} >
95
- {getFieldDecorator('itemCodeOther', {})(
96
- <Form.Item label="对方商品编码" >
97
- <Input />
98
- </Form.Item>
99
- )}
100
- </Col>
101
- <Col span={12} >
102
- {getFieldDecorator('itemName', {
103
- rules: [{ required: true, message: "请输入我方商品名称" }]
104
- })(
105
- <Form.Item label="我方商品名称" >
106
- <Input />
107
- </Form.Item>
108
- )}
109
-
110
- </Col>
111
- <Col span={12} >
112
- {getFieldDecorator('itemNameOther', {
113
- rules: [{ required: true, message: "请输入对方商品名称" }]
114
- })(
115
- <Form.Item label="对方商品名称">
116
- <Input />
117
- </Form.Item>
118
- )}
119
- </Col>
120
- <Col span={12} >
121
- <Form.Item label="我方规格型号">
57
+ })
58
+ }, [form, good])
59
+
60
+ React.useEffect(() => {
61
+ form.resetFields();
62
+ if (good) {
63
+ form.setFieldsValue({
64
+ ...good,
65
+ itemName: getSN(good.itemName)?.full,
66
+ itemNameOther: getSN(good.itemNameOther)?.full,
67
+ })
68
+ }
69
+ }, [good])
70
+
71
+ return (
72
+ <Drawer
73
+ width={500}
74
+ onClose={onClose}
75
+ placement="right"
76
+ title="添加商品对照"
77
+ visible={!!addComparisonIndex}
78
+ drawerStyle={{ display: 'flex', flexDirection: 'column' }}
79
+ bodyStyle={{ flex: 1, display: 'flex', flexDirection: 'column' }}
80
+ >
81
+ <Form layout="vertical" style={{ flex: 1 }} >
82
+ <Row gutter={[8, 8]} >
83
+ <Col span={12}>
84
+ {getFieldDecorator('itemCode', {})(
85
+ <Form.Item label="我方商品编码" >
86
+ <Input />
87
+ </Form.Item>
88
+ )}
89
+
90
+ </Col>
91
+ <Col span={12} >
92
+ {getFieldDecorator('itemCodeOther', {})(
93
+ <Form.Item label="对方商品编码" >
94
+ <Input />
95
+ </Form.Item>
96
+ )}
97
+ </Col>
98
+ <Col span={12} >
99
+ {getFieldDecorator('itemName', {
100
+ rules: [{ required: true, message: "请输入我方商品名称" }]
101
+ })(
102
+ <Form.Item label="我方商品名称" >
103
+ <Input />
104
+ </Form.Item>
105
+ )}
106
+
107
+ </Col>
108
+ <Col span={12} >
109
+ {getFieldDecorator('itemNameOther', {
110
+ rules: [{ required: true, message: "请输入对方商品名称" }]
111
+ })(
112
+ <Form.Item label="对方商品名称">
113
+ <Input />
114
+ </Form.Item>
115
+ )}
116
+ </Col>
117
+ <Col span={12} >
118
+ <Form.Item label="我方规格型号">
119
+ <Input />
120
+ </Form.Item>
121
+ </Col>
122
+ <Col span={12} >
123
+ {getFieldDecorator('itemModelNameOther', {
124
+ rules: [{ required: true, message: "请输入对方规格型号" }]
125
+ })(
126
+ <Form.Item label="对方规格型号">
127
+ <Input />
128
+ </Form.Item>
129
+ )}
130
+ </Col>
131
+ <Col span={12} >
132
+ {getFieldDecorator('unit', {
133
+ rules: [{ required: true, message: "请输入对方规格型号" }]
134
+ })(
135
+ <Form.Item label="我方计量单位" >
136
+ <Input />
137
+ </Form.Item>
138
+ )}
139
+ </Col>
140
+ <Col span={12} >
141
+ {getFieldDecorator('unitOther', {
142
+ rules: [{ required: true, message: "请输入对方计量单位" }]
143
+ })(
144
+ <Form.Item label="对方计量单位" >
122
145
  <Input />
123
146
  </Form.Item>
124
- </Col>
125
- <Col span={12} >
126
- {getFieldDecorator('itemModelNameOther', {
127
- rules: [{ required: true, message: "请输入对方规格型号" }]
128
- })(
129
- <Form.Item label="对方规格型号">
130
- <Input />
131
- </Form.Item>
132
- )}
133
- </Col>
134
- <Col span={12} >
135
- {getFieldDecorator('unit', {
136
- rules: [{ required: true, message: "请输入对方规格型号" }]
137
- })(
138
- <Form.Item label="我方计量单位" >
139
- <Input />
140
- </Form.Item>
141
- )}
142
- </Col>
143
- <Col span={12} >
144
- {getFieldDecorator('unitOther', {
145
- rules: [{ required: true, message: "请输入对方计量单位" }]
146
- })(
147
- <Form.Item label="对方计量单位" >
148
- <Input />
149
- </Form.Item>
150
- )}
151
- </Col>
152
- <Col span={24} >
153
- {getFieldDecorator('isUpdate', {
154
- })(
155
- <Form.Item >
156
- <Checkbox>更新到商品对照表中</Checkbox>
157
- </Form.Item>
158
- )}
159
- </Col>
160
- </Row>
161
- </Form>
162
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 10 }} >
163
- <Button type="primary" onClick={onSubmit} >提交</Button>
164
- <Button onClick={onClose} >取消</Button>
165
- </div>
166
- </Drawer>
167
- )
168
- }
169
- )
147
+ )}
148
+ </Col>
149
+ <Col span={24} >
150
+ {getFieldDecorator('isUpdate', {
151
+ })(
152
+ <Form.Item >
153
+ <Checkbox>更新到商品对照表中</Checkbox>
154
+ </Form.Item>
155
+ )}
156
+ </Col>
157
+ </Row>
158
+ </Form>
159
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 10 }} >
160
+ <Button type="primary" onClick={onSubmit} >提交</Button>
161
+ <Button onClick={onClose} >取消</Button>
162
+ </div>
163
+ </Drawer>
164
+ )
165
+ })
170
166
 
171
167
  export default AddComparisonDrawer;
172
168
 
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { Form, AutoComplete, Select, Typography, Button, Input, Spin } from 'kts-components-antd-x3';
3
3
  import { InputProps } from 'kts-components-antd-x3/lib/input';
4
4
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
5
- import Invoice from '../../../../';
6
5
  import { IGood } from '../../../../InvoiceController';
6
+ import Invoice from '../../../../';
7
7
  import RowMenu from './ui/RowMenu';
8
8
  import {
9
9
  onChangeQuantity,
@@ -12,7 +12,7 @@ import {
12
12
  onChangeLineAmountIncludeTax,
13
13
  onChangeLineAmountExcludeTax,
14
14
  onChangeTaxRate,
15
- onSaveEditGood,
15
+ // onSaveEditGood,
16
16
  endowCode,
17
17
  onChangeItemName,
18
18
  } from './autoFillFn';
@@ -33,6 +33,9 @@ export default (form: WrappedFormUtils) => {
33
33
  /** 正在编辑的货物 */
34
34
  const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
35
35
 
36
+ /** 搜索条件 */
37
+ const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
38
+
36
39
  /** 税率列表 */
37
40
  const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
38
41
 
@@ -105,7 +108,16 @@ export default (form: WrappedFormUtils) => {
105
108
  </Form.Item>
106
109
  );
107
110
  } else {
108
- return <MyItemNameDiv valueT={record.itemName} valueF={record.itemNameOther} isMyShow={isMyShow} />
111
+ return (
112
+ <MyItemNameDiv
113
+ valueT={formatSearch(record.itemName, searchValue)}
114
+ valueF={record.itemNameOther}
115
+ isMyShow={isMyShow}
116
+ />
117
+ )
118
+ // return (
119
+ // <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>
120
+ // );
109
121
  }
110
122
  },
111
123
  },
@@ -133,7 +145,14 @@ export default (form: WrappedFormUtils) => {
133
145
  </Form.Item>
134
146
  );
135
147
  } else {
136
- return <MyItemNameDiv valueT={record.itemModelName} valueF={record.itemModelNameOther} isMyShow={isMyShow} />
148
+ return (
149
+ <MyItemNameDiv
150
+ valueT={formatSearch(record.itemModelName, searchValue)}
151
+ valueF={formatSearch(record.itemModelNameOther, searchValue)}
152
+ isMyShow={isMyShow}
153
+ />
154
+ )
155
+ // return <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>;
137
156
  }
138
157
  },
139
158
  },
@@ -340,7 +359,7 @@ export default (form: WrappedFormUtils) => {
340
359
  </Form.Item>
341
360
  );
342
361
  } else {
343
- return <span style={{ padding: '0 10px' }}>{parseFloat(value).toFixed(2)}</span>;
362
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
344
363
  }
345
364
  },
346
365
  },
@@ -472,7 +491,7 @@ export default (form: WrappedFormUtils) => {
472
491
  ellipsis: true,
473
492
  };
474
493
  }) as any[];
475
- }, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow]);
494
+ }, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue]);
476
495
 
477
496
  React.useEffect(() => {
478
497
  if (!changeField) return;
@@ -513,7 +532,7 @@ class MyDiv extends React.Component<{ value?: any }> {
513
532
  }
514
533
  }
515
534
 
516
- class MyItemNameDiv extends React.Component<{ valueT?: string, valueF?: string, isMyShow: boolean }> {
535
+ class MyItemNameDiv extends React.Component<{ valueT?: React.ReactNode, valueF?: React.ReactNode, isMyShow: boolean }> {
517
536
  render(): React.ReactNode {
518
537
 
519
538
  const { isMyShow, valueT, valueF } = this.props;
@@ -540,4 +559,11 @@ class MyItemNameDiv extends React.Component<{ valueT?: string, valueF?: string,
540
559
  }
541
560
  }
542
561
  }
543
- }
562
+ }
563
+ /** 格式搜索结果 */
564
+ function formatSearch(value?: string, search?: string) {
565
+ if (!value || !search) return value;
566
+
567
+ const __html = value.split(new RegExp(search, 'g')).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
568
+ return <span dangerouslySetInnerHTML={{ __html }} />
569
+ }
@@ -15,20 +15,46 @@ export default () => {
15
15
  /** 货物列表 */
16
16
  const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
17
17
 
18
+ /** 搜索条件 */
19
+ const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
20
+
18
21
  /** 是否全选 */
19
- const isAll = controller.useMemo(s => s.goodsListState.goodsList.length > 0 && s.goodsListState.selectedGoodIndex.length === s.goodsListState.goodsList.length, [])
22
+ // const isAll = controller.useMemo(s => s.goodsListState.goodsList.length > 0 && s.goodsListState.selectedGoodIndex.length === s.goodsListState.goodsList.length, [])
23
+ const isAll = controller.useMemo(s => {
24
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return false;
25
+ const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index);
26
+ const selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
27
+ return selectedGoodIndex.length === seeGoodsIndex.length
28
+ }, [])
29
+
30
+ const indeterminate = controller.useMemo(s => {
31
+ const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index);
32
+ const selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
33
+ if (selectedGoodIndex.length === 0) return false;
34
+ return selectedGoodIndex.length < seeGoodsIndex.length
35
+ }, [])
20
36
 
21
37
  /** 点击了全选 */
22
- const onClickSelectAll = React.useCallback(() => {
38
+ const onClickSelectAll = React.useCallback(async () => {
23
39
  if (isAll) {
24
- controller.pipeline(async s => {
25
- s.goodsListState.selectedGoodIndex = [];
40
+ await controller.pipeline(async s => {
41
+ const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index)
42
+
43
+ s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e=>!seeGoodsIndex.some(t => e === t));
26
44
  })()
27
45
  } else {
28
- controller.pipeline(async s => {
29
- s.goodsListState.selectedGoodIndex = s.goodsListState.goodsList.map(e => e.$index);
46
+ // controller.pipeline(async s => {
47
+ // s.goodsListState.selectedGoodIndex = s.goodsListState.goodsList.map(e => e.$index);
48
+ // })()
49
+
50
+ await controller.pipeline(async s => {
51
+ const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue).map(e => e.$index)
52
+
53
+ s.goodsListState.selectedGoodIndex = [...s.goodsListState.selectedGoodIndex, ...seeGoodsIndex];
54
+ s.goodsListState.selectedGoodIndex = Array.from(new Set(s.goodsListState.selectedGoodIndex));
30
55
  })()
31
56
  }
57
+ await sortOut(true);
32
58
  }, [controller, isAll])
33
59
 
34
60
  const onSelect = React.useCallback(async (record, selected) => {
@@ -50,11 +76,11 @@ export default () => {
50
76
  return (
51
77
  <Checkbox
52
78
  onChange={onClickSelectAll}
53
- indeterminate={selectedRowKeys.length > 0 && selectedRowKeys.length < goodsList.length}
79
+ indeterminate={indeterminate}
54
80
  checked={isAll}
55
81
  ></Checkbox>
56
82
  )
57
- }, [goodsList, selectedRowKeys, onClickSelectAll, isAll])
83
+ }, [goodsList, selectedRowKeys, onClickSelectAll, isAll, indeterminate])
58
84
 
59
85
  /** 选择了商品后 调整 折扣行 和 被折扣行 */
60
86
  const sortOut = React.useCallback(async (selected: boolean) => {
@@ -13,7 +13,10 @@
13
13
  }
14
14
 
15
15
  .kts-invoice-operate-goods-list-able-list {
16
- flex: 1;
16
+ flex : 1;
17
+ display : flex;
18
+ gap : 10px;
19
+ padding-right: 10px;
17
20
 
18
21
  button {
19
22
  padding-left : 10px;
@@ -21,7 +24,6 @@
21
24
  border-radius: 12px;
22
25
  color : #0074ff;
23
26
  border : 1px solid #0074ff;
24
- margin : 0 10px;
25
27
  height : 24px;
26
28
  line-height : 22px;
27
29
  cursor : pointer;
@@ -123,4 +125,10 @@
123
125
  box-shadow : none;
124
126
  }
125
127
  }
128
+ }
129
+
130
+ .kts-invoice-operate-goods-list-table-search-protrude {
131
+ background : #ff0;
132
+ color : #000;
133
+ font-weight: bold;
126
134
  }