Commit 594e45cd authored by leon's avatar leon

feat:charts add new config

parent 86237de4
......@@ -113,27 +113,29 @@ export default {
}
})
chart.on('datazoom', event => {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
// 配置了滑动事件
if(that.elementInfo.dataZoom.slider) {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
}
})
return chart
},
initChart() {
// 等待子组件完全挂载完成---chart初始化完成
this.$nextTick().then(() => {
const { categories, series, preview, images } =
this.elementData.dataList
const { categories, series, preview, images } = this.elementData.dataList
var count = categories.length
if(count < this.elementInfo.dataZoom.count) {
this.elementInfo.dataZoom.start = 0
this.elementInfo.dataZoom.end = 100
}
if (this.labelShow) {
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
let count = categories.length
if (this.elementInfo.dataZoom && this.elementInfo.dataZoom.show) {
count =
(count *
(this.elementInfo.dataZoom.end -
this.elementInfo.dataZoom.start)) /
100
count = (count *(this.elementInfo.dataZoom.end - this.elementInfo.dataZoom.start)) / 100
}
if (
this.elementInfo.option.dataset.maxCount != null &&
......
......@@ -91,10 +91,13 @@
that.handleEchartsClick(event)
})
chart.on('datazoom', event => {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
// 配置了滑动事件
if(that.elementInfo.dataZoom.slider) {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
}
})
return chart
},
......@@ -102,13 +105,13 @@
// 等待子组件完全挂载完成---chart初始化完成
this.$nextTick().then(() => {
const { categories, series } = this.elementData.dataList
var count = categories.length
if(count < this.elementInfo.dataZoom.count) {
this.elementInfo.dataZoom.start = 0
this.elementInfo.dataZoom.end = 100
}
if(this.labelShow) {
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
let count = categories.length
if(count < this.elementInfo.option.dataset.maxCount) {
this.elementInfo.dataZoom.start = 0
this.elementInfo.dataZoom.end = 100
}
if(this.elementInfo.dataZoom && this.elementInfo.dataZoom.show) {
count = count * (this.elementInfo.dataZoom.end - this.elementInfo.dataZoom.start) / 100
}
......
......@@ -83,10 +83,13 @@
that.handleEchartsClick(event)
})
chart.on('datazoom', event => {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
// 配置了滑动事件
if(that.elementInfo.dataZoom.slider) {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
}
})
return chart
},
......@@ -94,9 +97,13 @@
// 等待子组件完全挂载完成---chart初始化完成
this.$nextTick().then(() => {
const { categories, series } = this.elementData.dataList
var count = categories.length
if(count < this.elementInfo.dataZoom.count) {
this.elementInfo.dataZoom.start = 0
this.elementInfo.dataZoom.end = 100
}
if(this.labelShow) {
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
let count = categories.length
if(this.elementInfo.dataZoom && this.elementInfo.dataZoom.show) {
count = count * (this.elementInfo.dataZoom.end - this.elementInfo.dataZoom.start) / 100
}
......
......@@ -81,11 +81,14 @@
chart.on('click', event => {
that.handleEchartsClick(event)
})
chart.on('datazoom', event => {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
chart.on('datazoom', event => {
// 配置了滑动事件
if(that.elementInfo.dataZoom.slider) {
// 传递参数给其他组件
that.echartsDataZoom(event)
// 处理dataZoom的拖动事件
that.handleDataZoomEvent(event)
}
})
return chart
},
......@@ -93,9 +96,13 @@
// 等待子组件完全挂载完成---chart初始化完成
this.$nextTick().then(() => {
const { categories, series } = this.elementData.dataList
var count = categories.length
if(count < this.elementInfo.dataZoom.count) {
this.elementInfo.dataZoom.start = 0
this.elementInfo.dataZoom.end = 100
}
if(this.labelShow) {
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
var count = categories.length
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
if(this.elementInfo.dataZoom && this.elementInfo.dataZoom.show) {
count = count * (this.elementInfo.dataZoom.end - this.elementInfo.dataZoom.start) / 100
}
......@@ -220,7 +227,7 @@
},
setChartDatas(event) {
const categories = this.elementData.dataList.datas[this.index].categories
const series = this.elementData.dataList.datas[this.index].series
const series = this.elementData.dataList.datas[this.index].series
const dealSeries = this.dealSeriesData(series)
this.$set(this.ec.option, 'xAxis.data', categories)
this.$set(this.ec.option, 'series', dealSeries)
......
......@@ -133,9 +133,9 @@
that.elementInfo.table.column = columns
}
that.chartTables = that.elementData.dataList.chartTables
// if(that.elementInfo.table.tableCell.autoHeight) {
if(that.elementInfo.table.tableCell.autoHeight) {
that.calculateCellHeight()
// }
}
})
},
......
<template>
<view class="wrapper" :class="{'tabs-layout': showTabs}">
<view class="wrapper" :class="{'tabs-layout': showTabs}" :style="{width: `${theStyle.width - theStyle.left}px`, left:`${theStyle.left}px`}">
<!-- 普通选项卡 -->
<NormalTabs
v-if="showTabs"
:elementInfo="tabsElement"
style="height: 40px;margin-top: 5px;"
:style="{width: `${theStyle.width - theStyle.left}px`}"
></NormalTabs>
<view :style="{height: `${theStyle.height}px`, width: `${theStyle.width - theStyle.left}px`}">
......@@ -38,19 +37,18 @@
const { windowWidth, windowHeight, screenHeight, safeArea } = uni.getSystemInfoSync()
const reduceBottom = screenHeight - safeArea.bottom
return {
height: this.showTabs ? windowHeight - reduceBottom - 50 : windowHeight - reduceBottom,
height: this.showTabs ? windowHeight - reduceBottom - this.tabsElement.height : windowHeight - reduceBottom,
width: windowWidth,
left: safeArea.left
}
},
},
onLoad(option) {
this.element = JSON.parse(decodeURIComponent(option.element))
this.element = JSON.parse(decodeURIComponent(option.element))
this.linkTabsId = option.linkTabsId
if(this.linkTabsId && uni.getStorageSync('reportInfo')) {
let info = JSON.parse(uni.getStorageSync('reportInfo'))
const data = info.list.find(item => item.id === this.linkTabsId)
data.height = this.theStyle.height
this.tabsElement = data
}
// 去掉全屏的定制按钮
......
......@@ -239,7 +239,7 @@
async getReportCharts() {
clearInterval(this.timename)
const that = this
let res = await that.$u.api.getReportCharts({id: '63647c3932f1997dd2ed53bf'})
let res = await that.$u.api.getReportCharts({id: '627a16644606332538b4633c'})
uni.stopPullDownRefresh()
uni.$emit('handlePullDownRefresh')
const { Status, Result: { info, list } } = res.data
......@@ -277,7 +277,7 @@
if (item.child.index.length) {
item.child.index.forEach(child => {
const index = data.list.findIndex(i => i.id === child )
data.list[index].linkTabsId = item
data.list[index].linkTabsId = item.id
})
}
if (item.child.data.length) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment