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
de7cb6f7
Commit
de7cb6f7
authored
Jan 19, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 选项卡组件交互
parent
d974d9e8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
26 deletions
+76
-26
NormalTabs.vue
components/NormalTabs/NormalTabs.vue
+33
-8
echartElementData.js
mixins/echartElementData.js
+6
-7
index.vue
pages/center/index.vue
+1
-1
customer.vue
pages/customer/customer.vue
+1
-1
index.vue
pages/index/index.vue
+34
-8
index.js
store/index.js
+1
-1
No files found.
components/NormalTabs/NormalTabs.vue
View file @
de7cb6f7
...
...
@@ -35,21 +35,46 @@
data
()
{
return
{
currentTabs
:
0
,
show
:
false
show
:
false
,
tabsValue
:
''
};
},
computed
:
{
tabsValue
()
{
return
this
.
elementData
.
dataList
.
series
[
this
.
currentTabs
].
value
}
},
methods
:
{
initChart
()
{},
initChart
()
{
this
.
tabsValue
=
this
.
elementData
.
dataList
.
series
[
this
.
currentTabs
].
value
},
handleTabsChange
(
index
)
{
this
.
currentTabs
=
index
this
.
initChart
()
this
.
tabsValueChange
()
},
handleSelectChange
(
e
)
{
console
.
log
(
e
)
this
.
tabsValue
=
e
[
0
].
value
this
.
tabsValueChange
()
},
/**
* 改变选项卡的值
*/
tabsValueChange
()
{
const
{
index
,
paramName
,
data
}
=
this
.
elementInfo
.
child
if
(
this
.
elementInfo
.
child
.
type
===
'param'
)
{
uni
.
$emit
(
'handleLinkParams'
,
{
index
,
paramName
,
value
:
this
.
tabsValue
})
}
else
if
(
this
.
elementInfo
.
child
.
type
===
'comp'
)
{
const
showData
=
[],
hideData
=
[]
data
.
forEach
(
element
=>
{
if
(
element
.
name
==
this
.
tabsValue
)
showData
.
push
(
element
.
comp
)
if
(
element
.
name
!=
this
.
tabsValue
)
hideData
.
push
(
element
.
comp
)
});
uni
.
$emit
(
'handleLinkComp'
,
{
showData
,
hideData
})
}
}
},
watch
:
{
'elementInfo.child.index'
:
{
handler
(
newVal
)
{
if
(
newVal
.
length
)
this
.
tabsValueChange
()
},
immediate
:
true
}
}
}
...
...
mixins/echartElementData.js
View file @
de7cb6f7
...
...
@@ -25,7 +25,6 @@ export default {
async
handleDynamicData
(
value
)
{
let
{
dataUrl
,
dataMethod
,
dataFormatter
,
dataProcessing
}
=
{
...
value
}
dataUrl
=
dataUrl
.
replace
(
/^
(\/
dashboardCharts
)?
|^
(\/
dashboardAPI
)?
/
,
''
)
if
(
value
.
queryFormatter
)
dataFormatter
=
{...
dataFormatter
,
...
value
.
queryFormatter
}
let
res
=
await
this
.
$u
[
dataMethod
.
toLowerCase
()](
dataUrl
,
dataFormatter
)
if
(
dataProcessing
)
{
this
.
elementData
.
dataList
=
this
.
$u
.
common
.
converFunction
(
dataProcessing
,
res
.
data
)
...
...
@@ -38,12 +37,12 @@ export default {
* 全局数据
*/
handlePublicData
(
value
)
{
if
(
!
this
.
globalData
)
return
if
(
!
this
.
vuex_
globalData
)
return
const
{
dataProcessing
}
=
{
...
value
}
if
(
dataProcessing
)
{
this
.
elementData
.
dataList
=
this
.
$u
.
common
.
converFunction
(
dataProcessing
,
JSON
.
parse
(
this
.
globalData
))
this
.
elementData
.
dataList
=
this
.
$u
.
common
.
converFunction
(
dataProcessing
,
JSON
.
parse
(
this
.
vuex_
globalData
))
}
else
{
this
.
elementData
.
dataList
=
JSON
.
parse
(
this
.
globalData
)
this
.
elementData
.
dataList
=
JSON
.
parse
(
this
.
vuex_
globalData
)
}
this
.
initChart
()
},
...
...
@@ -106,13 +105,13 @@ export default {
}
}
},
immediate
:
true
,
deep
:
true
deep
:
true
,
immediate
:
true
},
/**
* 全局数据更新监测
*/
globalData
()
{
'vuex_globalData'
()
{
if
(
this
.
elementInfo
.
data
.
dataType
===
'public'
)
this
.
handlePublicData
(
this
.
elementInfo
.
data
)
}
}
...
...
pages/center/index.vue
View file @
de7cb6f7
<
template
>
<view>
<view
class=
"item-list"
>
<block
v-for=
"(item,index) in itemList"
>
<block
v-for=
"(item,index) in itemList"
:key=
"index"
>
<view
class=
"item-cell"
@
tap=
"selectCell(index)"
>
<view
class=
"item-cell-text"
>
{{
item
.
text
}}
</view>
<view
class=
"item-cell-list-count"
v-if=
"item.show"
>
(
{{
item
.
count
}}
)人
</view>
...
...
pages/customer/customer.vue
View file @
de7cb6f7
<
template
>
<view
class=
"wrap"
>
<view
class=
"item-list"
>
<block
v-for=
"(item,index) in userList"
>
<block
v-for=
"(item,index) in userList"
:key=
"item.id"
>
<view
class=
"item-cell"
>
<view
class=
"item-name"
>
{{
item
.
userName
}}
</view>
<view
class=
"item-button"
@
tap =
"authorized(item.id, item.authorized, index)"
v-if=
"item.authorized"
>
取消授权
</view>
...
...
pages/index/index.vue
View file @
de7cb6f7
...
...
@@ -57,12 +57,20 @@
...
params
}
}
},
async
onLoad
()
{
},
onLoad
()
{
this
.
userAuthCheck
()
this
.
getReportList
()
},
onShow
()
{
this
.
userAuthCheck
()
/**
* 组件交互 - 参数
*/
uni
.
$on
(
'handleLinkParams'
,
({
index
,
paramName
,
value
})
=>
{
this
.
handleValueChange
(
index
,
paramName
,
value
)
})
},
onUnload
()
{
// 移除监听事件
uni
.
$off
(
'handleLinkParams'
)
},
methods
:
{
//检查是否登录
...
...
@@ -104,8 +112,6 @@
let
res
=
await
this
.
$u
.
api
.
getReportList
({
id
:
'61c424a4c06bff0ce05d9a53'
})
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
this
.
reportInfo
=
info
this
.
reportData
=
list
if
(
info
.
dataUrl
)
{
this
.
getGlobalData
(
info
)
if
(
info
.
dataPollingInterval
)
{
...
...
@@ -114,6 +120,8 @@
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
this
.
reportInfo
=
info
this
.
reportData
=
list
}
},
/**
...
...
@@ -122,7 +130,25 @@
async
getGlobalData
(
info
)
{
const
dataUrl
=
info
.
dataUrl
.
replace
(
/^
(\/
dashboardCharts
)?
|^
(\/
dashboardAPI
)?
/
,
''
)
let
res
=
await
this
.
$u
[
info
.
dataMethod
.
toLowerCase
()](
dataUrl
,
info
.
dataFormatter
)
this
.
$u
.
vuex
(
'globalData'
,
JSON
.
stringify
(
res
.
data
))
this
.
$u
.
vuex
(
'vuex_globalData'
,
JSON
.
stringify
(
res
.
data
))
},
/**
* 组件之间关联
*/
handleValueChange
(
index
,
paramName
,
value
)
{
if
(
index
.
length
&&
paramName
&&
value
)
{
this
.
reportData
.
map
(
item
=>
{
if
(
index
.
includes
(
item
.
id
)
&&
item
.
data
.
dataType
===
'dynamic'
)
{
if
(
!
item
.
data
.
dataFormatter
)
item
.
data
.
dataFormatter
=
{}
this
.
$set
(
item
.
data
.
dataFormatter
,
paramName
,
value
)
}
if
(
index
.
includes
(
item
.
id
)
&&
item
.
data
.
dataType
===
'dataSet'
)
{
if
(
!
item
.
data
.
dataSetInfo
.
queryFormatter
)
item
.
data
.
dataSetInfo
.
queryFormatter
=
{}
this
.
$set
(
item
.
data
.
dataSetInfo
.
queryFormatter
,
paramName
,
value
)
}
return
item
})
}
}
},
onReachBottom
()
{
...
...
store/index.js
View file @
de7cb6f7
...
...
@@ -31,7 +31,7 @@ const saveLifeData = function(key, value) {
const
store
=
new
Vuex
.
Store
({
state
:
{
vuex_token
:
lifeData
.
vuex_token
||
''
,
globalData
:
""
vuex_
globalData
:
""
},
mutations
:
{
$uStore
(
state
,
payload
)
{
...
...
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