Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
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
lihuizhen
ec-report-refactor
Commits
a9cb3377
Commit
a9cb3377
authored
Apr 26, 2023
by
leon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature-retail
parents
5e0f73e3
206f8396
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
28 deletions
+61
-28
NormalTabs.vue
components/NormalTabs/NormalTabs.vue
+15
-17
common.js
utils/common.js
+46
-11
No files found.
components/NormalTabs/NormalTabs.vue
View file @
a9cb3377
...
...
@@ -11,10 +11,6 @@
<u-icon
class=
"close-icon"
v-if=
"tabsValue && elementInfo.option.tabs.allowClear"
name=
"close-circle"
@
click
.
prevent
.
stop=
"handleClearValue"
></u-icon>
</view>
<!--
<u-select
v-model=
"show"
:default-value=
"defaultValue"
:list=
"elementData.dataList.series"
:safe-area-inset-bottom=
"true"
label-name=
"name"
:z-index=
"zIndex"
@
confirm=
"handleSelectChange"
>
</u-select>
-->
</
template
>
<swiper
v-if=
"elementInfo.option.tabs.type === 'group'"
class=
"tab-swiper"
...
...
@@ -47,7 +43,6 @@
show
:
false
,
tabsValue
:
''
,
selectValue
:
''
,
zIndex
:
0
,
defaultValue
:
[
0
]
}
},
...
...
@@ -103,13 +98,16 @@
},
methods
:
{
initChart
()
{
this
.
tabsValue
=
this
.
elementInfo
.
option
.
tabs
.
defaultValue
this
.
tabsValue
=
this
.
elementInfo
.
option
.
tabs
.
defaultValue
if
(
this
.
elementData
.
dataList
.
defaultValue
)
{
this
.
tabsValue
=
this
.
elementData
.
dataList
.
defaultValue
}
if
(
this
.
elementInfo
.
option
.
tabs
.
type
===
'select'
)
{
for
(
var
i
=
0
;
i
<
this
.
elementData
.
dataList
.
series
.
length
;
i
++
)
{
const
item
=
this
.
elementData
.
dataList
.
series
[
i
]
if
(
item
.
value
===
this
.
tabsValue
||
item
.
value
===
parseInt
(
this
.
tabsValue
))
{
this
.
selectValue
=
item
.
name
this
.
zIndex
=
i
const
item
=
this
.
elementData
.
dataList
.
series
[
i
]
if
(
item
.
value
==
this
.
tabsValue
||
item
.
value
==
parseInt
(
this
.
tabsValue
))
{
this
.
selectValue
=
item
.
name
}
}
}
...
...
@@ -119,7 +117,12 @@
)
}
},
handleShowSelect
()
{
handleShowSelect
()
{
this
.
defaultValue
[
0
]
=
[
this
.
elementData
.
dataList
.
series
.
findIndex
(
item
=>
item
.
value
==
this
.
tabsValue
)
]
uni
.
$emit
(
'showSelect'
,
{
id
:
this
.
elementInfo
.
id
,
show
:
true
,
...
...
@@ -137,14 +140,9 @@
this
.
tabsValueChange
()
},
handleSelectChange
(
e
)
{
handleSelectChange
(
e
)
{
this
.
selectValue
=
e
[
0
].
label
this
.
tabsValue
=
e
[
0
].
value
this
.
defaultValue
[
0
]
=
[
this
.
elementData
.
dataList
.
series
.
findIndex
(
item
=>
item
.
value
===
e
[
0
].
value
)
]
this
.
tabsValueChange
()
},
handleChangeTabValue
(
value
)
{
...
...
utils/common.js
View file @
a9cb3377
...
...
@@ -130,6 +130,9 @@ const install = (Vue, vm) => {
if
(
paramStr
.
includes
(
'@month'
))
{
paramStr
=
paramStr
.
replace
(
/@month/g
,
monthly
())
}
if
(
paramStr
.
includes
(
'@weekly'
))
{
paramStr
=
paramStr
.
replace
(
/@weekly/g
,
mweekly
())
}
if
(
paramStr
.
includes
(
'@day'
))
{
paramStr
=
paramStr
.
replace
(
/@day/g
,
day
())
}
...
...
@@ -139,8 +142,24 @@ const install = (Vue, vm) => {
}
if
(
paramStr
.
includes
(
'@yesterday'
))
{
paramStr
=
paramStr
.
replace
(
/@yesterday/g
,
yesterday
())
}
// 匹配以@开头,空格 或者 " 结尾的的字符串
const
pattern
=
/
((?<
=@
)
.*
?(?=\s))
|
((?<
=@
)
.*
?(?=
"
))
/g
const
match
=
paramStr
.
match
(
pattern
)
if
(
match
?.
length
)
{
match
.
forEach
((
item
)
=>
{
if
(
item
.
includes
(
'diffOfNow'
))
{
// 取出()里面的内容
const
regex
=
/
(?<
=
\()\S
+
(?=\))
/g
const
value
=
item
.
match
(
regex
)
if
(
value
?.
length
)
{
diffOfNow
(
parseInt
(
value
[
0
]))
const
str
=
'@'
+
item
paramStr
=
paramStr
.
replace
(
str
,
diffOfNow
(
parseInt
(
value
[
0
])))
}
}
})
}
return
JSON
.
parse
(
paramStr
)
}
...
...
@@ -155,6 +174,17 @@ const install = (Vue, vm) => {
const
month
=
date
.
getMonth
()
+
1
<
10
?
"0"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
;
return
month
}
const
weekly
=
()
=>
{
let
d1
=
new
Date
();
let
d2
=
new
Date
();
d2
.
setMonth
(
0
);
d2
.
setDate
(
3
);
//3 周一为本周第一天;2 周日为本周第一天;1 周六为本周第一天
let
rq
=
d1
-
d2
;
let
days
=
Math
.
ceil
(
rq
/
(
24
*
60
*
60
*
1000
));
let
weekly
=
Math
.
ceil
(
days
/
7
);
return
weekly
+
1
;
}
const
day
=
()
=>
{
const
date
=
new
Date
();
...
...
@@ -173,17 +203,22 @@ const install = (Vue, vm) => {
}
const
yesterday
=
()
=>
{
return
diffOfNow
(
-
1
)
}
const
diffOfNow
=
(
diff
)
=>
{
const
date
=
new
Date
()
const
timestamp
=
date
.
getTime
()
-
1000
*
24
*
60
*
60
const
timestamp
=
date
.
getTime
()
+
diff
*
1000
*
24
*
60
*
60
date
.
setTime
(
timestamp
)
const
year
=
date
.
getFullYear
();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
const
month
=
date
.
getMonth
()
+
1
<
10
?
"0"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
;
const
day
=
date
.
getDate
()
<
10
?
"0"
+
date
.
getDate
()
:
date
.
getDate
();
// 拼接
return
year
+
"-"
+
month
+
"-"
+
day
;
}
const
year
=
date
.
getFullYear
();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
const
month
=
date
.
getMonth
()
+
1
<
10
?
"0"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
;
const
day
=
date
.
getDate
()
<
10
?
"0"
+
date
.
getDate
()
:
date
.
getDate
();
// 拼接
return
year
+
"-"
+
month
+
"-"
+
day
;
}
vm
.
$u
.
common
=
{
converFunction
,
fillDigit
,
...
...
@@ -193,7 +228,7 @@ const install = (Vue, vm) => {
rpxToPx
,
chunk
,
getQueryFromString
,
filterRequestParams
filterRequestParams
}
}
...
...
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