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
e940b85d
Commit
e940b85d
authored
Jul 12, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:support folder data
parent
7da36d43
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
8 deletions
+89
-8
Folder.vue
components/Folder/Folder.vue
+27
-0
echartElementData.js
mixins/echartElementData.js
+35
-3
index.vue
pages/index/index.vue
+3
-0
common.js
utils/common.js
+24
-5
No files found.
components/Folder/Folder.vue
0 → 100644
View file @
e940b85d
<
template
>
<view>
</view>
</
template
>
<
script
>
import
echartElementData
from
'@/mixins/echartElementData.js'
export
default
{
name
:
'Folder'
,
mixins
:
[
echartElementData
],
props
:
{
elementInfo
:
{
type
:
Object
,
required
:
true
}
},
methods
:
{
initChart
()
{
uni
.
$emit
(
`folder_
${
this
.
elementInfo
.
id
}
`
,
this
.
elementData
.
dataList
)
}
}
}
</
script
>
<
style
>
</
style
>
mixins/echartElementData.js
View file @
e940b85d
...
...
@@ -39,6 +39,11 @@ export default {
let
res
=
await
that
.
$u
.
api
[
`
${
dataMethod
.
toLowerCase
()}
Http`
](
dataUrl
,
dataFormatter
,
{
custom
:
{
loading
:
false
}
})
// 文件夹类型的数据,直接拿接口返回数据
if
(
this
.
elementInfo
.
type
===
'folder'
)
{
that
.
elementData
.
dataList
=
res
.
data
return
}
if
(
dataProcessing
)
{
that
.
elementData
.
dataList
=
that
.
$u
.
common
.
converFunction
(
dataProcessing
,
res
.
data
,
value
.
queryFormatter
)
}
else
if
(
dataConfig
&&
dataConfig
.
value
&&
dataConfig
.
value
.
length
)
{
...
...
@@ -96,6 +101,24 @@ export default {
}
},
/** 文件数据 */
handleFolderData
(
value
)
{
const
that
=
this
const
{
dataProcessing
,
dataConfig
}
=
{
...
value
}
uni
.
$on
(
`folder_
${
that
.
elementInfo
.
folderId
}
`
,
data
=>
{
if
(
!
data
)
return
if
(
dataProcessing
)
{
that
.
elementData
.
dataList
=
that
.
$u
.
common
.
converFunction
(
dataProcessing
,
data
)
return
}
if
(
dataConfig
&&
dataConfig
.
value
&&
dataConfig
.
value
.
length
)
{
that
.
elementData
.
dataList
=
that
.
$u
.
charts
.
parseChartData
(
data
,
that
.
elementInfo
)
return
}
that
.
elementData
.
dataList
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
})
},
clearTimer
()
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
...
...
@@ -134,7 +157,7 @@ export default {
that
.
handleStaticData
(
newVal
)
}
else
if
(
newVal
.
dataType
===
'dynamic'
)
{
that
.
handleDynamicData
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleDynamicData
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
...
...
@@ -145,7 +168,7 @@ export default {
that
.
handlePublicData
(
newVal
)
}
else
if
(
newVal
.
dataType
===
'dataSet'
)
{
that
.
handleDataSet
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleDataSet
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
...
...
@@ -154,13 +177,22 @@ export default {
}
}
else
if
(
newVal
.
dataType
===
'viewConfig'
)
{
that
.
handleViewConfig
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleViewConfig
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
}
else
{
clearInterval
(
that
.
timer
)
}
}
else
if
(
newVal
.
dataType
===
'folder'
)
{
that
.
handleFolderData
(
newVal
)
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleFolderData
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
}
else
{
clearInterval
(
that
.
timer
)
}
}
},
deep
:
true
,
...
...
pages/index/index.vue
View file @
e940b85d
...
...
@@ -57,6 +57,7 @@
<!-- 普通表格 -->
<NormalTable
v-if=
"element.type == 'NormalTable'"
:elementInfo=
"element"
></NormalTable>
<!--
<Table
v-if=
"element.type == 'NormalTable'"
:elementInfo=
"element"
></Table>
-->
<Folder
v-if=
"element.type == 'folder'"
:elementInfo=
"element"
></Folder>
</view>
</
template
>
...
...
@@ -252,6 +253,8 @@
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
// 处理图层关系
res
.
data
.
Result
.
list
=
this
.
$u
.
common
.
elementFolderId
(
res
.
data
.
Result
.
list
)
that
.
reportInfo
=
this
.
handleTabsLink
(
res
.
data
.
Result
)
// 清除数据
if
(
uni
.
getStorageSync
(
'reportInfo'
))
{
...
...
utils/common.js
View file @
e940b85d
...
...
@@ -258,7 +258,7 @@ const install = (Vue, vm) => {
/**
*
* @param
yAxis 表单的yA
xis设置
* @param
axis 表单的a
xis设置
*/
const
dealAxisFormatter
=
(
axis
)
=>
{
if
(
!
axis
)
{
...
...
@@ -276,9 +276,27 @@ const install = (Vue, vm) => {
}
}
return
axis
}
}
/**
* 图层关系关联 子组件获取到folderId
* @param {elements}
*/
const
elementFolderId
=
(
elements
)
=>
{
elements
.
forEach
(
element
=>
{
if
(
element
.
type
===
'folder'
)
{
element
.
child
.
data
.
forEach
(
item
=>
{
const
index
=
elements
.
findIndex
(
ele
=>
ele
.
id
===
item
)
if
(
index
!=
-
1
)
{
elements
[
index
].
folderId
=
element
.
id
elements
[
index
].
isChild
=
true
}
})
}
})
return
elements
}
vm
.
$u
.
common
=
{
converFunction
,
...
...
@@ -291,7 +309,8 @@ const install = (Vue, vm) => {
getQueryFromString
,
filterRequestParams
,
dealTooltip
,
dealAxisFormatter
dealAxisFormatter
,
elementFolderId
}
}
...
...
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