|
@@ -3,9 +3,6 @@
|
|
|
<div class="bizIdSet">
|
|
|
<!-- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> -->
|
|
|
<!-- <breadcrumb class="breadcrumb-container" /> -->
|
|
|
- <el-button v-show="status" :disabled="showBizId" type="primary" @click="changeBizId">
|
|
|
- {{ sumType }}
|
|
|
- </el-button>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="right-menu" style="display: fiex; align-items: center; justify-content: space-between;">
|
|
@@ -25,14 +22,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import { needIdList } from '@/router/needIdList'
|
|
|
-import { redirect } from '@/router/redirect'
|
|
|
-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'
|
|
|
-import { memberGetLoginInMemberInfoByLdap, settingGetBizList, settingUserGetBiz } from '@/api/projectIndex'
|
|
|
+import { memberGetLoginInMemberInfoByLdap } from '@/api/projectIndex'
|
|
|
|
|
|
export default {
|
|
|
// components: {
|
|
@@ -42,128 +35,18 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
show2: false,
|
|
|
- options: {},
|
|
|
- value: '',
|
|
|
- arr_data: [],
|
|
|
- sumTypeArray: [],
|
|
|
- formulaArea: '', // 公式的文本框
|
|
|
- typeObj: {},
|
|
|
- showBizId: false
|
|
|
+ options: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters([
|
|
|
- 'sidebar',
|
|
|
- 'avatar',
|
|
|
- 'status',
|
|
|
- 'bizId'
|
|
|
- ]),
|
|
|
username() {
|
|
|
return localStorage.getItem('realname')
|
|
|
- },
|
|
|
- sumType() {
|
|
|
- const nowBiz = this.sumTypeArray.find(item => item.code === this.bizId)
|
|
|
- if (nowBiz) return nowBiz.name
|
|
|
- return ''
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- $route: {
|
|
|
- async handler(to, from) {
|
|
|
- const redirectUrl = `http://zhihui.xiaojukeji.com/#${to.fullPath}`
|
|
|
- if (redirect[redirectUrl]) {
|
|
|
- window.location.href = redirect[redirectUrl]
|
|
|
- window.location.reload()
|
|
|
- }
|
|
|
- // 如果业务线列表不存在,请求获取路由业务线列表
|
|
|
- if (this.sumTypeArray.length < 1) await this.settingGetBizList()
|
|
|
- // 如果没有业务线,但是页面又是工作台
|
|
|
- if (this.bizId === -1 && (to.name === '个人工作台' || to.name === '团队工作台')) this.settingUserGetBiz(true)
|
|
|
- // 如果是业务线选择页面,不作处理
|
|
|
- if (to.name === '业务线选择' || to.name === '个人工作台' || to.name === '团队工作台') return
|
|
|
- // 如果与原路由相同,不作处理
|
|
|
- if (from && to.path === from.path) return
|
|
|
- // 如果已存在业务线ID
|
|
|
- if (this.bizId !== -1) {
|
|
|
- const existBizId_id = needIdList.find(item => item === this.$route.name)
|
|
|
- existBizId_id
|
|
|
- ? ''
|
|
|
- : this.$router.replace({
|
|
|
- path: this.$route.path,
|
|
|
- query: { ...this.$route.query, bizId: EncryptId(this.bizId) }
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- // 如果前往路由中参数中bizId和bizId_id都不存在,去获取默认bizId
|
|
|
- if (!to.query.bizId && !to.query.bizId_id) {
|
|
|
- this.settingUserGetBiz()
|
|
|
- return
|
|
|
- }
|
|
|
- // 如果是需要bizId和id的详情页
|
|
|
- const existBizId_id = needIdList.find(item => item === to.name)
|
|
|
- existBizId_id ? this.handlerIdAndBizId() : this.handlerBizId()
|
|
|
- },
|
|
|
- immediate: true
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.getLoginMember()
|
|
|
},
|
|
|
methods: {
|
|
|
- handlerBizId() { // 只处理bizId
|
|
|
- const bizId = Number(desDecryptId(this.$route.query.bizId))
|
|
|
- const isExistBizId = this.sumTypeArray.find(item => bizId === item.code)// 业务线id是否存在
|
|
|
- if (isExistBizId) {
|
|
|
- this.$store.dispatch('global/setBizId', bizId)
|
|
|
- } else {
|
|
|
- this.settingUserGetBiz()
|
|
|
- }
|
|
|
- console.log('mainbizId', this.bizId)
|
|
|
- },
|
|
|
- handlerIdAndBizId() { // 处理bizId和id
|
|
|
- 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('global/setBizId', Number(arr[0]))
|
|
|
- } else {
|
|
|
- this.settingUserGetBiz()
|
|
|
- }
|
|
|
- console.log('mainbizId', this.bizId)
|
|
|
- },
|
|
|
- async settingGetBizList() { // 获取业务线列表
|
|
|
- const res = await settingGetBizList({})
|
|
|
- this.sumTypeArray = res.data || []
|
|
|
- },
|
|
|
- async settingUserGetBiz(noQuery = false) { // 获取人员默认业务线
|
|
|
- const res = await settingUserGetBiz()
|
|
|
- const nowBiz = this.sumTypeArray.find(item => res.data.bizId === item.code)
|
|
|
- if (nowBiz) {
|
|
|
- this.$store.dispatch('global/setBizId', nowBiz.code)
|
|
|
- localStorage.setItem('bizId', nowBiz.code)
|
|
|
- if (noQuery) return // 如果是不需要url参数的,直接返回
|
|
|
- const existBizId_id = needIdList.find(item => item === this.$route.name)
|
|
|
- // 如果不是在需要bizId_id的详情页,就去给路由添加bizId
|
|
|
- existBizId_id
|
|
|
- ? ''
|
|
|
- : this.$router.replace({
|
|
|
- path: this.$route.path,
|
|
|
- query: { ...this.$route.query, bizId: EncryptId(nowBiz.code) }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$router.push({ name: '业务线选择' })
|
|
|
- }
|
|
|
- },
|
|
|
- async remoteMethod(query) {
|
|
|
- if (query !== '') {
|
|
|
- const res = await settingGetBizList({ bizName: query })
|
|
|
- this.sumTypeArray = res.data
|
|
|
- } else {
|
|
|
- this.get_bizArr()
|
|
|
- }
|
|
|
- },
|
|
|
- changeBizId(type) { // 更改业务线
|
|
|
- this.$router.push({ name: '业务线选择' })
|
|
|
- },
|
|
|
async getLoginMember() { // 获取登录人员信息
|
|
|
const res = await memberGetLoginInMemberInfoByLdap()
|
|
|
this.options = res.data
|