kts-component-invoice-operate 3.2.178 → 3.2.180

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 (67) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +0 -5
  2. package/dist/Invoice/InvoiceController/index.d.ts +0 -10
  3. package/dist/Invoice/index.d.ts +0 -4
  4. package/dist/index.esm.js +47 -1958
  5. package/dist/index.js +47 -1958
  6. package/package.json +3 -3
  7. package/src/Invoice/Invoice-digtal/index.md +1 -7
  8. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +0 -6
  9. package/src/Invoice/InvoiceController/index.ts +1 -20
  10. package/src/Invoice/index.tsx +1 -8
  11. package/src/Invoice/tools/useToGenerateId/index.ts +0 -2
  12. package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +11 -10
  13. package/src/Invoice/ui/digtal/GoodsList/index.tsx +1 -0
  14. package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.tsx +1 -0
  15. package/src/TaxClassificationCodeModal/index.less +8 -0
  16. package/src/TaxClassificationCodeModal/index.tsx +14 -6
  17. package/dist/Invoice/Invoice-digtal/_test/architecture/index.d.ts +0 -4
  18. package/dist/Invoice/Invoice-digtal/_test/freight/index.d.ts +0 -4
  19. package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.d.ts +0 -6
  20. package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.d.ts +0 -23
  21. package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.d.ts +0 -21
  22. package/dist/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.d.ts +0 -31
  23. package/dist/Invoice/InvoiceController/fns/addFreight.d.ts +0 -6
  24. package/dist/Invoice/InvoiceController/fns/delFreight.d.ts +0 -6
  25. package/dist/Invoice/InvoiceController/fns/saveEditFreight.d.ts +0 -6
  26. package/dist/Invoice/InvoiceController/fns/setEditFreight.d.ts +0 -6
  27. package/dist/Invoice/InvoiceController/fns/setFreight.d.ts +0 -6
  28. package/dist/Invoice/ui/digtal/Architecture/index.d.ts +0 -15
  29. package/dist/Invoice/ui/digtal/FreightList/hook/useColumns/index.d.ts +0 -3
  30. package/dist/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.d.ts +0 -8
  31. package/dist/Invoice/ui/digtal/FreightList/hook/useOnRow/index.d.ts +0 -8
  32. package/dist/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.d.ts +0 -8
  33. package/dist/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.d.ts +0 -8
  34. package/dist/Invoice/ui/digtal/FreightList/index.d.ts +0 -15
  35. package/dist/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.d.ts +0 -3
  36. package/dist/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +0 -6
  37. package/dist/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +0 -6
  38. package/dist/Invoice/ui/digtal/FreightList/ui/TableRow/index.d.ts +0 -3
  39. package/dist/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.d.ts +0 -4
  40. package/src/Invoice/Invoice-digtal/_test/architecture/index.tsx +0 -22
  41. package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +0 -14575
  42. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IColumnsReplenish/index.ts +0 -10
  43. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/IGood/index.ts +0 -33
  44. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/ImportGoods/index.ts +0 -81
  45. package/src/Invoice/InvoiceController/InvoiceControllerState/FreightListState/index.ts +0 -40
  46. package/src/Invoice/InvoiceController/fns/addFreight.ts +0 -11
  47. package/src/Invoice/InvoiceController/fns/delFreight.ts +0 -38
  48. package/src/Invoice/InvoiceController/fns/saveEditFreight.ts +0 -24
  49. package/src/Invoice/InvoiceController/fns/setEditFreight.ts +0 -16
  50. package/src/Invoice/InvoiceController/fns/setFreight.ts +0 -11
  51. package/src/Invoice/ui/digtal/Architecture/index.less +0 -15
  52. package/src/Invoice/ui/digtal/Architecture/index.tsx +0 -166
  53. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/dist/index.js +0 -616
  54. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/index.tsx +0 -246
  55. package/src/Invoice/ui/digtal/FreightList/hook/useColumns/ui/TitleText/index.tsx +0 -20
  56. package/src/Invoice/ui/digtal/FreightList/hook/useOnRow/index.tsx +0 -37
  57. package/src/Invoice/ui/digtal/FreightList/hook/useRowSelection/index.tsx +0 -120
  58. package/src/Invoice/ui/digtal/FreightList/hook/useWindowClick/index.tsx +0 -23
  59. package/src/Invoice/ui/digtal/FreightList/index.less +0 -74
  60. package/src/Invoice/ui/digtal/FreightList/index.tsx +0 -129
  61. package/src/Invoice/ui/digtal/FreightList/ui/AddRowButton/index.tsx +0 -65
  62. package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +0 -50
  63. package/src/Invoice/ui/digtal/FreightList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +0 -37
  64. package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.less +0 -29
  65. package/src/Invoice/ui/digtal/FreightList/ui/TableRow/index.tsx +0 -21
  66. package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.less +0 -39
  67. package/src/Invoice/ui/digtal/FreightList/ui/TableVirtual/index.tsx +0 -109
@@ -1,246 +0,0 @@
1
-
2
- import React from 'react';
3
- import { Form } from 'kts-components-antd-x3';
4
- import { Select, Input, Spin, InputProps, Cascader } from 'kts-xui';
5
- import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
6
- import { IGood2 } from '../../../../../InvoiceController';
7
- import Invoice from '../../../../..';
8
- import TitleText from './ui/TitleText';
9
-
10
- export default (form: WrappedFormUtils) => {
11
- const { getFieldDecorator } = form;
12
-
13
- const controller = Invoice.useInvoiceController();
14
-
15
- const rootElement = controller.useMemo(s => s.rootElement, []);
16
-
17
- /** 组件模式 */
18
- const model = controller.useMemo(e => e.model, []);
19
-
20
- /** 正在编辑的货物 */
21
- const editGood = controller.useMemo((e) => e.freightListState.editGood, []);
22
-
23
- /** 禁用字段 */
24
- const disableds = controller.useMemo((e) => e.stakeholder.disableds || [], []);
25
-
26
- /** 运输工具种类列表 */
27
- const vehicleTypeList = controller.useMemo((e) => e.freightListState.vehicleTypeList, []);
28
-
29
- const area = controller.useMemo((e) => e.freightListState.area, []);
30
- const addressFieldNames = controller.useMemo((e) => e.freightListState.addressFieldNames, []);
31
- const getVehicle = React.useCallback((value?: string) => {
32
- if (vehicleTypeList && vehicleTypeList.length > 0) {
33
- return vehicleTypeList.find(e => e.value === value)?.label || '';
34
- }
35
- }, [vehicleTypeList])
36
- const splitArea = React.useCallback((value?: string) => {
37
- if (value) {
38
- const _array = value.split(',');
39
- return _array;
40
- } else {
41
- return [];
42
- }
43
- }, []);
44
-
45
- /** 表头 */
46
- const columns = React.useMemo(() => {
47
- return [
48
- {
49
- title: '序号',
50
- key: 'sortNumber',
51
- dataIndex: 'sortNumber',
52
- width: 50,
53
- render: (e: number) => <span style={{ padding: '0 10px' }}>{e}</span>,
54
- },
55
- {
56
- title: <TitleText required >运输工具种类</TitleText>,
57
- key: 'type',
58
- render: (_: string, record: IGood2) => {
59
- if (editGood?.$index === record.$index && !disableds.includes('type') && !(model === 'prefab')) {
60
- return (
61
- <Form.Item>
62
- {getFieldDecorator('type', {
63
- initialValue: editGood.type,
64
- rules: [
65
- { required: true, message: '请输入' },
66
- ],
67
- })(
68
- <Select
69
- className="kts-invoice-operate-goods-list-table-tax-rate"
70
- showArrow={false}
71
- style={{ width: '100%' }}
72
- getPopupContainer={() => rootElement || document.body}
73
- onChange={async (value) => {
74
- await controller.wait()
75
- controller.setEditFreight({ type: value });
76
- }}
77
- >
78
- {(record.vehicleList || vehicleTypeList).map((e, i) => {
79
- return (
80
- <Select.Option key={i} value={e.value}>
81
- {e.label}
82
- </Select.Option>
83
- );
84
- })}
85
- </Select>,
86
- )}
87
- </Form.Item>
88
- );
89
- } else {
90
- return <span style={{ padding: '0 10px' }}>{getVehicle(record.type)}</span>;
91
- }
92
- },
93
- },
94
- {
95
- title: <TitleText required>运输工具牌号</TitleText>,
96
- key: 'licensePlate',
97
- width: 119,
98
- render: (_: string, record: IGood2) => {
99
- if (editGood?.$index === record.$index && !disableds.includes('licensePlate') && model !== 'prefab') {
100
- return (
101
- <Form.Item>
102
- {getFieldDecorator('licensePlate', {
103
- initialValue: editGood.licensePlate,
104
- rules: [
105
- { required: true, message: '请输入' },
106
- ],
107
- })(
108
- <MyInput
109
- maxLength={200}
110
- onChange={async () => {
111
- await controller.wait()
112
- await controller.setEditFreight({ licensePlate: form.getFieldsValue().licensePlate });
113
- }}
114
- />,
115
- )}
116
- </Form.Item>
117
- );
118
- } else {
119
- return <span style={{ padding: '0 10px' }}>{record.licensePlate}</span>;
120
- }
121
- },
122
- },
123
- {
124
- title: <TitleText required>起运地</TitleText>,
125
- key: 'origin',
126
- width: 150,
127
- render: (_: string, record: IGood2) => {
128
- if (editGood?.$index === record.$index && !disableds.includes('origin') && model !== 'prefab') {
129
- return (
130
- <Form.Item>
131
- {getFieldDecorator('origin', {
132
- initialValue: editGood.origin,
133
- rules: [
134
- { required: true, message: '请输入' },
135
- ],
136
- })(<Cascader
137
- style={{ width: '100%' }}
138
- options={area}
139
- fieldNames={addressFieldNames}
140
- onChange={async (value) => {
141
- await controller.setEditFreight({ origin: value });
142
- }}
143
- />)}
144
- </Form.Item>
145
- );
146
- } else {
147
- return <span style={{ padding: '0 10px' }}>{record.origin}</span>;
148
- }
149
- },
150
- },
151
- {
152
- title: <TitleText required>到达地</TitleText>,
153
- dataIndex: 'destination',
154
- key: 'destination',
155
- width: 149,
156
- render: (_: string, record: IGood2) => {
157
- if (editGood?.$index === record.$index && !disableds.includes('destination') && model !== 'prefab') {
158
- return (
159
- <Form.Item>
160
- {getFieldDecorator('destination', {
161
- initialValue: editGood.destination,
162
- rules: [
163
- { required: true, message: '请输入' },
164
- ],
165
- })(
166
- <Cascader
167
- options={area}
168
- fieldNames={addressFieldNames}
169
- style={{ width: '100%' }}
170
- onChange={async (value) => {
171
- await controller.setEditFreight({ destination: value });
172
- }}
173
- />
174
- )}
175
- </Form.Item>
176
- );
177
- } else {
178
- return <span style={{ padding: '0 10px' }}>{record.destination}</span>;
179
- }
180
- },
181
- },
182
- {
183
- title: <TitleText required>运输货物名称</TitleText>,
184
- dataIndex: 'itemName',
185
- key: 'itemName',
186
- width: 149,
187
- render: (_: string, record: IGood2) => {
188
- if (editGood?.$index === record.$index && !disableds.includes('itemName') && model !== 'prefab') {
189
- return (
190
- <Form.Item>
191
- {getFieldDecorator('itemName', {
192
- initialValue: editGood.itemName,
193
- rules: [
194
- { required: true, message: '请输入货物名称' },
195
- ],
196
- })(
197
- <MyInput
198
- maxLength={200}
199
- onChange={async () => {
200
- await controller.wait()
201
- await controller.setEditFreight({ itemName: form.getFieldsValue().itemName });
202
- }}
203
- />,
204
- )}
205
- </Form.Item>
206
- );
207
- } else {
208
- return <span style={{ padding: '0 10px' }}>{record.itemName}</span>;
209
- }
210
- },
211
- },
212
- ]
213
-
214
- // 只读
215
- .filter(e => {
216
- if (model === 'readOnly') {
217
- return e.key !== 'operating';
218
- } else {
219
- return true;
220
- }
221
- })
222
- .map((e) => {
223
- return {
224
- ...e,
225
- ellipsis: true,
226
- };
227
- }) as any[];
228
- }, [editGood, controller, model, getVehicle]);
229
-
230
- return columns;
231
- };
232
-
233
-
234
- class MyInput extends React.Component<InputProps & { loading?: boolean }> {
235
- render() {
236
- if (this.props.loading) {
237
- return (
238
- <Spin size="small">
239
- <Input {...this.props} autoComplete="off" />
240
- </Spin>
241
- )
242
- } else {
243
- return <Input {...this.props} autoComplete="off" />
244
- }
245
- }
246
- }
@@ -1,20 +0,0 @@
1
-
2
- import React from 'react';
3
- import { Typography } from 'kts-components-antd-x3';
4
- import { ValidationRule } from 'kts-components-antd-x3/lib/form';
5
-
6
- const { Text } = Typography;
7
-
8
- export default (props: { children?: React.ReactNode, required?: boolean, rules?: ValidationRule[] }) => {
9
-
10
- const { rules, children } = props;
11
-
12
- const required = React.useMemo(() => rules?.some(e => !!e.required) || props.required, [rules, props.required]);
13
-
14
- return (
15
- <>
16
- {required ? <Text type="danger">*</Text> : <></>}
17
- {children}
18
- </>
19
- )
20
- };
@@ -1,37 +0,0 @@
1
- /**
2
- * 表格行事件
3
- */
4
-
5
- import React from 'react';
6
- import Invoice from '../../../../..';
7
- import IGood from '../../../../../InvoiceController/InvoiceControllerState/FreightListState/IGood';
8
-
9
- export default () => {
10
- /** 控制器 */
11
- const controller = Invoice.useInvoiceController();
12
-
13
- const model = controller.useMemo(s => s.model, []);
14
-
15
- const onClick = React.useCallback(
16
- async (record: IGood) => {
17
- // if (model === 'prefab') return;
18
- if (model === 'readOnly') return;
19
-
20
- const editGood = controller.state.freightListState.editGood;
21
-
22
- if (editGood) {
23
- if (editGood.$index === record.$index) return;
24
- await controller.saveEditFreight();
25
- await controller.wait();
26
- await controller.pipeline(async s => { s.freightListState.editGood || (await controller.setEditFreight(record)) })();
27
- } else {
28
- await controller.setEditFreight(record);
29
- }
30
- },
31
- [controller, model],
32
- );
33
-
34
- return {
35
- onClick,
36
- };
37
- };
@@ -1,120 +0,0 @@
1
-
2
- import React from 'react';
3
- import { Checkbox } from 'kts-components-antd-x3';
4
- import Invoice from '../../../../..';
5
-
6
- export default () => {
7
-
8
- /** 控制器 */
9
- const controller = Invoice.useInvoiceController();
10
-
11
- /** 列表选中的货物索引列表 */
12
- const selectedRowKeys = controller.useMemo(s => s.freightListState.selectedGoodIndex, []);
13
-
14
- /** 货物列表 */
15
- const goodsList = controller.useMemo(s => s.freightListState.goodsList, []);
16
-
17
- /** 组件模式 */
18
- const model = controller.useMemo(s => s.model, []);
19
-
20
- /** 搜索条件 */
21
- // const searchValue = controller.useMemo(s => s.goodsListState.searchValue, []);
22
-
23
- /** 是否显示选择框 */
24
- const isShow = React.useMemo(() => {
25
- if (model === 'readOnly') return false
26
- return true;
27
- }, [model])
28
-
29
- /** 是否全选 */
30
- // const isAll = controller.useMemo(s => s.goodsListState.goodsList.length > 0 && s.goodsListState.selectedGoodIndex.length === s.goodsListState.goodsList.length, [])
31
- const isAll = controller.useMemo(s => {
32
- if (s.freightListState.selectedGoodIndex.length <= 0) return false;
33
- const seeGoodsIndex = s.freightListState.goodsList.map(e => e.$index);
34
- const selectedGoodIndex = s.freightListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
35
- return selectedGoodIndex.length === seeGoodsIndex.length
36
- }, [])
37
-
38
- const indeterminate = controller.useMemo(s => {
39
- const seeGoodsIndex = s.freightListState.goodsList.map(e => e.$index);
40
- const selectedGoodIndex = s.freightListState.selectedGoodIndex.filter(e => seeGoodsIndex.some(t => e === t));
41
- if (selectedGoodIndex.length === 0) return false;
42
- return selectedGoodIndex.length < seeGoodsIndex.length
43
- }, [])
44
- /** 点击了全选 */
45
- const onClickSelectAll = React.useCallback(async () => {
46
- if (isAll) {
47
- await controller.pipeline(async s => {
48
- const seeGoodsIndex = s.freightListState.goodsList.map(e => e.$index)
49
-
50
- s.freightListState.selectedGoodIndex = s.freightListState.selectedGoodIndex.filter(e => !seeGoodsIndex.some(t => e === t));
51
- })()
52
- } else {
53
- await controller.pipeline(async s => {
54
- const seeGoodsIndex = s.freightListState.goodsList.map(e => e.$index)
55
-
56
- s.freightListState.selectedGoodIndex = [...s.freightListState.selectedGoodIndex, ...seeGoodsIndex];
57
- s.freightListState.selectedGoodIndex = Array.from(new Set(s.freightListState.selectedGoodIndex));
58
- })()
59
- }
60
- // await sortOut(true);
61
- }, [controller, isAll])
62
-
63
- const onSelect = React.useCallback(async (record, selected) => {
64
- if (selected) {
65
- await controller.pipeline(async s => {
66
- s.freightListState.selectedGoodIndex = [...s.freightListState.selectedGoodIndex, record.$index];
67
- s.freightListState = { ...s.freightListState };
68
- })()
69
- } else {
70
- await controller.pipeline(async s => {
71
- s.freightListState.selectedGoodIndex = s.freightListState.selectedGoodIndex.filter(e => e !== record.$index);
72
- s.freightListState = { ...s.freightListState };
73
- })()
74
- }
75
- // await sortOut(selected);
76
- }, [controller])
77
-
78
- const columnTitle = React.useMemo(() => {
79
- return (
80
- <Checkbox
81
- onChange={onClickSelectAll}
82
- indeterminate={indeterminate}
83
- checked={isAll}
84
- ></Checkbox>
85
- )
86
- }, [goodsList, selectedRowKeys, onClickSelectAll, isAll, indeterminate])
87
-
88
- /** 选择了商品后 调整 折扣行 和 被折扣行 */
89
- const sortOut = React.useCallback(async (selected: boolean) => {
90
- await controller.wait();
91
- await controller.pipeline(async s => {
92
- s.freightListState.selectedGoodIndex.forEach($index => {
93
- const goods = s.freightListState.goodsMap.get($index);
94
- if (!goods) return;
95
-
96
- // 数组位置
97
- let t = s.freightListState.goodsList.indexOf(goods);
98
- // goods.lineAttribute === LineAttributeType.折扣行 ? t : t++;
99
- const i = s.goodsListState.goodsList[t].$index;
100
- if (selected) {
101
- if (s.freightListState.selectedGoodIndex.indexOf(i) < 0) s.freightListState.selectedGoodIndex = [...s.freightListState.selectedGoodIndex, i];
102
- } else {
103
- if (s.freightListState.selectedGoodIndex.indexOf(i) < 0) s.freightListState.selectedGoodIndex = s.freightListState.selectedGoodIndex.filter(e => e !== $index);
104
- }
105
- })
106
- })()
107
- }, [controller])
108
-
109
- // React.useEffect(() => {
110
- // sortOut(true);
111
- // }, [sortOut, goodsList])
112
-
113
- if (isShow === false) return undefined;
114
- return {
115
- columnWidth: 45,
116
- columnTitle,
117
- onSelect,
118
- selectedRowKeys,
119
- }
120
- }
@@ -1,23 +0,0 @@
1
-
2
- /**
3
- * 点击组件外部 保存正在编辑的货物
4
- */
5
-
6
- import React from "react";
7
- import { InvoiceController } from "../../../../../..";
8
-
9
- /**
10
- * 点击组件外部 保存正在编辑的货物
11
- */
12
- export default function useWindowClick(controller: InvoiceController) {
13
-
14
- /** 点击组件外部 保存正在编辑的货物 */
15
- React.useEffect(() => {
16
- const click = () => { setTimeout(controller.saveEditFreight) };
17
-
18
- window.addEventListener('click', click);
19
- return () => {
20
- window.removeEventListener('click', click);
21
- };
22
- }, [controller]);
23
- }
@@ -1,74 +0,0 @@
1
- .kts-invoice-operate-freight{
2
- // padding : 20px;
3
- border-bottom: 2px solid #9F613E;
4
- border-left: 2px solid #9F613E;
5
- border-right: 2px solid #9F613E;
6
-
7
- .real-estate-info-digtal-label {
8
- padding: 20px 20px 0;
9
- color: #9F613E;
10
- font-weight: bold;
11
- }
12
-
13
- .ktsAnt3x-row.ktsAnt3x-form-item {
14
- margin-bottom: 0;
15
- }
16
- }
17
-
18
- .kts-invoice-operate-goods-list-digtal {
19
-
20
- .goods-list-digtal-discount-tag {
21
- display: inline-block;
22
- height: 20px;
23
- line-height: 20px;
24
- border: 1px solid;
25
- padding: 0 5px;
26
- border-radius: 4px;
27
- }
28
-
29
- .kts-invoice-operate-goods-list-table-tax-rate {
30
- .ktsAnt3x-select-selection-selected-value {
31
- float: right;
32
- }
33
- }
34
-
35
- .kts-invoice-operate-goods-list-able {
36
- display: flex;
37
- padding: 10px;
38
- border-bottom: 2px solid #9F613E;
39
- gap: 10px;
40
- align-items: center;
41
- height: 48px;
42
- }
43
-
44
- .ktsAntX-table {
45
-
46
- .ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell {
47
- color: #f00;
48
- }
49
-
50
- // .ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {
51
- // background: #f5f5f5;
52
- // }
53
- }
54
- }
55
-
56
- .kts-invoice-operate-goods-list-table-digtal {
57
-
58
- .ktsAnt3x-form-item-control.has-error {
59
- border: 1px solid #f00;
60
- }
61
-
62
- .kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab {
63
- .ktsAnt3x-table-row {
64
- color: rgba(0, 0, 0, 0.25);
65
- background: #f5f5f5;
66
- }
67
- }
68
-
69
- .kts-invoice-operate-goods-list-table-search-protrude {
70
- background: #ff0;
71
- color: #000;
72
- font-weight: bold;
73
- }
74
- }
@@ -1,129 +0,0 @@
1
-
2
- import React from 'react';
3
- import classnames from 'classnames';
4
- import { decorator } from 'grey-react-box';
5
- import { Form } from 'kts-components-antd-x3';
6
- import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
7
- import { FormComponentProps } from 'kts-components-antd-x3/lib/form';
8
- import Invoice from '../../..';
9
-
10
- import TableVirtual from './ui/TableVirtual';
11
- import AddRowButton from './ui/AddRowButton';
12
- import TableRow from './ui/TableRow';
13
-
14
- import useColumns from './hook/useColumns';
15
- import useOnRow from './hook/useOnRow';
16
- import useWindowClick from './hook/useWindowClick';
17
- import useRowSelection from './hook/useRowSelection';
18
-
19
- import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
20
-
21
- import './index.less';
22
-
23
- export interface IGoodsListProps {
24
-
25
- /** 产品最大数 */
26
- goodMax?: number;
27
-
28
- addressOptions: any[];
29
- vehicleTypeList:any[];
30
- /**
31
- * 地址数据字段名
32
- */
33
- fieldNames?: any;
34
-
35
- }
36
-
37
- export default class FreightList extends React.Component<IGoodsListProps> {
38
- render() {
39
- return <Main {...this.props} />
40
- }
41
- }
42
-
43
- const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Form.create())((props) => {
44
- const { form } = props;
45
- /** 控制器 */
46
- const controller = Invoice.useInvoiceController();
47
-
48
- const goodsList = controller.useMemo(s => s.freightListState.goodsList, []);
49
-
50
- /** 货物列表 */
51
- const dataSource = controller.useMemo(s => s.freightListState.goodsList, [])
52
-
53
- /** 表格行事件 */
54
- const onRow = useOnRow();
55
-
56
- /** 批量删除 */
57
- const delRowButton = useDelRowButton();
58
-
59
-
60
- useWindowClick(controller); // 点击组件外部 保存正在编辑的货物
61
-
62
- /** 注册 from 对象 */
63
- React.useEffect(() => {
64
- controller.pipeline<WrappedFormUtils>(async (s, form) => { s.freightListState = { ...s.freightListState, form } })(props.form);
65
- }, [controller, props.form]);
66
- React.useEffect(() => {
67
- controller.run(async (s) => {
68
- s.freightListState.addressFieldNames = props.fieldNames
69
- });
70
- }, [props.fieldNames])
71
- React.useEffect(() => {
72
- controller.run(async (s) => {
73
- s.freightListState.vehicleTypeList = props.vehicleTypeList
74
- });
75
- }, [props.vehicleTypeList])
76
- React.useEffect(() => {
77
- controller.run(async (s) => {
78
- s.freightListState.area = props.addressOptions
79
- });
80
- }, [props.addressOptions])
81
- // 跟新 货物
82
- React.useEffect(() => {
83
- controller.run(async (s) => {
84
- s.freightListState.goodsMap = new Map();
85
- goodsList.forEach((e) => { s.freightListState.goodsMap.set(e.$index, e); });
86
- });
87
- }, [controller, goodsList]);
88
-
89
- /** props 产品最大数 更新 */
90
- React.useEffect(() => {
91
- controller.pipeline(async s => { s.freightListState.goodMax = props.goodMax })()
92
- }, [controller, props.goodMax])
93
- // 注册 form
94
- // controller.useForm('freightInfo', form);
95
- return (
96
- <div className="kts-invoice-operate-freight">
97
- <div className='real-estate-info-digtal-label' >特殊信息-建筑服务</div>
98
- <div className="kts-invoice-operate-goods-list-digtal" onClick={(e) => { e.stopPropagation() }} >
99
- <div className="kts-invoice-operate-goods-list-able">
100
- {/* 添加行 */}
101
- <AddRowButton />
102
-
103
- {/* 批量删除 */}
104
- {delRowButton.button}
105
-
106
- <div style={{ flex: 1 }} />
107
-
108
- </div>
109
- <div className={classnames('kts-invoice-operate-goods-list-table-digtal')}>
110
- <TableVirtual
111
- size="small"
112
- rowKey="$index"
113
- pagination={false}
114
- scroll={{ y: 280 }}
115
- components={{ body: { row: TableRow } }}
116
- dataSource={dataSource}
117
- columns={useColumns(props.form)}
118
- rowSelection={useRowSelection()}
119
- onRow={record => ({
120
- onClick: () => {
121
- onRow.onClick(record);
122
- },
123
- })}
124
- />
125
- </div>
126
- </div>
127
- </div>
128
- );
129
- });