kts-component-invoice-operate 3.2.181-2 → 3.2.181-21

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 (27) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.d.ts +1 -0
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -0
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  4. package/dist/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.d.ts +1 -1
  5. package/dist/index.esm.js +961 -387
  6. package/dist/index.js +952 -378
  7. package/package.json +1 -1
  8. package/src/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.tsx +7 -0
  9. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +2 -0
  10. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +2 -1
  11. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +1 -1
  12. package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +2 -3
  13. package/src/Invoice/tools/calculate/index.ts +1 -1
  14. package/src/Invoice/ui/default/Buyer/ui/BuyerNameInput/index.tsx +2 -2
  15. package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +1 -2
  16. package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +92 -36
  17. package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +43 -14
  18. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +4 -1
  19. package/src/Invoice/ui/default/GoodsList/index.tsx +6 -6
  20. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +449 -139
  21. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +3 -3
  22. package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/index.tsx +1 -1
  23. package/src/Invoice/ui/default/ImportBuyerDrawer/index.tsx +1 -1
  24. package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +27 -14
  25. package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +9 -2
  26. package/src/Invoice/ui/digtal/Sign/index.tsx +2 -2
  27. package/src/Invoice/ui/digtal/Stakeholder/index.tsx +28 -17
@@ -49,8 +49,8 @@ const DrawerBody = () => {
49
49
 
50
50
  // const [editGood] = React.useState(controller.state.goodsListState.editGood);
51
51
 
52
- React.useEffect(() => { controller.getGoodsList && controller.getGoodsList({ pagination: { current: 1 } }) }, [controller]);
53
-
52
+ React.useEffect(() => { controller.getGoodsList && controller.getGoodsList({ pagination: { current: 1 } }) }, [controller]);
53
+ const roundTo8Decimals = (num:number) => Math.round(num * 1e8) / 1e8;
54
54
  return (
55
55
  <Table
56
56
  bordered
@@ -76,29 +76,43 @@ const DrawerBody = () => {
76
76
  record.lineAmountExcludeTax = undefined;
77
77
  record.lineAmountIncludeTax = undefined;
78
78
 
79
+ // console.log('s.goodsListState.editGood1:', s.goodsListState.editGood);
80
+ // 光电定制化功能:无论是否有值都替换 itemCode, itemName, shorthand, taxCategoryCode, taxClassificationCode;
81
+ // 如果其他输入框有值就不替换,没值就替换:itemModelName, lineAmountExcludeTax, lineAmountIncludeTax,lineAttribute,priceExcludeTax,
82
+ // priceIncludeTax,quantity, serialNo, taxAmount, taxRate, unit
79
83
  // 中间数据
80
84
  const between = { ...record };
85
+ // console.log(':between:', between);
81
86
  between.itemName = getItemName(record, s.goodsListState.editGood);
82
87
  between.itemCode = getItemCode(record, s.goodsListState.editGood);
83
88
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood);
84
-
85
89
  // 设置编辑货物
86
90
  const editGood: IGood = s.goodsListState.editGood = {
87
91
  ...s.goodsListState.editGood,
88
- itemModelName: undefined,
89
- itemModelNameSelf: undefined,
90
- ...between
91
- };
92
-
92
+ // itemModelName: undefined,
93
+ // itemModelNameSelf: undefined,
94
+ ...between,
95
+ itemModelName:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
96
+ itemModelNameSelf:s.goodsListState.editGood?.itemModelNameSelf ?? between.itemModelNameSelf,
97
+ lineAmountExcludeTax:s.goodsListState.editGood?.lineAmountExcludeTax ?? between.lineAmountExcludeTax,
98
+ lineAmountIncludeTax:s.goodsListState.editGood?.lineAmountIncludeTax ?? between.lineAmountIncludeTax,
99
+ priceExcludeTax:roundTo8Decimals(s.goodsListState.editGood?.priceExcludeTax ?? between.priceExcludeTax),
100
+ priceIncludeTax:roundTo8Decimals(s.goodsListState.editGood?.priceIncludeTax ?? between.priceIncludeTax),
101
+ quantity:s.goodsListState.editGood?.quantity ?? between.quantity,
102
+ unit:s.goodsListState.editGood?.unit ?? between.unit,
103
+ // serialNo:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
104
+ // taxAmount:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
105
+ // taxRate:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
106
+ // lineAttribute:s.goodsListState.editGood?.lineAttribute,
107
+ };
93
108
  if (editGood.taxRate) {
94
109
  editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
95
- }
96
-
110
+ }
97
111
  if (`${editGood.priceIncludeTax}` === '0') {
98
112
  editGood.priceIncludeTax = undefined;
99
113
  editGood.priceExcludeTax = undefined;
100
- } else {
101
- editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
114
+ } else {
115
+ editGood.priceExcludeTax = editGood.priceExcludeTax || getPriceExcludeTax(editGood, record, 8) as number;
102
116
  }
103
117
 
104
118
  if (editGood.quantity && editGood.priceIncludeTax) {
@@ -119,8 +133,7 @@ const DrawerBody = () => {
119
133
  // s.goodsListState.form.setFieldsValue({
120
134
  // ...editGood,
121
135
  // });
122
- // }
123
-
136
+ // }
124
137
  s.goodsListState.importGoods.isVisibleDrawer = false;
125
138
  s.goodsListState.isTaxIncluded
126
139
  ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
@@ -167,7 +167,10 @@ function AddDiscountRowDrawer(props: {
167
167
 
168
168
  /** 表单变化 */
169
169
  const onChangeForm = React.useCallback(async () => {
170
- setFormValues(form.getFieldsValue())
170
+ // setFormValues(form.getFieldsValue())
171
+ // 仅在输入框值变化时更新 formValues
172
+ const values = await form.getFieldsValue();
173
+ setFormValues(values);
171
174
  }, [form])
172
175
 
173
176
  /** 点击了确认 */
@@ -230,7 +233,8 @@ function AddDiscountRowDrawer(props: {
230
233
  React.useEffect(() => {
231
234
  if (open) {
232
235
  form.resetFields();
233
- setFormValues(form.getFieldsValue())
236
+ form.setFieldsValue({ discolineType: '1', discolineValue: undefined }); // 强制设置初始值
237
+ setFormValues({ discolineType: '1' }); // 强制设置formValues的初始状态
234
238
  }
235
239
  }, [open])
236
240
 
@@ -257,6 +261,9 @@ function AddDiscountRowDrawer(props: {
257
261
  form={form}
258
262
  layout='vertical'
259
263
  onChange={onChangeForm}
264
+ initialValues={{
265
+ discolineType: '1',
266
+ }}
260
267
  >
261
268
  <Form.Item label='商品金额(含税)' >
262
269
  {totalAmount.toFixed(2)}(共 {discountGood.length} 行)
@@ -13,7 +13,8 @@ export interface IBuyerProps {
13
13
  defaultRemark?: string;
14
14
 
15
15
  /** 默认开票人 */
16
- defaultIssuer?: string;
16
+ defaultIssuer?: string;
17
+
17
18
  }
18
19
 
19
20
  export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.create())((props) => {
@@ -79,7 +80,6 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
79
80
  initialValue: props.defaultRemark
80
81
  })(<Input.TextArea readOnly={isReadOnly('remarks')} autoSize placeholder='请输入' />)}
81
82
  </Form.Item>
82
-
83
83
  <Form.Item label="开票人" >
84
84
  {getFieldDecorator('drawer', {
85
85
  initialValue: props.defaultIssuer
@@ -146,7 +146,10 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
146
146
  }
147
147
  </div>
148
148
  <div>
149
- <div style={{ marginTop: 20 }} className='natural-person-flag' >
149
+
150
+ <Form className="digtal-stakeholder-form" >
151
+ <Row gutter={[16, 0]} className='natural-person-flag' style={{paddingRight: 0}} >
152
+ <Col span={24} style={{ display: 'flex', marginBottom: '15px' }} >
150
153
  {
151
154
  props.isNaturalPerson === true &&
152
155
  <Form.Item colon={false}>
@@ -156,8 +159,17 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
156
159
  )}
157
160
  </Form.Item>
158
161
  }
159
- </div>
160
- <Form className="digtal-stakeholder-form" >
162
+ <div style={{flex: 1}}>
163
+ <Form.Item label='客户代码' colon={false}>
164
+ {getFieldDecorator('buyerCode', {
165
+ rules: [{ required: true, message: '客户代码必填' }],
166
+ })(
167
+ <Input style={{width: '100%'}} />
168
+ )}
169
+ </Form.Item>
170
+ </div>
171
+ </Col>
172
+ </Row>
161
173
  <Row gutter={[16, 0]}>
162
174
  <Col span={24} >
163
175
  <Form.Item label='名称' colon={false}>
@@ -200,7 +212,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
200
212
  </Form.Item>
201
213
  </Col>
202
214
 
203
- <Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
215
+ <Col span={10 + riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
204
216
  <Form.Item label='购买方地址' colon={false}>
205
217
  {getFieldDecorator('buyerAddress', {
206
218
  rules: getRules('buyerAddress', [{ max: 100, message: '购买方地址内容超长' }])
@@ -208,7 +220,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
208
220
  </Form.Item>
209
221
  </Col>
210
222
 
211
- <Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
223
+ <Col span={10 + riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
212
224
  <Form.Item label='电话' colon={false} className='telephone'>
213
225
  {getFieldDecorator('buyerPhone', {
214
226
  rules: getRules('buyerPhone', RULES.buyerTelPhone('购买方电话'))
@@ -232,10 +244,10 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
232
244
  </Col>
233
245
  {(props.leqi) &&
234
246
  <Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
235
- <Form.Item colon={false}>
247
+ <Form.Item colon={false}>
236
248
  {getFieldDecorator('buyerBankAccountFlag', {
237
249
  valuePropName: 'checked',
238
- })(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('buyerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
250
+ })(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('buyerBankAccountFlag')} style={{ whiteSpace: 'nowrap' }}>是否展示</Checkbox>)}
239
251
  </Form.Item>
240
252
  </Col>
241
253
  }
@@ -281,7 +293,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
281
293
  </Form.Item>
282
294
  </Col>
283
295
 
284
- <Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
296
+ <Col span={10 + riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
285
297
  <Form.Item label='销售方地址' colon={false}>
286
298
  {getFieldDecorator('sellerAddress', {
287
299
  rules: getRules('sellerAddress', [{ max: 300, message: '销售方地址内容超长' }])
@@ -289,7 +301,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
289
301
  </Form.Item>
290
302
  </Col>
291
303
 
292
- <Col span={10+riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
304
+ <Col span={10 + riskspanW} style={{ display: isExpand ? undefined : 'none' }} >
293
305
  <Form.Item label='电话' colon={false} className='telephone' >
294
306
  {getFieldDecorator('sellerPhone', {
295
307
  rules: getRules('sellerPhone', RULES.sellerTelPhone('销售方电话'))
@@ -311,12 +323,12 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
311
323
  })(<MyInput readOnly={isReadOnly('sellerAccount')} placeholder="请输入银行账号" autoComplete="off" />)}
312
324
  </Form.Item>
313
325
  </Col>
314
- {(props.leqi ) &&
326
+ {(props.leqi) &&
315
327
  <Col span={4} style={{ display: isExpand ? undefined : 'none' }}>
316
328
  <Form.Item colon={false}>
317
329
  {getFieldDecorator('sellerBankAccountFlag', {
318
- valuePropName: 'checked',
319
- })(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('sellerBankAccountFlag')} style={{whiteSpace:'nowrap'}}>是否展示</Checkbox>)}
330
+ valuePropName: 'checked',
331
+ })(<Checkbox onChange={props?.invoiceMarkCallback} disabled={isReadOnly('sellerBankAccountFlag')} style={{ whiteSpace: 'nowrap' }}>是否展示</Checkbox>)}
320
332
  </Form.Item>
321
333
  </Col>
322
334
  }
@@ -353,7 +365,7 @@ function NaturalPersonFlag(props: {
353
365
  onChange={onChange}
354
366
  >
355
367
  是否开票给自然人
356
- </Checkbox>
368
+ </Checkbox>
357
369
  )
358
370
  }
359
371
 
@@ -371,14 +383,13 @@ function BuyerNameInput(props: InputProps & { fieldName: string; myform: Wrapped
371
383
 
372
384
  const onChangeAutoComplete = React.useCallback(value => {
373
385
  const record = options.filter(e => e[fieldName] === value)[0] as any;
374
- if (!record || !form) return;
375
-
386
+ if (!record || !form) return;
376
387
  form.setFieldsValue(record);
377
388
  setOptions([])
378
389
  }, [options, fieldName, form])
379
390
 
380
391
  const onSearch = React.useCallback(async (searchText: string) => {
381
- await Discontinue.start();
392
+ await Discontinue.start();
382
393
  try {
383
394
  if (fieldName === 'buyerName') {
384
395
  if (autoComplete.onBuyerNameSearch) {
@@ -389,7 +400,7 @@ function BuyerNameInput(props: InputProps & { fieldName: string; myform: Wrapped
389
400
  setOptions(await autoComplete.onBuyerTaxIdSearch(searchText));
390
401
  }
391
402
  }
392
-
403
+
393
404
  } catch (error) {
394
405
  setOptions([]);
395
406
  throw error;