|
@@ -0,0 +1,267 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="shaanxiNewsSimulcast">
|
|
|
|
+ <el-table :data="tableData" @expand-change="rowClick" style="width: 100%">
|
|
|
|
+ <el-table-column type="expand">
|
|
|
|
+ <template #default="props">
|
|
|
|
+ <div>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="20">
|
|
|
|
+ <div :ref="'huashanChart' + props.row.index"></div>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="4">
|
|
|
|
+ <div :ref="'huashanListChart' + props.row.index"></div>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="日期" prop="stadate" />
|
|
|
|
+ <el-table-column label="标题" prop="program_name" />
|
|
|
|
+ <!-- <el-table-column label="主题" prop="tagging" /> -->
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+// @ is an alias to /src
|
|
|
|
+import { epgDetail, epgResult } from "@/api/index";
|
|
|
|
+
|
|
|
|
+import * as echarts from "echarts/core";
|
|
|
|
+import { LineChart, BarChart } from "echarts/charts";
|
|
|
|
+import {
|
|
|
|
+ TitleComponent,
|
|
|
|
+ TooltipComponent,
|
|
|
|
+ GridComponent,
|
|
|
|
+ ToolboxComponent,
|
|
|
|
+ VisualMapComponent,
|
|
|
|
+} from "echarts/components";
|
|
|
|
+import { LabelLayout, UniversalTransition } from "echarts/features";
|
|
|
|
+import { CanvasRenderer } from "echarts/renderers";
|
|
|
|
+echarts.use([
|
|
|
|
+ TitleComponent,
|
|
|
|
+ TooltipComponent,
|
|
|
|
+ GridComponent,
|
|
|
|
+ LineChart,
|
|
|
|
+ BarChart,
|
|
|
|
+ CanvasRenderer,
|
|
|
|
+ ToolboxComponent,
|
|
|
|
+ VisualMapComponent,
|
|
|
|
+ LabelLayout,
|
|
|
|
+ UniversalTransition,
|
|
|
|
+]);
|
|
|
|
+const openList = [];
|
|
|
|
+const openLi = [];
|
|
|
|
+export default {
|
|
|
|
+ name: "shaanxiNewsSimulcast",
|
|
|
|
+ props: ["item"],
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ tableData: [],
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ epgResult({ programId: this.item.id }).then(programList => {
|
|
|
|
+ this.tableData = programList;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ computed: {},
|
|
|
|
+ methods: {
|
|
|
|
+ rowClick(row) {
|
|
|
|
+ if (
|
|
|
|
+ openList[row.index] !== undefined ||
|
|
|
|
+ openLi[row.index] !== undefined
|
|
|
|
+ ) {
|
|
|
|
+ if (openList[row.index]) {
|
|
|
|
+ openList[row.index].dispose();
|
|
|
|
+ openList[row.index] = undefined;
|
|
|
|
+ }
|
|
|
|
+ if (openLi[row.index]) {
|
|
|
|
+ openLi[row.index].dispose();
|
|
|
|
+ openLi[row.index] = undefined;
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ epgDetail({ epgId: row.epg_id }).then(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ let more = this.createChart(
|
|
|
|
+ this.$refs["huashanChart" + row.index],
|
|
|
|
+ res
|
|
|
|
+ );
|
|
|
|
+ openList[row.index] = more.chart;
|
|
|
|
+ openLi[row.index] = this.createBarChart(
|
|
|
|
+ this.$refs["huashanListChart" + row.index],
|
|
|
|
+ more.height
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ createChart(ele, list) {
|
|
|
|
+ if (!ele) return;
|
|
|
|
+ const chart = echarts.init(ele);
|
|
|
|
+ const height = (ele.offsetWidth * 6) / 16;
|
|
|
|
+ chart.resize({
|
|
|
|
+ height,
|
|
|
|
+ width: ele.offsetWidth,
|
|
|
|
+ });
|
|
|
|
+ let option = {
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: "axis",
|
|
|
|
+ axisPointer: {
|
|
|
|
+ type: "cross",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ toolbox: {
|
|
|
|
+ show: true,
|
|
|
|
+ feature: {
|
|
|
|
+ saveAsImage: {},
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ grid: {
|
|
|
|
+ top: "5%",
|
|
|
|
+ left: "3%",
|
|
|
|
+ right: "4%",
|
|
|
|
+ bottom: "3%",
|
|
|
|
+ containLabel: true,
|
|
|
|
+ },
|
|
|
|
+ xAxis: {
|
|
|
|
+ type: "category",
|
|
|
|
+ boundaryGap: false,
|
|
|
|
+ data: list.map(v=> v.metric)
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ type: "value",
|
|
|
|
+ axisLabel: {
|
|
|
|
+ formatter: watchrate => {
|
|
|
|
+ return watchrate;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ axisPointer: {
|
|
|
|
+ snap: true,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ visualMap: {
|
|
|
|
+ show: false,
|
|
|
|
+ dimension: 0,
|
|
|
|
+ pieces: [
|
|
|
|
+ {
|
|
|
|
+ lte: 6,
|
|
|
|
+ color: "green",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ gt: 6,
|
|
|
|
+ lte: 800,
|
|
|
|
+ color: "red",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ gt: 8,
|
|
|
|
+ lte: 14,
|
|
|
|
+ color: "green",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ gt: 14,
|
|
|
|
+ lte: 17,
|
|
|
|
+ color: "red",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ gt: 17,
|
|
|
|
+ color: "green",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: "Electricity",
|
|
|
|
+ type: "line",
|
|
|
|
+ smooth: true,
|
|
|
|
+ data: list.map(v => v.watchrate),
|
|
|
|
+ itemStyle: {
|
|
|
|
+ opacity: 0,
|
|
|
|
+ },
|
|
|
|
+ lineStyle: {
|
|
|
|
+ width: 1,
|
|
|
|
+ },
|
|
|
|
+ emphasis: {
|
|
|
|
+ scale: false,
|
|
|
|
+ lineStyle: {
|
|
|
|
+ width: 1,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ markArea: {
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: "rgba(255, 173, 177, 0.4)",
|
|
|
|
+ },
|
|
|
|
+ data: [
|
|
|
|
+ [
|
|
|
|
+ {
|
|
|
|
+ name: "Morning Peak",
|
|
|
|
+ xAxis: "07:30",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ xAxis: "10:00",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ {
|
|
|
|
+ name: "Evening Peak",
|
|
|
|
+ xAxis: "17:30",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ xAxis: "21:15",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+ option && chart.setOption(option);
|
|
|
|
+ return { chart, height };
|
|
|
|
+ },
|
|
|
|
+ createBarChart(ele, height) {
|
|
|
|
+ if (!ele) return;
|
|
|
|
+ const chart = echarts.init(ele);
|
|
|
|
+ chart.resize({
|
|
|
|
+ height,
|
|
|
|
+ width: ele.offsetWidth,
|
|
|
|
+ });
|
|
|
|
+ let option = {
|
|
|
|
+ title: {},
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: "axis",
|
|
|
|
+ axisPointer: {
|
|
|
|
+ type: "shadow",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ grid: {
|
|
|
|
+ top: 0,
|
|
|
|
+ left: "3%",
|
|
|
|
+ right: "4%",
|
|
|
|
+ bottom: "3%",
|
|
|
|
+ containLabel: true,
|
|
|
|
+ },
|
|
|
|
+ xAxis: {
|
|
|
|
+ type: "value",
|
|
|
|
+ splitNumber: 2,
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ type: "category",
|
|
|
|
+ data: ["Brazil", "Indonesia", "USA", "India", "China", "World"],
|
|
|
|
+ },
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: "2011",
|
|
|
|
+ type: "bar",
|
|
|
|
+ data: [1000, 2000, 4000, 50000, 6000, 70000],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+ option && chart.setOption(option);
|
|
|
|
+ return chart;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ beforeUnmount: function() {},
|
|
|
|
+ components: {},
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style></style>
|