Browse Source

fix types

fix styles
main
李金 7 months ago
parent
commit
b80918bfb1
  1. 10
      src/pages/system/menus/store.ts
  2. 2
      src/pages/system/menus/style.ts
  3. 4
      src/pages/system/roles/store.ts

10
src/pages/system/menus/store.ts

@ -1,5 +1,5 @@
import systemServ from '@/service/system.ts' import systemServ from '@/service/system.ts'
import { IPage, IPageResult, MenuItem } from '@/types'
import { IApiResult, IPage, MenuItem } from '@/types'
import { IMenu } from '@/types/menus' import { IMenu } from '@/types/menus'
import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query' import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query'
import { atom, createStore } from 'jotai' import { atom, createStore } from 'jotai'
@ -24,15 +24,15 @@ export const menuPageAtom = atom<IPage>({})
const store = createStore() const store = createStore()
export const menuDataAtom = atomWithQuery<any, IPageResult<IMenu>>((get) => {
export const menuDataAtom = atomWithQuery((get) => {
return { return {
queryKey: [ 'menus', get(menuPageAtom) ], queryKey: [ 'menus', get(menuPageAtom) ],
queryFn: async ({ queryKey: [ , page ] }) => { queryFn: async ({ queryKey: [ , page ] }) => {
return await systemServ.menus.list(page) return await systemServ.menus.list(page)
}, },
select: (data) => {
return data.rows ?? []
select: (res) => {
return res.data.rows ?? []
} }
} }
}) })
@ -49,7 +49,7 @@ export const byIdMenuAtom = atomWithQuery((get) => ({
})) }))
export const saveOrUpdateMenuAtom = atomWithMutation<any, IMenu>((get) => {
export const saveOrUpdateMenuAtom = atomWithMutation<IApiResult, IMenu>((get) => {
return { return {
mutationKey: [ 'updateMenu', get(selectedMenuIdAtom) ], mutationKey: [ 'updateMenu', get(selectedMenuIdAtom) ],

2
src/pages/system/menus/style.ts

@ -60,7 +60,7 @@ export const useStyle = createStyles(({ token, css, cx, prefixCls }) => {
` `
const treeActions = css` const treeActions = css`
padding: 0 10px 10px;
padding: 0 24px 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: sticky; position: sticky;

4
src/pages/system/roles/store.ts

@ -2,7 +2,7 @@ import { convertToBool } from '@/utils'
import { atom } from 'jotai/index' import { atom } from 'jotai/index'
import { IRole } from '@/types/roles' import { IRole } from '@/types/roles'
import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query' import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query'
import { IPage } from '@/types'
import { IApiResult, IPage } from '@/types'
import systemServ from '@/service/system.ts' import systemServ from '@/service/system.ts'
import { message } from 'antd' import { message } from 'antd'
import { t } from '@/i18n.ts' import { t } from '@/i18n.ts'
@ -45,7 +45,7 @@ export const rolesAtom = atomWithQuery((get) => {
//saveOrUpdateRoleAtom //saveOrUpdateRoleAtom
export const saveOrUpdateRoleAtom = atomWithMutation<any, IRole>((get) => {
export const saveOrUpdateRoleAtom = atomWithMutation<IApiResult, IRole>((get) => {
return { return {
mutationKey: [ 'updateMenu' ], mutationKey: [ 'updateMenu' ],

Loading…
Cancel
Save