Browse Source

业务线判断优化

wangziqian 4 năm trước cách đây
mục cha
commit
239758d4e8
1 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 7 7
      src/layout/components/Navbar.vue

+ 7 - 7
src/layout/components/Navbar.vue

@@ -27,7 +27,7 @@
 <script>
 import { mapGetters } from 'vuex'
 import { needIdList } from '@/router/needIdList'
-import { EncryptId, desDecryptId } from '@/utils/crypto-js.js'
+import { EncryptId, desDecryptId, analysisBizId_id } from '@/utils/crypto-js.js'
 // import Breadcrumb from '@/components/Breadcrumb' // 面包屑
 // import Hamburger from '@/components/Hamburger'  // 导航开关
 import { logoutUrl } from '@/apiConfig/requestIP.js'
@@ -113,8 +113,7 @@ export default {
       console.log('mainbizId', this.bizId)
     },
     handlerIdAndBizId() { // 处理bizId和id
-      const bizId_id = this.$route.query.bizId_id
-      const arr = desDecryptId(bizId_id).split('_')
+      const arr = analysisBizId_id(this.$route.query.bizId_id)
       const isExistBizId = this.sumTypeArray.find(item => Number(arr[0]) === item.code)// 业务线id是否存在
       if (isExistBizId) {
         this.$store.dispatch('data/setBizId', Number(arr[0]))
@@ -134,14 +133,15 @@ export default {
         this.$store.dispatch('data/setBizId', nowBiz.code)
         localStorage.setItem('bizId', nowBiz.code)
         const existBizId_id = needIdList.find(item => item === this.$route.name)
-        if (!existBizId_id) { // 如果不是在需要bizId_id的详情页,就去给路由添加bizId
-          this.$router.replace({
+        // 如果不是在需要bizId_id的详情页,就去给路由添加bizId
+        existBizId_id
+          ? ''
+          : this.$router.replace({
             path: this.$route.path,
             query: { ...this.$route.query, bizId: EncryptId(nowBiz.code) }
           })
-        }
       } else {
-        console.log('重定向到业务线选择页面')
+        this.$router.push({ name: '业务线选择' })
       }
     },
     async remoteMethod(query) {