Commit 4e49c3a1 by 匡雅琴

右侧内容

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