kts-component-invoice-operate 1.2.22 → 2.0.0

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 (76) hide show
  1. package/d.dio +2 -69
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.d.ts → EndowCode/index.d.ts} +2 -2
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.d.ts → IGood/index.d.ts} +15 -5
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.d.ts → ImportGoods/index.d.ts} +0 -0
  5. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.d.ts → LineAttributeType/index.d.ts} +0 -0
  6. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.d.ts +7 -0
  7. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +7 -0
  8. package/dist/Invoice/_test/buyerNameSearch/index.d.ts +1 -0
  9. package/dist/Invoice/_test/deduction/index.d.ts +1 -0
  10. package/dist/Invoice/_test/draft/index.d.ts +1 -0
  11. package/dist/Invoice/_test/easiest/index.d.ts +1 -0
  12. package/dist/Invoice/_test/endowCode/index.d.ts +1 -0
  13. package/dist/Invoice/_test/goodsMenuExpand/index.d.ts +1 -0
  14. package/dist/Invoice/_test/importBuyer/index.d.ts +1 -0
  15. package/dist/Invoice/_test/importGoods/index.d.ts +1 -0
  16. package/dist/Invoice/_test/invoiceType/index.d.ts +1 -0
  17. package/dist/Invoice/_test/isInvoiceNo/index.d.ts +1 -0
  18. package/dist/Invoice/_test/replaceHead/index.d.ts +1 -0
  19. package/dist/Invoice/_test/retrieveData/index.d.ts +1 -0
  20. package/dist/Invoice/_test/seller/index.d.ts +1 -0
  21. package/dist/Invoice/_test/setDataSource/index.d.ts +1 -0
  22. package/dist/Invoice/_test/unit/index.d.ts +1 -0
  23. package/dist/Invoice/index.d.ts +1 -1
  24. package/dist/Invoice/tools/itemName/index.d.ts +14 -0
  25. package/dist/Invoice/ui/AddComparisonDrawer/index.d.ts +3 -0
  26. package/dist/Invoice/ui/Buyer/ui/BuyerNameInput/index.d.ts +1 -0
  27. package/dist/Invoice/ui/Buyer/ui/ImportBuyerButton/index.d.ts +1 -0
  28. package/dist/Invoice/ui/EndowCodeDrawer/index.d.ts +1 -0
  29. package/dist/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
  30. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowEditButton/index.d.ts +1 -0
  31. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +5 -0
  32. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +1 -0
  33. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +1 -0
  34. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +1 -0
  35. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.d.ts +1 -0
  36. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowSaveButton/index.d.ts +1 -0
  37. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -0
  38. package/dist/Invoice/ui/GoodsList/ui/AddRowButton/index.d.ts +1 -0
  39. package/dist/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.d.ts +3 -0
  40. package/dist/Invoice/ui/GoodsList/ui/DelRowButton/index.d.ts +1 -0
  41. package/dist/Invoice/ui/GoodsList/ui/DescribeSwitch/index.d.ts +3 -0
  42. package/dist/Invoice/ui/GoodsList/ui/EndowCodeButton/index.d.ts +1 -0
  43. package/dist/Invoice/ui/GoodsList/ui/Statistics/index.d.ts +1 -0
  44. package/dist/Invoice/ui/GoodsList/ui/TableRow/index.d.ts +1 -0
  45. package/dist/Invoice/ui/GoodsList/ui/TableVirtual/index.d.ts +1 -0
  46. package/dist/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -0
  47. package/dist/Invoice/ui/ImportBuyerDrawer/index.d.ts +1 -0
  48. package/dist/Invoice/ui/ImportGoodsDrawer/index.d.ts +1 -0
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.esm.js +1044 -267
  51. package/dist/index.js +1043 -266
  52. package/docs/index.md +1 -1
  53. package/package.json +4 -1
  54. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{EndowCode.tsx → EndowCode/index.tsx} +3 -3
  55. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{IGood.ts → IGood/index.ts} +20 -5
  56. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{ImportGoods.ts → ImportGoods/index.ts} +0 -0
  57. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/{LineAttributeType.ts → LineAttributeType/index.ts} +0 -0
  58. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +10 -0
  59. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +11 -1
  60. package/src/Invoice/_test/importGoods/index.tsx +21 -3
  61. package/src/Invoice/index.tsx +5 -1
  62. package/src/Invoice/tools/itemName/index.ts +48 -0
  63. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +179 -0
  64. package/src/Invoice/ui/EndowCodeDrawer/index.tsx +6 -17
  65. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +15 -0
  66. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +71 -29
  67. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.tsx +39 -0
  68. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.tsx +5 -2
  69. package/src/Invoice/ui/GoodsList/index.less +34 -37
  70. package/src/Invoice/ui/GoodsList/index.tsx +8 -0
  71. package/src/Invoice/ui/GoodsList/ui/CommodityComparisonButton/index.tsx +74 -0
  72. package/src/Invoice/ui/GoodsList/ui/DescribeSwitch/index.tsx +37 -0
  73. package/src/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -2
  74. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +70 -18
  75. package/src/index.ts +1 -0
  76. package/yarn.o.lock +14800 -0
@@ -14,6 +14,7 @@ import {
14
14
  onChangeTaxRate,
15
15
  onSaveEditGood,
16
16
  endowCode,
17
+ onChangeItemName,
17
18
  } from './autoFillFn';
18
19
 
19
20
  const { Text } = Typography;
@@ -26,6 +27,9 @@ export default (form: WrappedFormUtils) => {
26
27
  /** 是否含税 */
27
28
  const isTaxIncluded = controller.useMemo(e => e.goodsListState.isTaxIncluded, []);
28
29
 
30
+ /** 是否显示我方 */
31
+ const isMyShow = controller.useMemo(e => e.goodsListState.isMyShow, []);
32
+
29
33
  /** 正在编辑的货物 */
30
34
  const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
31
35
 
@@ -50,21 +54,30 @@ export default (form: WrappedFormUtils) => {
50
54
  <Text type="danger">*</Text>货物名称
51
55
  </>
52
56
  ),
53
- dataIndex: 'itemName',
54
57
  key: 'itemName',
55
- render: (value: string, record: IGood) => {
58
+ render: (_: string, record: IGood) => {
56
59
  if (editGood?.$index === record.$index) {
57
60
  return (
58
61
  <Form.Item>
59
62
  <div style={{ display: 'flex' }} >
60
63
  {getFieldDecorator('itemName', {
61
- initialValue: editGood.itemName,
62
- rules: [{ required: true, message: '货物名称不能为空' }],
64
+ initialValue: isMyShow ? record.itemName : record.itemNameOther,
65
+ rules: [{
66
+ validator: async (_, __, callback) => {
67
+ await controller.wait();
68
+ const value = controller.state.goodsListState.editGood;
69
+ if (!value?.itemName && !value?.itemNameOther) {
70
+ callback('货物名称不能为空');
71
+ } else {
72
+ return;
73
+ }
74
+ }
75
+ }]
63
76
  })(
64
77
  <MyInput
65
78
  style={{ flex: 1 }}
66
79
  onChange={() => {
67
- onSaveEditGood(controller, form, record, 'itemName');
80
+ onChangeItemName(controller, form, record);
68
81
  }}
69
82
  />,
70
83
  )}
@@ -80,11 +93,9 @@ export default (form: WrappedFormUtils) => {
80
93
  )}
81
94
  {controller.getGoodsList && (
82
95
  <Button
83
- onClick={() => {
84
- controller.pipeline(async (s) => {
85
- s.goodsListState.importGoods.isVisibleDrawer = true;
86
- })();
87
- }}
96
+ onClick={controller.pipeline(async (s) => {
97
+ s.goodsListState.importGoods.isVisibleDrawer = true;
98
+ })}
88
99
  type="link"
89
100
  icon="plus-circle"
90
101
  />
@@ -94,41 +105,43 @@ export default (form: WrappedFormUtils) => {
94
105
  </Form.Item>
95
106
  );
96
107
  } else {
97
- return <span style={{ padding: '0 10px' }}>{value}</span>;
108
+ return <MyItemNameDiv valueT={record.itemName} valueF={record.itemNameOther} isMyShow={isMyShow} />
98
109
  }
99
110
  },
100
111
  },
101
112
  {
102
113
  title: '货物规格型号',
103
- dataIndex: 'itemModelName',
104
114
  key: 'itemModelName',
105
115
  width: 119,
106
- render: (value: string, record: IGood) => {
116
+ render: (_: string, record: IGood) => {
107
117
  if (editGood?.$index === record.$index) {
108
118
  return (
109
119
  <Form.Item>
110
120
  {getFieldDecorator('itemModelName', {
111
- initialValue: editGood.itemModelName,
121
+ initialValue: isMyShow ? editGood.itemModelName : editGood.itemModelNameOther,
112
122
  })(
113
123
  <MyInput
114
- onChange={() => {
115
- onSaveEditGood(controller, form, record, 'itemModelName');
124
+ onChange={async () => {
125
+ await controller.wait()
126
+ const key = isMyShow ? 'itemModelName' : 'itemModelNameOther';
127
+ const value = {} as any;
128
+ value[key] = form.getFieldsValue().itemModelName;
129
+ controller.setEditGood(value);
116
130
  }}
117
131
  />,
118
132
  )}
119
133
  </Form.Item>
120
134
  );
121
135
  } else {
122
- return <span style={{ padding: '0 10px' }}>{value}</span>;
136
+ return <MyItemNameDiv valueT={record.itemModelName} valueF={record.itemModelNameOther} isMyShow={isMyShow} />
123
137
  }
124
138
  },
125
139
  },
126
140
  {
127
141
  title: '单位',
128
- dataIndex: 'unit',
129
142
  key: 'unit',
130
143
  width: 70,
131
- render: (value: string, record: IGood) => {
144
+ render: (_: string, record: IGood) => {
132
145
  if (editGood?.$index === record.$index) {
133
146
  return (
134
147
  <Form.Item>
@@ -138,15 +151,19 @@ export default (form: WrappedFormUtils) => {
138
151
  <AutoComplete
139
152
  style={{ width: '100%' }}
140
153
  dataSource={unitList}
141
- onChange={() => {
142
- onSaveEditGood(controller, form, record, 'unit');
154
+ onChange={async () => {
155
+ await controller.wait()
156
+ const key = isMyShow ? 'unit' : 'unitOther';
157
+ const value = {} as any;
158
+ value[key] = form.getFieldsValue().unit;
159
+ controller.setEditGood(value);
143
160
  }}
144
161
  />,
145
162
  )}
146
163
  </Form.Item>
147
164
  );
148
165
  } else {
149
- return <span style={{ padding: '0 10px' }}>{value}</span>;
166
+ return <MyItemNameDiv valueT={record.unit} valueF={record.unitOther} isMyShow={isMyShow} />;
150
167
  }
151
168
  },
152
169
  },
@@ -444,13 +461,9 @@ export default (form: WrappedFormUtils) => {
444
461
  ]
445
462
  .filter((e) => {
446
463
  if (isTaxIncluded) {
447
- return !(
448
- e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax'
449
- );
464
+ return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
450
465
  } else {
451
- return !(
452
- e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax'
453
- );
466
+ return !(e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax');
454
467
  }
455
468
  })
456
469
  .map((e) => {
@@ -459,7 +472,7 @@ export default (form: WrappedFormUtils) => {
459
472
  ellipsis: true,
460
473
  };
461
474
  }) as any[];
462
- }, [isTaxIncluded, editGood, controller, changeField, deduction]);
475
+ }, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow]);
463
476
 
464
477
  React.useEffect(() => {
465
478
  if (!changeField) return;
@@ -499,3 +512,32 @@ class MyDiv extends React.Component<{ value?: any }> {
499
512
  return <span style={{ padding: '0 10px' }}>{this.props.value}</span>;
500
513
  }
501
514
  }
515
+
516
+ class MyItemNameDiv extends React.Component<{ valueT?: string, valueF?: string, isMyShow: boolean }> {
517
+ render(): React.ReactNode {
518
+
519
+ const { isMyShow, valueT, valueF } = this.props;
520
+
521
+ if (isMyShow) {
522
+ if (valueT) {
523
+ return (
524
+ <span style={{ padding: '0 10px', color: '#0074ff' }}>{valueT}</span>
525
+ )
526
+ } else {
527
+ return (
528
+ <span style={{ padding: '0 10px' }}>{valueF}</span>
529
+ )
530
+ }
531
+ } else {
532
+ if (valueF) {
533
+ return (
534
+ <span style={{ padding: '0 10px' }}>{valueF}</span>
535
+ )
536
+ } else {
537
+ return (
538
+ <span style={{ padding: '0 10px', color: '#0074ff' }}>{valueT}</span>
539
+ )
540
+ }
541
+ }
542
+ }
543
+ }
@@ -0,0 +1,39 @@
1
+ /** 添加商品对照 */
2
+
3
+ import React from 'react';
4
+ import { Menu, message, Typography } from 'kts-components-antd-x3';
5
+ import { IGood } from '../../../../../../../../InvoiceController';
6
+ import Invoice from '../../../../../../../../';
7
+
8
+ const { Text } = Typography;
9
+
10
+ export default (goods: IGood) => {
11
+
12
+ const controller = Invoice.useInvoiceController();
13
+
14
+ const productComparison = controller.useMemo(s => s.goodsListState.productComparison, []);
15
+
16
+ const onClick = React.useCallback(async () => {
17
+ await controller.saveEditGood();
18
+ await controller.wait();
19
+ await controller.run(async s => {
20
+ if (s.goodsListState.form) {
21
+ const err: any = s.goodsListState.form.getFieldsError();
22
+ for (let key in err) {
23
+ if (!err[key]) continue;
24
+ message.error(err[key][0]);
25
+ return;
26
+ }
27
+ }
28
+ s.goodsListState.addComparisonIndex = goods.$index;
29
+ })
30
+ }, [controller, goods.$index]);
31
+
32
+ return React.useMemo(() => {
33
+ if (productComparison.onComply) {
34
+ return <Menu.Item key="delItem" onClick={onClick}><Text strong>添加商品对照</Text></Menu.Item>
35
+ } else {
36
+ return <></>
37
+ }
38
+ }, [onClick, productComparison])
39
+ };
@@ -5,6 +5,7 @@ import { ReactComponent as SpotSvg } from './spot.svg';
5
5
  import useDelItem from './hook/useDelItem';
6
6
  import useAddDiscount from './hook/useAddDiscount';
7
7
  import useEndowCode from './hook/useEndowCode';
8
+ import useAddComparison from './hook/useAddComparison';
8
9
  import './index.less';
9
10
  import Invoice from '../../../../../../';
10
11
 
@@ -22,13 +23,15 @@ export default (props: { goods: IGood }) => {
22
23
  const delItem = useDelItem(props.goods);
23
24
  const addDiscount = useAddDiscount(props.goods);
24
25
  const endowCode = useEndowCode(props.goods);
26
+ const addComparison = useAddComparison(props.goods);
25
27
 
26
28
  const itemList = React.useMemo(() => {
27
29
  const arr: any[] = [];
28
30
 
29
31
  model !=='prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
30
- endowCode && arr.push(endowCode); // 赋码
31
- model !=='prefab' && delItem && arr.push(delItem); // 删除
32
+ arr.push(addComparison); // 添加商品对照
33
+ endowCode && arr.push(endowCode); // 赋码
34
+ model !=='prefab' && delItem && arr.push(delItem); // 删除
32
35
 
33
36
  if (!goodsMenuExpand || goodsMenuExpand.length === 0) return arr;
34
37
 
@@ -7,8 +7,8 @@
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
 
@@ -16,37 +16,34 @@
16
16
  flex: 1;
17
17
 
18
18
  button {
19
- padding-left: 10px;
19
+ padding-left : 10px;
20
20
  padding-right: 10px;
21
21
  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;
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;
29
29
  }
30
30
 
31
31
  button[disabled] {
32
- color: rgba(0, 0, 0, 0.25);
32
+ color : rgba(0, 0, 0, 0.25);
33
33
  border: 1px solid;
34
34
  }
35
35
  }
36
36
 
37
37
  .kts-invoice-operate-goods-list-able-extend {
38
- flex: none;
38
+ flex : none;
39
39
  display: flex;
40
-
41
- label {
42
- margin-right: 5px;
43
- }
40
+ gap : 5px;
44
41
  }
45
42
  }
46
43
 
47
- .kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab{
48
- .ktsAnt3x-table-row{
49
- color: rgba(0, 0, 0, 0.25);
44
+ .kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab {
45
+ .ktsAnt3x-table-row {
46
+ color : rgba(0, 0, 0, 0.25);
50
47
  background: #f5f5f5;
51
48
  }
52
49
  }
@@ -55,7 +52,7 @@
55
52
  border-bottom: 1px solid #dcdcdc;
56
53
 
57
54
  .kts-invoice-operate-goods-discount {
58
- color: rgba(0, 0, 0, 0.25);
55
+ color : rgba(0, 0, 0, 0.25);
59
56
  background: #f5f5f5;
60
57
  }
61
58
 
@@ -63,15 +60,15 @@
63
60
  display: flex;
64
61
 
65
62
  .ktsAnt3x-btn {
66
- display: block;
67
- line-height: 0;
68
- width: auto;
63
+ display : block;
64
+ line-height : 0;
65
+ width : auto;
69
66
  padding-right: 5px;
70
67
  }
71
68
  }
72
69
 
73
70
  .ktsAnt3x-form-item-children {
74
- height: 30px;
71
+ height : 30px;
75
72
  display: block;
76
73
  }
77
74
 
@@ -81,8 +78,8 @@
81
78
 
82
79
  .ktsAnt3x-form-explain {
83
80
  position: absolute;
84
- right: 6px;
85
- top: 6px;
81
+ right : 6px;
82
+ top : 6px;
86
83
  }
87
84
 
88
85
  table {
@@ -98,7 +95,7 @@
98
95
 
99
96
  .ktsAnt3x-form-item {
100
97
  padding: 0;
101
- margin: 0;
98
+ margin : 0;
102
99
 
103
100
  .ktsAnt3x-form-item-control {
104
101
  line-height: inherit;
@@ -108,22 +105,22 @@
108
105
  .has-error .ktsAnt3x-select-selection,
109
106
  .has-error .ktsAnt3x-input,
110
107
  .has-error .ktsAnt3x-input:hover {
111
- border-right-width: 1px !important;
112
- border-top-width: 1px;
113
- border-left-width: 1px;
108
+ border-right-width : 1px !important;
109
+ border-top-width : 1px;
110
+ border-left-width : 1px;
114
111
  border-bottom-width: 1px;
115
112
  }
116
113
 
117
114
  .ktsAnt3x-select-selection--single,
118
115
  .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,
119
116
  .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;
117
+ height : 30px;
118
+ border-radius : 0;
119
+ border-right-width : 0 !important;
120
+ border-top-width : 0;
121
+ border-left-width : 0;
125
122
  border-bottom-width: 0;
126
- box-shadow: none;
123
+ box-shadow : none;
127
124
  }
128
125
  }
129
- }
126
+ }
@@ -10,10 +10,12 @@ 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 DescribeSwitch from './ui/DescribeSwitch';
13
14
  import TableRow from './ui/TableRow';
14
15
  import AddDiscountRowButton from './ui/AddDiscountRowButton';
15
16
  import EndowCodeButton from './ui/EndowCodeButton';
16
17
  import DelRowButton from './ui/DelRowButton';
18
+ import CommodityComparisonButton from './ui/CommodityComparisonButton';
17
19
 
18
20
  import useColumns from './hook/useColumns';
19
21
  import useOnRow from './hook/useOnRow';
@@ -112,12 +114,18 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
112
114
 
113
115
  {/* 批量赋码 */}
114
116
  <EndowCodeButton />
117
+
118
+ {/* 执行商品对照 */}
119
+ <CommodityComparisonButton/>
115
120
  </div>
116
121
  <div className="kts-invoice-operate-goods-list-able-extend">
117
122
 
118
123
  {/* 扩展部分 */}
119
124
  {props.menuExpansion}
120
125
 
126
+ {/* 使用哪方商品描述 */}
127
+ <DescribeSwitch />
128
+
121
129
  {/* 是否含税开关 */}
122
130
  <TaxIncludedSwitch />
123
131
  </div>
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { Button, message } from 'kts-components-antd-x3';
3
+ import coolingFn from '../../../../tools/coolingFn'
4
+ import { getSN, setShorthand } from '../../../../tools/itemName'
5
+ import { Invoice, IGood } from '../../../../../';
6
+
7
+ export default () => {
8
+
9
+ const controller = Invoice.useInvoiceController();
10
+
11
+ const { onComply } = controller.useMemo(s => s.goodsListState.productComparison, [])
12
+
13
+ /** 是否禁用 */
14
+ const disabled = controller.useMemo((s) => {
15
+ if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
16
+ }, []);
17
+
18
+ /** 点击了 */
19
+ const onClick = React.useCallback(async () => {
20
+ await controller.saveEditGood();
21
+ await controller.wait();
22
+ await controller.run(async s => {
23
+
24
+ // 不能给正在编辑的货物对照
25
+ if (s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0) {
26
+ coolingFn('不能给正在编辑的货物执行商品对照', 3000, () => { message.error('不能给正在编辑的货物执行商品对照') });
27
+ return;
28
+ }
29
+
30
+ if (!s.goodsListState?.productComparison?.onComply) return;
31
+
32
+ const goods = s.goodsListState.selectedGoodIndex.map(e => {
33
+ const t = s.goodsListState.goodsMap.get(e);
34
+ if (!t) return undefined;
35
+
36
+ return {
37
+ ...t,
38
+ itemName: getSN(t.itemName)?.full,
39
+ itemNameOther: getSN(t.itemNameOther)?.full,
40
+ } as IGood
41
+ }).filter(e => !!e) as IGood[]
42
+
43
+
44
+ // 比对后的商品
45
+ const newGoods = await s.goodsListState.productComparison.onComply(goods);
46
+
47
+ newGoods.filter(e => {
48
+ const vt = s.goodsListState.goodsMap.get(e.$index);
49
+ if (!vt) return undefined;
50
+
51
+ vt.itemName = e.itemName ? setShorthand(e.itemName, getSN(vt.itemName)?.shorthand) : vt.itemName;
52
+ vt.itemNameOther = e.itemNameOther ? setShorthand(e.itemNameOther, getSN(vt.itemNameOther)?.shorthand) : vt.itemNameOther;
53
+
54
+ vt.unit = e.unit ? e.unit : vt.unit;
55
+ vt.unitOther = e.unitOther ? e.unitOther : vt.unitOther;
56
+
57
+ vt.itemModelName = e.itemModelName ? e.itemModelName : vt.itemModelName;
58
+ vt.itemModelNameOther = e.itemModelNameOther ? e.itemModelNameOther : vt.itemModelNameOther;
59
+
60
+ vt.itemCode = e.itemCode ? e.itemCode : vt.itemCode;
61
+ vt.itemCodeOther = e.itemCodeOther ? e.itemCodeOther : vt.itemCodeOther;
62
+ })
63
+ })
64
+ }, [])
65
+
66
+ // 没用 执行商品对照 的方法 不显示按钮
67
+ if (!onComply) return <></>;
68
+
69
+ return (
70
+ <Button icon='swap' disabled={disabled} onClick={onClick} >
71
+ 执行商品对照
72
+ </Button>
73
+ );
74
+ };
@@ -0,0 +1,37 @@
1
+
2
+ import React from 'react';
3
+ import { Switch, Icon, Tooltip } from 'kts-components-antd-x3';
4
+ import Invoice from '../../../../';
5
+
6
+ export default () => {
7
+
8
+ const controller = Invoice.useInvoiceController();
9
+
10
+ const productComparison = controller.useMemo(s => s.goodsListState.productComparison, [])
11
+
12
+ const isMyShow = controller.useMemo(s => s.goodsListState.isMyShow, []);
13
+
14
+ const onChange = React.useCallback(e => {
15
+ controller.run(async s => s.goodsListState.isMyShow = !s.goodsListState.isMyShow)
16
+ }, [])
17
+
18
+ if (!productComparison.onComply) return <></>;
19
+
20
+ return (
21
+ <span>
22
+ <label style={{ marginRight: 2 }} >
23
+ <Tooltip title="蓝色代表我方商品描述,黑色代表对方的商品描述。">
24
+ <Icon style={{ marginRight: 3 }} type="info-circle" />
25
+ </Tooltip>
26
+ 使用哪方商品描述:
27
+ </label>
28
+ <Switch
29
+ checked={isMyShow}
30
+ checkedChildren="我方"
31
+ unCheckedChildren="对方"
32
+ defaultChecked
33
+ onChange={onChange}
34
+ />
35
+ </span>
36
+ )
37
+ }
@@ -14,12 +14,12 @@ export default () => {
14
14
  const isSwitchTax = controller.useMemo(e => e.goodsListState.isSwitchTax, []);
15
15
 
16
16
  const onChange = React.useCallback(e => {
17
- controller.pipeline(async s => { s.goodsListState = { ...s.goodsListState, isTaxIncluded: e } })()
17
+ controller.pipeline(async s => { s.goodsListState = { ...s.goodsListState, isTaxIncluded: e } })();
18
18
  }, [])
19
19
 
20
20
  return (
21
21
  <span>
22
- <label>含税:</label>
22
+ <label style={{ marginRight: 2 }}>含税:</label>
23
23
  <Switch
24
24
  disabled={isSwitchTax === false}
25
25
  checked={isTaxIncluded}