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
a594c45c
Commit
a594c45c
authored
Jul 12, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: index page to detail page component error
parent
3641660f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
34 deletions
+66
-34
NormalLine.vue
components/NormalLine/NormalLine.vue
+3
-0
NormalTable.vue
components/NormalTable/NormalTable.vue
+2
-2
echartElementData.js
mixins/echartElementData.js
+16
-6
details.vue
pages/details/details.vue
+31
-19
index.vue
pages/index/index.vue
+14
-7
No files found.
components/NormalLine/NormalLine.vue
View file @
a594c45c
...
...
@@ -96,6 +96,9 @@
// 等待子组件完全挂载完成---chart初始化完成
this
.
$nextTick
().
then
(()
=>
{
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
if
(
!
categories
)
{
return
}
var
count
=
categories
.
length
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
...
...
components/NormalTable/NormalTable.vue
View file @
a594c45c
...
...
@@ -113,8 +113,8 @@
}
)
}
,
destroyed
()
{
if
(
elementInfo
&&
elementInfo
.
id
)
{
uni
.
$off
(
elementInfo
.
id
)
if
(
this
.
elementInfo
&&
this
.
elementInfo
.
id
)
{
uni
.
$off
(
this
.
elementInfo
.
id
)
}
}
,
methods
:
{
...
...
mixins/echartElementData.js
View file @
a594c45c
...
...
@@ -126,7 +126,7 @@ export default {
handler
(
newVal
)
{
const
that
=
this
const
storageData
=
uni
.
getStorageSync
(
this
.
elementInfo
.
id
)
if
(
storageData
&&
newVal
.
dataType
!==
'static'
)
{
if
(
storageData
&&
JSON
.
stringify
(
storageData
)
!=
"{}"
&&
newVal
.
dataType
!==
'static'
)
{
this
.
elementData
.
dataList
=
JSON
.
parse
(
storageData
)
}
if
(
that
.
elementInfo
.
hide
)
return
false
...
...
@@ -142,7 +142,9 @@ export default {
clearInterval
(
that
.
timer
)
}
}
else
if
(
newVal
.
dataType
===
'public'
)
{
that
.
handlePublicData
(
newVal
)
if
(
that
.
vuex_globalData
&&
that
.
vuex_globalData
.
elements
.
includes
(
that
.
elementInfo
.
id
))
{
that
.
handlePublicData
(
newVal
)
}
}
else
if
(
newVal
.
dataType
===
'dataSet'
)
{
that
.
handleDataSet
(
newVal
)
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
...
...
@@ -169,13 +171,21 @@ export default {
/**
* 全局数据更新监测
*/
'vuex_globalData'
()
{
if
(
this
.
elementInfo
.
data
.
dataType
===
'public'
)
this
.
handlePublicData
(
this
.
elementInfo
.
data
)
'vuex_globalData'
(
newVal
)
{
const
elements
=
newVal
.
elements
/* elements.includes(this.elementInfo.id) 全局数据对应的elements包含当前的element id,
否则在切换页面的时候,被切换页面的全局组件也会再次请求,导致报错
*/
if
(
elements
.
includes
(
this
.
elementInfo
.
id
)
&&
this
.
elementInfo
.
data
.
dataType
===
'public'
)
{
this
.
handlePublicData
(
this
.
elementInfo
.
data
)
}
},
'elementData.dataList'
:
{
handler
(
newVal
)
{
this
.
setStorageData
()
this
.
initChart
()
if
(
newVal
)
{
this
.
setStorageData
()
this
.
initChart
()
}
},
deep
:
true
,
immediate
:
true
...
...
pages/details/details.vue
View file @
a594c45c
...
...
@@ -219,27 +219,24 @@
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
if
(
info
.
dataUrl
)
{
that
.
getGlobalData
(
info
)
that
.
getGlobalData
(
info
,
list
)
if
(
info
.
dataPollingInterval
)
{
that
.
timename
=
setInterval
(()
=>
{
that
.
getGlobalData
(
info
)
that
.
getGlobalData
(
info
,
list
)
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
that
.
reportInfo
=
res
.
data
.
Result
// 暂不支持tabs带入,没有做数据缓存
// that.reportInfo = this.handleTabsLink(res.data.Result)
// 清除数据
if
(
uni
.
getStorageSync
(
'reportInfo'
))
{
let
i
nfo
=
JSON
.
parse
(
uni
.
getStorageSync
(
'reportInfo'
))
i
nfo
.
list
.
forEach
(
item
=>
{
let
cacheI
nfo
=
JSON
.
parse
(
uni
.
getStorageSync
(
'reportInfo'
))
cacheI
nfo
.
list
.
forEach
(
item
=>
{
// 如果本地缓存的数组在接口请求的数组中不存在,则删除
if
(
!
that
.
reportInfo
.
list
.
some
(
idx
=>
idx
.
id
==
item
.
id
))
{
if
(
!
list
.
some
(
idx
=>
idx
.
id
==
item
.
id
))
{
uni
.
removeStorageSync
(
item
.
id
)
}
})
}
that
.
reportInfo
=
this
.
handleTabsLink
(
res
.
data
.
Result
)
uni
.
setStorageSync
(
'reportInfo'
,
JSON
.
stringify
(
res
.
data
.
Result
))
that
.
getStickyTables
()
}
...
...
@@ -250,14 +247,22 @@
handleTabsLink
(
data
)
{
data
.
list
.
forEach
(
item
=>
{
if
(
item
.
type
===
'NormalTabs'
&&
(
item
.
child
.
index
.
length
||
item
.
child
.
data
.
length
))
{
item
.
child
.
index
.
forEach
(
child
=>
{
const
index
=
data
.
list
.
findIndex
(
i
=>
i
.
id
===
child
)
data
.
list
[
index
].
linkTabsId
=
item
.
id
})
item
.
child
.
data
.
forEach
(
child
=>
{
const
index
=
data
.
list
.
findIndex
(
i
=>
i
.
id
===
child
.
comp
)
data
.
list
[
index
].
linkTabsId
=
item
.
id
})
if
(
item
.
child
.
index
.
length
)
{
item
.
child
.
index
.
forEach
(
child
=>
{
const
index
=
data
.
list
.
findIndex
(
i
=>
i
.
id
===
child
)
if
(
index
!=
-
1
)
{
data
.
list
[
index
].
linkTabsId
=
item
.
id
}
})
}
if
(
item
.
child
.
data
.
length
)
{
item
.
child
.
data
.
forEach
(
child
=>
{
const
index
=
data
.
list
.
findIndex
(
i
=>
i
.
id
===
child
.
comp
)
if
(
index
!=
-
1
)
{
data
.
list
[
index
].
linkTabsId
=
item
.
id
}
})
}
}
})
return
data
...
...
@@ -265,14 +270,21 @@
/**
* 获取全局接口数据
*/
async
getGlobalData
(
info
)
{
async
getGlobalData
(
info
,
list
)
{
const
that
=
this
const
dataUrl
=
info
.
dataUrl
.
replace
(
/^
(\/(
dashboardCharts|dashboardAPI
))?
/
,
''
)
const
dataFormatter
=
this
.
$u
.
common
.
filterRequestParams
({...
info
.
dataFormatter
})
let
res
=
await
that
.
$u
.
api
[
`
${
info
.
dataMethod
.
toLowerCase
()}
Http`
](
dataUrl
,
dataFormatter
,
{
custom
:
{
loading
:
false
}
})
that
.
$u
.
vuex
(
'vuex_globalData'
,
res
.
data
)
const
elements
=
[]
list
.
forEach
(
item
=>
{
if
(
item
.
data
.
dataType
===
'public'
)
{
elements
.
push
(
item
.
id
)
}
})
const
data
=
{...
res
.
data
,
elements
}
that
.
$u
.
vuex
(
'vuex_globalData'
,
data
)
},
/**
* 组件之间关联
...
...
pages/index/index.vue
View file @
a594c45c
...
...
@@ -245,25 +245,25 @@
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
if
(
info
.
dataUrl
)
{
that
.
getGlobalData
(
info
)
that
.
getGlobalData
(
info
,
list
)
if
(
info
.
dataPollingInterval
)
{
that
.
timename
=
setInterval
(()
=>
{
that
.
getGlobalData
(
info
)
that
.
getGlobalData
(
info
,
list
)
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
that
.
reportInfo
=
this
.
handleTabsLink
(
res
.
data
.
Result
)
// 清除数据
if
(
uni
.
getStorageSync
(
'reportInfo'
))
{
let
info
=
JSON
.
parse
(
uni
.
getStorageSync
(
'reportInfo'
))
info
.
list
.
forEach
(
item
=>
{
// 如果本地缓存的数组在接口请求的数组中不存在,则删除
if
(
!
that
.
reportInfo
.
list
.
some
(
idx
=>
idx
.
id
==
item
.
id
))
{
if
(
!
list
.
some
(
idx
=>
idx
.
id
==
item
.
id
))
{
uni
.
removeStorageSync
(
item
.
id
)
}
})
}
that
.
reportInfo
=
this
.
handleTabsLink
(
res
.
data
.
Result
)
uni
.
setStorageSync
(
'reportInfo'
,
JSON
.
stringify
(
res
.
data
.
Result
))
that
.
getStickyTables
()
}
...
...
@@ -297,14 +297,21 @@
/**
* 获取全局接口数据
*/
async
getGlobalData
(
info
)
{
async
getGlobalData
(
info
,
list
)
{
const
that
=
this
const
dataUrl
=
info
.
dataUrl
.
replace
(
/^
(\/(
dashboardCharts|dashboardAPI
))?
/
,
''
)
const
dataFormatter
=
that
.
$u
.
common
.
filterRequestParams
({...
info
.
dataFormatter
})
let
res
=
await
that
.
$u
.
api
[
`
${
info
.
dataMethod
.
toLowerCase
()}
Http`
](
dataUrl
,
dataFormatter
,
{
custom
:
{
loading
:
false
}
})
that
.
$u
.
vuex
(
'vuex_globalData'
,
res
.
data
)
const
elements
=
[]
list
.
forEach
(
item
=>
{
if
(
item
.
data
.
dataType
===
'public'
)
{
elements
.
push
(
item
.
id
)
}
})
const
data
=
{...
res
.
data
,
elements
}
that
.
$u
.
vuex
(
'vuex_globalData'
,
data
)
},
/**
* 组件之间关联
...
...
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