Commit 526d2b54 by 胡悦

Merge branch 'v1.0.0' of http://192.168.3.233:8090/h5/glsk-data-view-pd into v1.0.0

2 parents b061c075 99c4f028
<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
......
<template>
<div>
<div v-for="(item, index) in rankingsList" :key="index" class="ranking-box-item" @click="goDetailPage(item)">
<div class="ranking-box-item-left">
<div class="circle" :style="{ 'background-image': index < 3 ? RankColor[index] : '' }">{{ index + 1 }}</div>
<div class="text">{{ item.name }}</div>
</div>
<div class="ranking-box-item-right">{{ item.value }}</div>
</div>
</div>
</template>
<script>
import datas from '@/utils/data'
export default {
name: 'Ranking',
props: {
rankingsList: {
type: Array,
default: () => []
}
},
data() {
return {
RankColor: datas.RankColor
}
},
mounted() {
},
methods: {
// 跳转详情页面
goDetailPage(item) {
console.log(item)
}
}
}
</script>
<style lang="scss" scoped>
.ranking-box-item {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 4px;
&-left {
display: flex;
.circle {
width: 20px;
height: 20px;
border-radius: 20px;
font-size: 14px;
color: #ffffff;
text-align: center;
background: #1e3372;
}
.text {
font-weight: 400;
font-size: 14px;
color: #ffffff;
margin-left: 1.11vw;
cursor: default;
}
.text:hover {
padding-bottom: 1px;
border-bottom: 1px solid #fff;
}
}
&-right {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #95acd9;
text-align: right;
}
}
</style>
...@@ -20,6 +20,9 @@ const DefaultData = { ...@@ -20,6 +20,9 @@ const DefaultData = {
] ]
} }
const RankColor = ['linear-gradient(180deg, #FFDA0B 0%, #FFBC24 100%)', 'linear-gradient(180deg, #EBE5D6 0%, #BDB4A6 100%)', 'linear-gradient(180deg, #EEC08E 0%, #B86E3A 100%)']
export default Object.freeze({ export default Object.freeze({
DefaultData DefaultData,
RankColor
}) })
...@@ -23,25 +23,27 @@ ...@@ -23,25 +23,27 @@
</div> </div>
<!-- 门店排行 --> <!-- 门店排行 -->
<div class="merchant-box"> <div class="merchant-box">
<div v-for="(item, index) in merchantsList" :key="index" class="merchant-box-item"> <!-- <div v-for="(item, index) in merchantsList" :key="index" class="merchant-box-item">
<div class="merchant-box-item-left"> <div class="merchant-box-item-left">
<div class="circle" :style="{ 'background-image': index < 3 ? perchaseColorList[index] : '' }">{{ index + 1 }}</div> <div class="circle" :style="{ 'background-image': index < 3 ? perchaseColorList[index] : '' }">{{ index + 1 }}</div>
<div class="text">{{ item.name }}</div> <div class="text">{{ item.name }}</div>
</div> </div>
<div class="merchant-box-item-right">{{ item.value }}</div> <div class="merchant-box-item-right">{{ item.value }}</div>
</div> </div> -->
<ranking :rankingsList="merchantsList"></ranking>
</div> </div>
</div> </div>
</div> </div>
<!-- 右侧第一个盒子 --> <!-- 右侧第一个盒子 -->
<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>
...@@ -63,7 +65,7 @@ export default { ...@@ -63,7 +65,7 @@ export default {
// 采购额排名当前选中值 // 采购额排名当前选中值
purchase: '商城采购', purchase: '商城采购',
// 采购额排名前三图标颜色 // 采购额排名前三图标颜色
perchaseColorList: ['linear-gradient(180deg, #FFDA0B 0%, #FFBC24 100%)', 'linear-gradient(180deg, #EBE5D6 0%, #BDB4A6 100%)', 'linear-gradient(180deg, #EEC08E 0%, #B86E3A 100%)'], // perchaseColorList: ['linear-gradient(180deg, #FFDA0B 0%, #FFBC24 100%)', 'linear-gradient(180deg, #EBE5D6 0%, #BDB4A6 100%)', 'linear-gradient(180deg, #EEC08E 0%, #B86E3A 100%)'],
// 采购额排名门店数据 // 采购额排名门店数据
merchantsList: [ merchantsList: [
{ {
...@@ -90,7 +92,9 @@ export default { ...@@ -90,7 +92,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 +105,7 @@ export default { ...@@ -101,7 +105,7 @@ export default {
}, },
{ {
isDelivery: '未发货', isDelivery: '未发货',
per: 0.2, per: 0.25,
price: 4568 price: 4568
}, },
{ {
...@@ -109,7 +113,74 @@ export default { ...@@ -109,7 +113,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 +201,6 @@ export default { ...@@ -130,8 +201,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,
...@@ -199,42 +268,12 @@ export default { ...@@ -199,42 +268,12 @@ export default {
} }
.merchant-box { .merchant-box {
margin-top: 2.06vh; margin-top: 2.06vh;
&-item { }
display: flex; }
justify-content: space-between;
align-items: center; &-box2 {
padding-bottom: 1vh; .content-box {
&-left { padding: 3.78vh 1.39vw 1.39vh;
display: flex;
.circle {
width: 20px;
height: 20px;
border-radius: 20px;
font-size: 14px;
color: #ffffff;
text-align: center;
background: #1e3372;
}
.text {
font-weight: 400;
font-size: 14px;
color: #ffffff;
margin-left: 1.11vw;
cursor: default;
}
.text:hover {
padding-bottom: 1px;
border-bottom: 1px solid #fff;
}
}
&-right {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #95acd9;
text-align: right;
}
}
} }
} }
......
<!-- 太阳膜右侧下面两个盒子里面内容 -->
<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!