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