供应商路由调整
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
-- 供应商管理是一级目录,path 被写成了 "1",列表实际地址变成 /1/supplierinfo。
|
||||
-- 编辑页取消若写死 /customersuppliermanagement/supplierinfo,路由未注册,会落到 404。
|
||||
-- 把目录地址改成 supplier,列表即为 /supplier/supplierinfo。可重复执行。
|
||||
UPDATE sys_menu
|
||||
SET path = 'supplier',
|
||||
update_by = 'admin',
|
||||
update_time = NOW()
|
||||
WHERE menu_id = 2497
|
||||
AND menu_type = 'M'
|
||||
AND path = '1';
|
||||
@@ -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() })
|
||||
}
|
||||
|
||||
/* ============ 初始化 ============ */
|
||||
|
||||
Reference in New Issue
Block a user