123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <template>
- <br />
- <el-card style="margin: 0 1em;">
- <div class="title_card" v-text="title"></div>
- <br />
- <el-button-group style="margin-left: 1.5em">
- <el-button
- size="small"
- type="primary"
- v-for="(item, i) in soft_planting_list"
- :key="'soft_planting' + i"
- :plain="soft_planting_act !== i"
- @click="() => soft_planting_change(i)"
- >
- {{ item.text }}
- </el-button>
- </el-button-group>
- <br />
- <el-row>
- <el-col :span="12">
- <div class="customer_list">
- <div class="customer_list_head">
- 软广-节目类型占比
- </div>
- <div ref="softAd"></div>
- </div>
- </el-col>
- <el-col :span="12">
- <com-table
- :title="'栏目排名top10-' + titleName"
- :tableList="tableList"
- :child="true"
- >
- <template #cols>
- <el-table-column
- align="center"
- type="index"
- label="序号"
- width="50"
- />
- <el-table-column
- show-overflow-tooltip
- align="center"
- property="programName"
- label="栏目名称"
- >
- <template #default="scope">
- {{ scope.row.programName || '--' }}
- </template>
- </el-table-column>
- <el-table-column align="center" property="pinci">
- <template #header>
- <span
- :style="
- soft_planting_list[soft_planting_act].type === 1
- ? 'color: red'
- : ''
- "
- >
- 频次(次)
- </span>
- </template>
- <template #default="scope">
- {{ numFor(scope.row.pinci) }}
- </template>
- </el-table-column>
- <el-table-column align="center" property="timeSize">
- <template #header>
- <span
- :style="
- soft_planting_list[soft_planting_act].type === 2
- ? 'color: red'
- : ''
- "
- >
- 时长(秒)
- </span>
- </template>
- <template #default="scope">
- {{ numFor(scope.row.timeSize) }}
- </template>
- </el-table-column>
- <el-table-column align="center" property="customer" label="">
- <template #header>
- <span
- :style="
- soft_planting_list[soft_planting_act].type === 4
- ? 'color: red'
- : ''
- "
- >
- 客户数
- </span>
- </template>
- <template #default="scope">
- {{ numFor(scope.row.customer) }}
- </template>
- </el-table-column>
- </template>
- </com-table>
- </el-col>
- </el-row>
- </el-card>
- </template>
- <script>
- // @ is an alias to /src
- // import config from "@/config/index";
- import * as echarts from "echarts";
- import comTable from "./table.vue";
- import { ProgramTypeDistribution } from "@/api/index.js";
- export default {
- name: "AdvertisingEye_distribution",
- data() {
- return {
- titleName: "",
- tableList: [],
- soft_planting_act: 0,
- soft_planting_list: [
- {
- text: "时长",
- proportionType: "timeSize",
- type: 2,
- },
- {
- text: "频次",
- proportionType: "pinci",
- type: 1,
- },
- {
- text: "客户数",
- proportionType: "custom",
- type: 4,
- },
- ],
- softAd_chart: undefined,
- };
- },
- props: {
- title: String,
- industry: Number,
- industryRang: Number,
- },
- watch: {
- industryRang() {
- this.init();
- },
- industry() {
- this.init();
- },
- },
- mounted() {
- this.init();
- },
- computed: {},
- filter: {},
- methods: {
- init() {
- ProgramTypeDistribution({
- industryId: this.industry,
- dataType: this.industryRang + 1,
- type: this.soft_planting_list[this.soft_planting_act].type,
- }).then(all => {
- const li = (all || { data: [] }).data || [];
- this.tableList = li;
- li.length && (this.titleName = li[0].name || "");
- this.softAdChart(li || []);
- });
- },
- soft_planting_change(i) {
- this.soft_planting_act = i;
- this.init();
- },
- softAdChart(list) {
- if (!this.$refs.softAd) return;
- if (this.softAd_chart && this.softAd_chart.dispose) {
- this.softAd_chart.dispose();
- this.softAd_chart = undefined;
- }
- this.softAd_chart = echarts.init(this.$refs.softAd);
- this.softAd_chart.resize({
- height: 524,
- });
- let k = [],
- item = [],
- max =
- list[0][
- this.soft_planting_list[this.soft_planting_act].proportionType
- ] || 0;
- list.map(v => {
- k.push({ name: v.programType, max });
- let val = (
- v[this.soft_planting_list[this.soft_planting_act].proportionType] - 0
- ).toFixed(2);
- item.push(val);
- });
- var option = {
- radar: {
- // shape: 'circle',
- indicator: k,
- radius: 130,
- shape: "circle",
- splitNumber: 5,
- splitArea: {
- show: true,
- },
- axisName: {
- color: "#0000ee",
- },
- },
- tooltip: {
- trigger: "item",
- },
- series: [
- {
- type: "radar",
- lineStyle: {
- width: 1,
- opacity: 0.5,
- },
- areaStyle: {
- color: "rgba(157,200,241,.5)",
- },
- itemStyle: {
- color: "#7cb5ec",
- },
- data: [
- {
- value: item,
- },
- ],
- },
- ],
- };
- option && this.softAd_chart.setOption(option);
- },
- numFor(num) {
- if (isNaN(num)) return 0;
- if (num >= 100000000) return (num / 100000000).toFixed(2) + "亿";
- if (num >= 10000) return (num / 10000).toFixed(2) + "万";
- return Number(num).toFixed(2);
- },
- },
- beforeUnmount: function() {
- this.softAd_chart && this.softAd_chart.dispose();
- this.softAd_chart && (this.softAd_chart = undefined);
- },
- components: {
- comTable,
- },
- };
- </script>
- <style scoped>
- .customer_list {
- width: 500px;
- margin: 30px auto;
- border: 1px solid #d2e7fc;
- border-top: 3px solid #40a1f3;
- }
- .customer_list_head {
- line-height: 42px;
- height: 42px;
- color: #378ee8;
- border-bottom: none;
- font-family: "Microsoft YaHei";
- text-align: center;
- font-size: 18px;
- background-color: #d9efff;
- }
- .headStyle .cell {
- font-weight: 600;
- color: #000;
- }
- </style>
|