princeLee 4 роки тому
батько
коміт
af251fb118

+ 9 - 1
src/api/projectIndex.js

@@ -132,10 +132,18 @@ export function settingUserSetBiz(data) {
   })
 }
 
-// 获取业务线
+// 获取用户最后选中业务线
 export function settingUserGetBiz() {
   return request({
     url: TeamManagement + `/setting/userGetBiz`,
     method: 'get'
   })
 }
+
+// 获取用户所在业务线
+export function getPersonBizList() {
+  return request({
+    url: TeamManagement + `/setting/getPersonBizList`,
+    method: 'get'
+  })
+}

+ 9 - 4
src/components/newLayout/Head.vue

@@ -10,18 +10,23 @@
       </div>
       <div class="name">{{ item.name }}</div>
     </div>
-    <div v-show="navTagType === 2" class="nav-tag-type" @click="setNavTagType(1)">
+    <!-- <div v-show="navTagType === 2" class="nav-tag-type" @click="setNavTagType(1)">
       <i class="el-icon-notebook-2" style="transform: rotate(90deg);" />
     </div>
     <div v-show="navTagType === 1" class="nav-tag-type" @click="setNavTagType(2)">
       <i class="el-icon-notebook-2" />
-    </div>
+    </div> -->
     <div v-if="userInfo" class="user-info">
       <a-popover placement="rightBottom" overlay-class-name="head-popover">
         <template #content>
           <div class="user-control">
             <div class="user-name">{{ userInfo.name }}</div>
             <div class="line" />
+            <div class="user-logout">
+              <el-button v-if="navTagType === 1" type="primary" plain size="small" @click="setNavTagType(2)">顶部导航</el-button>
+              <el-button v-if="navTagType === 2" type="primary" plain size="small" @click="setNavTagType(1)">侧边导航</el-button>
+            </div>
+            <div class="line" />
             <div class="user-logout">
               <el-button type="primary" plain size="small" @click="layout()">退出登录</el-button>
             </div>
@@ -187,12 +192,12 @@ export default {
   }
 }
 .user-control {
-  height: 95px;
+  height: 143px;
   width: 95px;
   display: flex;
   flex-direction: column;
   display: grid;
-  grid-template-rows: 47px 1px 47px;
+  grid-template-rows: 47px 1px 47px 1px 47px;
   justify-items: center;
   align-items: center;
   .line {

+ 1 - 1
src/components/newLayout/Main.vue

@@ -48,7 +48,7 @@ export default {
       // 如果没有业务线,但是页面又是工作台
       if (this.bizId === -1 && to.name.search(/工作台/) > 0) this.getDefaultBizId(true)
       // 如果是业务线选择页面,不作处理
-      if (to.name.search(/工作台|业务线/) > 0) return
+      if (to.name.search(/工作台|业务线/) >= 0) return
       // 如果与原路由相同,不作处理
       if (from && to.path === from.path) return
       // 如果已存在业务线ID(第一优先级)

+ 46 - 8
src/views/business/bizIdSelect.vue

@@ -7,8 +7,16 @@
       <article>
         <div class="my-business">
           <div class="business-title">我的业务线</div>
-          <div class="business-name my-business-name" @click="enter({ code: bizId, name: bizName })">
-            {{ bizName }}
+          <div class="my-business-list">
+            <div
+              v-for="(item, index) in myBusiness"
+              :key="'my'+item.code"
+              class="business-name"
+              :class="'business-item' + (index % 4)"
+              @click="enter(item,'my')"
+            >
+              {{ item.name }}
+            </div>
           </div>
         </div>
         <div class="all-business">
@@ -16,10 +24,10 @@
           <div class="all-business-list">
             <div
               v-for="(item, index) in bizSelectList"
-              :key="item.code"
+              :key="'all'+item.code"
               class="business-name"
-              :class="'business-item' + (index % 4)"
-              @click="enter(item)"
+              :class="['business-item' + (index % 4), item.isSecret?'disable':'']"
+              @click="enter(item,'all')"
             >
               {{ item.name }}
             </div>
@@ -39,12 +47,13 @@
 import { mapGetters } from 'vuex'
 import { needIdList } from '@/router/needIdList'
 import { EncryptId } from '@/utils/crypto-js.js'
-import { settingGetBizList, settingUserSetBiz } from '@/api/projectIndex'
+import { settingGetBizList, settingUserSetBiz, getPersonBizList } from '@/api/projectIndex'
 let fromRoute = null
 export default {
   data() {
     return {
-      bizSelectList: [] // 业务线选择列表
+      bizSelectList: [], // 业务线选择列表
+      myBusiness: []
     }
   },
   computed: {
@@ -56,17 +65,31 @@ export default {
   },
   created() {
     this.settingGetBizList()
+    this.getPersonBizList()
   },
   methods: {
     async settingGetBizList() {
       const res = await settingGetBizList({})
       if (res.code === 200) this.bizSelectList = res.data || []
     },
+    async getPersonBizList() {
+      const res = await getPersonBizList()
+      if (res.code === 200 && res.data) this.myBusiness = res.data || []
+    },
     // 设置成员登录业务线
     async settingUserSetBiz(bizId) {
       await settingUserSetBiz({ bizId: bizId })
     },
-    enter(biz) {
+    enter(biz, type) {
+      if (biz.isSecret === 1 && type === 'all') {
+        this.$message({
+          message: '无权限',
+          type: 'warning',
+          duration: 1000,
+          offset: 150
+        })
+        return false
+      }
       this.$store.dispatch('global/setBizId', biz.code)
       this.$store.dispatch('global/setBizName', biz.name)
       this.settingUserSetBiz(biz.code)
@@ -137,6 +160,12 @@ export default {
   padding: 64px 46px 0 46px;
   color: #666666;
   font-size: 18px;
+  .my-business-list {
+    padding: 27px 32px;
+    display: grid;
+    grid-template-columns: repeat(4, 25%);
+    grid-gap: 50px 0;
+  }
 }
 .all-business {
   width: 100%;
@@ -223,4 +252,13 @@ export default {
     color: #333333;
   }
 }
+.disable {
+  color: #999999;
+  border-color:  #999999;
+  box-shadow: 0px 6px 12px rgba(153, 153, 153, 0.2);
+}
+.disable:hover {
+  color: #999999;
+  background-color: #ffffff;
+}
 </style>