index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <el-container>
  3. <el-aside>
  4. <left-menu @changeNavType="changeNavType"></left-menu>
  5. </el-aside>
  6. <el-container>
  7. <el-main>
  8. <split-pane v-if="mainViewType == 0 && roleCodeList.indexOf(__self.clientRole) > -1"
  9. :min-percent='minPercent'
  10. :default-percent='defaultPercent'
  11. split="vertical">
  12. <template slot="paneL">
  13. <header-main :refreshReportTemplateData="refreshReportTemplateDataFlag"
  14. :style="leftMenuStyle" @changeTabType="changeTabType"></header-main>
  15. <div @click="expandEvent" style="position: absolute; top: 25px; right: 0; z-index: 2; cursor: pointer;">
  16. <i :class="expandIcon" style="color: #FFFFFF;"></i>
  17. </div>
  18. </template>
  19. <template slot="paneR">
  20. <header-personal></header-personal>
  21. <router-view ref="childView" @refreshReportTemplateData="refreshReportTemplateData" :key="refreshKey"></router-view>
  22. </template>
  23. </split-pane>
  24. <template v-else>
  25. <header-personal></header-personal>
  26. <router-view></router-view>
  27. </template>
  28. </el-main>
  29. </el-container>
  30. </el-container>
  31. </template>
  32. <script>
  33. import LeftMenu from '@/components/LeftMenu/index'
  34. import HeaderMain from '@/components/HeaderMain/index'
  35. import HeaderPersonal from '@/components/HeaderPersonal/index'
  36. import {mapGetters} from "vuex";
  37. import {goPage, gotoPage} from "@/utils/cqcy";
  38. export default {
  39. components: {
  40. LeftMenu,
  41. HeaderMain,
  42. HeaderPersonal
  43. },
  44. data() {
  45. return {
  46. roleCodeList: [],
  47. defaultPercent: 15,
  48. minPercent: 15,
  49. mainViewType: 0,
  50. refreshReportTemplateDataFlag: null,
  51. refreshKey: null,
  52. leftMenuStyle: '',
  53. expandIcon: 'el-icon-d-arrow-left'
  54. }
  55. },
  56. inject: ['__self'],
  57. computed: {
  58. ...mapGetters([
  59. 'roles'
  60. ])
  61. },
  62. mounted() {
  63. this.roleCodeList = []
  64. this.roles.forEach((role) => {
  65. this.roleCodeList.push(role.roleCode)
  66. })
  67. },
  68. created() {
  69. this.disableEvent()
  70. },
  71. methods: {
  72. disableEvent() {
  73. this.$nextTick(() => {
  74. // 禁用右键
  75. document.oncontextmenu = new Function("event.returnValue=false")
  76. // 禁用选择
  77. document.onselectstart = new Function("event.returnValue=false")
  78. document.body.onmouseup = (e) => {
  79. if (window.location.href.indexOf('reportTemplate') > -1) {
  80. console.log('my_report page...')
  81. }
  82. }
  83. })
  84. },
  85. expandEvent() {
  86. if (this.defaultPercent === 1) {
  87. this.leftMenuStyle = 'display: block;'
  88. this.defaultPercent = this.minPercent
  89. this.expandIcon = 'el-icon-d-arrow-left'
  90. } else {
  91. this.leftMenuStyle = 'display: none;'
  92. this.defaultPercent = 1
  93. this.expandIcon = 'el-icon-d-arrow-right'
  94. }
  95. this.refreshKey = new Date().getTime()
  96. localStorage.setItem('EXPAND_REPORT_FLAG', 'true')
  97. },
  98. /** 修改右侧布局视图 */
  99. changeNavType(type) {
  100. this.mainViewType = type
  101. if (type == 1) {
  102. gotoPage(this, '/runConfig')
  103. } else if (type == 2) {
  104. gotoPage(this, '/myReport')
  105. } else if (type == 3) {
  106. gotoPage(this, '/dataModel')
  107. } else if (type == 4) {
  108. gotoPage(this, '/userGroup')
  109. } else if (type == 5) {
  110. gotoPage(this, '/printConfig')
  111. }else {
  112. gotoPage(this, '/index')
  113. this.changeTabType()
  114. }
  115. },
  116. /** Tab 改变事件 */
  117. changeTabType(tab) {
  118. if (this.$refs.childView && this.$refs.childView.hideMainView) this.$refs.childView.hideMainView(tab == null)
  119. },
  120. refreshReportTemplateData(val) {
  121. this.refreshReportTemplateDataFlag = val
  122. }
  123. }
  124. };
  125. </script>
  126. <style rel="stylesheet/scss" lang="scss">
  127. .el-container {
  128. height: 100%;
  129. }
  130. .el-main {
  131. padding: 0 !important;
  132. overflow: hidden !important;
  133. }
  134. .el-aside {
  135. width: 80px !important;
  136. padding: 0;
  137. background-color: #2c3e50;
  138. margin-bottom: 0;
  139. }
  140. .splitter-paneL {
  141. background-color: #2c3e50;
  142. padding-right: 0 !important;
  143. }
  144. .splitter-paneR {
  145. padding-left: 0 !important;
  146. }
  147. .splitter-pane-resizer {
  148. opacity: unset !important;
  149. background: #2c3e50 !important;
  150. }
  151. .cqcy-content {
  152. margin: 20px;
  153. overflow: auto;
  154. height: calc(100% - 110px);
  155. }
  156. </style>