kts-component-invoice-operate 3.0.0 → 3.0.2

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 (30) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.d.ts +1 -1
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -1
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +5 -5
  4. package/dist/Invoice/InvoiceController/fns/addGoodDiscount.d.ts +1 -1
  5. package/dist/Invoice/InvoiceController/fns/delGood.d.ts +1 -1
  6. package/dist/Invoice/InvoiceController/index.d.ts +1 -1
  7. package/dist/Invoice/index.d.ts +1 -1
  8. package/dist/Invoice/tools/idGenerator/index.d.ts +1 -1
  9. package/dist/Invoice/ui/GoodsList/hook/useRowSelection/index.d.ts +1 -1
  10. package/dist/index.esm.js +28 -24
  11. package/dist/index.js +28 -24
  12. package/docs-dist/umi.css +2 -3
  13. package/docs-dist/umi.js +1 -1
  14. package/package.json +1 -1
  15. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +3 -0
  16. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode/index.tsx +1 -1
  17. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +1 -1
  18. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +5 -5
  19. package/src/Invoice/InvoiceController/fns/addGoodDiscount.ts +1 -1
  20. package/src/Invoice/InvoiceController/fns/delGood.ts +2 -4
  21. package/src/Invoice/index.tsx +4 -6
  22. package/src/Invoice/tools/idGenerator/index.ts +3 -2
  23. package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +1 -1
  24. package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +1 -1
  25. package/src/Invoice/ui/GoodsList/hook/useOnRow/index.tsx +0 -1
  26. package/src/Invoice/ui/GoodsList/hook/useToGenerateId/index.ts +1 -5
  27. package/src/Invoice/ui/GoodsList/index.less +5 -1
  28. package/src/Invoice/ui/GoodsList/ui/TableRow/index.tsx +12 -4
  29. package/src/Invoice/ui/GoodsList/ui/TableVirtual/index.tsx +1 -4
  30. package/d.dio +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -77,6 +77,9 @@ export default class InvoiceControllerForm extends GreyReactBox<InvoiceControlle
77
77
  return sum.done().toNumber();
78
78
  })());
79
79
 
80
+ // 含税标记
81
+ _values.set('isSwitchTax', this.state.goodsListState.isSwitchTax)
82
+
80
83
  return { errors: _errors, values: _values };
81
84
  }
82
85
  }
@@ -5,7 +5,7 @@ import LineAttributeType from '../LineAttributeType';
5
5
  export default class EndowCode {
6
6
 
7
7
  /** 准备赋码的货物索引列表 */
8
- endowcodeGoodIndex: number[] = [];
8
+ endowcodeGoodIndex: string[] = [];
9
9
 
10
10
  /**
11
11
  * 获取 税收分类编码列表 (弃用)
@@ -2,7 +2,7 @@ import LineAttributeType from '../LineAttributeType';
2
2
 
3
3
  export default interface IGood {
4
4
  /** 数据索引 */
5
- $index: number;
5
+ $index: string;
6
6
 
7
7
  /** 序号 */
8
8
  serialNo?: number;
@@ -47,16 +47,16 @@ export default class GoodsListState {
47
47
  goodsList: IGood[] = [];
48
48
 
49
49
  /** 货物字典 */
50
- goodsMap = new Map<number, IGood>();
50
+ goodsMap = new Map<string, IGood>();
51
51
 
52
52
  /** 货物菜单扩展 */
53
- goodsMenuExpand: ((index: number, controller: InvoiceController) => React.ReactNode)[] = [];
53
+ goodsMenuExpand: ((index: string, controller: InvoiceController) => React.ReactNode)[] = [];
54
54
 
55
55
  /** 列表选中的货物索引列表 */
56
- selectedGoodIndex: number[] = [];
56
+ selectedGoodIndex: string[] = [];
57
57
 
58
58
  /** 准备添加折扣的货物索引列表 */
59
- discountGoodIndex: number[] = [];
59
+ discountGoodIndex: string[] = [];
60
60
 
61
61
  /** 货物赋码的相关数据 */
62
62
  endowCode = new EndowCode();
@@ -71,5 +71,5 @@ export default class GoodsListState {
71
71
  isVisibleDrawer = false;
72
72
 
73
73
  /** 正在 添加商品对照 的货物 */
74
- addComparisonIndex?: number;
74
+ addComparisonIndex?: string;
75
75
  }
@@ -16,7 +16,7 @@ import { format2 } from '../../../Invoice/tools/calculate';
16
16
 
17
17
  export interface IOptions {
18
18
  /** 需要添加的 索引列表 */
19
- indexList: number[];
19
+ indexList: string[];
20
20
 
21
21
  /** 折扣 */
22
22
  discount: number;
@@ -4,12 +4,10 @@ import LineAttributeType from '../../InvoiceController/InvoiceControllerState/Go
4
4
  /**
5
5
  * 设置当前的编辑货物
6
6
  */
7
- export default async (state: InvoiceControllerState, $index?: number) => {
7
+ export default async (state: InvoiceControllerState, $index?: string) => {
8
8
  if (!$index) return;
9
9
 
10
- const goods = state.goodsListState.goodsList.filter(
11
- (e) => e.$index === $index,
12
- )[0];
10
+ const goods = state.goodsListState.goodsList.filter( (e) => e.$index === $index)[0];
13
11
  if (!goods) return;
14
12
  if (
15
13
  state.goodsListState.editGood &&
@@ -81,8 +81,6 @@ const Main = (props: IInvoiceProps) => {
81
81
 
82
82
  React.useEffect(() => { setKey(key + 1) }, [controller]);
83
83
 
84
- React.useEffect(() => { }, [])
85
-
86
84
  return (
87
85
  <InvoiceContext.Provider key={key} value={controller}>
88
86
 
@@ -95,10 +93,10 @@ const Main = (props: IInvoiceProps) => {
95
93
  {props.footExpand}
96
94
  </div>
97
95
 
98
- <ImportBuyerDrawer />{/* 导入购买方的抽屉 */}
99
- <ImportGoodsDrawer />{/* 导入货品的抽屉 */}
100
- <EndowCodeDrawer />{/* 给货品赋码的抽屉 */}
101
- <AddComparisonDrawer />{/* 添加商品对照的抽屉 */}
96
+ <ImportBuyerDrawer />{/* 导入购买方的抽屉 */}
97
+ <ImportGoodsDrawer />{/* 导入货品的抽屉 */}
98
+ <EndowCodeDrawer />{/* 给货品赋码的抽屉 */}
99
+ <AddComparisonDrawer />{/* 添加商品对照的抽屉 */}
102
100
  </InvoiceContext.Provider>
103
101
  );
104
102
  };
@@ -1,2 +1,3 @@
1
- let id = new Date().getTime();
2
- export default () => ++id;
1
+
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ export default () => uuidv4();
@@ -415,8 +415,8 @@ export const onSaveEditGood = lazyFn(
415
415
 
416
416
  /** 单调赋码 */
417
417
  export const endowCode = async (controller: InvoiceController, goods: IGood) => {
418
- await controller.saveEditGood();
419
418
  await controller.wait();
419
+ await controller.saveEditGood();
420
420
  await controller.pipeline(async (s) => {
421
421
  if (s.goodsListState.form) {
422
422
  const err: any = s.goodsListState.form.getFieldsError();
@@ -17,8 +17,8 @@ export default (goods: IGood) => {
17
17
 
18
18
  /** 点击了 添加折扣行 按钮 */
19
19
  const onClick = React.useCallback(async () => {
20
- await controller.saveEditGood();
21
20
  await controller.wait();
21
+ await controller.saveEditGood();
22
22
  await controller.run(async s => {
23
23
  if (s.goodsListState.form) {
24
24
  const err: any = s.goodsListState.form.getFieldsError();
@@ -23,7 +23,6 @@ export default () => {
23
23
  if (editGood) {
24
24
  if (editGood.$index === record.$index) return;
25
25
  await controller.saveEditGood();
26
- await controller.wait();
27
26
  await controller.pipeline(async s => { s.goodsListState.editGood || (await controller.setEditGood(record)) })();
28
27
  } else {
29
28
  await controller.setEditGood(record);
@@ -4,10 +4,6 @@ import InvoiceController from '../../../../InvoiceController'
4
4
 
5
5
  /** 更新 商品序号 */
6
6
  export default function useToGenerateId(controller: InvoiceController) {
7
-
8
7
  const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
9
-
10
- React.useEffect(() => {
11
- goodsList.forEach((e, i) => { e.serialNo = i + 1 });
12
- }, [goodsList])
8
+ React.useEffect(() => { goodsList.forEach((e, i) => { e.serialNo = i + 1 }) }, [goodsList])
13
9
  }
@@ -53,11 +53,15 @@
53
53
  .kts-invoice-operate-goods-list-table {
54
54
  border-bottom: 1px solid #dcdcdc;
55
55
 
56
+ .kts-invoice-operate-goods-be-discount,
56
57
  .kts-invoice-operate-goods-discount {
57
- color : rgba(0, 0, 0, 0.25);
58
58
  background: #f5f5f5;
59
59
  }
60
60
 
61
+ .kts-invoice-operate-goods-be-discount{
62
+ color: #D9001B;
63
+ }
64
+
61
65
  .kts-invoice-operate-goods-list-able-list-itemName-import {
62
66
  display: flex;
63
67
 
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import Invoice from '../../../../';
3
3
  import { LineAttributeType } from '../../../../InvoiceController'
4
+ import classnames from 'classnames'
4
5
 
5
6
  export default function TableRow(props: any) {
6
7
 
@@ -8,13 +9,20 @@ export default function TableRow(props: any) {
8
9
 
9
10
  const goodsMap = controller.useMemo(s => s.goodsListState.goodsMap, [])
10
11
 
11
- const isR = React.useMemo(() => {
12
+ const discount = React.useMemo(() => {
12
13
  const i = goodsMap.get(props['data-row-key']);
13
- if (!i) return false;
14
- return i.lineAttribute !== LineAttributeType.正常
14
+ if (!i) return undefined;
15
+
16
+ if (i.lineAttribute === LineAttributeType.折扣行) {
17
+ return 'kts-invoice-operate-goods-be-discount'
18
+ } else if (i.lineAttribute === LineAttributeType.被折扣行) {
19
+ return 'kts-invoice-operate-goods-discount'
20
+ } else {
21
+ return undefined;
22
+ }
15
23
  }, [props['data-row-key'], goodsMap])
16
24
 
17
25
  return (
18
- <tr {...props} className={`${isR ? 'kts-invoice-operate-goods-discount ' : ''}${props.className}`} />
26
+ <tr {...props} className={classnames(props.className, discount)} />
19
27
  )
20
28
  }
@@ -89,10 +89,7 @@ export default function <T = any>(props: TableProps<T>) {
89
89
  }, [pointer, self, rowHeight]);
90
90
 
91
91
  return (
92
- <span
93
- className="kts-invoice-operate-goods-table-virtual"
94
- ref={(e) => { setSelf(e) }}
95
- >
92
+ <span className="kts-invoice-operate-goods-table-virtual" ref={(e) => { setSelf(e) }} >
96
93
  <Table {...props} dataSource={dataSource} />
97
94
  </span>
98
95
  );
package/d.dio DELETED
@@ -1,10 +0,0 @@
1
- <mxfile host="65bd71144e">
2
- <diagram id="fPgEJXQJnfzUtXCRGjsd" name="第 1 页">
3
- <mxGraphModel dx="1721" dy="1025" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4
- <root>
5
- <mxCell id="0"/>
6
- <mxCell id="1" parent="0"/>
7
- </root>
8
- </mxGraphModel>
9
- </diagram>
10
- </mxfile>