kts-component-invoice-operate 3.2.243 → 3.2.244

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 (66) hide show
  1. package/dist/Invoice/Invoice-digtal/_test/pay/index.d.ts +4 -0
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -0
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.d.ts +6 -0
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.d.ts +12 -0
  5. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.d.ts +21 -0
  6. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.d.ts +31 -0
  7. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +2 -0
  8. package/dist/Invoice/InvoiceController/fns/addPay.d.ts +6 -0
  9. package/dist/Invoice/InvoiceController/fns/delPay.d.ts +6 -0
  10. package/dist/Invoice/InvoiceController/fns/saveEditPay.d.ts +6 -0
  11. package/dist/Invoice/InvoiceController/fns/setEditPay.d.ts +6 -0
  12. package/dist/Invoice/InvoiceController/fns/setPay.d.ts +6 -0
  13. package/dist/Invoice/InvoiceController/index.d.ts +6 -0
  14. package/dist/Invoice/index.d.ts +2 -0
  15. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/index.d.ts +3 -0
  16. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.d.ts +8 -0
  17. package/dist/Invoice/ui/digtal/PayList/hook/useOnRow/index.d.ts +8 -0
  18. package/dist/Invoice/ui/digtal/PayList/hook/useRowSelection/index.d.ts +8 -0
  19. package/dist/Invoice/ui/digtal/PayList/hook/useWindowClick/index.d.ts +5 -0
  20. package/dist/Invoice/ui/digtal/PayList/index.d.ts +18 -0
  21. package/dist/Invoice/ui/digtal/PayList/ui/AddRowButton/index.d.ts +3 -0
  22. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +6 -0
  23. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +6 -0
  24. package/dist/Invoice/ui/digtal/PayList/ui/TableRow/index.d.ts +3 -0
  25. package/dist/Invoice/ui/digtal/PayList/ui/TableVirtual/index.d.ts +4 -0
  26. package/dist/index.esm.js +8763 -5735
  27. package/dist/index.js +8762 -5734
  28. package/package.json +1 -1
  29. package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +40 -8
  30. package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +23 -17
  31. package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +14637 -0
  32. package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +47 -0
  33. package/src/Invoice/Invoice-digtal/index.md +7 -6
  34. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +11 -0
  35. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +1 -0
  36. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.ts +10 -0
  37. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.ts +35 -0
  38. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.ts +81 -0
  39. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.ts +40 -0
  40. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +3 -0
  41. package/src/Invoice/InvoiceController/fns/addPay.ts +11 -0
  42. package/src/Invoice/InvoiceController/fns/delPay.ts +38 -0
  43. package/src/Invoice/InvoiceController/fns/saveEditPay.ts +23 -0
  44. package/src/Invoice/InvoiceController/fns/setEditPay.ts +16 -0
  45. package/src/Invoice/InvoiceController/fns/setPay.ts +11 -0
  46. package/src/Invoice/InvoiceController/index.ts +21 -0
  47. package/src/Invoice/index.tsx +3 -0
  48. package/src/Invoice/tools/useToGenerateId/index.ts +2 -0
  49. package/src/Invoice/ui/digtal/PayList/hook/useColumns/dist/index.js +616 -0
  50. package/src/Invoice/ui/digtal/PayList/hook/useColumns/index.tsx +168 -0
  51. package/src/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.tsx +20 -0
  52. package/src/Invoice/ui/digtal/PayList/hook/useOnRow/index.tsx +37 -0
  53. package/src/Invoice/ui/digtal/PayList/hook/useRowSelection/index.tsx +120 -0
  54. package/src/Invoice/ui/digtal/PayList/hook/useWindowClick/index.tsx +19 -0
  55. package/src/Invoice/ui/digtal/PayList/index.less +73 -0
  56. package/src/Invoice/ui/digtal/PayList/index.tsx +132 -0
  57. package/src/Invoice/ui/digtal/PayList/ui/AddRowButton/index.tsx +75 -0
  58. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +50 -0
  59. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +37 -0
  60. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.less +29 -0
  61. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.tsx +21 -0
  62. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.less +39 -0
  63. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.tsx +109 -0
  64. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +246 -37
  65. package/src/Invoice/ui/digtal/StakeFarmerholder/index.less +1 -1
  66. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +809 -204
@@ -0,0 +1,37 @@
1
+
2
+ import Invoice from '../../../../../../..';
3
+ import { Button, Popconfirm } from "kts-xui"
4
+ import React from "react"
5
+
6
+ /** 清空重填 */
7
+ export default () => {
8
+
9
+ const controller = Invoice.useInvoiceController();
10
+
11
+ const model = controller.useMemo(s => s.model, []);
12
+
13
+ const confirm = React.useCallback(() => {
14
+ controller.run(async s => {
15
+ s.payListState.goodsList = [];
16
+ s.payListState.goodsMap = new Map();
17
+ s.payListState.selectedGoodIndex = [];
18
+ })
19
+ }, [controller])
20
+
21
+ const button = React.useMemo(() => {
22
+ if (model === 'readOnly') return <></>;
23
+ if (model === 'prefab') return <></>;
24
+ return (
25
+ <Popconfirm
26
+ title="将要清空所有项目信息,是否继续"
27
+ onConfirm={confirm}
28
+ okText="确定"
29
+ cancelText="取消"
30
+ >
31
+ <Button size='small' >清空重填</Button>
32
+ </Popconfirm>
33
+ )
34
+ }, [model, confirm])
35
+
36
+ return { button }
37
+ }
@@ -0,0 +1,29 @@
1
+ .kts-invoice-operate-goods-list-itemName-drag-container-u {
2
+ position: relative;
3
+
4
+ &::after {
5
+ content : " ";
6
+ width : 100%;
7
+ height : 2px;
8
+ background: #0074ff;
9
+ position : absolute;
10
+ left : 0;
11
+ top : 0;
12
+ z-index : 9999;
13
+ }
14
+ }
15
+
16
+ .kts-invoice-operate-goods-list-itemName-drag-container-d {
17
+ position: relative;
18
+
19
+ &::after {
20
+ content : " ";
21
+ width : 100%;
22
+ height : 2px;
23
+ background: #0074ff;
24
+ position : absolute;
25
+ left : 0;
26
+ bottom : 0;
27
+ z-index : 9999;
28
+ }
29
+ }
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import Invoice from '../../../../..';
3
+ import { LineAttributeType } from '../../../../../InvoiceController'
4
+ import classnames from 'classnames'
5
+ import './index.less'
6
+
7
+ export default function TableRow(props: any) {
8
+
9
+ const rowKey = props['data-row-key']
10
+
11
+
12
+
13
+
14
+ return <tr
15
+ {...props}
16
+ className={classnames(
17
+ props.className,
18
+ )}
19
+ />
20
+
21
+ }
@@ -0,0 +1,39 @@
1
+ .kts-invoice-operate-goods-table-virtual {
2
+
3
+ .ktsAntX-table-body {
4
+ height: 280px;
5
+ }
6
+
7
+ .ktsAntX-table.ktsAntX-table-bordered>.ktsAntX-table-container>.ktsAntX-table-header>table>thead>tr>th {
8
+ padding : 0 10px;
9
+ height : 32px;
10
+ background: #f4f4f4;
11
+ }
12
+
13
+ .ktsAntX-table.ktsAntX-table-bordered>.ktsAntX-table-container>.ktsAntX-table-body>table>tbody>tr>td {
14
+ padding: 0;
15
+ height : 32px;
16
+ }
17
+
18
+ .ktsAntX-table .ktsAntX-table-body {
19
+ position: relative;
20
+ }
21
+
22
+ .ktsAntX-table .ktsAntX-table-body>table {
23
+ position: absolute;
24
+ left : 0;
25
+ top : 0;
26
+ }
27
+
28
+ .ktsAntX-table .ktsAntX-table-tbody {
29
+ position: relative;
30
+ }
31
+
32
+ .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-inner {
33
+ width : 16px;
34
+ height : 16px;
35
+ border : 1px solid #d9d9d9;
36
+ border-radius: 2px;
37
+ top : 1px;
38
+ }
39
+ }
@@ -0,0 +1,109 @@
1
+
2
+ import React from "react";
3
+ import { TableManual, TableProps } from "kts-xui";
4
+ import { Table } from 'kts-components-antd-x4-v4';
5
+ import './index.less';
6
+
7
+ export default function <T extends object = any>(props: TableProps<T>) {
8
+
9
+ const [self, setSelf] = React.useState<HTMLSpanElement | null>(null);
10
+
11
+ const tableBody = React.useMemo(() => {
12
+ if (!self) return;
13
+ return self.querySelector('.ktsAntX-table-body') as HTMLDivElement;
14
+ }, [self]);
15
+
16
+ /** 显示指针 */
17
+ const [pointer, setPointer] = React.useState(0);
18
+
19
+ /** 行高 */
20
+ const rowHeight = React.useMemo(() => {
21
+ if (!self) return 50;
22
+
23
+ const td = self.querySelector('.ktsAntX-table-tbody .ktsAntX-table-row');
24
+ if (!td) return 50;
25
+
26
+ return td.clientHeight;
27
+ }, [self, props.dataSource]);
28
+
29
+ /** 间隔容器 */
30
+ const placeholder = React.useMemo(() => {
31
+ if (!self || !tableBody) return;
32
+ let placeholder = tableBody.querySelector('.table-virtual-placeholder') as HTMLDivElement;
33
+ if (!placeholder) {
34
+ placeholder = document.createElement('div');
35
+ placeholder.className = 'table-virtual-placeholder';
36
+ tableBody.appendChild(placeholder);
37
+ }
38
+ return placeholder;
39
+ }, [self, tableBody]);
40
+
41
+ // 设置占位dom的搞
42
+ const placeholderHeight = React.useMemo(() => {
43
+ if (!self || !rowHeight || !props.dataSource || !placeholder) return;
44
+ const placeholderHeight = rowHeight * props.dataSource.length;
45
+ placeholder.style.height = `${placeholderHeight}px`;
46
+ return placeholderHeight;
47
+ }, [self, rowHeight, props.dataSource, placeholder]);
48
+
49
+ /** 可以容纳的行数 */
50
+ const rowSize = React.useMemo(() => {
51
+ if (!tableBody! || !rowHeight) return 0;
52
+ return Math.ceil(tableBody.clientHeight / rowHeight);
53
+ }, [tableBody, rowHeight, placeholderHeight]);
54
+
55
+ // 计算渲染的行
56
+ const dataSource = React.useMemo(() => {
57
+ if (!props.dataSource) return [];
58
+ if (props.dataSource.length < 10) return props.dataSource;
59
+
60
+ if (!rowSize) return [props.dataSource[0]];
61
+ return props.dataSource?.slice(pointer, pointer + 2 * rowSize);
62
+ }, [props.dataSource, pointer, rowSize]);
63
+
64
+ // 监听滚动
65
+ React.useEffect(() => {
66
+ if (!self || !placeholder || !props.dataSource || !rowHeight || !tableBody || props.dataSource.length < 10)
67
+ return;
68
+
69
+ const onScroll = () => {
70
+ if (!props.dataSource || !tableBody) return;
71
+ setPointer(Math.floor((props.dataSource.length - rowSize) * (tableBody.scrollTop / (placeholder.clientHeight - tableBody.clientHeight))));
72
+ };
73
+ onScroll();
74
+
75
+ tableBody.addEventListener('scroll', onScroll);
76
+ return () => {
77
+ tableBody.removeEventListener('scroll', onScroll);
78
+ };
79
+ }, [self, placeholder, props.dataSource, rowHeight, rowSize]);
80
+
81
+ // 移动列表
82
+ React.useEffect(() => {
83
+ if (!self) return;
84
+
85
+ const table = self.querySelector('.ktsAntX-table .ktsAntX-table-body>table') as HTMLDivElement;
86
+ if (!table) return;
87
+
88
+ table.style.top = `${pointer * rowHeight}px`;
89
+ }, [pointer, self, rowHeight]);
90
+
91
+ React.useEffect(() => {
92
+ if (!self) return;
93
+ const cont = self.querySelector('.kts-invoice-operate-goods-table-virtual .ktsAntX-table-body');
94
+ if (!cont) return;
95
+
96
+ cont.scrollTop = 0;
97
+ }, [props.dataSource?.length])
98
+
99
+ return (
100
+ <span className="kts-invoice-operate-goods-table-virtual" ref={(e) => { setSelf(e) }} >
101
+ <TableManual
102
+ {...props}
103
+ dataSource={dataSource}
104
+ // 新版本Table会有输入框无法连续输入的问题,先兼容老版本
105
+ tableComponent={Table as any}
106
+ />
107
+ </span>
108
+ )
109
+ }
@@ -1,11 +1,11 @@
1
1
 
2
2
  import React, { useEffect } from "react";
3
3
  import { decorator } from 'grey-react-box';
4
- import { Form } from 'kts-components-antd-x3';
4
+ import { Form, message } from 'kts-components-antd-x3';
5
5
  import { FormComponentProps } from 'kts-components-antd-x3/lib/form';
6
6
  import Invoice from '../../..';
7
7
  import './index.less';
8
- import { Cascader, Col, DatePicker, Input, Row, Select } from "kts-components-antd-x4";
8
+ import { Button, Cascader, Col, DatePicker, Input, Row, Select } from "kts-components-antd-x4";
9
9
  import moment from "moment";
10
10
 
11
11
  const { RangePicker } = DatePicker;
@@ -37,10 +37,24 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
37
37
  const readOnly = React.useMemo(() => model === 'readOnly', [model]);
38
38
 
39
39
  const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
40
+ //outcome-104 任务 https://wiki.dev.kingxunlian.com/pages/viewpage.action?pageId=180355189
41
+ //商品和服务税收分类合并编码为“3040502020200000000”时,视为停车费业务,针对停车费业务,蓝字发票增加以下判断:
42
+ // 单位必须为“平方米”;
43
+ // 项目名称必须为“车辆停放服务”;
44
+ // 车牌号必填,最多支持填写3个车牌号;除该场景车牌号必须为空;
45
+ // 租赁期起止格式必须为“yyyy-MM-dd HH:mm(租赁期起)”+“空格”+“yyyy-MM-dd HH:mm(租赁期止)。
46
+ const isParkFee = React.useCallback((taxClassificationCode?: string) => {
47
+ if (taxClassificationCode === '3040502020200000000') {
48
+ return true
49
+ } else {
50
+ return false;
51
+ }
52
+ }, [])
53
+
40
54
  const indexRef = React.useRef<any>([]);
41
55
  useEffect(() => {
42
56
  const dd = goodsList?.reduce((acc: any, cur: any) => {
43
- if (cur.lineAttribute !==1) {
57
+ if (cur.lineAttribute !== 1) {
44
58
  acc.push(cur.$index)
45
59
  }
46
60
  return acc
@@ -48,7 +62,7 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
48
62
  indexRef.current = dd;
49
63
  }, [goodsList, indexRef])
50
64
  // 注册 form
51
-
65
+
52
66
  controller.useForm('realEstateInfo', form);
53
67
  const getList = () => {
54
68
  const decrease = indexRef.current.length > goodsList.length
@@ -70,9 +84,9 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
70
84
  });
71
85
  }
72
86
  }
73
- console.log('goodsList',goodsList)
74
- return goodsList.filter(item=>item.lineAttribute !== 1).map((item, index) => {
87
+ return goodsList.filter(item => item.lineAttribute !== 1).map((item, index) => {
75
88
  if (item.lineAttribute !== 1) {
89
+ const isParkFeeItem = isParkFee(item.taxClassificationCode)
76
90
  return <Row gutter={[17, 0]} >
77
91
  <Col span={6} >
78
92
  <Form.Item style={{ display: 'none' }}>
@@ -121,17 +135,31 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
121
135
  )}
122
136
  </Form.Item>
123
137
  </Col>
124
- <Col span={6} >
125
- <Form.Item label='租赁期起止' >
126
- {getFieldDecorator(`realEstateDataDto[${index}].leaseTerm`, {
127
- rules: readOnly ? [] : [{ required: true, message: '请输入租赁期' }]
128
- })(
129
- readOnly
130
- ? <MyArrMoment />
131
- : <RangePicker style={{ width: '100%' }} />
132
- )}
133
- </Form.Item>
134
- </Col>
138
+ {!isParkFeeItem &&
139
+ <Col span={6} >
140
+ <Form.Item label='租赁期起止' >
141
+ {getFieldDecorator(`realEstateDataDto[${index}].leaseTerm`, {
142
+ rules: readOnly ? [] : [{ required: true, message: '请输入租赁期' }]
143
+ })(
144
+ readOnly
145
+ ? <MyArrMoment />
146
+ : <RangePicker style={{ width: '100%' }} />
147
+ )}
148
+ </Form.Item>
149
+ </Col>}
150
+ {isParkFeeItem &&
151
+ <Col span={6} >
152
+ <Form.Item label='租赁期起止' >
153
+ {getFieldDecorator(`realEstateDataDto[${index}].leaseTerm`, {
154
+ rules: readOnly ? [] : [{ required: true, message: '请输入租赁期' }]
155
+ })(
156
+ readOnly
157
+ ? <MyArrMomentTime />
158
+ : <RangePicker style={{ width: '100%' }} showTime={{ format: 'HH:mm' }} format="YYYY-MM-DD HH:mm" />
159
+ )}
160
+ </Form.Item>
161
+ </Col>
162
+ }
135
163
  <Col span={6} >
136
164
  <Form.Item label='跨地(市)标志' >
137
165
  {getFieldDecorator(`realEstateDataDto[${index}].crossCitiesSign`, {
@@ -162,25 +190,56 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
162
190
  )}
163
191
  </Form.Item>
164
192
  </Col>
165
- <Col span={6} >
166
- <Form.Item label='面积单位' >
167
- {getFieldDecorator(`realEstateDataDto[${index}].realEstateUnit`, {
168
- rules: readOnly ? [] : [{ required: true, message: '请选择面积单位' }]
169
- })(
170
- readOnly
171
- ? <MyDiv />
172
- : <Select placeholder='请选择' style={{ width: '100%' }} >
173
- <Select.Option value="平方千米">平方千米</Select.Option>
174
- <Select.Option value="平方米">平方米</Select.Option>
175
- <Select.Option value="公顷">公顷</Select.Option>
176
- <Select.Option value="">亩</Select.Option>
177
- <Select.Option value="h㎡">h㎡</Select.Option>
178
- <Select.Option value="k㎡">k㎡</Select.Option>
179
- <Select.Option value="㎡">㎡</Select.Option>
180
- </Select>
181
- )}
182
- </Form.Item>
183
- </Col>
193
+ {!isParkFeeItem &&
194
+ <Col span={6} >
195
+ <Form.Item label='面积单位' >
196
+ {getFieldDecorator(`realEstateDataDto[${index}].realEstateUnit`, {
197
+ rules: readOnly ? [] : [{ required: true, message: '请选择面积单位' }]
198
+ })(
199
+ readOnly
200
+ ? <MyDiv />
201
+ : <Select placeholder='请选择' style={{ width: '100%' }} >
202
+ <Select.Option value="平方千米">平方千米</Select.Option>
203
+ <Select.Option value="平方米">平方米</Select.Option>
204
+ <Select.Option value="公顷">公顷</Select.Option>
205
+ <Select.Option value="">亩</Select.Option>
206
+ <Select.Option value="h㎡">h㎡</Select.Option>
207
+ <Select.Option value="k㎡">k㎡</Select.Option>
208
+ <Select.Option value="㎡">㎡</Select.Option>
209
+ </Select>
210
+ )}
211
+ </Form.Item>
212
+ </Col>
213
+ }
214
+ {isParkFeeItem &&
215
+ <Col span={6} >
216
+ <Form.Item label='面积单位' >
217
+ {getFieldDecorator(`realEstateDataDto[${index}].realEstateUnit`, {
218
+ rules: readOnly ? [] : [{ required: true, message: '请选择面积单位' }]
219
+ })(
220
+ readOnly
221
+ ? <MyDiv />
222
+ : <Select placeholder='请选择' style={{ width: '100%' }} >
223
+ <Select.Option value="平方米">平方米</Select.Option>
224
+ </Select>
225
+ )}
226
+ </Form.Item>
227
+ </Col>
228
+ }
229
+ {isParkFeeItem &&
230
+ <LicensePlateNumber form={form} index={index} cd={item.cd} readOnly={readOnly} />
231
+ // <Col span={6} >
232
+ // <Form.Item label='车牌号' >
233
+ // {getFieldDecorator(`realEstateDataDto[${index}].licensePlateNumber`, {
234
+ // rules: readOnly ? [] : [{ required: true, message: '请选择面积单位' }]
235
+ // })(
236
+ // readOnly
237
+ // ? <MyDiv />
238
+ // : <LicensePlateNumber form={form}/>
239
+ // )}
240
+ // </Form.Item>
241
+ // </Col>
242
+ }
184
243
  </Row>
185
244
  }
186
245
  })
@@ -227,7 +286,18 @@ class MyArrMoment extends React.Component<{ value?: moment.Moment[], style?: Rea
227
286
  )
228
287
  }
229
288
  }
230
-
289
+ class MyArrMomentTime extends React.Component<{ value?: moment.Moment[], style?: React.CSSProperties }> {
290
+ render(): React.ReactNode {
291
+ const { value = [] } = this.props
292
+ return (
293
+ <div style={this.props.style}>
294
+ <span>{moment.isMoment(value[0]) && value[0].format('YYYY-MM-DD HH:mm')}</span>
295
+ <span style={{ color: '#9F603D', fontWeight: 600 }} > - </span>
296
+ <span>{moment.isMoment(value[1]) && value[1].format('YYYY-MM-DD HH:mm')}</span>
297
+ </div>
298
+ )
299
+ }
300
+ }
231
301
  class MyNY extends React.Component<{ value?: 'Y' | 'N', style?: React.CSSProperties }> {
232
302
  render(): React.ReactNode {
233
303
  return (
@@ -239,4 +309,143 @@ class MyNY extends React.Component<{ value?: 'Y' | 'N', style?: React.CSSPropert
239
309
  )
240
310
  }
241
311
  }
312
+ interface PriceInputProps {
313
+ // value?: string[];
314
+ // style?: React.CSSProperties
315
+ // onChange?: (value: string[]) => void;
316
+ form: any,
317
+ index: number
318
+ cd?: number
319
+ readOnly: boolean
320
+ }
321
+ const LicensePlateNumber: React.FC<PriceInputProps> = (props) => {
322
+
323
+ const { form, readOnly } = props;
324
+
325
+ const { getFieldDecorator } = form;
326
+ const licenceLimit = 3; // 最多支持填写3个车牌号
327
+ const formData: any[] = form.getFieldValue('realEstateDataDto');
328
+ const [value, setVal] = React.useState(new Array(props.cd || 1).fill(''));
329
+ const cd = React.useMemo(() => formData[props.index]?.cd, [formData[props.index]?.cd])
330
+ // useEffect(() => {
331
+ // if (cd) {
332
+ // const dd = value.concat(new Array(cd.length-1).fill(''))
333
+ // setVal(dd);
334
+ // }
335
+ // }, [cd])
336
+ const onAdd = () => {
337
+ if (value.length < licenceLimit) {
338
+ setVal([...value, '']);
339
+ }else{
340
+ message.warn('最多支持填写3个车牌号')
341
+ }
342
+ }
343
+ // 删除车牌号
344
+ const onDelete = () => {
345
+ if (value.length > 0) {
346
+ const dd = value.slice(0, -1)
347
+ setVal(dd);
348
+ }
349
+ }
350
+
351
+ return <>
352
+ {
353
+ value.length > 0 && value.map((item: string[], key: number) => {
354
+
355
+ return <Col span={6} ><Form.Item label='车牌号' key={key}>
356
+ {getFieldDecorator(`realEstateDataDto[${props.index}].cphList[${key}]`, {
357
+ rules: readOnly ? [] : [{ required: true, message: '请输入车牌号,最多20位' }]
358
+ })(
359
+ readOnly
360
+ ? <MyDiv /> :
361
+ <Input style={{ width: '100%' }} maxLength={20} autoComplete='off' placeholder="请输入车牌号" />
362
+ )}
363
+ </Form.Item>
364
+ </Col>
365
+ })
366
+
367
+
368
+ }
369
+ {/* <Col span={6} style={{ display: 'none' }}><Form.Item label='长度' >
370
+ {getFieldDecorator(`realEstateDataDto[${props.index}].cd`, {
371
+
372
+ })(
373
+ <Select />
374
+ )}
375
+ </Form.Item>
376
+ </Col> */}
377
+ {!readOnly &&
378
+ <Col span={6} >
379
+ <Form.Item >
380
+ <div style={{ color: 'white' }}>1</div>
381
+ <a style={{ marginRight: 10 }} onClick={onAdd}>添加车牌号</a>
382
+ {value.length > 1 && <a onClick={onDelete}>删除</a>}
383
+ </Form.Item>
384
+ </Col>
385
+ }
386
+ </>
387
+ }
388
+
389
+
390
+ // const LicensePlateNumber: React.FC<PriceInputProps> = (props) => {
391
+
392
+ // const { form } = props;
393
+
394
+ // const { getFieldDecorator } = form;
395
+ // const licenceLimit = 3; // 最多支持填写3个车牌号
396
+ // // const { value = [] } = this.props;
397
+ // const [value, setVal] = React.useState(props.value || ['']);
398
+ // // const newArr = value.filter(e => !!e);
399
+ // const newArrLength = value.length;
400
+ // console.log(value, newArrLength)
401
+ // // 新增车牌号
402
+ // const onAdd = () => {
403
+ // if (newArrLength < licenceLimit) {
404
+ // setVal([...value, '']);
405
+ // props.onChange?.([...value, ''])
406
+ // }
407
+ // }
408
+ // // 删除车牌号
409
+ // const onDelete = () => {
410
+ // if (newArrLength > 0) {
411
+ // const dd = value.slice(0, -1)
412
+ // setVal(dd);
413
+ // props.onChange?.(dd)
414
+ // }
415
+ // }
416
+ // const onInputChange = (e: React.ChangeEvent<HTMLInputElement>, index: number) => {
417
+ // console.log(e.target.value);
418
+ // const dd = value.map((item, i) => {
419
+ // if (i === index) {
420
+ // return e.target.value
421
+ // }
422
+ // return item
423
+ // })
424
+ // setVal(dd);
425
+ // props.onChange?.(dd)
426
+
427
+
428
+ // }
429
+ // return (
430
+
431
+ // <>
432
+ // {newArrLength > 0 && value.map((item, index) => {
433
+ // return
434
+ // <Form.Item label='车牌号' >
435
+ // {getFieldDecorator(`realEstateDataDto[${index}].licensePlateNumber`, {
436
+ // rules: [{ required: true, }]
437
+ // })(
438
+ // <Input onChange={(e) => { onInputChange(e, index) }} key={index} style={{ width: '100%' }} autoComplete='off' placeholder="请输入车牌号" />
439
+ // )}
440
+ // </Form.Item>
441
+ // // <Col span={6} >
442
+ // // <Input onChange={(e) => { onInputChange(e, index) }} key={index} style={{ width: '100%' }} autoComplete='off' placeholder="请输入车牌号" />
443
+ // // </Col>
444
+ // })}
445
+
446
+ // <Button type="link" onClick={onAdd}>添加车牌号</Button>
447
+ // {newArrLength > 1 && <Button type="link" onClick={onDelete}>删除</Button>}
448
+ // </>
242
449
 
450
+ // )
451
+ // }
@@ -1,4 +1,4 @@
1
- .kts-invoice-operate-invoice-digtal-stakeholder {
1
+ .kts-invoice-operate-invoice-digtal-stakeholder,.kts-invoice-operate-invoice-digtal-payinfo {
2
2
 
3
3
  display: flex;
4
4