a70bbac09cae609965beddc0184ca9f4e2c047a2.svn-base 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="app-container">
  3. <h1>集团</h1>
  4. <el-tabs v-model="activeName" @tab-click="handleTabClick">
  5. <el-tab-pane label="效率统计" name="first">
  6. <component :is="myComponent1" ref="detail1" />
  7. </el-tab-pane>
  8. <el-tab-pane label="牛群评估" name="second">
  9. <keep-alive>
  10. <component :is="myComponent2" ref="detail2" />
  11. </keep-alive>
  12. </el-tab-pane>
  13. </el-tabs>
  14. </div>
  15. </template>
  16. <script>
  17. import echarts from 'echarts'
  18. require('echarts/theme/macarons')
  19. import { GetDataByName, GetReportform } from '@/api/common'
  20. import Cookies from 'js-cookie'
  21. import { parseTime } from '@/utils/index.js'
  22. import Pagination from '@/components/Pagination'
  23. import { json2excel } from '@/utils/index.js'
  24. import { MessageBox } from 'element-ui'
  25. import Tab1 from './tab1'
  26. import Tab2 from './tab2'
  27. export default {
  28. name: 'GroupFeedingEfficiency',
  29. components: { Pagination, Tab1, Tab2 },
  30. data() {
  31. return {
  32. activeName: 'first',
  33. myComponent1: null,
  34. myComponent2: null
  35. }
  36. },
  37. created() {},
  38. mounted() {
  39. this.detailComponent1()
  40. },
  41. methods: {
  42. detailComponent1() {
  43. if (this.activeName == 'first') {
  44. const vue = this
  45. var myComponent1 = () => import('./tab1.vue')
  46. return vue.myComponent1 = myComponent1
  47. }
  48. },
  49. handleTabClick() {
  50. if (this.activeName == 'first') {
  51. const vue = this
  52. var myComponent1 = () => import('./tab1.vue')
  53. return vue.myComponent1 = myComponent1
  54. } else if (this.activeName == 'second') {
  55. const vue = this
  56. var myComponent2 = () => import('./tab2.vue')
  57. return vue.myComponent2 = myComponent2
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .search{margin-bottom:10px;}
  65. </style>