Commit 716d90a0 by 匡雅琴

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

2 parents e2befc53 35fb9c2f
......@@ -3,11 +3,16 @@
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-09-08 14:40:35
* @LastEditTime: 2023-09-11 11:09:19
-->
<template>
<div>
<div :id="domId" style="width: 100%" :style="{ height }"></div>
<div v-if="!isEmpty">
<div :id="domId" style="width: 100%" :style="{ height }"></div>
</div>
<div v-else class="empty" :style="{ height }">
<Empty></Empty>
</div>
</div>
</template>
<script type="text/ecmascript-6">
......@@ -21,10 +26,10 @@ export default {
type: String,
default: ''
},
dataList: {
type: Array,
default: () => []
},
// dataList: {
// type: Array,
// default: () => []
// },
tooltipFormatterObj: {
type: Object,
default: () => {
......@@ -57,7 +62,8 @@ export default {
},
data() {
return {
barOptions: []
barOptions: [],
isEmpty: false
}
},
created() {
......@@ -80,11 +86,15 @@ export default {
return _html
},
drawBar(dataList) {
if (!dataList || dataList.length === 0) return (this.isEmpty = true)
if (dataList && dataList.length) {
console.log(dataList)
console.log(this.dataList)
this.dataList = dataList
this.isEmpty = false
this.barOptions.xAxis.data = dataList.map(item => item[this.label])
this.barOptions.series[0].data = dataList.map(item => item[this.valueName])
this[this.domId].setOption(this.barOptions)
this[this.domId].resize()
}
},
chartBindEvent() {
......@@ -96,3 +106,7 @@ export default {
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -80,24 +80,19 @@ export default {
// tab切换
changeTab(val) {
console.log(val)
let _dataList
let _dataList = []
switch (val) {
case 0:
this.valueName = this.selectActive === 0 ? 'saasMerchantNum' : 'retentionNum'
_dataList = this.selectActive === 0 ? this.activeMerchant : this.coreRetention
// this.$refs.coreChartRef.drawBar(_dataList)
break
case 1:
this.valueName = this.selectActive === 0 ? 'clinchDealMerchantNum' : 'lastyearActive'
_dataList = this.selectActive === 0 ? this.activeMerchant : this.coreRetention
// this.$refs.coreChartRef.drawBar(_dataList)
break
case 2:
this.valueName = this.selectActive === 0 ? 'activeMerchantNum' : 'retention'
_dataList = this.selectActive === 0 ? this.activeMerchant : this.coreRetention
// this.$refs.coreChartRef.drawBar(_dataList)
break
}
_dataList = this.selectActive === 0 ? this.activeMerchant : this.coreRetention
this.$refs.coreChartRef.drawBar(_dataList)
},
async getCoreActiveMerchant() {
......
......@@ -2,10 +2,10 @@
<div class="price-select">
<div class="type-plugin">
<div class="trend-type-box" @click.stop="switchType">
<div class="text">{{ selectType || priceList[0] }}</div>
<div class="text">{{ selectType || priceList[0].label }}</div>
<div class="trangle-icon"></div>
</div>
<SelectBox :isShow="isShow" :defaultValue.sync="priceList[0]" @clickOutside="clickOutside" :dataList.sync="priceList" :boxWidth="boxWidth" @selectVal="selectPrice"></SelectBox>
<SelectBox :isShow="isShow" :defaultValue.sync="priceList[0].value" @clickOutside="clickOutside" :dataList.sync="priceList" isObject :boxWidth="boxWidth" @selectVal="selectPrice"></SelectBox>
</div>
</div>
</template>
......@@ -39,12 +39,19 @@ export default {
selectList: {
handler(newVal) {
console.log(newVal)
this.priceList = []
newVal.forEach(item => {
this.priceList.push(item + this.unit)
})
if (!this.unit) return
this.priceList.unshift('全部')
// this.priceList = newVal
// this.priceList = []
// newVal.forEach(item => {
// this.priceList.push(item + this.unit)
// })
// if (!this.unit) return (this.priceList = newVal)
if (this.unit) {
this.priceList.unshift({
label: '全部',
value: ''
})
}
this.priceList = this.priceList.concat(newVal)
},
immediate: true
}
......@@ -60,7 +67,7 @@ export default {
this.isShow = false
},
selectPrice(val) {
this.selectType = val
this.selectType = val.label
this.$emit('selectPrice', val)
this.switchType()
}
......
......@@ -17,13 +17,13 @@
<BarChart ref="saleChartRef" domId="saleChart" :height="chartHeight" :colorList="colorList" valueName="channel"></BarChart>
</div>
<div class="trend-box">
<div class="patch-title">按年统计客户销售金额的合理性-<PriceSwitch class="rationality" unit="" :selectList="selectList" @selectPrice="selectPrice"></PriceSwitch></div>
<div class="rationality-text">收入占比:64.89% <PriceSwitch style="display: inline-block;" :selectList="rationalityPriceList"></PriceSwitch></div>
<div class="patch-title">按年统计客户销售金额的合理性-<PriceSwitch class="rationality" unit="" isObject :selectList="selectList" @selectPrice="selectRationality"></PriceSwitch></div>
<div class="rationality-text">收入占比:64.89% <PriceSwitch v-show="isShowPrice" style="display: inline-block;" :selectList="rationalityPriceList" @selectPrice="selectPrice"></PriceSwitch></div>
<BarChart ref="rationalityChartRef" domId="rationalityChart" height="13.99vh" label="statDate" :barWidth="'50'" :colorList="greenColorList" valueName="num"></BarChart>
</div>
<div class="trend-box">
<div class="patch-title">设备订阅数量和线索相关性分析</div>
<div class="correlation"><PriceSwitch style="display: inline-block;" unit="" boxWidth="6.94vw" :selectList="serviceList"></PriceSwitch></div>
<div class="correlation"><PriceSwitch style="display: inline-block;" unit="" boxWidth="6.94vw" :selectList="serviceList" @selectPrice="selectCorrelation"></PriceSwitch></div>
<LineChart ref="correlationChartRef" domId="correlationChart" height="13.99vh" :tooltipFormatterObj="correlationTooltips" :valName="correlationTooltips.attrName"></LineChart>
</div>
</div>
......@@ -67,7 +67,8 @@ export default {
},
selectList: rationalityList,
rationalityPriceList,
serviceList
serviceList,
isShowPrice: false
}
},
mounted() {
......@@ -87,10 +88,12 @@ export default {
this.$refs.monthIncomeChartRef.drawLine(_dataList)
this.$refs.saleChartRef.drawBar(_dataList)
},
async getManageClueSalesAmountRationality(queryItem) {
async getManageClueSalesAmountRationality(queryItem, startPrice, endPrice) {
const params = {
queryItem
}
if (startPrice) params.startPrice = startPrice
if (endPrice) params.endPrice = endPrice
const _data = await this.api.internal.getManageClueSalesAmountRationality(params)
const _dataList = _data.data.dataList[0].finishedProductTrendList
this.$refs.rationalityChartRef.drawBar(_dataList)
......@@ -100,26 +103,28 @@ export default {
const _dataList = _data.data.dataList
this.$refs.correlationChartRef.drawLine(_dataList)
},
selectRationality(val) {
console.log(val)
this.getManageClueSalesAmountRationality(val.value)
this.isShowPrice = val.label === '销售数'
},
// 只有当是销售数(output)时才会触发此事件
selectPrice(val) {
console.log(val)
switch (val) {
case '门店数':
this.getManageClueSalesAmountRationality('num')
break
case '用户数':
this.getManageClueSalesAmountRationality('customerNum')
break
case '销售数':
this.getManageClueSalesAmountRationality('output')
break
default:
break
}
this.getManageClueSalesAmountRationality('output', val.startPrice, val.endPrice)
},
selectCorrelation(val) {
console.log(val)
}
}
}
</script>
<style lang="scss" scoped>
.clue {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.trend-box {
display: inline-block;
height: 21.78vh;
......
......@@ -185,9 +185,61 @@ const edunPriceList = ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-
const equityPriceList = ['0-1', '1-5', '5-10', '10-20', '>=20']
const rationalityList = ['门店数', '用户数', '销售数']
// const rationalityList = ['门店数', '用户数', '销售数']
const rationalityList = [
{
label: '门店数',
value: 'num'
},
{
label: '用户数',
value: 'customerNum'
},
{
label: '销售数',
value: 'output'
}
]
const rationalityPriceList = ['0-10万', '10-20万', '20-30万', '30-40万', '40-50万', '≧60万']
// const rationalityPriceList = ['0-10万', '10-20万', '20-30万', '30-40万', '40-50万', '≧60万']
const rationalityPriceList = [
{
label: '0-10万',
value: '0-10万',
startPrice: 0,
endPrice: 100000
},
{
label: '10-20万',
value: '10-20万',
startPrice: 100000,
endPrice: 200000
},
{
label: '20-30万',
value: '20-30万',
startPrice: 200000,
endPrice: 300000
},
{
label: '30-40万',
value: '30-40万',
startPrice: 300000,
endPrice: 400000
},
{
label: '40-50万',
value: '40-50万',
startPrice: 400000,
endPrice: 500000
},
{
label: '≧60万',
value: '≧60万',
startPrice: 600000,
endPrice: ''
}
]
const serviceList = ['服务订阅设备数', '总线索条数']
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!