Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
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
周远喜
mes-ui
Commits
cd81a8f2
Commit
cd81a8f2
authored
Apr 26, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getArry
parent
cfdf172e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
henq.js
libs/henq.js
+26
-14
No files found.
libs/henq.js
View file @
cd81a8f2
...
...
@@ -43,12 +43,12 @@ henq.isArray = u => {
return
Object
.
prototype
.
toString
.
call
(
u
)
==
'[object Array]'
;
}
henq
.
toIntArray
=
u
=>
{
if
(
henq
.
isNull
(
u
))
{
if
(
henq
.
isNull
(
u
))
{
return
[];
}
var
arrs
=
u
.
split
(
','
)
var
result
=
[];
arrs
.
map
(
p
=>
{
var
arrs
=
u
.
split
(
','
)
var
result
=
[];
arrs
.
map
(
p
=>
{
result
.
push
(
parseInt
(
p
));
})
return
result
;
...
...
@@ -96,7 +96,7 @@ henq.getDate = (strDate) => {
}).
match
(
/
\d
+/g
)
+
')'
);
return
date
;
}
henq
.
group
=
(
array
,
f
)
=>
{
henq
.
group
=
(
array
,
f
)
=>
{
const
groups
=
{};
array
.
forEach
(
function
(
o
)
{
const
group
=
JSON
.
stringify
(
f
(
o
));
...
...
@@ -122,7 +122,7 @@ henq.toTree = (list, rootId, format, parentFiledName) => {
if
(
format
)
{
format
(
u
)
}
u
.
children
=
toTree
(
data
,
u
.
id
,
level
)
u
.
children
=
toTree
(
data
,
u
.
id
,
level
)
})
}
return
parents
;
...
...
@@ -130,19 +130,20 @@ henq.toTree = (list, rootId, format, parentFiledName) => {
return
toTree
(
list
,
rootId
,
i
)
}
henq
.
treeToList
=
(
tree
)
=>
{
let
list
=
[];
let
list
=
[];
function
treeToList
(
data
)
{
data
.
map
(
u
=>
{
if
(
u
.
children
)
{
treeToList
(
u
.
children
,
u
)
data
.
map
(
u
=>
{
if
(
u
.
children
)
{
treeToList
(
u
.
children
,
u
)
}
let
copy
=
henq
.
clone
(
u
);
let
copy
=
henq
.
clone
(
u
);
delete
copy
.
delete
;
copy
.
parent
=
u
;
copy
.
parent
=
u
;
list
.
push
(
copy
);
})
}
treeToList
(
tree
,
null
)
treeToList
(
tree
,
null
)
return
list
;
}
//导出pdf
...
...
@@ -169,4 +170,15 @@ henq.outPdf = (ele, fileName) => {
window
.
open
(
"/static/pdf.html"
,
'_blank'
);
},
1000
)
}
export
default
henq
;
\ No newline at end of file
henq
.
getArry
=
(
arryList
)
=>
{
//得到数据字典对应的label和value,用于table排序
let
arry
=
[];
arryList
.
forEach
(
data
=>
{
var
that
=
this
;
let
arryObj
=
{};
arryObj
[
"label"
]
=
data
.
name
;
arryObj
[
"value"
]
=
data
.
code
;
arry
.
push
(
arryObj
);
});
return
arry
;
}
export
default
henq
;
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