kts-component-invoice-operate 2.0.1 → 2.0.4

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 (63) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +10 -12
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.d.ts +0 -2
  3. package/dist/Invoice/_test/buyerNameSearch/index.d.ts +1 -0
  4. package/dist/Invoice/_test/deduction/index.d.ts +1 -0
  5. package/dist/Invoice/_test/draft/index.d.ts +1 -0
  6. package/dist/Invoice/_test/easiest/index.d.ts +1 -0
  7. package/dist/Invoice/_test/endowCode/index.d.ts +1 -0
  8. package/dist/Invoice/_test/goodsMenuExpand/index.d.ts +1 -0
  9. package/dist/Invoice/_test/importBuyer/index.d.ts +1 -0
  10. package/dist/Invoice/_test/importGoods/index.d.ts +1 -0
  11. package/dist/Invoice/_test/invoiceType/index.d.ts +1 -0
  12. package/dist/Invoice/_test/isInvoiceNo/index.d.ts +1 -0
  13. package/dist/Invoice/_test/replaceHead/index.d.ts +1 -0
  14. package/dist/Invoice/_test/retrieveData/index.d.ts +1 -0
  15. package/dist/Invoice/_test/seller/index.d.ts +1 -0
  16. package/dist/Invoice/_test/setDataSource/index.d.ts +1 -0
  17. package/dist/Invoice/_test/unit/index.d.ts +1 -0
  18. package/dist/Invoice/ui/AddComparisonDrawer/index.d.ts +2 -3
  19. package/dist/Invoice/ui/Buyer/ui/BuyerNameInput/index.d.ts +1 -0
  20. package/dist/Invoice/ui/Buyer/ui/ImportBuyerButton/index.d.ts +1 -0
  21. package/dist/Invoice/ui/EndowCodeDrawer/index.d.ts +1 -0
  22. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowEditButton/index.d.ts +1 -0
  23. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddComparison/index.d.ts +1 -0
  24. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +1 -0
  25. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.d.ts +1 -0
  26. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.d.ts +1 -0
  27. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/index.d.ts +1 -0
  28. package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowSaveButton/index.d.ts +1 -0
  29. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -0
  30. package/dist/Invoice/ui/GoodsList/ui/AddRowButton/index.d.ts +1 -0
  31. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.d.ts +1 -0
  32. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.d.ts +1 -0
  33. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +1 -0
  34. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useEndowCodeButton/index.d.ts +1 -0
  35. package/dist/Invoice/ui/GoodsList/ui/BulkMenu/index.d.ts +1 -0
  36. package/dist/Invoice/ui/GoodsList/ui/DescribeSwitch/index.d.ts +1 -0
  37. package/dist/Invoice/ui/GoodsList/ui/Search/index.d.ts +1 -0
  38. package/dist/Invoice/ui/GoodsList/ui/Statistics/index.d.ts +1 -0
  39. package/dist/Invoice/ui/GoodsList/ui/TableRow/index.d.ts +1 -0
  40. package/dist/Invoice/ui/GoodsList/ui/TableVirtual/index.d.ts +1 -0
  41. package/dist/Invoice/ui/GoodsList/ui/TaxIncludedSwitch/index.d.ts +1 -0
  42. package/dist/Invoice/ui/ImportBuyerDrawer/index.d.ts +1 -0
  43. package/dist/Invoice/ui/ImportGoodsDrawer/index.d.ts +1 -0
  44. package/dist/index.esm.js +136 -169
  45. package/dist/index.js +136 -169
  46. package/docs-dist/404.html +33 -0
  47. package/docs-dist/index.html +33 -0
  48. package/docs-dist/static/auto.a6cd905c.svg +1 -0
  49. package/docs-dist/static/magnifier.2b26be6e.svg +1 -0
  50. package/docs-dist/static/spot.42e620e1.svg +1 -0
  51. package/docs-dist/umi.css +21 -0
  52. package/docs-dist/umi.js +1 -0
  53. package/package.json +3 -1
  54. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +10 -13
  55. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/ProductComparison/index.ts +1 -1
  56. package/src/Invoice/_test/importGoods/index.tsx +3 -4
  57. package/src/Invoice/tools/itemName/index.ts +0 -1
  58. package/src/Invoice/ui/AddComparisonDrawer/index.tsx +73 -113
  59. package/src/Invoice/ui/EndowCodeDrawer/index.tsx +1 -1
  60. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +5 -4
  61. package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +36 -16
  62. package/src/Invoice/ui/GoodsList/ui/BulkMenu/hooks/useCommodityComparisonButton/index.tsx +8 -13
  63. package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -30,6 +30,8 @@
30
30
  "classnames": "^2.3.1",
31
31
  "grey-react-box": "^0.2.20",
32
32
  "kts-components-antd-x3": "^3.26.20-5",
33
+ "kts-components-antd-x4": "^4.0.3",
34
+ "kts-xui": "^1.0.30",
33
35
  "mathjs": "^9.4.2",
34
36
  "next": "^11.0.1",
35
37
  "nzh": "^1.0.4",
@@ -10,29 +10,26 @@ export default interface IGood {
10
10
  /** 发票ID */
11
11
  id?: string;
12
12
 
13
- /** 商品编码(我方) */
13
+ /** 商品编码(对方-购买方) */
14
14
  itemCode?: string;
15
15
 
16
- /** 货物名称(我方) */
16
+ /** 货物名称(对方-购买方) */
17
17
  itemName?: string;
18
18
 
19
- /** 单位(我方) */
19
+ /** 单位(对方-购买方) */
20
20
  unit?: string;
21
21
 
22
- /** 货物规格型号(我方) */
22
+ /** 货物规格型号(对方-购买方) */
23
23
  itemModelName?: string;
24
24
 
25
- /** 商品编码(对方) */
26
- itemCodeOther?: string;
25
+ /** 商品编码(我方-销售) */
26
+ itemCodeSelf?: string;
27
27
 
28
- /** 货物名称(对方) */
29
- itemNameOther?: string;
28
+ /** 货物名称(我方-销售) */
29
+ itemNameSelf?: string;
30
30
 
31
- /** 单位(对方) */
32
- unitOther?: string;
33
-
34
- /** 货物规格型号(对方) */
35
- itemModelNameOther?: string;
31
+ /** 货物规格型号(我方-销售) */
32
+ itemModelNameSelf?: string;
36
33
 
37
34
  /** 数量 */
38
35
  quantity?: number;
@@ -6,5 +6,5 @@ export default class ProductComparison {
6
6
  onComply?: (e: IGood[]) => Promise<IGood[]>
7
7
 
8
8
  /** 更新对照表 */
9
- onUpdateComparisonTable?: (e: IGood, values:any) => Promise<void>
9
+ // onUpdateComparisonTable?: (e: IGood, values:any) => Promise<void>
10
10
  }
@@ -40,10 +40,9 @@ class MyInvoiceController extends InvoiceController {
40
40
  return e.map(e => {
41
41
  return {
42
42
  ...e,
43
- itemNameOther: e.itemName + '(他方)',
44
- unitOther: e.unit + '(他方)',
45
- itemModelNameOther: e.itemModelName + '(他方)',
46
- itemCodeOther: e.itemCode + '(他方)',
43
+ itemName: e.itemNameSelf + '(他方)',
44
+ itemModelName: e.itemModelNameSelf + '(他方)',
45
+ itemCode: e.itemCodeSelf + '(他方)',
47
46
  }
48
47
  })
49
48
  }
@@ -10,7 +10,6 @@ export interface ISN {
10
10
 
11
11
  /** 拆分全称加简称 */
12
12
  export const getSN = (value?: string): ISN | undefined => {
13
- debugger;
14
13
  if (!value) return undefined;
15
14
  const arr = value.match(/\*[^*]+\*/);
16
15
  if (arr && arr[0]) {
@@ -1,19 +1,13 @@
1
1
 
2
2
  import React from "react";
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";
5
- import { FormComponentProps } from "kts-components-antd-x3/lib/form";
6
- import { decorator } from "grey-react-box";
3
+ import { Row, Col, Input, Button } from "kts-components-antd-x3";
4
+ import { Form, Drawer } from "kts-xui";
7
5
  import { Invoice } from "../../../";
8
6
  import { getSN } from "../../tools/itemName";
9
7
 
10
- const AddComparisonDrawer = decorator<{}, FormComponentProps>(
11
- Form.create()
12
- )(props => {
8
+ export default function AddComparisonDrawer() {
13
9
 
14
- const { form } = props;
15
-
16
- const { getFieldDecorator } = form;
10
+ const [form] = Form.useForm();
17
11
 
18
12
  /** 控制器 */
19
13
  const controller = Invoice.useInvoiceController();
@@ -35,24 +29,21 @@ const AddComparisonDrawer = decorator<{}, FormComponentProps>(
35
29
  controller.run(async s => {
36
30
  if (!good) return
37
31
 
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);
32
+ try {
33
+ const values = await form.validateFields()
34
+ const shorthand = s.goodsListState.isMyShow ? getSN(good.itemNameSelf)?.shorthand : getSN(good.itemName)?.shorthand;
35
+
36
+ good.itemCode = values.itemCode;
37
+ good.itemCodeSelf = values.itemCodeSelf;
38
+ good.itemName = shorthand ? `*${shorthand}*${values.itemName}` : values.itemName;
39
+ good.itemNameSelf = shorthand ? `*${shorthand}*${values.itemNameSelf}` : values.itemNameSelf;
40
+ good.itemModelName = values.itemModelName;
41
+ good.itemModelNameSelf = values.itemModelNameSelf;
42
+
43
+ s.goodsListState.addComparisonIndex = undefined;
44
+ s.goodsListState.goodsList = [...s.goodsListState.goodsList];
45
+ } catch (error) {
46
+
56
47
  }
57
48
  })
58
49
  }, [form, good])
@@ -63,7 +54,7 @@ const AddComparisonDrawer = decorator<{}, FormComponentProps>(
63
54
  form.setFieldsValue({
64
55
  ...good,
65
56
  itemName: getSN(good.itemName)?.full,
66
- itemNameOther: getSN(good.itemNameOther)?.full,
57
+ itemNameSelf: getSN(good.itemNameSelf)?.full,
67
58
  })
68
59
  }
69
60
  }, [good])
@@ -74,102 +65,71 @@ const AddComparisonDrawer = decorator<{}, FormComponentProps>(
74
65
  onClose={onClose}
75
66
  placement="right"
76
67
  title="添加商品对照"
77
- visible={!!addComparisonIndex}
78
- drawerStyle={{ display: 'flex', flexDirection: 'column' }}
79
- bodyStyle={{ flex: 1, display: 'flex', flexDirection: 'column' }}
68
+ visible={!!good}
69
+ footer={
70
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 10 }} >
71
+ <Button type="primary" onClick={onSubmit} >提交</Button>
72
+ <Button onClick={onClose} >取消</Button>
73
+ </div>
74
+ }
80
75
  >
81
- <Form layout="vertical" style={{ flex: 1 }} >
82
- <Row gutter={[8, 8]} >
83
- <Col span={12}>
84
- {getFieldDecorator('itemCode', {})(
85
- <Form.Item label="我方商品编码" >
76
+ {
77
+ !!good &&
78
+ <Form layout="vertical" style={{ flex: 1 }} form={form} >
79
+ <Row gutter={[8, 8]} >
80
+ <Col span={12}>
81
+ <Form.Item
82
+ name="itemCodeSelf"
83
+ label="我方商品编码"
84
+ >
86
85
  <Input />
87
86
  </Form.Item>
88
- )}
89
-
90
- </Col>
91
- <Col span={12} >
92
- {getFieldDecorator('itemCodeOther', {})(
93
- <Form.Item label="对方商品编码" >
87
+ </Col>
88
+ <Col span={12} >
89
+ <Form.Item
90
+ name="itemCode"
91
+ label="对方商品编码"
92
+ >
94
93
  <Input />
95
94
  </Form.Item>
96
- )}
97
- </Col>
98
- <Col span={12} >
99
- {getFieldDecorator('itemName', {
100
- rules: [{ required: true, message: "请输入我方商品名称" }]
101
- })(
102
- <Form.Item label="我方商品名称" >
95
+ </Col>
96
+ <Col span={12} >
97
+ <Form.Item
98
+ name="itemNameSelf"
99
+ label="我方商品名称"
100
+ >
103
101
  <Input />
104
102
  </Form.Item>
105
- )}
106
-
107
- </Col>
108
- <Col span={12} >
109
- {getFieldDecorator('itemNameOther', {
110
- rules: [{ required: true, message: "请输入对方商品名称" }]
111
- })(
112
- <Form.Item label="对方商品名称">
103
+ </Col>
104
+ <Col span={12} >
105
+ <Form.Item
106
+ name="itemName"
107
+ label="对方商品名称"
108
+ >
113
109
  <Input />
114
110
  </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="对方规格型号">
111
+ </Col>
112
+ <Col span={12} >
113
+ <Form.Item name='itemModelNameSelf' label="我方规格型号">
127
114
  <Input />
128
115
  </Form.Item>
129
- )}
130
- </Col>
131
- <Col span={12} >
132
- {getFieldDecorator('unit', {
133
- rules: [{ required: true, message: "请输入对方规格型号" }]
134
- })(
135
- <Form.Item label="我方计量单位" >
116
+ </Col>
117
+ <Col span={12} >
118
+ <Form.Item name="itemModelName" label="对方规格型号">
136
119
  <Input />
137
120
  </Form.Item>
138
- )}
139
- </Col>
140
- <Col span={12} >
141
- {getFieldDecorator('unitOther', {
142
- rules: [{ required: true, message: "请输入对方计量单位" }]
143
- })(
144
- <Form.Item label="对方计量单位" >
145
- <Input />
146
- </Form.Item>
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>
121
+ </Col>
122
+ </Row>
123
+ </Form>
124
+ }
163
125
  </Drawer>
164
126
  )
165
- })
166
-
167
- export default AddComparisonDrawer;
168
-
169
- function validateFields(form: WrappedFormUtils<any>) {
170
- return new Promise<{ err: any, values: any }>(resolve => {
171
- form.validateFields((err, values) => {
172
- resolve({ err, values })
173
- })
174
- })
175
- }
127
+ }
128
+
129
+ // function validateFields(form: WrappedFormUtils<any>) {
130
+ // return new Promise<{ err: any, values: any }>(resolve => {
131
+ // form.validateFields((err, values) => {
132
+ // resolve({ err, values })
133
+ // })
134
+ // })
135
+ // }
@@ -291,7 +291,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
291
291
  if (!good) return;
292
292
 
293
293
  good.itemName = setShorthand(good.itemName, values.shorthand);
294
- good.itemNameOther = setShorthand(good.itemNameOther, values.shorthand);
294
+ good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
295
295
 
296
296
  // const name = getItemName(good.itemName, values.shorthand);
297
297
  // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
@@ -452,12 +452,13 @@ export const onChangeItemName = async (controller: InvoiceController, form: Wrap
452
452
  controller.run(async s => {
453
453
  const value = form.getFieldsValue().itemName;
454
454
  const shorthand = getSN(value)?.shorthand ?? '';
455
+
455
456
  if (s.goodsListState.isMyShow) {
456
- await controller.setEditGood({ itemName: value });
457
- record.itemNameOther && await controller.setEditGood({ itemNameOther: setShorthand(record.itemNameOther, shorthand) });
458
- } else {
459
- await controller.setEditGood({ itemNameOther: value });
457
+ await controller.setEditGood({ itemNameSelf: value });
460
458
  record.itemName && await controller.setEditGood({ itemName: setShorthand(record.itemName, shorthand) });
459
+ } else {
460
+ await controller.setEditGood({ itemName: value });
461
+ record.itemNameSelf && await controller.setEditGood({ itemNameSelf: setShorthand(record.itemNameSelf, shorthand) });
461
462
  }
462
463
  })
463
464
  }
@@ -64,12 +64,12 @@ export default (form: WrappedFormUtils) => {
64
64
  <Form.Item>
65
65
  <div style={{ display: 'flex' }} >
66
66
  {getFieldDecorator('itemName', {
67
- initialValue: isMyShow ? record.itemName : record.itemNameOther,
67
+ initialValue: isMyShow ? record.itemNameSelf : record.itemName,
68
68
  rules: [{
69
69
  validator: async (_, __, callback) => {
70
70
  await controller.wait();
71
71
  const value = controller.state.goodsListState.editGood;
72
- if (!value?.itemName && !value?.itemNameOther) {
72
+ if (!value?.itemName && !value?.itemNameSelf) {
73
73
  callback('货物名称不能为空');
74
74
  } else {
75
75
  return;
@@ -110,8 +110,8 @@ export default (form: WrappedFormUtils) => {
110
110
  } else {
111
111
  return (
112
112
  <MyItemNameDiv
113
- valueT={formatSearch(record.itemName, searchValue)}
114
- valueF={record.itemNameOther}
113
+ valueT={formatSearch(record.itemNameSelf, searchValue)}
114
+ valueF={formatSearch(record.itemName, searchValue)}
115
115
  isMyShow={isMyShow}
116
116
  />
117
117
  )
@@ -130,12 +130,12 @@ export default (form: WrappedFormUtils) => {
130
130
  return (
131
131
  <Form.Item>
132
132
  {getFieldDecorator('itemModelName', {
133
- initialValue: isMyShow ? editGood.itemModelName : editGood.itemModelNameOther,
133
+ initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
134
134
  })(
135
135
  <MyInput
136
136
  onChange={async () => {
137
137
  await controller.wait()
138
- const key = isMyShow ? 'itemModelName' : 'itemModelNameOther';
138
+ const key = isMyShow ? 'itemModelNameSelf' : 'itemModelName';
139
139
  const value = {} as any;
140
140
  value[key] = form.getFieldsValue().itemModelName;
141
141
  controller.setEditGood(value);
@@ -146,13 +146,12 @@ export default (form: WrappedFormUtils) => {
146
146
  );
147
147
  } else {
148
148
  return (
149
- <MyItemNameDiv
150
- valueT={formatSearch(record.itemModelName, searchValue)}
151
- valueF={formatSearch(record.itemModelNameOther, searchValue)}
152
- isMyShow={isMyShow}
149
+ <MyItemNameDiv
150
+ valueT={formatSearch(record.itemModelNameSelf, searchValue)}
151
+ valueF={formatSearch(record.itemModelName, searchValue)}
152
+ isMyShow={isMyShow}
153
153
  />
154
154
  )
155
- // return <span style={{ padding: '0 10px' }}>{formatSearch(value, searchValue)}</span>;
156
155
  }
157
156
  },
158
157
  },
@@ -182,7 +181,7 @@ export default (form: WrappedFormUtils) => {
182
181
  </Form.Item>
183
182
  );
184
183
  } else {
185
- return <MyItemNameDiv valueT={record.unit} valueF={record.unitOther} isMyShow={isMyShow} />;
184
+ return record.unit;
186
185
  }
187
186
  },
188
187
  },
@@ -434,6 +433,7 @@ export default (form: WrappedFormUtils) => {
434
433
  showArrow={false}
435
434
  style={{ width: '100%' }}
436
435
  onChange={() => {
436
+ setChangeField('taxRate');
437
437
  onChangeTaxRate(controller, form, record);
438
438
  }}
439
439
  >
@@ -463,7 +463,7 @@ export default (form: WrappedFormUtils) => {
463
463
  if (editGood?.$index === record.$index) {
464
464
  return getFieldDecorator('taxAmount', {
465
465
  initialValue: editGood.taxAmount,
466
- })(<MyDiv />);
466
+ })(<MyDiv loading={isCipher(changeField, 'taxAmount')} />);
467
467
  } else {
468
468
  return <span style={{ padding: '0 10px' }}>{parseFloat(value).toFixed(2)}</span>;
469
469
  }
@@ -526,9 +526,18 @@ class MyInput extends React.Component<InputProps & { loading?: boolean }> {
526
526
  }
527
527
  }
528
528
 
529
- class MyDiv extends React.Component<{ value?: any }> {
529
+ class MyDiv extends React.Component<{ value?: any, loading?: boolean }> {
530
+
530
531
  render() {
531
- return <span style={{ padding: '0 10px' }}>{this.props.value}</span>;
532
+ if (this.props.loading) {
533
+ return (
534
+ <Spin size="small">
535
+ <span style={{ padding: '0 10px' }}>{this.props.value}</span>
536
+ </Spin>
537
+ )
538
+ } else {
539
+ return <span style={{ padding: '0 10px' }}>{this.props.value}</span>
540
+ }
532
541
  }
533
542
  }
534
543
 
@@ -560,10 +569,21 @@ class MyItemNameDiv extends React.Component<{ valueT?: React.ReactNode, valueF?:
560
569
  }
561
570
  }
562
571
  }
572
+
563
573
  /** 格式搜索结果 */
564
574
  function formatSearch(value?: string, search?: string) {
565
575
  if (!value || !search) return value;
566
576
 
567
- const __html = value.split(new RegExp(search, 'g')).join(`<span class="kts-invoice-operate-goods-list-table-search-protrude" >${search}</span>`);
577
+ 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>`);
568
578
  return <span dangerouslySetInnerHTML={{ __html }} />
569
579
  }
580
+
581
+ /** 编码 */
582
+ function ucoding(v: string): string {
583
+ return v.split('').map(e => `U${e.charCodeAt(0)}E`).join('');
584
+ }
585
+
586
+ /** 解码 */
587
+ function dcoding(v: string): string {
588
+ return v.split('U').map(e => e ? String.fromCharCode(parseInt(e.replace('E', ''))) : '').join('');
589
+ }
@@ -11,9 +11,7 @@ export default () => {
11
11
  const { onComply } = controller.useMemo(s => s.goodsListState.productComparison, [])
12
12
 
13
13
  /** 是否禁用 */
14
- const disabled = controller.useMemo((s) => {
15
- if (s.goodsListState.selectedGoodIndex.length <= 0) return true;
16
- }, []);
14
+ const disabled = controller.useMemo(s => s.goodsListState.selectedGoodIndex.length <= 0, []);
17
15
 
18
16
  /** 点击了 */
19
17
  const onClick = React.useCallback(async () => {
@@ -36,7 +34,7 @@ export default () => {
36
34
  return {
37
35
  ...t,
38
36
  itemName: getSN(t.itemName)?.full,
39
- itemNameOther: getSN(t.itemNameOther)?.full,
37
+ itemNameSelf: getSN(t.itemNameSelf)?.full,
40
38
  } as IGood
41
39
  }).filter(e => !!e) as IGood[]
42
40
 
@@ -44,21 +42,18 @@ export default () => {
44
42
  // 比对后的商品
45
43
  const newGoods = await s.goodsListState.productComparison.onComply(goods);
46
44
 
47
- newGoods.filter(e => {
45
+ newGoods.forEach(e => {
48
46
  const vt = s.goodsListState.goodsMap.get(e.$index);
49
47
  if (!vt) return undefined;
50
48
 
51
49
  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
-
50
+ vt.itemNameSelf = e.itemNameSelf ? setShorthand(e.itemNameSelf, getSN(vt.itemNameSelf)?.shorthand) : vt.itemNameSelf;
51
+
57
52
  vt.itemModelName = e.itemModelName ? e.itemModelName : vt.itemModelName;
58
- vt.itemModelNameOther = e.itemModelNameOther ? e.itemModelNameOther : vt.itemModelNameOther;
53
+ vt.itemModelNameSelf = e.itemModelNameSelf ? e.itemModelNameSelf : vt.itemModelNameSelf;
59
54
 
60
55
  vt.itemCode = e.itemCode ? e.itemCode : vt.itemCode;
61
- vt.itemCodeOther = e.itemCodeOther ? e.itemCodeOther : vt.itemCodeOther;
56
+ vt.itemCodeSelf = e.itemCodeSelf ? e.itemCodeSelf : vt.itemCodeSelf;
62
57
  })
63
58
  })
64
59
  }, [])
@@ -74,7 +69,7 @@ export default () => {
74
69
  执行商品对照
75
70
  </Menu.Item>
76
71
  );
77
- }, [])
72
+ }, [disabled, onClick, onComply])
78
73
 
79
74
  return { menuItem }
80
75
  };
@@ -107,17 +107,17 @@ const DrawerBody = () => {
107
107
 
108
108
  // 导入FORM里
109
109
  if (s.goodsListState.isMyShow) {
110
- s.goodsListState.form.setFieldsValue(editGood);
110
+ s.goodsListState.form.setFieldsValue({
111
+ ...editGood,
112
+ itemName: editGood.itemNameSelf,
113
+ itemModelName: editGood.itemModelNameSelf,
114
+ });
111
115
  } else {
112
116
  s.goodsListState.form.setFieldsValue({
113
117
  ...editGood,
114
- itemName: editGood.itemNameOther,
115
- unit: editGood.unitOther,
116
- itemModelName: editGood.itemModelNameOther,
117
118
  });
118
119
  }
119
120
 
120
-
121
121
  s.goodsListState.importGoods.isVisibleDrawer = false;
122
122
 
123
123
  s.goodsListState.isTaxIncluded
@@ -157,9 +157,9 @@ const getItemName = (record: any, editGood: IGood) => {
157
157
  return `*${shorthand}*${record.itemName}`;
158
158
  }
159
159
 
160
- shorthand = getSN(editGood.itemNameOther)?.shorthand;
160
+ shorthand = getSN(editGood.itemName)?.shorthand;
161
161
  if (shorthand) {
162
- return `*${shorthand}*${record.itemName}`;
162
+ return `*${shorthand}*${record.itemNameSelf}`;
163
163
  }
164
164
 
165
165
  return record.itemName;
@@ -167,14 +167,14 @@ const getItemName = (record: any, editGood: IGood) => {
167
167
 
168
168
  // 获取他方名称
169
169
  const getItemNameOther = (record: any, editGood: IGood) => {
170
- if (!editGood.itemNameOther) return editGood.itemNameOther;
170
+ if (!editGood.itemName) return editGood.itemName;
171
171
 
172
172
  let shorthand;
173
173
 
174
174
  shorthand = record.shorthand;
175
175
  if (shorthand) {
176
- return `*${shorthand}*${record.itemName}`;
176
+ return `*${shorthand}*${record.itemNameSelf}`;
177
177
  }
178
178
 
179
- return record.itemNameOther;
179
+ return record.itemName;
180
180
  }