|
|
@@ -1,17 +1,18 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <borderTemplate borderBox="width: 17.083vw;height: 12.500vw;" title="营销费用统计" detailTitle="查看详情">
|
|
|
+ <borderTemplate borderBox="width: 17.083vw;height: 12.500vw;" title="营销费用统计" detailTitle="查看详情" @dialog="$emit('dialog')" systemappid="290" push_path="/salerpriceData">
|
|
|
<template slot="content">
|
|
|
<div>
|
|
|
<div style="display: flex;justify-content: right">
|
|
|
- <el-button type="text" class="inline-16" @click="btnTitle == '客户'?btnTitle = '项目':btnTitle ='客户';typeInit(false)">切换{{btnTitle}}</el-button>
|
|
|
- <el-select v-model="param.content.dateType" class="inline-16" size="small" @change="typeInit(false)" :popper-append-to-body="false">
|
|
|
+ <el-button type="text" class="inline-16" @click="onChange">切换{{btnTitle}}</el-button>
|
|
|
+ <el-select v-model="param.content.dateType" class="inline-16" size="small" @change="onChange" :popper-append-to-body="false">
|
|
|
<el-option :label="$t('全部')" value="全部"></el-option>
|
|
|
<el-option :label="$t('本年')" value="本年"></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div style="width: 15.125vw;height: 7.233vw;margin-top: 0.464vw;position: relative" ref="expenseRefChar">
|
|
|
-<!-- <el-button style="position: absolute;left: 90px;top: 90px" type="text" size="mini">切换{{btnTitle}}</el-button>-->
|
|
|
+ <div v-show="btnTitle == '项目'" style="width: 16.525vw;height: 7.533vw;margin-top: 0.464vw;position: relative" ref="customerRefChar">
|
|
|
+ </div>
|
|
|
+ <div v-show="btnTitle == '客户'" style="width: 16.525vw;height: 7.533vw;margin-top: 0.464vw;position: relative" ref="projectRefChar">
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -41,22 +42,99 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mapData:'',
|
|
|
- typeMap:''
|
|
|
+ cusData:'',
|
|
|
+ proData:'',
|
|
|
+ cusMap:'',
|
|
|
+ proMap:''
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
- async typeInit(init){
|
|
|
- if (this.btnTitle == '客户'){
|
|
|
- this.param.id = 2024062915152702
|
|
|
- this.param.content.ownertable = 'sa_project'
|
|
|
- }else if (this.btnTitle == '项目'){
|
|
|
- this.param.id = 2024062615133802
|
|
|
- this.param.content.ownertable = 'sa_customers'
|
|
|
+ async cusInit(init){
|
|
|
+ this.param.id = 2024062615133802
|
|
|
+ this.param.content.ownertable = 'sa_customers'
|
|
|
+ let res = await this.$api.requested(this.param)
|
|
|
+ // this.mapData = res.data[0].ratio
|
|
|
+ this.cusData = res.data[0].ratio.map(item=>{
|
|
|
+ return {
|
|
|
+ "totalamount": this.totalamount,//值
|
|
|
+ "type": item.type,
|
|
|
+ "rowindex": item.rowindex,
|
|
|
+ "ratio": Math.round(((item.ratio * 100)*100)/100), //比例
|
|
|
+ "value":item.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('客户类型数据',this.cusData)
|
|
|
+ if (init) {
|
|
|
+ this.cusMap = new Pie(this.$refs.customerRefChar, {
|
|
|
+ appendPadding: 2,
|
|
|
+ data:this.cusData,
|
|
|
+ angleField: 'ratio',
|
|
|
+ colorField: 'type',
|
|
|
+ radius: 1,
|
|
|
+ innerRadius: 0.79,
|
|
|
+ label:{
|
|
|
+ style:{
|
|
|
+ fill:'#CFDCE5'
|
|
|
+ },
|
|
|
+ /*type: 'inner',
|
|
|
+ offset: '-50%',
|
|
|
+ style: {
|
|
|
+ textAlign: 'center',
|
|
|
+ },
|
|
|
+ autoRotate: false,*/
|
|
|
+ formatter: (datum) => `${datum.ratio}%`
|
|
|
+ },
|
|
|
+ tooltip:{
|
|
|
+ formatter: (datum) => {
|
|
|
+ return { name: datum.key, value: datum.ratio + '%' };
|
|
|
+ },
|
|
|
+ },
|
|
|
+ statistic: {
|
|
|
+ title: {
|
|
|
+ offsetY: -4,
|
|
|
+ style: {
|
|
|
+ fontSize:'0.833vw',
|
|
|
+ color:'#E6F4FF'
|
|
|
+ },
|
|
|
+ content:'客户营销费用'
|
|
|
+ },
|
|
|
+ content: {
|
|
|
+ offsetY: 4,
|
|
|
+ style: {
|
|
|
+ whiteSpace: 'pre-wrap',
|
|
|
+ overflow: 'hidden',
|
|
|
+ textOverflow: 'ellipsis',
|
|
|
+ fontSize:'0.833vw',
|
|
|
+ color:'#FFFFFF'
|
|
|
+ },
|
|
|
+ customHtml: (container, view, datum, data) => {
|
|
|
+ const text = this.totalamount = '¥'+this.tool.formatAmount(res.data[0].ratio[0].total/10000,2)+'万'
|
|
|
+ return text
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ position:'right',
|
|
|
+ itemName:{
|
|
|
+ style:{
|
|
|
+ fill:'#CFDCE5'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 添加 中心统计文本 交互
|
|
|
+ interactions: [{ type: 'element-single-selected' },{ type: 'element-active' }],
|
|
|
+ });
|
|
|
+ this.cusMap.render();
|
|
|
+ } else {
|
|
|
+ this.cusMap.changeData(this.cusData)
|
|
|
}
|
|
|
+ },
|
|
|
+ async proInit(init){
|
|
|
+ this.param.id = 2024062915152702
|
|
|
+ this.param.content.ownertable = 'sa_project'
|
|
|
let res = await this.$api.requested(this.param)
|
|
|
// this.mapData = res.data[0].ratio
|
|
|
- this.mapData = res.data[0].ratio.map(item=>{
|
|
|
+ this.proData = res.data[0].ratio.map(item=>{
|
|
|
return {
|
|
|
"totalamount": this.totalamount,//值
|
|
|
"type": item.type,
|
|
|
@@ -65,18 +143,19 @@ export default {
|
|
|
"value":item.value
|
|
|
}
|
|
|
})
|
|
|
- console.log('项目类型数据',this.mapData)
|
|
|
- let content = this.btnTitle == '项目'?'客户营销费用':'项目营销费用'
|
|
|
+ console.log('项目类型数据',this.proData)
|
|
|
if (init) {
|
|
|
- console.log('11111ce')
|
|
|
- this.typeMap = new Pie(this.$refs.expenseRefChar, {
|
|
|
- appendPadding: 10,
|
|
|
- data:this.mapData,
|
|
|
+ this.proMap = new Pie(this.$refs.projectRefChar, {
|
|
|
+ appendPadding: 2,
|
|
|
+ data:this.proData,
|
|
|
angleField: 'ratio',
|
|
|
colorField: 'type',
|
|
|
radius: 1,
|
|
|
innerRadius: 0.79,
|
|
|
label:{
|
|
|
+ style:{
|
|
|
+ fill:'#CFDCE5'
|
|
|
+ },
|
|
|
/*type: 'inner',
|
|
|
offset: '-50%',
|
|
|
style: {
|
|
|
@@ -94,9 +173,10 @@ export default {
|
|
|
title: {
|
|
|
offsetY: -4,
|
|
|
style: {
|
|
|
- fontSize:'16px'
|
|
|
+ fontSize:'0.833vw',
|
|
|
+ color:'#E6F4FF'
|
|
|
},
|
|
|
- content:content
|
|
|
+ content:'项目营销费用'
|
|
|
},
|
|
|
content: {
|
|
|
offsetY: 4,
|
|
|
@@ -104,24 +184,38 @@ export default {
|
|
|
whiteSpace: 'pre-wrap',
|
|
|
overflow: 'hidden',
|
|
|
textOverflow: 'ellipsis',
|
|
|
- fontSize:'16px'
|
|
|
+ fontSize:'0.833vw',
|
|
|
+ color:'#FFFFFF'
|
|
|
},
|
|
|
customHtml: (container, view, datum, data) => {
|
|
|
- const text = res.data[0].ratio[0].total
|
|
|
+ const text = this.totalamount = '¥'+this.tool.formatAmount(res.data[0].ratio[0].total/10000,2)+'万'
|
|
|
return text
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
legend: {
|
|
|
position:'right',
|
|
|
- top:'20px'
|
|
|
+ itemName:{
|
|
|
+ style:{
|
|
|
+ fill:'#CFDCE5'
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
// 添加 中心统计文本 交互
|
|
|
interactions: [{ type: 'element-single-selected' },{ type: 'element-active' }],
|
|
|
});
|
|
|
- this.typeMap.render();
|
|
|
+ this.proMap.render();
|
|
|
} else {
|
|
|
- this.typeMap.changeData(this.mapData)
|
|
|
+ this.proMap.changeData(this.proData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onChange(){
|
|
|
+ if (this.btnTitle == '客户'){
|
|
|
+ this.btnTitle = '项目'
|
|
|
+ this.cusInit(false)
|
|
|
+ }else {
|
|
|
+ this.btnTitle = '客户'
|
|
|
+ this.proInit(false)
|
|
|
}
|
|
|
}
|
|
|
}
|