Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
8562b489
Commit
8562b489
authored
Jun 10, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 修改 修改会员信息 相关
parent
61ba864a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
104 deletions
+18
-104
index.tsx
...pages/member/memberImport/components/MemberForm/index.tsx
+0
-0
index.ts
...member/memberImport/components/MemberForm/schema/index.ts
+3
-100
editMySelf.tsx
src/pages/member/memberImport/editMySelf.tsx
+1
-1
utils.tsx
src/pages/member/utils.tsx
+14
-3
No files found.
src/pages/member/memberImport/components/MemberForm/index.tsx
View file @
8562b489
This diff is collapsed.
Click to expand it.
src/pages/member/memberImport/components/MemberForm/schema/index.ts
View file @
8562b489
import
{
ISchema
}
from
'@formily/antd'
;
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
;
import
{
createMemberSchema
,
GroupItem
}
from
'../../../../utils'
;
type
FieldType
=
'string'
|
'long'
|
'upload'
|
'radio'
|
'select'
|
'checkbox'
;
// 字段校验规则枚举:0-无校验规则,1-邮箱规则,2-手机号码规则,3-身份证规则,4-电话号码规则
const
RULE_REG_MAP
=
{
1
:
PATTERN_MAPS
.
email
,
2
:
PATTERN_MAPS
.
phone
,
3
:
PATTERN_MAPS
.
identity
,
4
:
PATTERN_MAPS
.
tel
,
};
const
getFieldType
=
(
field
)
=>
{
// 默认是 输入框
let
description
:
{
[
key
:
string
]:
any
}
=
{
type
:
'string'
,
required
:
field
.
fieldEmpty
===
0
,
title
:
field
.
fieldLocalName
,
default
:
field
.
fieldValue
,
'x-component-props'
:
{
placeholder
:
field
.
fieldRemark
,
disabled
:
field
.
disabled
,
},
};
// 公共的属性
const
common
=
{
type
:
'string'
,
required
:
field
.
fieldEmpty
===
0
,
title
:
field
.
fieldLocalName
,
default
:
field
.
fieldValue
,
'x-rules'
:
[
(
field
.
ruleEnum
?
{
pattern
:
RULE_REG_MAP
[
field
.
ruleEnum
],
message
:
field
.
msg
,
}
:
null
),
(
field
.
pattern
?
{
pattern
:
field
.
pattern
,
message
:
field
.
msg
,
}
:
null
),
].
filter
(
Boolean
),
};
switch
(
field
.
fieldType
as
FieldType
)
{
case
'upload'
:
{
description
=
{
'x-component'
:
'CustomUpload'
,
'x-component-props'
:
{
showDesc
:
false
,
disabled
:
field
.
disabled
,
},
};
break
;
}
case
'radio'
:
{
description
=
{
'x-component'
:
'RadioGroup'
,
enum
:
field
.
fieldEnum
,
'x-component-props'
:
{
showDesc
:
false
,
disabled
:
field
.
disabled
,
},
};
break
;
}
case
'select'
:
{
description
=
{
enum
:
field
.
fieldEnum
,
};
break
;
}
case
'checkbox'
:
{
description
=
{
'x-component'
:
'CheckboxGroup'
,
enum
:
field
.
fieldEnum
,
};
break
;
}
default
:
break
;
}
return
Object
.
assign
({},
description
,
common
);
};
const
getComponentValue
=
(
elements
:
any
)
=>
{
const
components
=
{};
for
(
let
item
of
elements
)
{
components
[
item
.
fieldName
]
=
getFieldType
(
item
);
}
return
components
;
};
export
const
initDetailSchema
=
(
props
:
any
)
=>
{
export
const
initDetailSchema
=
(
props
:
GroupItem
[])
=>
{
let
tabSchema
:
ISchema
=
{
properties
:
{
'tab-1'
:
{
...
...
@@ -316,7 +219,7 @@ export const initDetailSchema = (props: any) => {
wrapperCol
:
8
,
labelAlign
:
'left'
,
},
properties
:
getComponentValue
(
item
.
elements
),
properties
:
createMemberSchema
(
item
.
elements
),
},
},
};
...
...
src/pages/member/memberImport/editMySelf.tsx
View file @
8562b489
...
...
@@ -6,7 +6,7 @@ const EditMySelf: React.FC = () => {
const
{
id
,
validateId
}
=
usePageStatus
();
return
(
<
MemberForm
id=
{
+
id
}
validateId=
{
+
validateId
}
isEdit=
{
true
}
mode=
{
"myself"
}
/>
<
MemberForm
id=
{
+
id
}
validateId=
{
+
validateId
}
isEdit=
{
true
}
mode=
"myself"
/>
);
};
...
...
src/pages/member/utils.tsx
View file @
8562b489
...
...
@@ -70,6 +70,17 @@ export type ElementType = {
editable
?:
boolean
,
}
export
type
GroupItem
=
{
/**
* 组名
*/
groupName
:
string
,
/**
* 元素
*/
elements
:
ElementType
[],
}
export
function
coverColFiltersItem
(
data
:
Array
<
{[
key
:
string
]:
any
}
>
,
dataIndex
:
string
,
...
...
@@ -100,7 +111,7 @@ const getFieldType = (field: ElementType) => {
let
description
:
{
[
key
:
string
]:
any
}
=
{
'x-component-props'
:
{
placeholder
:
field
.
fieldRemark
,
disabled
:
field
.
disabled
||
!
field
.
editable
||
false
,
disabled
:
field
.
disabled
||
!
field
.
editable
,
},
};
// 公共的属性
...
...
@@ -135,7 +146,7 @@ const getFieldType = (field: ElementType) => {
'x-component'
:
'CustomUpload'
,
'x-component-props'
:
{
showDesc
:
false
,
disabled
:
field
.
disabled
||
!
field
.
editable
||
fals
e
,
disabled
:
field
.
disabled
||
!
!
field
.
editabl
e
,
},
};
break
;
...
...
@@ -146,7 +157,7 @@ const getFieldType = (field: ElementType) => {
enum
:
field
.
fieldEnum
,
'x-component-props'
:
{
showDesc
:
false
,
disabled
:
field
.
disabled
||
!
field
.
editable
||
fals
e
,
disabled
:
field
.
disabled
||
!
!
field
.
editabl
e
,
},
};
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment