index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div id="work-platform">
  3. <el-container>
  4. <el-header>
  5. <div class="header">
  6. <div class="header-left">
  7. <div class="logo-bar" @click="handleClick">
  8. <img src="@/assets/logo-3.png" class="logo">
  9. </div>
  10. <div v-if="showProjectName" class="projectName">
  11. <p><span>专题库名称:</span>{{ projectName }}</p>
  12. </div>
  13. </div>
  14. <div class="header-right">
  15. <user-bar/>
  16. </div>
  17. </div>
  18. </el-header>
  19. <el-main class="main">
  20. <section class="wrapper" >
  21. <!-- <keep-alive>
  22. <router-view id="view" v-if="$route.meta.keepAlive"></router-view>
  23. </keep-alive> -->
  24. <router-view id="view" v-if="!$route.meta.keepAlive"></router-view>
  25. <contextMenu></contextMenu>
  26. </section>
  27. </el-main>
  28. </el-container>
  29. <help></help>
  30. </div>
  31. </template>
  32. <script>
  33. import { mapGetters } from "vuex";
  34. import UserBar from "./components/UserBar";
  35. import { webSocket } from "./mixins";
  36. import { guide } from "./components/guide";
  37. import contextMenu from "./components/contextMenu.vue";
  38. import help from "./components/help.vue";
  39. export default {
  40. components: {
  41. UserBar,
  42. contextMenu,
  43. help
  44. },
  45. mixins: [webSocket,guide],
  46. data() {
  47. return {
  48. showProjectName:false,
  49. projectName:'',
  50. id: this.$route.query.id,
  51. key: this.$route.query.key,
  52. button: [],
  53. show: false,
  54. btnLoading: false,
  55. }
  56. },
  57. watch: {
  58. $route() {
  59. this.button = this.$route.meta.button || []
  60. this.showProjectName = this.$route.meta.showProjectName
  61. this.openGuide(this.$route.meta.sign)
  62. },
  63. showProjectName(val){
  64. this.projectName = this.$s.getSession('projectName')
  65. }
  66. },
  67. computed: {
  68. ...mapGetters(['projectId', 'userinfo','webSocket']),
  69. },
  70. created(){
  71. this.getPermissionList()
  72. },
  73. async mounted() {
  74. this.$store.commit('SET_PREFIX', '/')
  75. this.getRouter()
  76. await this.getPermissions()
  77. if (this.id) {
  78. this.$store.commit('SET_PROJECT_ID', parseInt(this.id))
  79. }
  80. if (this.key) {
  81. this.$store.commit('SET_PATENT_KEY', this.key)
  82. await this.$store.dispatch('getCustomField', this.projectId)
  83. await this.$store.dispatch('getSystemField', this.projectId)
  84. }
  85. this.openGuide(this.$route.meta.sign)
  86. },
  87. methods: {
  88. //获取专题库权限
  89. async getPermissions() {
  90. const response = await this.$api.getPermissions()
  91. this.$store.commit('SET_PERMISSIONS', response.data)
  92. },
  93. //获取路由信息
  94. getRouter(){
  95. this.button = this.$route.meta.button || []
  96. this.showProjectName = this.$route.meta.showProjectName
  97. },
  98. //点击图标
  99. handleClick(){
  100. this.$router.push({
  101. path: '/home'
  102. })
  103. },
  104. //修改权限
  105. changePermission(){
  106. this.webSocket.onmessage = (e) => {
  107. if(JSON.parse(e.data).code=='903' ){
  108. this.getPermissionList()
  109. }
  110. }
  111. },
  112. //获取权限
  113. getPermissionList(){
  114. var code = "6a8d3f4d1d5f11eda41c00163e2f0200;5051395c24e311eda41c00163e2f0200;a97c468b924111ed905500163e2f0200"
  115. this.$api.getPermissionList({code:code}).then(response=>{
  116. this.$store.commit('SET_ADMIN_PERMISSION', response.data)
  117. }).catch(error=>{
  118. this.$store.commit('SET_ADMIN_PERMISSION', [])
  119. })
  120. },
  121. },
  122. }
  123. </script>
  124. <style lang="scss">
  125. .tenant .el-input__inner{
  126. height: 32px;
  127. line-height: 32px;
  128. }
  129. .role .el-icon-close{
  130. display: none;
  131. }
  132. </style>
  133. <style lang="scss" scoped>
  134. #work-platform {
  135. width: 100%;
  136. min-width: 1024px;
  137. height: 100%;
  138. .header {
  139. width: 100%;
  140. height: 60px;
  141. background: #fff;
  142. box-shadow: 0 1px 3px 0 rgba(0,0,0,.12), 0 0 3px 0 rgba(0,0,0,.04);
  143. color: #fff;
  144. display: flex;
  145. justify-content: space-between;
  146. border-bottom: 10px solid #e6e6e6;
  147. .logo-bar {
  148. font-size: 20px;
  149. font-weight: bold;
  150. display: flex;
  151. align-items: center;
  152. cursor: pointer;
  153. .logo {
  154. margin-right: 10px;
  155. // width: 140px;
  156. height: 40px;
  157. }
  158. }
  159. }
  160. .projectName{
  161. margin-left:30px;
  162. color:black
  163. }
  164. .header-left {
  165. display: flex;
  166. align-items: center;
  167. padding-left: 20px;
  168. }
  169. .header-right {
  170. display: flex;
  171. align-items: center;
  172. }
  173. .main{
  174. padding:0 !important;
  175. padding-top:0px !important;
  176. overflow:auto !important;
  177. background:white !important;
  178. }
  179. .wrapper {
  180. width: 100%;
  181. height: 100%;
  182. background: white;
  183. #view {
  184. height: 100%
  185. }
  186. }
  187. }
  188. </style>