index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="dayReport-box">
  3. <!-- 选项卡切换 -->
  4. <a-tabs v-model="activeKey" @change="callback" :tabBarStyle="{'background':'#fff',height:'41px',overflow:'hidden',marginBottom:'5px'}">
  5. <a-tab-pane :key="item.id" :tab="item.name" v-for="item in tabsList" forceRender>
  6. <dTable :ref="'table'+item.id"></dTable>
  7. </a-tab-pane>
  8. </a-tabs>
  9. </div>
  10. </template>
  11. <script>
  12. import { commonMixin } from '@/utils/mixin'
  13. import dTable from './table.vue'
  14. export default {
  15. name: 'RegionTypeSalesReportList',
  16. mixins: [commonMixin],
  17. components: { dTable },
  18. data () {
  19. return {
  20. spinning: false,
  21. activeKey: 0, // 切换显示页面值 0 各分区品类实售明细 1各区域品类实售明细
  22. tabsList: [] // tab切换data
  23. }
  24. },
  25. methods: {
  26. // tabs切换 change时间
  27. callback (key) {
  28. this.activeKey = key
  29. this.$refs['table' + this.activeKey][0].pageInit(this.activeKey)
  30. },
  31. // 初始化
  32. pageInit () {
  33. this.tabsList = []
  34. if (this.$hasPermissions('M_National_Sales_Daily_Report')) {
  35. this.tabsList.push({ id: 0, name: '全国销售日报' })
  36. }
  37. if (this.$hasPermissions('M_Project_Sales_Daily_Report')) {
  38. this.tabsList.push({ id: 1, name: '项目销售日报1' })
  39. }
  40. if (this.$hasPermissions('M_Project_Sales_Daily_Report_2')) {
  41. this.tabsList.push({ id: 2, name: '项目销售日报2' })
  42. }
  43. if (this.$hasPermissions('M_Regional_Sales_Daily_Report')) {
  44. this.tabsList.push({ id: 3, name: '分区销售日报' })
  45. }
  46. this.activeKey = this.tabsList[0].id
  47. this.$nextTick(() => {
  48. this.$refs['table' + this.activeKey][0].pageInit(this.activeKey)
  49. })
  50. }
  51. },
  52. mounted () {
  53. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  54. this.pageInit()
  55. }
  56. },
  57. activated () {
  58. // 如果是新页签打开,则重置当前页面
  59. if (this.$store.state.app.isNewTab) {
  60. this.pageInit()
  61. }
  62. },
  63. beforeRouteEnter (to, from, next) {
  64. next(vm => {})
  65. }
  66. }
  67. </script>
  68. <style lang="less" scoped>
  69. .dayReport-box{
  70. min-height: calc(100vh - 90px);
  71. background: #fff;
  72. }
  73. </style>