You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

370 lines
17 KiB

3 years ago
<template>
<div class="home-page-content">
<div class="top-number">
<div class="top-number-item">
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_renwu_slices/ic_renwu.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 34px">总任务数</span>
</div>
3 years ago
<!-- <div class="top-number-content-tag">
3 years ago
<span class="average" style="padding: 10px">日均</span>
<span class="average-number" style="padding: 10px">15000</span>
3 years ago
</div> -->
3 years ago
</div>
3 years ago
<div class="top-number-total">{{totalData.taskNum || 0}}</div>
3 years ago
</div>
</div>
<div class="grey-line"></div>
<div class="top-number-item">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_sucai_slices/ic_sucai.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 34px">总素材数</span>
</div>
<!-- <div class="top-number-content-tag">
<span class="average" style="padding: 10px">日均</span>
<span class="average-number" style="padding: 10px">15000</span>
</div> -->
</div>
3 years ago
<div class="top-number-total">{{totalData.referenceNum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
<div class="grey-line"></div>
<div class="top-number-item">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_xiansuo_slices/ic_xiansuo.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 34px">总线索数</span>
</div>
<!-- <div class="top-number-content-tag">
<span class="average" style="padding: 10px">日均</span>
<span class="average-number" style="padding: 10px">15000</span>
</div> -->
</div>
3 years ago
<div class="top-number-total">{{totalData.customerActionNoteNum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
</div>
<div class="grey-line-cross"></div>
<div class="top-number">
<div class="top-number-item-small">
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_bofang_slices/ic_bofang.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总播放数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.playNumSum || 0}}</div>
3 years ago
</div>
</div>
<div class="grey-line"></div>
<div class="top-number-item-small">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_dianzan_slices/ic_dianzan.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总点赞数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.commendNumSum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
<div class="grey-line"></div>
<div class="top-number-item-small">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_shoucang_slices/ic_shoucang.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总收藏数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.collectionNumSum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
3 years ago
<div class="grey-line"></div>
3 years ago
<div class="top-number-item-small">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_pinglun_slices/ic_pinglun.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总评论数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.commentNumSum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
<div class="grey-line"></div>
<div class="top-number-item-small">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_zhuanfa_slices/ic_zhuanfa.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总转发数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.reSendNumSum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
<div class="grey-line"></div>
<div class="top-number-item-small">
3 years ago
<div class="top-number-content">
<div style="display: flex; justify-content: space-between">
<div class="top-number-content-title">
<img src="@/assets/ic_tuijian_slices/ic_tuijian.png" alt="" />
<span style="margin-left: 12px;width: 120px;line-height: 32px">总推荐数</span>
</div>
</div>
3 years ago
<div class="top-number-total">{{totalData.commendNumSum || 0}}</div>
3 years ago
</div>
3 years ago
</div>
</div>
<div class="middle-charts" style="margin-top: 24px">
3 years ago
<el-tabs v-model="playNumFormType" @tab-change="statusChange">
3 years ago
<el-tab-pane label="播放" :name="1"></el-tab-pane>
<el-tab-pane label="点赞" :name="2"></el-tab-pane>
<el-tab-pane label="收藏" :name="3"></el-tab-pane>
<el-tab-pane label="评论" :name="4"></el-tab-pane>
<el-tab-pane label="转发" :name="5"></el-tab-pane>
<el-tab-pane label="推荐" :name="6"></el-tab-pane>
</el-tabs>
2 years ago
<div class="middle-tab">
<el-form :inline="true">
<el-form-item label="用户">
<el-select clearable v-model="playNumForm.userId" @change="statusChange">
<el-option v-for="(item) in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="任务">
<el-select clearable v-model="playNumForm.taskId" @change="statusChange">
<el-option v-for="(item) in taskList" :key="item.id" :label="item.title" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-radio-group style="margin-left: 12px" @change="changeDateType" v-model="playNumForm.dateCondition" size="default">
<el-radio-button :label="2">本周</el-radio-button>
<el-radio-button :label="3">本月</el-radio-button>
<el-radio-button :label="4">全年</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-date-picker style="margin-left: 12px" value-format="YYYY-MM-DD HH:mm:ss" type="daterange" v-model="selTime" @change="dateRangeChange"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="toExcel">Excel</el-button>
</el-form-item>
</el-form>
3 years ago
</div>
</div>
3 years ago
<div class="chart-content">
3 years ago
<div class="chart-title">
{{playNumFormType==1?'播放量趋势':playNumFormType==2?'点赞数趋势':playNumFormType==3?'收藏数趋势':playNumFormType==4?'评论数趋势':playNumFormType==5?'转发数趋势':'推荐数趋势'}}
<!-- ({{playNumForm.dateCondition==1?'今日':playNumForm.dateCondition==2?'本周':playNumForm.dateCondition==3?'本月':'全年'}}) -->
</div>
3 years ago
<div class="chart-item" id="chartItem"></div>
</div>
3 years ago
<div class="bottom-table" style="margin-top: 24px">
3 years ago
<el-tabs v-model="form.type" @tab-change="rankStatusChange">
3 years ago
<el-tab-pane label="经销商统计" :name="1"></el-tab-pane>
<el-tab-pane label="员工统计" :name="2"></el-tab-pane>
</el-tabs>
<div style="padding: 6px">
3 years ago
<el-radio-group @change="changeRankDateType" v-model="form.dateCondition" size="default">
<el-radio-button :label="2">本周</el-radio-button>
<el-radio-button :label="3">本月</el-radio-button>
<el-radio-button :label="4">全年</el-radio-button>
</el-radio-group>
<!-- <el-button size="default" @click="changeRankDateType(2)" text>本周</el-button>
3 years ago
<el-button size="default" @click="changeRankDateType(3)" text>本月</el-button>
3 years ago
<el-button size="default" @click="changeRankDateType(4)" text>全年</el-button> -->
3 years ago
</div>
</div>
<div class="table-content">
3 years ago
<el-table :data="tableData" size="large" stripe
:header-cell-style="{background: '#FAFAFA'}">
3 years ago
<el-table-column prop="sort" label="排序" width="180">
<template #default="scope">
<img v-if="scope.$index == 0" src="@/assets/ic_diyi_slices/ic_diyi.png" alt="" />
<img v-else-if="scope.$index == 1" src="@/assets/ic_dier_slices/ic_dier.png" alt="" />
<img v-else-if="scope.$index == 2" src="@/assets/ic_disan_slices/ic_disan.png" alt="" />
<span v-else>{{scope.$index+1}}</span>
</template>
</el-table-column>
<el-table-column prop="title" :label="form.type==1?'经销商名称':'员工名称'" width="480"></el-table-column>
3 years ago
<el-table-column prop="subtitle" :label="form.type==1?'地址':'部门'" width="480"></el-table-column>
3 years ago
<el-table-column prop="effectValue" label="传播值">
3 years ago
<template #default="scope">
3 years ago
<span class="transValue-number">{{scope.row.effectValue}}</span>
3 years ago
</template>
</el-table-column>
3 years ago
</el-table>
3 years ago
</div>
</div>
</template>
<script>
3 years ago
import * as echarts from "echarts";
import {defineComponent, reactive, ref, getCurrentInstance} from 'vue'
3 years ago
export default defineComponent({
name: 'v-home',
setup() {
const form = reactive({
3 years ago
type: 1,
3 years ago
dateCondition: 2
3 years ago
});
const playNumForm = reactive({
2 years ago
taskId: undefined,
userId: undefined,
3 years ago
dateCondition: 2,
3 years ago
beginTime: undefined,
endTime: undefined,
3 years ago
})
3 years ago
const playNumFormType = ref(1);
3 years ago
const totalData = ref({});
3 years ago
const tableData = ref([]);
3 years ago
const selTime = ref([]);
const myChart = ref();
2 years ago
const userList = ref([]);
const taskList = ref([]);
3 years ago
const { proxy } = getCurrentInstance();
3 years ago
return {
3 years ago
form,playNumForm,proxy,playNumFormType,myChart,selTime,
2 years ago
tableData,totalData,userList,taskList
3 years ago
}
},
mounted() {
2 years ago
this.getApi();
3 years ago
this.getTotal();
3 years ago
this.drawChart();
3 years ago
this.getRank();
3 years ago
},
methods: {
3 years ago
statusChange() {
this.drawChart();
},
2 years ago
getApi() {
let obj = {pageNum: 1, pageSize: 1000}
this.proxy.$post("/task/list", obj).then(res => {
if(res.code == 200) {
const data = res.data.records
this.taskList = data
} else {
this.$message.error(res.msg)
}
}).catch(() => {});
this.proxy.$post("/user/list", obj).then(res => {
if(res.code == 200) {
const data = res.data.records
this.userList = data
} else {
this.$message.error(res.msg)
}
}).catch(() => {});
},
3 years ago
getTotal() {
this.proxy.$post("/statistics/data1", {}).then(res => {
if(res.code == 200) {
this.totalData = res.data
} else {
this.$message.error(res.msg)
}
}).catch(() => {});
},
3 years ago
changeDateType() {
3 years ago
this.selTime = [];
this.playNumForm.beginTime = undefined;
this.playNumForm.endTime = undefined;
3 years ago
this.drawChart();
},
3 years ago
changeRankDateType() {
3 years ago
this.getRank();
},
dateRangeChange(value) {
3 years ago
this.playNumForm.dateCondition = undefined;
3 years ago
this.playNumForm.beginTime = value[0];
this.playNumForm.endTime = value[1];
this.drawChart();
},
3 years ago
drawChart() {
3 years ago
if(this.myChart != null && this.myChart != '' && this.myChart != undefined) {
this.myChart.dispose();
}
this.myChart = echarts.init(document.getElementById('chartItem'));
3 years ago
this.proxy.$post("/statistics/data2", this.playNumForm).then(res => {
3 years ago
let dx = []; let dy = [];
res.data.forEach(ele => {
dx.push(ele.dat);
if(this.playNumFormType == 1) {
dy.push(ele.playNumSum)
} else if(this.playNumFormType == 2) {
dy.push(ele.commendNumSum)
} else if(this.playNumFormType == 3) {
dy.push(ele.collectionNumSum)
} else if(this.playNumFormType == 4) {
dy.push(ele.commentNumSum)
} else if(this.playNumFormType == 5) {
dy.push(ele.reSendNumSum)
} else if(this.playNumFormType == 6) {
dy.push(ele.recommendNumSum)
};
});
this.setOption(dx,dy);
3 years ago
}).catch(() => {});
3 years ago
},
setOption(dx, dy) {
//type数据类型 1播放2点赞3收藏4评论5转发6推荐date日期类型 1今日2本周3本月4全年
3 years ago
let option = {
3 years ago
xAxis: [{ data: dx }],
yAxis: [{
type: 'value'
}],
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }
3 years ago
},
3 years ago
grid: { containLabel: true },
3 years ago
series: [
{
type: 'bar',
3 years ago
data: dy,
3 years ago
barWidth: 20,
itemStyle: {
color: 'rgb(61,147,253)',
},
3 years ago
label: {
show: true,
position: 'top',
textStyle: { fontSize: 12 }
}
3 years ago
}
]
};
3 years ago
this.myChart.setOption(option);
3 years ago
},
getRank() {
let obj = Object.assign({pageNum: 1,pageSize: 10},this.form)
this.proxy.$post("/statistics/data3", obj).then(res => {
3 years ago
let data = res.data.records;
3 years ago
this.tableData = data;
3 years ago
}).catch(() => {});
},
rankStatusChange() {
this.getRank()
2 years ago
},
toExcel() {
let date = new Date()
this.proxy.$download("/statistics/excel2", this.playNumForm, '播放量趋势'+date.toLocaleString()+'.xlsx').then(res => {
console.log(res);
}).catch(() => {});
3 years ago
}
3 years ago
}
})
</script>
<style lang="less" scoped>
@import './title.less';
</style>