Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
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
web_component
submodule
Commits
c57c7061
Commit
c57c7061
authored
Jul 08, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数字上送时格式化
parent
fe0c58fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
setFormatter.tsx
...onents/apolloTable/component/base/_utils/setFormatter.tsx
+2
-1
index.tsx
components/apolloTable/component/base/index.tsx
+2
-2
No files found.
components/apolloTable/component/base/_utils/setFormatter.tsx
View file @
c57c7061
...
@@ -84,11 +84,12 @@ export const SetFormatter = {
...
@@ -84,11 +84,12 @@ export const SetFormatter = {
},
},
NUMBER
:
(
val
,
config
)
=>
{
NUMBER
:
(
val
,
config
)
=>
{
if
(
!
isNumber
(
val
))
return
emptyModel
;
if
(
!
isNumber
(
val
))
return
emptyModel
;
const
{
unit
=
{}
}
=
config
||
{};
// 设置单位
const
{
unit
=
{}
,
precision
}
=
config
||
{};
// 设置单位
if
(
unit
&&
unit
.
code
===
'wan'
)
{
if
(
unit
&&
unit
.
code
===
'wan'
)
{
const
newVal
=
val
?
val
*
10000
:
val
;
const
newVal
=
val
?
val
*
10000
:
val
;
return
[{
value
:
newVal
,
text
:
newVal
}];
return
[{
value
:
newVal
,
text
:
newVal
}];
}
}
val
=
Number
(
val
).
toFixed
(
precision
);
return
[{
value
:
val
,
text
:
val
}];
return
[{
value
:
val
,
text
:
val
}];
},
},
PERCENTAGE
:
(
val
)
=>
{
PERCENTAGE
:
(
val
)
=>
{
...
...
components/apolloTable/component/base/index.tsx
View file @
c57c7061
...
@@ -3,7 +3,7 @@ import React from 'react';
...
@@ -3,7 +3,7 @@ import React from 'react';
import
{
transferAttr
}
from
'./_utils/transferAttr'
;
import
{
transferAttr
}
from
'./_utils/transferAttr'
;
import
{
BaseComponentProps
,
BaseComponentState
}
from
'../interface'
;
import
{
BaseComponentProps
,
BaseComponentState
}
from
'../interface'
;
export
const
setFormat
=
(
config
,
columnConfig
:
any
,
value
:
any
,
option
?:
any
)
=>
{
export
const
setFormat
=
(
config
:
any
,
columnConfig
:
any
,
value
:
any
,
option
?:
any
)
=>
{
const
{
columnAttrObj
,
columnType
}
=
columnConfig
||
{};
const
{
columnAttrObj
,
columnType
}
=
columnConfig
||
{};
const
transferColumn
=
transferAttr
(
columnType
,
{
const
transferColumn
=
transferAttr
(
columnType
,
{
...(
config
.
componentAttr
||
{}),
...(
config
.
componentAttr
||
{}),
...
@@ -13,7 +13,7 @@ export const setFormat = (config, columnConfig: any, value: any, option?: any) =
...
@@ -13,7 +13,7 @@ export const setFormat = (config, columnConfig: any, value: any, option?: any) =
return
value
;
return
value
;
};
};
export
const
getFormat
=
(
config
,
columnConfig
:
any
,
value
:
any
)
=>
{
export
const
getFormat
=
(
config
:
any
,
columnConfig
:
any
,
value
:
any
)
=>
{
const
{
columnAttrObj
,
columnType
}
=
columnConfig
||
{};
const
{
columnAttrObj
,
columnType
}
=
columnConfig
||
{};
if
(
!
value
||
!
Array
.
isArray
(
value
)
||
value
.
length
<=
0
)
return
undefined
;
if
(
!
value
||
!
Array
.
isArray
(
value
)
||
value
.
length
<=
0
)
return
undefined
;
const
transferColumn
=
transferAttr
(
columnType
,
{
const
transferColumn
=
transferAttr
(
columnType
,
{
...
...
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