供应商路由调整

This commit is contained in:
liuminghui
2026-11-02 10:41:20 +08:00
parent 1ba5822a86
commit 1b1b934d87
3 changed files with 27 additions and 2 deletions
+14 -1
View File
@@ -197,7 +197,11 @@ export const dynamicRoutes = [
path: 'index',
component: () => import('@/views/customersuppliermanagement/supplierinfo/supplieredit/index.vue'),
name: 'SupplierEdit',
meta: { title: '供应商编辑', activeMenu: '/customersuppliermanagement/supplierinfo' }
// 高亮地址跟菜单走。供应商目录 path 曾被写成 "1",列表实际是 /1/supplierinfo,写死客户管理目录会对不上。
beforeEnter(to) {
to.meta.activeMenu = supplierListPath()
},
meta: { title: '供应商编辑', activeMenu: '/supplier/supplierinfo' }
}
]
},
@@ -264,4 +268,13 @@ const router = createRouter({
},
})
/**
* 供应商列表的真实地址由菜单注册,不写死目录。
* 当前库里「供应商管理」目录 path 若仍是 1,这里会得到 /1/supplierinfo。
*/
export function supplierListPath() {
const hit = router.getRoutes().find(r => /\/supplierinfo$/.test(r.path))
return hit ? hit.path : '/supplier/supplierinfo'
}
export default router
@@ -622,6 +622,7 @@ import { getToken } from '@/utils/auth'
import axios from 'axios'
import { saveAs } from 'file-saver'
import { useChannels, parseChannelCodes } from '@/components/ChannelSelect/useChannels'
import { supplierListPath } from '@/router'
const { proxy } = getCurrentInstance()
const route = useRoute()
@@ -1063,7 +1064,8 @@ function submitForm() {
}
function goBack() {
router.push({ path: '/customersuppliermanagement/supplierinfo' })
// 关闭编辑页并回到已注册的供应商列表。菜单目录 path 是 1 时列表为 /1/supplierinfo,不能回到客户管理那条不存在的地址。
proxy.$tab.closeOpenPage({ path: supplierListPath() })
}
/* ============ 初始化 ============ */