kts-component-invoice-operate 1.2.0 → 1.2.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -29,20 +29,23 @@ const Main = decorator<IBuyerProps, IBuyerProps & FormComponentProps>(
29
29
  const controller = Invoice.useInvoiceController();
30
30
 
31
31
  /** 组件模式 */
32
- const model = controller.useMemo(s => s.model, [])
32
+ const model = controller.useMemo(s => s.model, []);
33
+
34
+ /** 自动填充 */
35
+ const autoContainer = controller.useMemo(s => s.buyerState.autoContainer, []);
33
36
 
34
37
  const formItem = React.useMemo(() => {
35
38
  if (props.formItem) {
36
39
  return props.formItem;
37
40
  } else {
38
41
  return [
39
- { id: 'buyerName', label: '购买方名称', node: <BuyerNameInput />, options: { rules: [{ required: true, message: '不能为空' }] } },
42
+ { id: 'buyerName', label: '购买方名称', node: <Input size="small" autoComplete="off" readOnly={model === 'prefab'} />, options: { rules: [{ required: true, message: '不能为空' }] } },
40
43
  { id: 'buyerNo', label: '购买方纳税人识别号', node: <Input size="small" autoComplete="off" readOnly={model === 'prefab'} />, options: { rules: [{ required: true, message: '不能为空' }] } },
41
44
  { id: 'buyerAddress', label: '购买方地址及电话', node: <Input size="small" autoComplete="off" readOnly={model === 'prefab'} />, options: { rules: [{ required: true, message: '不能为空' }] } },
42
45
  { id: 'buyerBank', label: '购买方开户行及账号', node: <Input size="small" autoComplete="off" readOnly={model === 'prefab'} />, options: { rules: [{ required: true, message: '不能为空' }] } },
43
46
  ]
44
47
  }
45
- }, [props.formItem, model])
48
+ }, [props.formItem, model]);
46
49
 
47
50
  /** 注册 form */
48
51
  controller.useForm('buyer', form);
@@ -86,7 +89,11 @@ const Main = decorator<IBuyerProps, IBuyerProps & FormComponentProps>(
86
89
  return (
87
90
  <Descriptions.Item key={i} label={getlabel(item)}>
88
91
  <Form.Item>
89
- {getFieldDecorator(item.id, item.options)(item.node)}
92
+ {getFieldDecorator(item.id, item.options)(
93
+ autoContainer
94
+ ? item.id === 'buyerName' ? <BuyerNameInput /> : item.node
95
+ : item.node
96
+ )}
90
97
  </Form.Item>
91
98
  </Descriptions.Item>
92
99
  )
@@ -42,14 +42,14 @@ export default (props: IBuyerNameInputProps) => {
42
42
  <div className='kts-invoice-operate-buyer-name-content-block' style={{ padding: '14px 10px' }} >
43
43
  <label style={{ marginBottom: 10 }} >最近开具</label>
44
44
  <ul className='kts-invoice-operate-buyer-name-content-recently-issued' >
45
- {dataSource.recent.map((e, i) => <li key={i} onClick={() => { onClickItem(e) }} style={{ marginBottom: interval(i, dataSource.recent.length) }} ><MyTag>{e.buyerName}</MyTag></li>)}
45
+ {dataSource.recent?.map((e, i) => <li key={i} onClick={() => { onClickItem(e) }} style={{ marginBottom: interval(i, dataSource.recent?.length ?? 0) }} ><MyTag>{e.buyerName}</MyTag></li>)}
46
46
  </ul>
47
47
  </div>
48
48
  <Divider style={{ margin: "0 6px" }} />
49
49
  <div className='kts-invoice-operate-buyer-name-content-block' style={{ padding: '14px 10px 4px' }} >
50
50
  <label style={{ padding: '0 10px' }} >选择公司</label>
51
51
  {
52
- dataSource.list.map((e, i) => {
52
+ dataSource.list?.map((e, i) => {
53
53
  return (
54
54
  <ul key={i} onClick={() => { onClickItem(e) }} className='kts-invoice-operate-buyer-name-content-select-company' >
55
55
  <li>{e.buyerName}</li>
@@ -78,7 +78,7 @@ export default (props: IBuyerNameInputProps) => {
78
78
  onBuyNameChange(e.target.value);
79
79
  }, [dataSource])
80
80
 
81
- React.useEffect(()=>{
81
+ React.useEffect(() => {
82
82
  visible && onBuyNameChange(props.value)
83
83
  }, [visible, props.value])
84
84
 
@@ -121,7 +121,7 @@ function useDataSource() {
121
121
 
122
122
  const [loading, setLoading] = React.useState(false);
123
123
 
124
- const [dataSource, setDataSource] = React.useState<{ recent: IBuyerInfo[], list: IBuyerInfo[] }>({ recent: [], list: [] })
124
+ const [dataSource, setDataSource] = React.useState<{ recent?: IBuyerInfo[], list?: IBuyerInfo[] }>({ recent: [], list: [] })
125
125
 
126
126
  const autoContainer = controller.useMemo(s => s.buyerState.autoContainer, []);
127
127