Browse Source

[Feature][UI Next]Improve menu bar function (#8141)

* Improve menu bar function

* Improve menu bar function
3.0.0/version-upgrade
labbomb 3 years ago committed by GitHub
parent
commit
38b40e7ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
  2. 9
      dolphinscheduler-ui-next/src/store/menu/menu.ts
  3. 1
      dolphinscheduler-ui-next/src/store/menu/types.ts
  4. 7
      dolphinscheduler-ui-next/src/views/projects/list/use-table.ts

4
dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts

@ -44,9 +44,11 @@ import {
SafetyOutlined,
GroupOutlined
} from '@vicons/antd'
import { useMenuStore } from '@/store/menu/menu'
export function useDataList() {
const { t } = useI18n()
const menuStore = useMenuStore()
const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) })
@ -268,13 +270,11 @@ export function useDataList() {
label: string
key: string
icon: any
isShowSide: boolean
}) => {
return {
label: item.label,
key: item.key,
icon: item.icon,
isShowSide: item.isShowSide
}
}
)

9
dolphinscheduler-ui-next/src/store/menu/menu.ts

@ -23,7 +23,8 @@ export const useMenuStore = defineStore({
state: (): MenuState => ({
menuKey: 'home',
isShowSide: false,
sideMenuKey: ''
sideMenuKey: '',
projectCode: ''
}),
persist: true,
getters: {
@ -35,6 +36,9 @@ export const useMenuStore = defineStore({
},
getSideMenuKey(): string {
return this.sideMenuKey || ''
},
getProjectCode(): string {
return this.projectCode || ''
}
},
actions: {
@ -46,6 +50,9 @@ export const useMenuStore = defineStore({
},
setSideMenuKey(sideMenuKey: string): void {
this.sideMenuKey = sideMenuKey
},
setProjectCode(projectCode: string): void {
this.projectCode = projectCode
}
}
})

1
dolphinscheduler-ui-next/src/store/menu/types.ts

@ -19,6 +19,7 @@ interface MenuState {
menuKey: string
isShowSide: boolean
sideMenuKey: string
projectCode: string
}
export default MenuState

7
dolphinscheduler-ui-next/src/views/projects/list/use-table.ts

@ -26,6 +26,7 @@ import styles from './index.module.scss'
import type { Router } from 'vue-router'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
import type { ProjectRes } from '@/service/modules/projects/types'
import { useMenuStore } from '@/store/menu/menu'
export function useTable(
updateProjectItem = (
@ -37,6 +38,7 @@ export function useTable(
) {
const { t } = useI18n()
const router: Router = useRouter()
const menuStore = useMenuStore()
const columns: TableColumns<any> = [
{ title: '#', key: 'index' },
@ -48,7 +50,10 @@ export function useTable(
'a',
{
class: styles.links,
onClick: () => router.push({ path: `/projects/${row.code}` })
onClick: () => {
menuStore.setProjectCode(row.code)
router.push({ path: `/projects/${row.code}` })
}
},
{
default: () => {

Loading…
Cancel
Save