Commit 4ce59807 by liimin

test

1 parent 4132e498
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* @Author: limin * @Author: limin
* @Date: 2021-08-25 14:52:15 * @Date: 2021-08-25 14:52:15
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2021-10-13 11:22:37 * @LastEditTime: 2023-09-19 11:18:00
* @FilePath: \scrm\scrm-base\src\global\history.js * @FilePath: \scrm-base\src\global\history.js
*/ */
import store from '@/store' import store from '@/store'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
...@@ -36,8 +36,9 @@ function push(menu) { ...@@ -36,8 +36,9 @@ function push(menu) {
if (!url) { if (!url) {
throw new Error('history.push:必须传入URL') throw new Error('history.push:必须传入URL')
} }
const to = store.getters.app.flatten.find(mod => url === mod.path || '/' + url === mod.path) const to = utils.array.valInDeep(store.getters.app.menuList, url, 'path', 'children') || []
to && val(to) // const to = store.getters.app.flatten.find(mod => url === mod.path || '/' + url === mod.path)
to[0] && val(to[0])
if (!url) { if (!url) {
throw new Error('跳转页面失败,请检查页面参数是否正确') throw new Error('跳转页面失败,请检查页面参数是否正确')
} }
......
...@@ -20,8 +20,8 @@ export default { ...@@ -20,8 +20,8 @@ export default {
handleSelect({ path, children = [] }) { handleSelect({ path, children = [] }) {
if (path) { if (path) {
this.$router.push(path) this.$router.push(path)
this.bus.$emit('menu3Changed', children.noHidden())
} }
this.bus.$emit('menu3Changed', children.noHidden())
} }
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<script> <script>
import { currentId } from './mixins/index' import { currentId } from './mixins/index'
import { utils } from 'glsx-common'
export default { export default {
name: 'MenuLv4', name: 'MenuLv4',
inject: ['bus'], inject: ['bus'],
...@@ -38,16 +39,18 @@ export default { ...@@ -38,16 +39,18 @@ export default {
this.$nextTick(() => (this.activeName = sub.path)) this.$nextTick(() => (this.activeName = sub.path))
} }
}, },
find(id) {
return this.app.flatten.find(item => item.id == id)
},
onMenu3Changed(menus = []) { onMenu3Changed(menus = []) {
this.setActive(menus[0]?.id, menus) this.setActive(menus[0]?.id, menus)
}, },
find(id) {
const item = utils.array.valInDeep(this.app.menuList, id, 'id', 'children') || []
return item[0]
},
onLoad() { onLoad() {
const { lv1, lv2, lv3, lv4 } = this.current const { lv1, lv2, lv3, lv4 } = this.current
const lv3id = `${lv1}-${lv2}-${lv3}` const lv3id = `${lv1}-${lv2}-${lv3}`
const lv4id = `${lv3id}-${lv4}` const lv4id = `${lv3id}-${lv4}`
console.log(lv4id)
const sub = this.find(lv3id)?.children const sub = this.find(lv3id)?.children
if (sub?.length) { if (sub?.length) {
const nav4 = sub.noHidden() const nav4 = sub.noHidden()
......
...@@ -18,7 +18,7 @@ const app = { ...@@ -18,7 +18,7 @@ const app = {
}, },
SET_MENU_LIST(state, list) { SET_MENU_LIST(state, list) {
state.menuList = list state.menuList = list
state.flatten = utils.array.flattenDeep(list) // state.flatten = utils.array.flattenDeep(list)
}, },
SET_ROUTES(state, payload) { SET_ROUTES(state, payload) {
state.routers = payload state.routers = payload
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!