Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
shenshaokai
jinfa-admin
Commits
e182d528
Commit
e182d528
authored
Sep 26, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:交易规则查看异常处理
parent
f3ded9af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
1 deletion
+44
-1
addAttribute.tsx
src/pages/classAndProperty/attribute/addAttribute.tsx
+7
-0
index.ts
src/pages/classAndProperty/class/schema/index.ts
+7
-1
addPropertyValue.tsx
...pages/classAndProperty/propertyValue/addPropertyValue.tsx
+4
-0
regExp.ts
src/utils/regExp.ts
+26
-0
No files found.
src/pages/classAndProperty/attribute/addAttribute.tsx
View file @
e182d528
...
...
@@ -7,6 +7,7 @@ import {ColumnType} from 'antd/lib/table/interface';
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
{
Option
}
=
Select
;
...
...
@@ -173,6 +174,9 @@ const AddAtttribute: React.FC<{}> = () => {
required
:
true
,
message
:
'输入属性组名!'
,
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
20
)
}
]
}
>
<
Input
placeholder=
"输入属性组名"
disabled=
{
pageStatus
===
2
}
/>
...
...
@@ -195,6 +199,9 @@ const AddAtttribute: React.FC<{}> = () => {
required
:
true
,
message
:
'输入属性名称!'
,
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
20
)
}
]
}
>
<
Input
placeholder=
"输入属性名称"
disabled=
{
pageStatus
===
2
}
/>
...
...
src/pages/classAndProperty/class/schema/index.ts
View file @
e182d528
...
...
@@ -28,7 +28,13 @@ export const classSchema: ISchema = {
required
:
true
,
"x-component-props"
:
{
placeholder
:
'请输入品类名称'
}
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
16
}
]
},
type
:
{
type
:
'number'
,
...
...
src/pages/classAndProperty/propertyValue/addPropertyValue.tsx
View file @
e182d528
...
...
@@ -7,6 +7,7 @@ import { history } from 'umi';
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetManageAreaAllResponse
}
from
'@/services/PassApi'
;
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
layout
=
{
labelCol
:
{
...
...
@@ -158,6 +159,9 @@ const AddPropertyValue: React.FC<{}> = () => {
required
:
true
,
message
:
'输入属性值名称!'
,
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
12
)
}
]
}
>
<
Input
placeholder=
"输入属性值名称"
disabled=
{
isSee
}
/>
...
...
src/utils/regExp.ts
View file @
e182d528
...
...
@@ -42,3 +42,28 @@ export const checkRegExp = (str:string, type:string) => {
return
true
;
}
}
/**
* 区别校验 汉字 和 字符 长度
* @param rule
* @param value 表单输入的值
* @param callback
* @param maxByte:number 最大字符数
*/
export
const
validatorByte
=
(
rule
,
value
,
callback
,
maxByte
:
number
)
=>
{
try
{
if
(
value
){
let
str
=
value
str
=
str
.
replace
(
/
[\u
4e00-
\u
9fa5
]
/g
,
'OO'
)
if
(
str
.
length
>
maxByte
)
throw
new
Error
(
`最多输入
${
maxByte
}
个字符,
${
Math
.
floor
(
maxByte
/
2
)}
个汉字`
);
else
callback
()
}
else
{
callback
()
}
}
catch
(
err
)
{
callback
(
err
)
}
}
\ No newline at end of file
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