Commit 4e49c3a1 by 匡雅琴

右侧内容

1 parent f6bfc044
<template>
<div class="legend">
<div class="legend" :style="legendStyle">
<div class="legend-item flex" v-for="(item, index) in dataList" :key="index">
<div class="icon" :style="{ background: colors[index] }"></div>
<div class="item-content">{{ item.name }}</div>
<div v-for="(itm, inx) in legentList" :key="inx">
<template v-if="inx == 0">
<div class="flex legend-item-right">
<div class="icon" :style="{ background: colors[index] }"></div>
<div class="item-content">{{ item[itm.name] }}</div>
</div>
</template>
<template v-else>
<div class="flex item-content">
<div v-show="itm.hasIcon">{{ itm.hasIcon }}</div>
<div>{{ item[itm.name] }}</div>
</div>
</template>
</div>
</div>
</div>
</template>
......@@ -19,9 +31,17 @@ export default {
type: Array,
default: () => []
},
legentList: {
type: Array,
default: () => []
},
colors: {
type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#BF98FF', '#58D9F9']
},
legendStyle: {
type: String,
default: ''
}
},
watch: {
......@@ -36,26 +56,19 @@ export default {
<style lang="scss" scoped>
.legend {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 7.7vw;
height: 8.54vh;
margin-left: 0.42vw;
.legend-item {
width: 3.68vw;
height: 2.44vh;
background: #0d133b;
align-items: center;
font-size: 7px;
color: #fff;
box-sizing: border-box;
margin: 2px 2px 2px 0;
white-space: nowrap;
font-size: 12px;
font-weight: 400;
line-height: 24px;
color: #c9c9c9ff;
justify-content: space-between;
&-right {
// margin-right: 1.39vw;
}
.item-content {
width: 2.5vw;
overflow: hidden;
text-align: left;
}
.icon {
width: 5px;
......
......@@ -2,12 +2,12 @@
<div class="pie-box">
<div :id="id" :style="{ height: height }" class="pie-chart"></div>
<!-- <div class="center-content" :style="{ fontSize: size }">
<div :class="[id, 'center-content-num', 'center-content-num-color']"></div>
</div> -->
<div :class="[id, 'center-content-num', 'center-content-num-color']"></div>
</div> -->
<!-- <div class="content-desc">
<div class="content-desc-icon" :style="{ background: descColor }"></div>
{{ numDesc }}
</div> -->
<div class="content-desc-icon" :style="{ background: descColor }"></div>
{{ numDesc }}
</div> -->
</div>
</template>
......@@ -39,7 +39,7 @@ export default {
},
colors: {
type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006']
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#58D9F9']
},
size: {
type: String,
......@@ -75,7 +75,8 @@ export default {
}
},
mounted() {},
mounted() {
},
methods: {
// 初始化数据
......@@ -88,7 +89,6 @@ export default {
value: item[keys[1]]
})
})
console.log(this.viewData)
},
draw() {
if (this.mTime) clearInterval(this.mTime)
......@@ -151,7 +151,6 @@ export default {
this.mainValue = data.data.value
this.numDesc = data.data.name
this.descColor = data.color
// 停止定时器,清除之前的高亮
clearInterval(this.mTime)
this.currentIndex = data.dataIndex
......
......@@ -36,12 +36,13 @@
<!-- 右侧第一个盒子 -->
<div class="right-box2">
<box-title title="商城采购进度分析"></box-title>
<RightViewContent :chart="progressChart" :listData="progressData"></RightViewContent>
<RightViewContent class="content-box" :chart="progressChart" :listData="progressData" :legentList="progressLegend" :legendColors="progressLegendColors"></RightViewContent>
<!-- 内容 -->
</div>
<!-- 右侧第一个盒子 -->
<div class="right-box3">
<box-title title="商城采购额商品占比"></box-title>
<RightViewContent class="content-box" :chart="propertionChart" :listData="propertionData" :legentList="propertionLegend" :legendColors="propertionLegendColors"></RightViewContent>
<!-- 内容 -->
</div>
</div>
......@@ -90,7 +91,9 @@ export default {
// 采购进度饼图结构
progressChart: {
id: 'progress',
keys: ['isDelivery', 'per']
keys: ['isDelivery', 'per'],
height: '15.34vh',
colors: ['#34AFFF', '#FFC200', '#16E193']
},
// 采购进度数据
progressData: [
......@@ -101,7 +104,7 @@ export default {
},
{
isDelivery: '未发货',
per: 0.2,
per: 0.25,
price: 4568
},
{
......@@ -109,7 +112,74 @@ export default {
per: 0.44,
price: 4568
}
]
],
progressLegend: [{
name: 'isDelivery'
}, {
name: 'per'
}, {
name: 'price',
hasIcon: '¥'
}],
progressLegendColors: ['#34AFFF', '#FFC200', '#16E193'],
// 采购占比饼图结构
propertionChart: {
id: 'propertion',
keys: ['name', 'per'],
height: '15.34vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
// 采购占比数据
propertionData: [
{
name: '商品1',
per: 0.36,
price: 4568,
averagePrice: 668
},
{
name: '商品1',
per: 0.20,
price: 4568,
averagePrice: 668
},
{
name: '商品1',
per: 0.16,
price: 4568,
averagePrice: 668
},
{
name: '品1发货',
per: 0.10,
price: 4568,
averagePrice: 668
},
{
name: '商品1',
per: 0.09,
price: 4568,
averagePrice: 668
},
{
name: '商品1',
per: 0.09,
price: 4568,
averagePrice: 668
}
],
propertionLegend: [{
name: 'name'
}, {
name: 'per'
}, {
name: 'price',
hasIcon: '¥'
}, {
name: 'averagePrice',
hasIcon: '均价¥'
}],
propertionLegendColors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
}
},
methods: {
......@@ -130,8 +200,6 @@ export default {
flex-direction: column;
width: 31.39vw;
overflow: hidden;
background: #091c40;
// background: #061422;
&-box1,
&-box2,
......@@ -238,6 +306,12 @@ export default {
}
}
&-box2 {
.content-box {
padding: 3.78vh 1.39vw 1.39vh;
}
}
&-box2,
&-box3 {
height: 25vh;
......
<!-- 太阳膜右侧下面两个盒子里面内容 -->
<template>
<div>
<pie-chart :id="chart.id" :list="listData" :keys="chart.keys"></pie-chart>
<div class="main-box">
<pie-chart class="pie-chart" :id="chart.id" :list="listData" :keys="chart.keys" :height="chart.height" :colors="chart.colors"></pie-chart>
<Legend class="legend" :list="listData" :legentList="legentList" :colors="legendColors"></Legend>
</div>
</template>
<script>
// import * as echarts from 'echarts'
import Legend from '../../../components/Legend.vue'
export default {
components: { Legend },
name: 'RightViewContent',
props: {
chart: {
......@@ -16,6 +19,14 @@ export default {
listData: {
type: Array,
default: () => []
},
legentList: {
type: Array,
default: () => []
},
legendColors: {
type: Array,
default: () => []
}
},
data() {
......@@ -28,4 +39,17 @@ export default {
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.main-box {
display: flex;
align-items: center;
.pie-chart {
// width: 138px;
// height: 138px;
width: 20%;
}
.legend {
flex: 1;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!