Browse Source

档案统计 宽高自适应 重叠bug

master
x_ying 3 years ago
parent
commit
b26fc88c51
  1. 32
      src/views/components/echarts/catePie.vue
  2. 36
      src/views/components/echarts/lendAcross.vue
  3. 37
      src/views/components/echarts/typePie.vue
  4. 55
      src/views/system/archiveStatistics/index.vue
  5. 33
      src/views/system/archiveStatistics/module/acrossBar.vue
  6. 35
      src/views/system/archiveStatistics/module/barEcharts.vue
  7. 34
      src/views/system/archiveStatistics/module/lineEchart.vue

32
src/views/components/echarts/catePie.vue

@ -1,15 +1,15 @@
<template> <template>
<div>
<!-- 档案类别 -->
<div id="maincate" />
</div>
<!-- 档案类别 -->
<div id="maincate" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'CatePie', name: 'CatePie',
mixins: [resize],
props: { props: {
cateData: { cateData: {
type: Array, type: Array,
@ -17,6 +17,19 @@ export default {
default: function() { default: function() {
return [] return []
} }
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
} }
}, },
mounted() { mounted() {
@ -25,7 +38,7 @@ export default {
methods: { methods: {
drawChart() { drawChart() {
const chartDom = document.getElementById('maincate') const chartDom = document.getElementById('maincate')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
option = { option = {
tooltip: { tooltip: {
@ -47,7 +60,7 @@ export default {
name: '档案类别', name: '档案类别',
type: 'pie', type: 'pie',
radius: ['20%', '50%'], radius: ['20%', '50%'],
center: ['50%', '35%'], //
center: ['50%', '40%'], //
roseType: 'area', roseType: 'area',
avoidLabelOverlap: false, // avoidLabelOverlap: false, //
labelLine: { labelLine: {
@ -81,15 +94,12 @@ export default {
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#maincate {
width: 520px;
height:257px;
}
</style> </style>

36
src/views/components/echarts/lendAcross.vue

@ -1,15 +1,14 @@
<template> <template>
<div>
<!-- 档案借阅 -->
<div id="mainlend" />
</div>
<!-- 档案借阅 -->
<div id="mainlend" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'AcrossEcharts', name: 'AcrossEcharts',
mixins: [resize],
props: { props: {
lendData: { lendData: {
type: Array, type: Array,
@ -17,15 +16,32 @@ export default {
default: function() { default: function() {
return [] return []
} }
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
} }
}, },
mounted() { mounted() {
this.drawChart() this.drawChart()
},
beforeDestroy() {
}, },
methods: { methods: {
drawChart() { drawChart() {
const chartDom = document.getElementById('mainlend') const chartDom = document.getElementById('mainlend')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
option = { option = {
tooltip: { tooltip: {
@ -119,15 +135,13 @@ export default {
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#mainlend {
width: 520px;
height:257px;
}
</style> </style>

37
src/views/components/echarts/typePie.vue

@ -1,15 +1,16 @@
<template> <template>
<div>
<!-- 档案类别 -->
<div id="maintype" />
</div>
<!-- 档案类别 -->
<div id="maintype" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'TypePie', name: 'TypePie',
mixins: [resize],
props: { props: {
typeData: { typeData: {
type: Array, type: Array,
@ -17,6 +18,19 @@ export default {
default: function() { default: function() {
return [] return []
} }
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
} }
}, },
mounted() { mounted() {
@ -25,7 +39,7 @@ export default {
methods: { methods: {
drawChart() { drawChart() {
const chartDom = document.getElementById('maintype') const chartDom = document.getElementById('maintype')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
option = { option = {
tooltip: { tooltip: {
@ -44,7 +58,6 @@ export default {
color: '#fff' color: '#fff'
} }
}, },
// color: ['#1CADAB', '#339CF'], //
series: [ series: [
{ {
name: '档案类型', name: '档案类型',
@ -67,10 +80,7 @@ export default {
} }
} }
}, },
// label: {
// show: false,
// position: 'center'
// },
emphasis: { emphasis: {
label: { label: {
show: false show: false
@ -87,15 +97,12 @@ export default {
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#maintype {
width: 520px;
height:257px;
}
</style> </style>

55
src/views/system/archiveStatistics/index.vue

@ -1,92 +1,95 @@
<template> <template>
<div class="app-container" style="background-color: #031435;"> <div class="app-container" style="background-color: #031435;">
<div> <div>
<el-row :gutter="20" style="height:296px;">
<el-row :gutter="20">
<el-col :xs="24" :sm="24" :lg="8"> <el-col :xs="24" :sm="24" :lg="8">
<div class="top-row container-wrap">
<div class="top-row container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">档案借阅</p> <p class="title-arrow">档案借阅</p>
</h3> </h3>
<div class="chart-wrapper">
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<lend-across :lend-data="lendData" /> <lend-across :lend-data="lendData" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :lg="8"> <el-col :xs="24" :sm="24" :lg="8">
<div class="top-row container-wrap">
<div class="top-row container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">档案类别</p> <p class="title-arrow">档案类别</p>
</h3> </h3>
<div class="chart-wrapper">
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<cate-pie :cate-data="cateData" /> <cate-pie :cate-data="cateData" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :lg="8"> <el-col :xs="24" :sm="24" :lg="8">
<div class="top-row container-wrap">
<div class="top-row container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">档案类型</p> <p class="title-arrow">档案类型</p>
</h3> </h3>
<div class="chart-wrapper">
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<type-pie :type-data="typeData" /> <type-pie :type-data="typeData" />
</div> </div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<!-- 中间 --> <!-- 中间 -->
<el-row :gutter="20" style="width:100%;padding:20px 0 20px 10px;" class="dpflex">
<el-col :xs="24" :sm="24" :lg="12" style="padding:0;margin-right:20px">
<div class="container-wrap">
<el-row class="center-box">
<el-col class="center-chart" style="margin-right:20px">
<div class="container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">出入库管理情况</p> <p class="title-arrow">出入库管理情况</p>
</h3> </h3>
<BarEcharts />
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<BarEcharts />
</div>
</div> </div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :lg="12" style="padding:0;margin-right: -10px">
<div class=" container-wrap">
<el-col class="center-chart">
<div class=" container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">档案检索排名</p> <p class="title-arrow">档案检索排名</p>
</h3> </h3>
<AcrossBar />
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<AcrossBar />
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<!-- 底部 --> <!-- 底部 -->
<el-row :gutter="20" style="height:296px;">
<el-row :gutter="20">
<el-col :xs="24" :sm="24" :lg="25"> <el-col :xs="24" :sm="24" :lg="25">
<div class=" container-wrap">
<div class="container-wrap" style="height:calc(25vh - 40px)">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title"> <h3 class="table-title">
<p class="title-arrow">档案实际情况</p> <p class="title-arrow">档案实际情况</p>
</h3> </h3>
<LineEchart />
<div class="chart-wrapper" style="height: calc(100% - 40px);">
<LineEchart />
</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
// import RadarChart from '@/components/Echarts/RadarChart'
import lendAcross from '@/views/components/echarts/lendAcross.vue' import lendAcross from '@/views/components/echarts/lendAcross.vue'
import catePie from '@/views/components/echarts/catePie.vue' import catePie from '@/views/components/echarts/catePie.vue'
import typePie from '@/views/components/echarts/typePie.vue' import typePie from '@/views/components/echarts/typePie.vue'
// import PieChart from '@/components/Echarts/PieChart'
import BarEcharts from './module/barEcharts.vue' import BarEcharts from './module/barEcharts.vue'
import AcrossBar from './module/acrossBar.vue' import AcrossBar from './module/acrossBar.vue'
import LineEchart from './module/lineEchart.vue' import LineEchart from './module/lineEchart.vue'
@ -107,4 +110,16 @@ export default {
.container-wrap{ .container-wrap{
min-height:calc(100vh - 636px) ; min-height:calc(100vh - 636px) ;
} }
.center-box{
// width:100%;
margin:20px 0;
display: flex;
justify-content: space-between;
.center-chart{
padding:0;
height:100%;
flex: 1;
}
}
</style> </style>

33
src/views/system/archiveStatistics/module/acrossBar.vue

@ -1,22 +1,38 @@
<template> <template>
<div class="barEcharts">
<!-- 档案检索排名 -->
<div id="main2" />
</div>
<!-- 档案检索排名 -->
<div id="main2" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'AcrossEcharts', name: 'AcrossEcharts',
mixins: [resize],
props: {
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
}
},
mounted() { mounted() {
this.drawChart() this.drawChart()
}, },
methods: { methods: {
drawChart() { drawChart() {
const chartDom = document.getElementById('main2') const chartDom = document.getElementById('main2')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
option = { option = {
tooltip: { tooltip: {
@ -90,15 +106,12 @@ export default {
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#main2 {
width: 765px;
height:257px;
}
</style> </style>

35
src/views/system/archiveStatistics/module/barEcharts.vue

@ -1,15 +1,31 @@
<template> <template>
<div class="barEcharts">
<!-- 出入库管理情况 -->
<div id="main1" />
</div>
<div id="main1" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'BarEcharts', name: 'BarEcharts',
mixins: [resize],
props: {
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
}
},
mounted() { mounted() {
this.drawChart() this.drawChart()
}, },
@ -17,7 +33,7 @@ export default {
drawChart() { drawChart() {
const app = {} const app = {}
const chartDom = document.getElementById('main1') const chartDom = document.getElementById('main1')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
const posList = [ const posList = [
@ -79,7 +95,7 @@ export default {
position: app.config.position, position: app.config.position,
distance: app.config.distance distance: app.config.distance
} }
myChart.setOption({
this.chart.setOption({
series: [ series: [
{ {
label: labelOption label: labelOption
@ -216,15 +232,12 @@ export default {
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#main1 {
width: 765px;
height:257px;
}
</style> </style>

34
src/views/system/archiveStatistics/module/lineEchart.vue

@ -1,22 +1,38 @@
<template> <template>
<div class="barEcharts">
<!-- 档案检索排名 -->
<div id="main3" />
</div>
<!-- 档案检索排名 -->
<div id="main3" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
import resize from '@/views/dashboard/mixins/resize'
export default { export default {
name: 'AcrossEcharts', name: 'AcrossEcharts',
mixins: [resize],
props: {
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null
}
},
mounted() { mounted() {
this.drawChart() this.drawChart()
window.addEventListener('resize', this.__resizeHandler)
}, },
methods: { methods: {
drawChart() { drawChart() {
const chartDom = document.getElementById('main3') const chartDom = document.getElementById('main3')
const myChart = echarts.init(chartDom)
this.chart = echarts.init(chartDom)
let option = null let option = null
option = { option = {
grid: { // grid: { //
@ -118,16 +134,12 @@ export default {
} }
] ]
} }
option && myChart.setOption(option)
option && this.chart.setOption(option)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#main3 {
width: 100%;
height:257px;
// color: #339cff;
}
</style> </style>
Loading…
Cancel
Save