Heightlight.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="heightlight">
  3. <el-page-header v-if="dataAll.n" :content="dataAll.n" @back="goBack" />
  4. <br />
  5. <trend-line-chart
  6. v-if="dataAll.i"
  7. :list="dataAll.i || []"
  8. ></trend-line-chart>
  9. <el-table v-if="dataAll.i" :header-cell-style="{ backgroundColor: '#f4f5f7',color: '#606266' }" :data="dataAll.i" style="width: 100%">
  10. <el-table-column align="center" width="180" prop="t" label="日期" />
  11. <el-table-column align="center" prop="n" label="名称" />
  12. <el-table-column
  13. align="center"
  14. prop="r"
  15. :formatter="matrer"
  16. label="收视率"
  17. width="180"
  18. />
  19. </el-table>
  20. </div>
  21. </template>
  22. <script>
  23. // @ is an alias to /src
  24. import trendLineChart from "@/components/trendLineChart.vue";
  25. import { heightlightDataApi } from "@/api/index";
  26. export default {
  27. name: "Heightlight",
  28. data() {
  29. return {
  30. dataAll: {},
  31. };
  32. },
  33. mounted() {
  34. heightlightDataApi({
  35. tv_id: this.$route.query.t,
  36. ca_id: this.$route.query.id,
  37. })
  38. .then(r => {
  39. this.dataAll = r || {};
  40. })
  41. .catch(() => {
  42. this.dataAll ={};
  43. });
  44. },
  45. computed: {},
  46. methods: {
  47. playTime(row) {
  48. return row.start_time.split(" ")[1] + "~" + row.end_time.split(" ")[1];
  49. },
  50. goBack() {
  51. this.$router.go(-1);
  52. },
  53. matrer(row, column, cellValue) {
  54. return (cellValue * 100).toFixed(4) + "%";
  55. },
  56. matrerTime(row, column, cellValue) {
  57. return cellValue.split(" ")[0];
  58. },
  59. },
  60. beforeUnmount: function() {},
  61. components: { trendLineChart },
  62. };
  63. </script>
  64. <style>
  65. .heightlight {
  66. padding: 1em;
  67. min-height: 100%;
  68. }
  69. </style>