修复一些路由跳转问题

This commit is contained in:
梁州 2025-05-08 16:58:18 +08:00
parent ab65f82cf4
commit 64f1067a8d
5 changed files with 5264 additions and 13809 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +1,91 @@
<template>
<el-scrollbar ref="scrollbar" :wrap-style="{ 'align-content': 'center' }">
<div class="app-tag">
<el-tag closable size="default" v-for="(tag, index) in tags" :key="tag.labelName"
:disable-transitions="true" :effect="$route.path === tag.path ? 'dark' : 'plain'"
@close="handleClose(tag, index)" @click="handleClick(tag, index)">
<el-tooltip effect="light" :content="tag.labelName" placement="top">
{{ tag.labelName.length > 4 ? tag.labelName.substring(0, 4) + '..' : tag.labelName }}
</el-tooltip>
</el-tag>
</div>
</el-scrollbar>
<el-scrollbar ref="scrollbar" :wrap-style="{ 'align-content': 'center' }">
<div class="app-tag">
<el-tag closable size="default" v-for="(tag, index) in tags" :key="tag.labelName"
:disable-transitions="true" :effect="$route.path === tag.path ? 'dark' : 'plain'"
@close="handleClose(tag, index)" @click="handleClick(tag, index)">
<el-tooltip effect="light" :content="tag.labelName" placement="top">
{{ tag.labelName.length > 4 ? tag.labelName.substring(0, 4) + '..' : tag.labelName }}
</el-tooltip>
</el-tag>
</div>
</el-scrollbar>
</template>
<script setup>
import store from '@/store'
import { nextTick, ref, watch } from 'vue'
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
import {nextTick, ref, watch} from 'vue'
import {onMounted} from 'vue';
import {useRouter} from 'vue-router';
const router = useRouter()
let tags = ref([])
const scrollbar = ref()
//
onMounted(() => {
tags.value = store.getters.getStateTagsList
nextTick(() => {
autoScroll(router.currentRoute.value.path)
})
tags.value = store.getters.getStateTagsList
nextTick(() => {
autoScroll(router.currentRoute.value.path)
})
})
//
watch(() => router.currentRoute.value.path, (newVal, oldVal) => {
if (newVal !== oldVal) {
// pathtag
autoScroll(router.currentRoute.value.path)
}
if (newVal !== oldVal) {
// pathtag
autoScroll(router.currentRoute.value.path)
}
})
//
const closeTag = (tag) => {
store.commit('mutationCloseTag', tag)
store.commit('mutationCloseTag', tag)
}
//
const handleClose = (tag, index) => {
if (tags.value.length === 1) { //
return
}
closeTag(tag) // tag
if (router.path !== tag.path) {
if (index === (tags.value.length - 1)) { // ,
router.push(this.tags[index].path)
} else { //
if (index === 0) {
router.push(tags.value[0].path)
} else {
router.push(tags.value[index - 1].path)
}
}
//
if (router.currentRoute.value.path === tag.path) {
console.log(index + ':' + tags.value.length)
if (index === (tags.value.length - 1)) { // ,
router.push('/home')
} else { //
if (index === 0) {
router.push(tags.value[index + 1].path)
} else {
router.push(tags.value[index - 1].path)
}
}
}
closeTag(tag) // tag
}
// tags
const handleClick = (tag) => {
router.push(tag.path)
autoScroll(router.currentRoute.value.path)
router.push(tag.path)
autoScroll(router.currentRoute.value.path)
}
//
const autoScroll = (path) => {
// pathtag
tags.value.forEach((item, index) => {
if (item.path === path) {
scrollbar.value.setScrollLeft(index * 80)
}
})
// pathtag
tags.value.forEach((item, index) => {
if (item.path === path) {
scrollbar.value.setScrollLeft(index * 80)
}
})
}
</script>
<style scoped>
.app-tag {
display: flex;
display: flex;
}
.app-tag .el-tag {
display: flex;
cursor: pointer;
height: 30px;
min-width: 80px;
max-width: 80px;
margin-right: 2px;
display: flex;
cursor: pointer;
height: 30px;
min-width: 80px;
max-width: 80px;
margin-right: 2px;
}
.app-tag .el-tag:hover {
color: #000;
background-color: #5A9CF8;
color: #000;
background-color: #5A9CF8;
}
</style>

View File

@ -1,39 +1,41 @@
<template>
<div class="menu-title">主菜单</div>
<!-- 侧边栏菜单区域 -->
<el-menu :default-active="route.path" active-text-color="#409Eff" background-color="#fff" text-color="#000" :router="true" unique-opened>
<!-- 一级菜单 -->
<el-sub-menu :index="item.id" v-for="item in menuList" :key="item.id">
<!-- 一级菜单模板区域 -->
<template #title>
<el-icon>
<component :is="item.iconValue"></component>
</el-icon>
<span>{{ item.labelName }}</span>
</template>
<!-- 二级菜单 -->
<el-menu-item :index="subItem.path" v-for="subItem in item.children" :key="subItem.id"
@click="clickMenu(subItem)">
<template #title>
<span>{{ subItem.labelName }}</span>
</template>
</el-menu-item>
</el-sub-menu>
</el-menu>
<div class="menu-title">主菜单</div>
<!-- 侧边栏菜单区域 -->
<el-menu :default-active="route.path" active-text-color="#409Eff" background-color="#fff" text-color="#000"
:router="true" unique-opened>
<!-- 一级菜单 -->
<el-sub-menu :index="item.id" v-for="item in menuList" :key="item.id">
<!-- 一级菜单模板区域 -->
<template #title>
<el-icon>
<component :is="item.iconValue"></component>
</el-icon>
<span>{{ item.labelName }}</span>
</template>
<!-- 二级菜单 -->
<el-menu-item :index="subItem.path" v-for="subItem in item.children" :key="subItem.id"
@click="clickMenu(subItem)">
<template #title>
<span>{{ subItem.labelName }}</span>
</template>
</el-menu-item>
</el-sub-menu>
</el-menu>
</template>
<script setup>
import store from '@/store'
import { useRoute } from 'vue-router'
import {useRoute} from 'vue-router'
const menuList = store.getters.getMenuList
const route = useRoute()
//
const clickMenu = (item) => {
store.commit('mutationSelectTags', item)
store.commit('mutationSelectTags', item)
}
</script>
<style scoped>
.menu-title {
margin-top: 5px;
margin-top: 5px;
}
</style>

View File

@ -4,7 +4,7 @@
<div class="work-area">
<fieldset class="search-area">
<el-form ref="stockQueryFormRef" :model="stockQuery" :label-position="labelPosition"
label-width="158px" style="max-width: 100%" status-icon>
label-width="auto" style="max-width: 100%" status-icon>
<div style="display: flex;justify-content: space-between;">
<el-row>
<el-form-item label="箱号">

View File

@ -30,7 +30,8 @@
<script setup>
import store from '@/store'
import router from '@/router'
const user = store.getters.getUserNam//
const user = store.getters.getUserName//
const token = store.getters.getToken//
// WMS
const loginToWms = () => {
@ -50,12 +51,10 @@ const loginToScanImage = () => {
}
// WCS
const loginToWcs = () => {
const wcsUrl = `https://cxlasrs.ecorp.cat.com/wcs/#/login?user=user&pwd=user`
window.location.href = wcsUrl//
window.location.href = `https://cxlasrs.ecorp.cat.com/wcs/#/login?user=user&pwd=user`//
}
const loginToMonitor = () => {
const mpnitorUrl = `https://cxlasrs.ecorp.cat.com?user=${user}&token=${token}`
window.location.href = mpnitorUrl//
window.location.href = `https://cxlasrs.ecorp.cat.com?user=${user}&token=${token}`//
}
</script>