Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
founder_vue
Overview
Overview
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
常超
founder_vue
Commits
91677ce7
Commit
91677ce7
authored
Nov 25, 2021
by
liyuhang19990520
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工具类函数以及比中和认定逻辑修改样式修改
parent
35eee2ff
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
7 deletions
+69
-7
src/plugins/axios.js
+1
-1
src/utils/util.js
+65
-4
src/views/cxyrd/TT.scss
+3
-2
src/views/cxyrd/TT.vue
+0
-0
No files found.
src/plugins/axios.js
View file @
91677ce7
...
...
@@ -65,7 +65,7 @@ _axios.interceptors.response.use(
function
(
response
)
{
NProgress
.
done
();
loadingIndex
--
;
console
.
log
(
'请求后'
+
loadingIndex
)
//
console.log('请求后' + loadingIndex)
if
(
loadingIndex
<=
0
)
{
clearTimeout
(
timer
)
timer
=
setTimeout
(()
=>
{
...
...
src/utils/util.js
View file @
91677ce7
...
...
@@ -57,19 +57,19 @@ export default {
* @param {Object} arr
* @param {Object} i
*/
inArray
:
function
(
elem
,
arr
)
{
inArray
:
function
(
elem
,
arr
)
{
return
arr
==
null
?
-
1
:
arr
.
indexOf
(
elem
);
},
/**
* 获取某天日期
* @param {Object} day
*/
getDay
:
function
(
day
)
{
getDay
:
function
(
day
)
{
var
today
=
new
Date
();
var
targetday_milliseconds
=
today
.
getTime
()
+
1000
*
60
*
60
*
24
*
day
;
today
.
setTime
(
targetday_milliseconds
);
const
doHandleMonth
=
function
(
month
)
{
const
doHandleMonth
=
function
(
month
)
{
var
m
=
month
;
if
(
month
.
toString
().
length
==
1
)
{
m
=
"0"
+
month
;
...
...
@@ -99,7 +99,7 @@ export default {
* @param {Object} obj
*/
deepClone
(
obj
)
{
const
isObject
=
function
(
obj
)
{
const
isObject
=
function
(
obj
)
{
return
typeof
obj
==
"object"
;
};
...
...
@@ -114,5 +114,66 @@ export default {
cloneObj
[
key
]
=
isObject
(
obj
[
key
])
?
this
.
deepClone
(
obj
[
key
])
:
obj
[
key
];
}
return
cloneObj
;
},
//一个数组减去另一个数组中的值
arrToValue
(
souceArr
,
targetArr
,
key
)
{
if
(
!
key
)
{
return
souceArr
.
filter
((
x
)
=>
targetArr
.
indexOf
(
x
)
<
0
);
}
else
{
souceArr
.
filter
((
x
)
=>
{
return
targetArr
.
findIndex
(
y
=>
y
[
key
]
==
x
[
key
])
<
0
});
}
},
// 转换字符串,undefined,null等转化为""
praseStrEmpty
(
str
)
{
return
!
str
||
str
===
'undefined'
||
str
===
'null'
?
''
:
str
},
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
* @param {*} rootId 根Id 默认 0
*/
handleTree
(
data
=
[],
id
=
'id'
,
parentId
=
'parentId'
,
children
=
'children'
,
rootId
)
{
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
})
)
||
0
//对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
//循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
let
branchArr
=
cloneData
.
filter
(
child
=>
{
//返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
&&
(
father
.
children
=
branchArr
)
//返回第一层
return
father
[
parentId
]
===
rootId
})
// 排序
treeData
.
sort
((
a
,
b
)
=>
{
return
Number
(
a
.
code
)
-
Number
(
b
.
code
)
})
.
forEach
(
m
=>
{
if
(
m
.
children
&&
m
.
children
.
length
)
{
m
.
children
.
sort
((
c
,
d
)
=>
{
return
Number
(
c
.
code
)
-
Number
(
d
.
code
)
})
}
})
return
treeData
!==
''
?
treeData
:
data
}
};
src/views/cxyrd/TT.scss
View file @
91677ce7
...
...
@@ -21,8 +21,9 @@ $phone: var(--phone, #606266); //#ff4242;
padding
:
20px
;
box-sizing
:
border-box
;
position
:
absolute
;
top
:
calc
(
50%
-
300px
);
left
:
calc
(
50%
-
300px
);
top
:
30%
;
left
:
50%
;
transform
:
translateX
(
-50%
);
z-index
:
1000
;
width
:
600px
;
height
:
152px
;
...
...
src/views/cxyrd/TT.vue
View file @
91677ce7
This diff is collapsed.
Click to expand it.
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