kts-component-invoice-operate 1.2.21 → 1.2.24

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 (35) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  2. package/dist/Invoice/InvoiceController/fns/addGood.d.ts +1 -1
  3. package/dist/Invoice/InvoiceController/fns/addGoodDiscount.d.ts +1 -1
  4. package/dist/Invoice/InvoiceController/fns/delGood.d.ts +1 -1
  5. package/dist/Invoice/InvoiceController/fns/getGoodsSearch.d.ts +2 -0
  6. package/dist/Invoice/InvoiceController/fns/saveEditGood.d.ts +1 -1
  7. package/dist/Invoice/InvoiceController/fns/setEditGood.d.ts +1 -1
  8. package/dist/Invoice/InvoiceController/fns/setGoods.d.ts +1 -1
  9. package/dist/Invoice/InvoiceController/fns/updateInvoiceNo.d.ts +1 -1
  10. package/dist/Invoice/InvoiceController/index.d.ts +3 -0
  11. package/dist/Invoice/tools/coolingFn/index.d.ts +1 -1
  12. package/dist/Invoice/tools/lazyFn/index.d.ts +1 -1
  13. package/dist/Invoice/ui/GoodsList/ui/Search/index.d.ts +2 -0
  14. package/dist/index.esm.js +1203 -615
  15. package/dist/index.js +1203 -615
  16. package/docs/index.md +1 -1
  17. package/package.json +1 -1
  18. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +4 -1
  19. package/src/Invoice/InvoiceController/fns/getGoodsSearch.ts +17 -0
  20. package/src/Invoice/InvoiceController/index.ts +4 -0
  21. package/src/Invoice/ui/EndowCodeDrawer/index.tsx +19 -13
  22. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +27 -4
  23. package/src/Invoice/ui/GoodsList/hook/useRowSelection/index.tsx +34 -8
  24. package/src/Invoice/ui/GoodsList/index.less +41 -33
  25. package/src/Invoice/ui/GoodsList/index.tsx +11 -1
  26. package/src/Invoice/ui/GoodsList/ui/AddRowButton/index.tsx +5 -2
  27. package/src/Invoice/ui/GoodsList/ui/Search/icon/magnifier.svg +1 -0
  28. package/src/Invoice/ui/GoodsList/ui/Search/index.less +10 -0
  29. package/src/Invoice/ui/GoodsList/ui/Search/index.tsx +47 -0
  30. package/docs-dist/404.html +0 -33
  31. package/docs-dist/index.html +0 -33
  32. package/docs-dist/static/auto.a6cd905c.svg +0 -1
  33. package/docs-dist/static/spot.42e620e1.svg +0 -1
  34. package/docs-dist/umi.css +0 -20
  35. package/docs-dist/umi.js +0 -1
package/docs/index.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  npm 地址:https://www.npmjs.com/package/kts-component-invoice-operate
4
4
 
5
- ### 版本 1.2.20
5
+ ### 版本 1.2.23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "1.2.21",
3
+ "version": "1.2.24",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -11,7 +11,7 @@ export default class GoodsListState {
11
11
 
12
12
  /** 产品最大数 */
13
13
  goodMax?: number;
14
-
14
+
15
15
  /** 是否可以切换(含税/不含税)状态 */
16
16
  isSwitchTax?: boolean;
17
17
 
@@ -36,6 +36,9 @@ export default class GoodsListState {
36
36
  /** 税率列表 */
37
37
  taxRateList: number[] = [0, 3, 5, 6, 9, 13];
38
38
 
39
+ /** 搜索条件 */
40
+ searchValue = '';
41
+
39
42
  /** 货物列表 */
40
43
  goodsList: IGood[] = [];
41
44
 
@@ -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
  }
@@ -242,7 +242,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
242
242
  setList([])
243
243
  }
244
244
  }, [visible])
245
-
245
+
246
246
  return (
247
247
  <>
248
248
  <InputAntd readOnly value={props.value} addonAfter={<Button size="small" type="link" onClick={() => { setVisible(true) }} >点击选择</Button>} />
@@ -290,7 +290,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
290
290
  if (!good) return;
291
291
 
292
292
  // const name = getItemName(good.itemName, values.shorthand);
293
-
293
+
294
294
  good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
295
295
  good.taxClassificationCode = values.taxClassificationCode;
296
296
  good.taxRate = values.taxRate;
@@ -301,19 +301,25 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
301
301
  const taxRate = chain(bignumber(values.taxRate)).dotDivide(bignumber(100)).add(bignumber(1)).done();
302
302
 
303
303
  // 是否含税
304
- if (s.goodsListState.isTaxIncluded) {
305
- const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
306
- const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
304
+ const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
305
+ const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
307
306
 
308
- good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
309
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
310
- } else {
311
- const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
312
- const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
307
+ good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
308
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
313
309
 
314
- good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
315
- good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
316
- }
310
+ // if (s.goodsListState.isTaxIncluded) {
311
+ // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
312
+ // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
313
+
314
+ // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
315
+ // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
316
+ // } else {
317
+ // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
318
+ // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
319
+
320
+ // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
321
+ // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
322
+ // }
317
323
 
318
324
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
319
325
  });
@@ -29,6 +29,9 @@ export default (form: WrappedFormUtils) => {
29
29
  /** 正在编辑的货物 */
30
30
  const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
31
31
 
32
+ /** 搜索条件 */
33
+ const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
34
+
32
35
  /** 税率列表 */
33
36
  const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
34
37
 
@@ -94,7 +97,9 @@ export default (form: WrappedFormUtils) => {
94
97
  </Form.Item>
95
98
  );
96
99
  } else {
97
- return <span style={{ padding: '0 10px' }}>{value}</span>;
100
+ return (
101
+ <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>
102
+ );
98
103
  }
99
104
  },
100
105
  },
@@ -119,7 +124,7 @@ export default (form: WrappedFormUtils) => {
119
124
  </Form.Item>
120
125
  );
121
126
  } else {
122
- return <span style={{ padding: '0 10px' }}>{value}</span>;
127
+ return <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>;
123
128
  }
124
129
  },
125
130
  },
@@ -323,7 +328,7 @@ export default (form: WrappedFormUtils) => {
323
328
  </Form.Item>
324
329
  );
325
330
  } else {
326
- return <span style={{ padding: '0 10px' }}>{parseFloat(value).toFixed(2)}</span>;
331
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
327
332
  }
328
333
  },
329
334
  },
@@ -459,7 +464,7 @@ export default (form: WrappedFormUtils) => {
459
464
  ellipsis: true,
460
465
  };
461
466
  }) as any[];
462
- }, [isTaxIncluded, editGood, controller, changeField, deduction]);
467
+ }, [isTaxIncluded, editGood, controller, changeField, deduction, searchValue]);
463
468
 
464
469
  React.useEffect(() => {
465
470
  if (!changeField) return;
@@ -499,3 +504,21 @@ class MyDiv extends React.Component<{ value?: any }> {
499
504
  return <span style={{ padding: '0 10px' }}>{this.props.value}</span>;
500
505
  }
501
506
  }
507
+
508
+ /** 格式搜索结果 */
509
+ function formatSearch(value: string, search: string) {
510
+ if (!value || !search) return value;
511
+
512
+ const __html = ucoding(value).split(new RegExp(ucoding(search), 'g')).map(e => dcoding(e)).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
513
+ return <span dangerouslySetInnerHTML={{ __html }} />
514
+ }
515
+
516
+ /** 编码 */
517
+ function ucoding(v: string): string {
518
+ return v.split('').map(e => `\\U${e.charCodeAt(0)}`).join('');
519
+ }
520
+
521
+ /** 解码 */
522
+ function dcoding(v: string): string {
523
+ return v.split('\\U').map(e => e ? String.fromCharCode(parseInt(e)) : '').join('');
524
+ }
@@ -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) => {
@@ -7,35 +7,37 @@
7
7
  }
8
8
 
9
9
  .kts-invoice-operate-goods-list-able {
10
- display: flex;
11
- padding: 10px;
10
+ display : flex;
11
+ padding : 10px;
12
12
  border-bottom: 1px solid #dcdcdc;
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
- padding-left: 10px;
22
+ padding-left : 10px;
20
23
  padding-right: 10px;
21
24
  border-radius: 12px;
22
- color: #0074ff;
23
- border: 1px solid #0074ff;
24
- margin: 0 10px;
25
- height: 24px;
26
- line-height: 22px;
27
- cursor: pointer;
28
- font-size: 12px;
25
+ color : #0074ff;
26
+ border : 1px solid #0074ff;
27
+ height : 24px;
28
+ line-height : 22px;
29
+ cursor : pointer;
30
+ font-size : 12px;
29
31
  }
30
32
 
31
33
  button[disabled] {
32
- color: rgba(0, 0, 0, 0.25);
34
+ color : rgba(0, 0, 0, 0.25);
33
35
  border: 1px solid;
34
36
  }
35
37
  }
36
38
 
37
39
  .kts-invoice-operate-goods-list-able-extend {
38
- flex: none;
40
+ flex : none;
39
41
  display: flex;
40
42
 
41
43
  label {
@@ -44,9 +46,9 @@
44
46
  }
45
47
  }
46
48
 
47
- .kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab{
48
- .ktsAnt3x-table-row{
49
- color: rgba(0, 0, 0, 0.25);
49
+ .kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab {
50
+ .ktsAnt3x-table-row {
51
+ color : rgba(0, 0, 0, 0.25);
50
52
  background: #f5f5f5;
51
53
  }
52
54
  }
@@ -55,7 +57,7 @@
55
57
  border-bottom: 1px solid #dcdcdc;
56
58
 
57
59
  .kts-invoice-operate-goods-discount {
58
- color: rgba(0, 0, 0, 0.25);
60
+ color : rgba(0, 0, 0, 0.25);
59
61
  background: #f5f5f5;
60
62
  }
61
63
 
@@ -63,15 +65,15 @@
63
65
  display: flex;
64
66
 
65
67
  .ktsAnt3x-btn {
66
- display: block;
67
- line-height: 0;
68
- width: auto;
68
+ display : block;
69
+ line-height : 0;
70
+ width : auto;
69
71
  padding-right: 5px;
70
72
  }
71
73
  }
72
74
 
73
75
  .ktsAnt3x-form-item-children {
74
- height: 30px;
76
+ height : 30px;
75
77
  display: block;
76
78
  }
77
79
 
@@ -81,8 +83,8 @@
81
83
 
82
84
  .ktsAnt3x-form-explain {
83
85
  position: absolute;
84
- right: 6px;
85
- top: 6px;
86
+ right : 6px;
87
+ top : 6px;
86
88
  }
87
89
 
88
90
  table {
@@ -98,7 +100,7 @@
98
100
 
99
101
  .ktsAnt3x-form-item {
100
102
  padding: 0;
101
- margin: 0;
103
+ margin : 0;
102
104
 
103
105
  .ktsAnt3x-form-item-control {
104
106
  line-height: inherit;
@@ -108,22 +110,28 @@
108
110
  .has-error .ktsAnt3x-select-selection,
109
111
  .has-error .ktsAnt3x-input,
110
112
  .has-error .ktsAnt3x-input:hover {
111
- border-right-width: 1px !important;
112
- border-top-width: 1px;
113
- border-left-width: 1px;
113
+ border-right-width : 1px !important;
114
+ border-top-width : 1px;
115
+ border-left-width : 1px;
114
116
  border-bottom-width: 1px;
115
117
  }
116
118
 
117
119
  .ktsAnt3x-select-selection--single,
118
120
  .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,
119
121
  .ktsAnt3x-input {
120
- height: 30px;
121
- border-radius: 0;
122
- border-right-width: 0 !important;
123
- border-top-width: 0;
124
- border-left-width: 0;
122
+ height : 30px;
123
+ border-radius : 0;
124
+ border-right-width : 0 !important;
125
+ border-top-width : 0;
126
+ border-left-width : 0;
125
127
  border-bottom-width: 0;
126
- box-shadow: none;
128
+ box-shadow : none;
127
129
  }
128
130
  }
129
131
  }
132
+
133
+ .kts-invoice-operate-goods-list-table-search-protrude {
134
+ background : #ff0;
135
+ color : #000;
136
+ font-weight: bold;
137
+ }
@@ -10,6 +10,7 @@ import TableVirtual from './ui/TableVirtual';
10
10
  import Statistics from './ui/Statistics';
11
11
  import AddRowButton from './ui/AddRowButton';
12
12
  import TaxIncludedSwitch from './ui/TaxIncludedSwitch';
13
+ import Search from './ui/Search';
13
14
  import TableRow from './ui/TableRow';
14
15
  import AddDiscountRowButton from './ui/AddDiscountRowButton';
15
16
  import EndowCodeButton from './ui/EndowCodeButton';
@@ -56,6 +57,12 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
56
57
 
57
58
  const isprefab = controller.useMemo(s => s.model === 'prefab', []);
58
59
 
60
+ const dataSource = controller.useMemo(s => s.goodsListState.goodsList, [])
61
+
62
+ const searchValue = controller.useMemo(s => s.goodsListState.searchValue, [])
63
+
64
+ const dataSourceSearch = React.useMemo(() => controller.getGoodsSearch(dataSource, searchValue), [dataSource, searchValue, controller])
65
+
59
66
  /** 表格行事件 */
60
67
  const onRow = useOnRow();
61
68
 
@@ -112,6 +119,9 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
112
119
 
113
120
  {/* 批量赋码 */}
114
121
  <EndowCodeButton />
122
+
123
+ {/* 搜索 */}
124
+ <Search />
115
125
  </div>
116
126
  <div className="kts-invoice-operate-goods-list-able-extend">
117
127
 
@@ -130,7 +140,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
130
140
  pagination={false}
131
141
  scroll={{ y: 540 }}
132
142
  components={{ body: { row: TableRow } }}
133
- dataSource={controller.useMemo((s) => s.goodsListState.goodsList, [controller])}
143
+ dataSource={dataSourceSearch}
134
144
  columns={useColumns(props.form)}
135
145
  rowSelection={useRowSelection()}
136
146
  onRow={(record) => ({
@@ -11,13 +11,16 @@ export default () => {
11
11
  /** 产品数据量 */
12
12
  const goodsNum = controller.useMemo(s => s.goodsListState.goodsList.length, []);
13
13
 
14
+ /** 搜索条件 */
15
+ const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
16
+
14
17
  /** 产品最大数 */
15
18
  const goodMax = controller.useMemo(s => s.goodsListState.goodMax, []);
16
19
 
17
20
  /** 按钮是否禁用 */
18
21
  const disabled = React.useMemo(() => {
19
- return typeof goodMax === 'number' ? goodsNum >= goodMax : false;
20
- }, [goodMax, goodsNum])
22
+ return typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue;
23
+ }, [goodMax, goodsNum, searchValue])
21
24
 
22
25
  const onClick = React.useCallback(async () => {
23
26
  await controller.saveEditGood();
@@ -0,0 +1 @@
1
+ <svg t="1656901778998" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9253" width="200" height="200"><path d="M985.781333 918.594133 820.773333 765.5264c27.3728-32.973867 49.6544-69.5776 66.436267-109.258667 22.933333-54.218667 34.561067-111.7952 34.561067-171.1296 0-59.333333-11.627733-116.910933-34.561067-171.1296-22.142933-52.354133-53.837867-99.365333-94.200533-139.729067S705.633067 102.222933 653.28 80.08c-54.218667-22.933333-111.7952-34.561067-171.1296-34.561067S365.240533 57.147733 311.021867 80.08c-52.354133 22.142933-99.365333 53.8368-139.729067 94.200533s-72.0576 87.374933-94.200533 139.729067c-22.932267 54.218667-34.56 111.7952-34.56 171.1296 0 59.3344 11.627733 116.910933 34.56 171.1296 22.144 52.354133 53.837867 99.365333 94.200533 139.729067s87.374933 72.0576 139.729067 94.200533c54.218667 22.932267 111.7952 34.56 171.1296 34.56s116.910933-11.627733 171.1296-34.56c45.352533-19.181867 86.686933-45.543467 123.172267-78.487467L942.256 965.514667c6.16 5.714133 13.966933 8.539733 21.755733 8.539733 8.593067 0 17.163733-3.441067 23.467733-10.237867C999.4976 950.8608 998.738133 930.612267 985.781333 918.594133zM482.151467 860.7584c-207.117867 0-375.620267-168.5024-375.620267-375.620267 0-207.1168 168.5024-375.6192 375.620267-375.6192S857.770667 278.021333 857.770667 485.138133C857.770667 692.256 689.268267 860.7584 482.151467 860.7584z" p-id="9254"></path></svg>
@@ -0,0 +1,10 @@
1
+ .kts-invoice-operate-goods-list-able-list {
2
+ .kts-invoice-operate-goods-list-search {
3
+ width: 330px;
4
+
5
+ input {
6
+ border-radius: 999px;
7
+ border-color : #b8b8b8;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,47 @@
1
+
2
+ import React from "react";
3
+ import { Icon, Input, message } from "kts-components-antd-x3";
4
+ import { ReactComponent as MagnifierSvg } from './icon/magnifier.svg';
5
+ import Invoice from '../../../../';
6
+ import './index.less';
7
+
8
+ export default function Search() {
9
+
10
+ const controller = Invoice.useInvoiceController();
11
+
12
+ const [value, setValue] = React.useState('');
13
+
14
+ const readOnly = controller.useMemo(s => !!s.goodsListState.editGood, [])
15
+
16
+ const onClick = React.useCallback(async () => {
17
+ await controller.saveEditGood();
18
+ await controller.wait();
19
+ if (controller.state.goodsListState.editGood) {
20
+ message.error({
21
+ content: '你正在编辑一个货物',
22
+ key: '你正在编辑一个货物',
23
+ });
24
+ return;
25
+ }
26
+ }, [])
27
+
28
+ React.useEffect(() => {
29
+ controller.run(async s => {
30
+ s.goodsListState.searchValue = value;
31
+ })
32
+ }, [value, controller])
33
+
34
+ return (
35
+ <Input
36
+ size="small"
37
+ readOnly={readOnly}
38
+ value={value}
39
+ className="kts-invoice-operate-goods-list-search"
40
+ placeholder="请您输入货物名称、规格型号、金额(含税)搜索"
41
+ prefix={<Icon component={MagnifierSvg} style={{ color: "#b8b8b8" }} />}
42
+ onChange={e => { setValue(e.target.value); }}
43
+ onClick={onClick}
44
+ />
45
+ )
46
+ }
47
+
@@ -1,33 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
- />
9
- <link rel="stylesheet" href="/docs-dist/umi.css" />
10
- <script>
11
- window.routerBase = "/";
12
- </script>
13
- <script>
14
- //! umi version: 3.5.20
15
- </script>
16
- <script>
17
- !(function () {
18
- var e = localStorage.getItem("dumi:prefers-color"),
19
- t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
- r = ["light", "dark", "auto"];
21
- document.documentElement.setAttribute(
22
- "data-prefers-color",
23
- e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
- );
25
- })();
26
- </script>
27
- </head>
28
- <body>
29
- <div id="root"></div>
30
-
31
- <script src="/docs-dist/umi.js"></script>
32
- </body>
33
- </html>
@@ -1,33 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
- />
9
- <link rel="stylesheet" href="/docs-dist/umi.css" />
10
- <script>
11
- window.routerBase = "/";
12
- </script>
13
- <script>
14
- //! umi version: 3.5.20
15
- </script>
16
- <script>
17
- !(function () {
18
- var e = localStorage.getItem("dumi:prefers-color"),
19
- t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
- r = ["light", "dark", "auto"];
21
- document.documentElement.setAttribute(
22
- "data-prefers-color",
23
- e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
- );
25
- })();
26
- </script>
27
- </head>
28
- <body>
29
- <div id="root"></div>
30
-
31
- <script src="/docs-dist/umi.js"></script>
32
- </body>
33
- </html>
@@ -1 +0,0 @@
1
- <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1586510245354" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4976" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M510.677 83.529c60.891 0 119.75 13.191 174.046 38.055l-40.087 70.028 202.97-1.016-101.99-175.063-35.52 61.909c-61.908-29.433-129.903-44.657-199.419-44.657-257.266 0-466.833 209.566-466.833 466.833 0 93.368 27.4 183.69 79.668 261.326l42.116-28.415c-46.684-69.012-71.039-149.183-71.039-232.91 0-229.355 186.729-416.09 416.088-416.09z m425.225 223.774l-46.175 20.802c24.356 53.788 37.039 111.637 37.039 171.512 0 229.358-186.73 416.089-416.089 416.089-46.684 0-92.351-7.608-135.99-22.832l34-65.968-202.468 10.148 110.116 170.5 35.52-69.012c50.738 18.777 104.526 27.908 159.33 27.908 257.265 0 466.832-209.567 466.832-466.833-0.507-66.98-14.715-131.93-42.115-192.314z m0 0" p-id="4977"></path><path d="M317.096 1023.06L192.387 829.965 421.78 818.47l-36.039 69.924c40.06 12.971 82.045 19.543 124.936 19.543 225.147 0 408.317-183.17 408.317-408.317 0-58.417-12.23-115.043-36.348-168.305l-3.212-7.094 60.343-27.186 3.203 7.059c27.889 61.462 42.292 127.226 42.81 195.467 0 261.757-212.908 474.664-474.606 474.664-54.211 0-106.5-8.76-155.546-26.05l-38.54 74.885zM220.05 844.143l95.524 147.906 32.521-63.187 6.458 2.39c49.176 18.198 101.874 27.425 156.632 27.425 253.126 0 459.06-205.933 459.06-459.06-0.48-63.377-13.353-124.59-38.275-182.018l-32.013 14.422c22.95 53.205 34.582 109.55 34.582 167.595 0 233.719-190.143 423.862-423.862 423.862-47.682 0-94.297-7.828-138.55-23.266l-8.448-2.948 31.914-61.92-175.543 8.8z m-98.64-72.405l-4.345-6.455C64.08 686.583 36.071 594.717 36.071 499.617c0-261.698 212.907-474.605 474.605-474.605 68.724 0 134.705 14.25 196.232 42.368L745.564 0.005 861.09 198.301l-229.898 1.151 42.514-74.27c-51.835-22.486-106.64-33.88-163.03-33.88-225.147 0-408.317 183.17-408.317 408.316 0 82.11 24.104 161.145 69.705 228.556l4.36 6.445-55.014 37.12zM510.677 40.557c-253.126 0-459.06 205.934-459.06 459.06 0 89.396 25.578 175.828 74.053 250.495l29.221-19.715c-44.563-68.554-68.074-148.169-68.074-230.78 0-233.717 190.143-423.861 423.861-423.861 61.471 0 121.117 13.04 177.283 38.76l7.738 3.543-37.618 65.714 176.044-0.882-88.458-151.83-32.41 56.489-6.498-3.09C645.482 55.329 579.51 40.558 510.677 40.558z" p-id="4978"></path><path d="M320.113 320.409h383.973v63.55H320.113z m0.184 127.952H704.27v63.55H320.297z m-0.184 127.803h383.973v63.55H320.113z" p-id="4979"></path></svg>
@@ -1 +0,0 @@
1
- <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574652728953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4119" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M512 512m-96 0a1.5 1.5 0 1 0 192 0 1.5 1.5 0 1 0-192 0Z" p-id="4120"></path><path d="M512 96.64m-96 0a1.5 1.5 0 1 0 192 0 1.5 1.5 0 1 0-192 0Z" p-id="4121"></path><path d="M512 927.36m-96 0a1.5 1.5 0 1 0 192 0 1.5 1.5 0 1 0-192 0Z" p-id="4122"></path></svg>