kts-component-invoice-operate 3.2.218-chinaship → 3.2.218

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.
@@ -1,10 +1,13 @@
1
1
  # 数电
2
2
 
3
- ## 简单用法
4
- <code src="./_test/easiest/index.tsx"></code>
3
+ <!-- ## 简单用法
4
+ <code src="./_test/easiest/index.tsx"></code> -->
5
5
 
6
- ## 建筑服务
7
- <code src="./_test/architecture/index.tsx"></code>
6
+ ## 不动产经营租赁服务
7
+ <code src="./_test/realEstateInfo/index.tsx"></code>
8
+
9
+ <!-- ## 建筑服务
10
+ <code src="./_test/architecture/index.tsx"></code> -->
8
11
 
9
12
  <!-- ## 只读模式
10
13
  <code src="./_test/readOnly/index.tsx"></code> -->
@@ -33,10 +36,9 @@
33
36
  ## 查看当前可用授信额度
34
37
  <code src="./_test/lineCredit/index.tsx"></code>
35
38
 
36
- ## 不动产经营租赁服务
37
- <code src="./_test/realEstateInfo/index.tsx"></code>
39
+
38
40
 
39
41
  -->
40
42
 
41
- ## 货物运输服务
42
- <code src="./_test/freight/index.tsx"></code>
43
+ <!-- ## 货物运输服务
44
+ <code src="./_test/freight/index.tsx"></code> -->
@@ -40,7 +40,7 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
40
40
 
41
41
  return (
42
42
  <div className="kts-invoice-operate-real-estate-info-digtal">
43
- <div className='real-estate-info-digtal-label' >特殊信息-建筑服务</div>
43
+ <div className='real-estate-info-digtal-label' >特定信息-建筑服务</div>
44
44
  <Row gutter={[17, 0]}>
45
45
  <Col span={6} >
46
46
  <Form.Item label='土地增值税项目编号' >
@@ -94,7 +94,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
94
94
  // controller.useForm('freightInfo', form);
95
95
  return (
96
96
  <div className="kts-invoice-operate-freight">
97
- <div className='real-estate-info-digtal-label' >特殊信息-货物运输</div>
97
+ <div className='real-estate-info-digtal-label' >特定信息-货物运输</div>
98
98
  <div className="kts-invoice-operate-goods-list-digtal" onClick={(e) => { e.stopPropagation() }} >
99
99
  <div className="kts-invoice-operate-freight-list-able">
100
100
  {/* 添加行 */}
@@ -416,7 +416,7 @@ export default (form: WrappedFormUtils) => {
416
416
  </Form.Item>
417
417
  );
418
418
  } else {
419
- return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
419
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
420
420
  }
421
421
  },
422
422
  },
@@ -458,7 +458,7 @@ export default (form: WrappedFormUtils) => {
458
458
  </Form.Item>
459
459
  );
460
460
  } else {
461
- return <span style={{ padding: '0 10px' }}>{value && formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
461
+ return <span style={{ padding: '0 10px' }}>{formatSearch(parseFloat(value).toFixed(2), searchValue)}</span>;
462
462
  }
463
463
  },
464
464
  },
@@ -518,7 +518,7 @@ export default (form: WrappedFormUtils) => {
518
518
  align: 'right',
519
519
  width: 119,
520
520
  render: (value: string, record: IGood) => {
521
- if (editGood?.$index === record.$index && !disableds.includes('taxAmount') && model !== 'prefab') {
521
+ if (editGood?.$index === record.$index && !disableds.includes('taxAmount')&& model !== 'prefab') {
522
522
  return (
523
523
  <Form.Item>
524
524
  {getFieldDecorator('taxAmount', {
@@ -532,13 +532,13 @@ export default (form: WrappedFormUtils) => {
532
532
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
533
533
  //不含税金额
534
534
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
535
- const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
535
+ const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax||0)).subtract(bignumber(value||0));
536
536
  const taxRate = editGood?.taxRate;
537
537
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
538
538
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
539
- const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
539
+ const total = lineAmountExcludeTax.multiply(bignumber(taxRate||0)).divide(bignumber(100));
540
540
  // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
541
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
541
+ if (Math.abs(total.subtract(bignumber(value||0)).done().toNumber()) <= 0.01) {
542
542
  callback();
543
543
  } else {
544
544
  callback('税额填写错误,请重新输入')
@@ -568,7 +568,7 @@ export default (form: WrappedFormUtils) => {
568
568
  </Form.Item>
569
569
  )
570
570
  } else {
571
- return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' :value && parseFloat(value).toFixed(2)}</span>;
571
+ return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : parseFloat(value).toFixed(2)}</span>;
572
572
  }
573
573
  },
574
574
  },
@@ -45,6 +45,13 @@ export default () => {
45
45
 
46
46
  /** 添加一个空货物 */
47
47
  async function addGood(controller: InvoiceController) {
48
+ await controller.formList.get('realEstateInfo')?.validateFields(async (err: any, values: any) => {
49
+ console.log(err, values)
50
+ if (err) {
51
+ message.error('请先填写发票行信息,再添加新的行');
52
+ return;
53
+ }
54
+ });
48
55
  await controller.saveEditGood();
49
56
  await controller.wait();
50
57
  await controller.run(async (s) => {
@@ -64,6 +71,7 @@ async function addGood(controller: InvoiceController) {
64
71
  return;
65
72
  }
66
73
  });
74
+
67
75
  }
68
76
  s.goodsListState.editGood = await controller.addGood({ taxRate: s.goodsListState.defaultRate, lineAttribute: LineAttributeType.正常 });
69
77
  });
@@ -12,4 +12,11 @@
12
12
  .ktsAnt3x-row.ktsAnt3x-form-item {
13
13
  margin-bottom: 0;
14
14
  }
15
+ .ktsAntX-row{
16
+ border-bottom: 1px dashed #9F613E;
17
+ &:last-child {
18
+ border-bottom: none;
19
+ }
20
+ }
21
+
15
22
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import React from "react";
2
+ import React, { useEffect } from "react";
3
3
  import { decorator } from 'grey-react-box';
4
4
  import { Form } from 'kts-components-antd-x3';
5
5
  import { FormComponentProps } from 'kts-components-antd-x3/lib/form';
@@ -36,110 +36,160 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
36
36
 
37
37
  const readOnly = React.useMemo(() => model === 'readOnly', [model]);
38
38
 
39
+ const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
40
+ const indexRef = React.useRef<any>([]);
41
+ useEffect(() => {
42
+ const dd = goodsList?.reduce((acc: any, cur: any) => {
43
+ if (cur.lineAttribute !==1) {
44
+ acc.push(cur.$index)
45
+ }
46
+ return acc
47
+ }, [])
48
+ indexRef.current = dd;
49
+ }, [goodsList, indexRef])
39
50
  // 注册 form
51
+
40
52
  controller.useForm('realEstateInfo', form);
41
-
53
+ const getList = () => {
54
+ const decrease = indexRef.current.length > goodsList.length
55
+ if (decrease) {
56
+ //已删行列表
57
+ const diff = indexRef.current.filter((item: any) => !goodsList.find(i => i.$index === item));
58
+
59
+ const formData: any[] = form.getFieldValue('realEstateDataDto');
60
+ if (Array.isArray(formData) && diff.length > 0) {
61
+
62
+ const newForm = formData?.filter(item => !diff.find((i: any) => i === item.$index));
63
+
64
+ form.setFieldsValue({
65
+ realEstateDataDto: newForm
66
+ });
67
+ } else {
68
+ form.setFieldsValue({
69
+ realEstateDataDto: undefined
70
+ });
71
+ }
72
+ }
73
+ console.log('goodsList',goodsList)
74
+ return goodsList.filter(item=>item.lineAttribute !== 1).map((item, index) => {
75
+ if (item.lineAttribute !== 1) {
76
+ return <Row gutter={[17, 0]} >
77
+ <Col span={6} >
78
+ <Form.Item style={{ display: 'none' }}>
79
+ {getFieldDecorator(`realEstateDataDto[${index}].$index`, {
80
+ initialValue: item.$index,
81
+ })(
82
+ <Input />
83
+ )}
84
+ </Form.Item>
85
+ <Form.Item label='不动产地址'>
86
+ {getFieldDecorator(`realEstateDataDto[${index}].realEstateAddress`, {
87
+ rules: readOnly ? [] : [{ required: true, message: '请选择不动产地址' }]
88
+ })(
89
+ readOnly
90
+ ? (<MyArrString />)
91
+ : (<Cascader
92
+ style={{ width: '100%' }}
93
+ options={props.realEstateAddressOptions}
94
+ fieldNames={props.realEstateAddressFieldNames}
95
+ placeholder="请选择省市区县"
96
+ />)
97
+ )}
98
+ </Form.Item>
99
+ </Col>
100
+ <Col span={6} >
101
+ <Form.Item label='详细地址' >
102
+ {getFieldDecorator(`realEstateDataDto[${index}].realEstateDetailedAddress`, {
103
+ rules: readOnly ? [] : [
104
+ { required: true, message: '请输入详细地址' },
105
+ { max: 120, message: '详细地址最多120个字符' },
106
+ {
107
+ validator: async (_, value, callback) => {
108
+ const pattern = /街|路|村|乡|镇|道|巷|号/;
109
+ if (pattern.test(value)) {
110
+ callback()
111
+ } else {
112
+ callback('地址必须包含“街”、“路”、“村”、“乡”、“镇”、“道”、“巷”、“号”等任意一个关键词')
113
+ }
114
+ }
115
+ }
116
+ ]
117
+ })(
118
+ readOnly
119
+ ? <MyDiv />
120
+ : <Input autoComplete='off' placeholder="请输入详细地址" />
121
+ )}
122
+ </Form.Item>
123
+ </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>
135
+ <Col span={6} >
136
+ <Form.Item label='跨地(市)标志' >
137
+ {getFieldDecorator(`realEstateDataDto[${index}].crossCitiesSign`, {
138
+ rules: readOnly ? [] : [
139
+ { required: true, message: '请选择跨地(市)标志' }
140
+ ]
141
+ })(
142
+ readOnly
143
+ ? <MyNY />
144
+ : <Select placeholder='请选择' style={{ width: '100%' }} >
145
+ <Select.Option value='Y'>是</Select.Option>
146
+ <Select.Option value='N'>否</Select.Option>
147
+ </Select>
148
+ )}
149
+ </Form.Item>
150
+ </Col>
151
+ <Col span={6} >
152
+ <Form.Item label='产权证书/不动产权证号' >
153
+ {getFieldDecorator(`realEstateDataDto[${index}].realEstateNumber`, {
154
+ rules: readOnly ? [] : [
155
+ { required: true, message: '请输入证书编号,若没有证书填写“无”' },
156
+ { max: 40, message: '证书编号最多40个字符' },
157
+ ]
158
+ })(
159
+ readOnly
160
+ ? <MyDiv />
161
+ : <Input autoComplete='off' placeholder="请输入证书编号,若没有证书填写“无”" />
162
+ )}
163
+ </Form.Item>
164
+ </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>
184
+ </Row>
185
+ }
186
+ })
187
+ }
42
188
  return (
43
189
  <div className="kts-invoice-operate-real-estate-info-digtal">
44
- <div className='real-estate-info-digtal-label' >特殊信息-不动产经营租赁服务</div>
45
- <Row gutter={[17, 0]}>
46
- <Col span={6} >
47
- <Form.Item label='不动产地址' >
48
- {getFieldDecorator('realEstateAddress', {
49
- rules: readOnly ? [] : [{ required: true, message: '请选择不动产地址' }]
50
- })(
51
- readOnly
52
- ? (<MyArrString />)
53
- : (<Cascader
54
- style={{ width: '100%' }}
55
- options={props.realEstateAddressOptions}
56
- fieldNames={props.realEstateAddressFieldNames}
57
- placeholder="请选择省市区县"
58
- />)
59
- )}
60
- </Form.Item>
61
- </Col>
62
- <Col span={6} >
63
- <Form.Item label='详细地址' >
64
- {getFieldDecorator('realEstateDetailedAddress', {
65
- rules: readOnly ? [] : [
66
- { required: true, message: '请输入详细地址' },
67
- { max: 120, message: '详细地址最多120个字符' },
68
- {
69
- validator: (_, value) => {
70
- const pattern = /街|路|村|乡|镇|道|巷|号/;
71
- return pattern.test(value) ? Promise.resolve() : Promise.reject('地址必须包含“街”、“路”、“村”、“乡”、“镇”、“道”、“巷”、“号”等任意一个关键词');
72
- }
73
- }
74
- ]
75
- })(
76
- readOnly
77
- ? <MyDiv />
78
- : <Input autoComplete='off' placeholder="请输入详细地址" />
79
- )}
80
- </Form.Item>
81
- </Col>
82
- <Col span={6} >
83
- <Form.Item label='租赁期起止' >
84
- {getFieldDecorator('leaseTerm', {
85
- rules: readOnly ? [] : [{ required: true, message: '请输入租赁期' }]
86
- })(
87
- readOnly
88
- ? <MyArrMoment />
89
- : <RangePicker style={{ width: '100%' }} />
90
- )}
91
- </Form.Item>
92
- </Col>
93
- <Col span={6} >
94
- <Form.Item label='跨地(市)标志' >
95
- {getFieldDecorator('crossCitiesSign', {
96
- rules: readOnly ? [] : [
97
- { required: true, message: '请选择跨地(市)标志' }
98
- ]
99
- })(
100
- readOnly
101
- ? <MyNY />
102
- : <Select placeholder='请选择' style={{ width: '100%' }} >
103
- <Select.Option value='Y'>是</Select.Option>
104
- <Select.Option value='N'>否</Select.Option>
105
- </Select>
106
- )}
107
- </Form.Item>
108
- </Col>
109
- <Col span={6} >
110
- <Form.Item label='产权证书/不动产权证号' >
111
- {getFieldDecorator('realEstateNumber', {
112
- rules: readOnly ? [] : [
113
- { required: true, message: '请输入证书编号,若没有证书填写“无”' },
114
- { max: 40, message: '证书编号最多40个字符' },
115
- ]
116
- })(
117
- readOnly
118
- ? <MyDiv />
119
- : <Input autoComplete='off' placeholder="请输入证书编号,若没有证书填写“无”" />
120
- )}
121
- </Form.Item>
122
- </Col>
123
- <Col span={6} >
124
- <Form.Item label='面积单位' >
125
- {getFieldDecorator('realEstateUnit', {
126
- rules: readOnly ? [] : [{ required: true, message: '请选择面积单位' }]
127
- })(
128
- readOnly
129
- ? <MyDiv />
130
- : <Select placeholder='请选择' style={{ width: '100%' }} >
131
- <Select.Option value="平方千米">平方千米</Select.Option>
132
- <Select.Option value="平方米">平方米</Select.Option>
133
- <Select.Option value="公顷">公顷</Select.Option>
134
- <Select.Option value="亩">亩</Select.Option>
135
- <Select.Option value="h㎡">h㎡</Select.Option>
136
- <Select.Option value="k㎡">k㎡</Select.Option>
137
- <Select.Option value="㎡">㎡</Select.Option>
138
- </Select>
139
- )}
140
- </Form.Item>
141
- </Col>
142
- </Row>
190
+ <div className='real-estate-info-digtal-label' >特定信息-不动产经营租赁服务</div>
191
+ {getList()}
192
+
143
193
  </div>
144
194
  )
145
195
  })
@@ -172,7 +222,7 @@ class MyArrMoment extends React.Component<{ value?: moment.Moment[], style?: Rea
172
222
  <div style={this.props.style}>
173
223
  <span>{moment.isMoment(value[0]) && value[0].format('YYYY-MM-DD')}</span>
174
224
  <span style={{ color: '#9F603D', fontWeight: 600 }} > - </span>
175
- <span>{moment.isMoment(value[1]) && value[0].format('YYYY-MM-DD')}</span>
225
+ <span>{moment.isMoment(value[1]) && value[1].format('YYYY-MM-DD')}</span>
176
226
  </div>
177
227
  )
178
228
  }