cfel-base-components 2.0.3 → 2.0.4
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,20 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import {
|
|
3
|
-
Button, Modal, Form, Input,
|
|
4
|
-
Col, InputNumber, Switch, Select, Cascader, Divider
|
|
3
|
+
Button, Modal, Form, Input,
|
|
5
4
|
} from 'antd';
|
|
6
|
-
import { } from '../api'
|
|
7
5
|
export default function index({
|
|
8
6
|
ModalOpen, //弹框状态
|
|
9
7
|
editOpenStatus, //关闭弹框
|
|
10
8
|
editingData, //编辑数据
|
|
11
|
-
actionFunc,
|
|
9
|
+
actionFunc, //新增事件
|
|
12
10
|
}: any) {
|
|
13
|
-
const { TextArea } = Input;
|
|
14
11
|
const [form] = Form.useForm();
|
|
15
12
|
|
|
16
|
-
const [hypervisorValue, setHypervisorValue] = useState(null) // 厂商list
|
|
17
|
-
const [RAZValue, setRAZValue] = useState([]) // 可用区list
|
|
18
13
|
|
|
19
14
|
const formDom = [
|
|
20
15
|
{ title: "名称", key: 'name', type: 'string', required: true },
|
|
@@ -25,14 +20,14 @@ export default function index({
|
|
|
25
20
|
if (!ModalOpen) return
|
|
26
21
|
|
|
27
22
|
if (editingData) {
|
|
28
|
-
console.log(editingData,"editingData")
|
|
23
|
+
console.log(editingData, "editingData")
|
|
29
24
|
form.setFieldsValue({
|
|
30
25
|
...editingData
|
|
31
26
|
})
|
|
32
27
|
}
|
|
33
28
|
}, [ModalOpen])
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
|
|
36
31
|
const showCom = ({ title, key, type, required }: any) => {
|
|
37
32
|
let dom: any = null
|
|
38
33
|
switch (type) {
|
|
@@ -62,13 +57,13 @@ export default function index({
|
|
|
62
57
|
label={title}
|
|
63
58
|
name={key}
|
|
64
59
|
rules={
|
|
65
|
-
editingData?[{ required: required, message: '请输入' }]:[
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
editingData ? [{ required: required, message: '请输入' }] : [
|
|
61
|
+
{ required: required, message: '请输入' },
|
|
62
|
+
{ pattern: /1[0-9]{10}$/, message: '请输入正确的电话号码' }
|
|
63
|
+
]}
|
|
69
64
|
>
|
|
70
65
|
<Input placeholder="请输入"
|
|
71
|
-
|
|
66
|
+
disabled={editingData ? true : false} />
|
|
72
67
|
</Form.Item>)
|
|
73
68
|
break;
|
|
74
69
|
default:
|
|
@@ -76,7 +71,7 @@ export default function index({
|
|
|
76
71
|
}
|
|
77
72
|
return dom
|
|
78
73
|
}
|
|
79
|
-
|
|
74
|
+
|
|
80
75
|
const closeModel = () => {
|
|
81
76
|
form.resetFields()
|
|
82
77
|
editOpenStatus(false)
|
|
@@ -94,7 +89,7 @@ export default function index({
|
|
|
94
89
|
})
|
|
95
90
|
}
|
|
96
91
|
return (
|
|
97
|
-
<Modal title={
|
|
92
|
+
<Modal title={editingData ? "编辑账号" : "新增账号"}
|
|
98
93
|
destroyOnClose={true}
|
|
99
94
|
open={ModalOpen}
|
|
100
95
|
onCancel={() => {
|
|
@@ -126,11 +121,11 @@ export default function index({
|
|
|
126
121
|
initialValues={{ remember: true }}
|
|
127
122
|
autoComplete="off"
|
|
128
123
|
>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
124
|
+
{
|
|
125
|
+
formDom.map((item: any, index: number) => {
|
|
126
|
+
return showCom(item)
|
|
127
|
+
})
|
|
128
|
+
}
|
|
134
129
|
</Form>
|
|
135
130
|
</Modal>
|
|
136
131
|
)
|