diff --git a/package.json b/package.json index 1b88958..844fc3c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "qs": "^6.14.1", "react": "^19.2.3", "react-dom": "^19.2.3", - "react-router-dom": "^6.30.3", "valtio": "^2.3.0", "zustand": "^5.0.9" }, diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..047c9d0 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/vite.svg b/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/SiderMenu/NavMenu.tsx b/src/components/SiderMenu/NavMenu.tsx index 5c66a74..efcb2f1 100644 --- a/src/components/SiderMenu/NavMenu.tsx +++ b/src/components/SiderMenu/NavMenu.tsx @@ -5,7 +5,7 @@ import { asideMenuConfig } from '@/configs/menuConfig'; import { getHash, navigate } from '@/router/routerUtils'; import { useAuthStore } from '@/store/AuthStore'; import { useCompanyStore } from '@/store/CompanyStore'; -import { isArray, toArray } from '@/utils/common'; +import { toArray } from '@/utils/common'; interface IProps { onCallback?: () => void; @@ -32,23 +32,23 @@ const NavMenu: React.FC = (props) => { label: itemName, title: itemName, }; - if (isArray(item.children)) { - obj.children = []; - item.children?.forEach((el: any) => { - // ! 添加权限判断 - if (!el.hideInMenu && (!el.auth || (auth && el.auth.split(',').some((key: string) => auth?.[key.trim()])))) { - if (!el.auth && (company.staff_type == '3' || company.staff_type == '4')) { - // - } else { - const elName = el.name; - if (el.target && el.path) { - newWindowUrl[el.path] = { target: el.target }; - } - obj.children.push({ key: el.path, icon: el.icon, label: elName, title: elName }); + + obj.children = []; + toArray(item.children).forEach((el: any) => { + // ! 添加权限判断 + if (!el.hideInMenu && (!el.auth || (auth && el.auth.split(',').some((key: string) => auth?.[key.trim()])))) { + if (!el.auth && (company.staff_type == '3' || company.staff_type == '4')) { + // + } else { + const elName = el.name; + if (el.target && el.path) { + newWindowUrl[el.path] = { target: el.target }; } + obj.children.push({ key: el.path, icon: el.icon, label: elName, title: elName }); } - }); - } + } + }); + if (obj.children.length) { arr.push(obj); } @@ -101,10 +101,9 @@ const NavMenu: React.FC = (props) => { onOpenChange={(openKeys) => { setOpenKeys(openKeys); }} - // style={{ width: '100%' }} + inlineIndent={window.dfConfig.isPhone ? undefined : 16} selectedKeys={[hash]} openKeys={openKeys} - // key={`${openKeys[0]}_${lo.pathname}`} mode='inline' items={menuOptions} /> diff --git a/src/index.css b/src/index.css index 758ed6f..be52efa 100644 --- a/src/index.css +++ b/src/index.css @@ -8,3 +8,8 @@ body { min-height: 100vh; } } + +.cf-sider .ant-layout-sider-trigger { + height: 34px; + line-height: 34px; +} diff --git a/src/layouts/AppLayout.tsx b/src/layouts/AppLayout.tsx index 4aae76a..a8c1c0e 100644 --- a/src/layouts/AppLayout.tsx +++ b/src/layouts/AppLayout.tsx @@ -61,7 +61,7 @@ const AppLayout = () => { ) : (
{DefaultERPName}
)} - {Date.now()} + {/* {Date.now()} */}
@@ -70,23 +70,24 @@ const AppLayout = () => { {isPhone ? null : ( { // setCollapsed(collapsed); // }} style={{ background: '#fff', overflow: 'auto', - // height: `calc(100vh - ${headerHeight}px)`, + height: `calc(100vh - ${headerHeight}px)`, position: 'sticky', // zIndex: 1000, left: 0, - // top: headerHeight, + top: headerHeight, }} - width={200} + width={180} // width={window?.dfConfig?.language == 'zh-cn' ? 100 : 240} // collapsed={collapsed} - // collapsedWidth={60} + collapsedWidth={60} > {/* */} diff --git a/src/main.tsx b/src/main.tsx index 52bb540..f329669 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,12 +1,9 @@ import { createRoot } from 'react-dom/client'; import './index.css'; -import { HashRouter } from 'react-router-dom'; import App from './App.tsx'; createRoot(document.getElementById('root')!).render( // - - , - , + , // , ); diff --git a/src/pages/Company/List/index.tsx b/src/pages/Company/List/index.tsx index 0302dd3..b1adbd2 100644 --- a/src/pages/Company/List/index.tsx +++ b/src/pages/Company/List/index.tsx @@ -1,7 +1,6 @@ import { Button, DatePicker, Input, Select } from 'antd'; import { stringify } from 'qs'; import { useEffect, useRef, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; import { FormItemPlugin, FormPlugin } from '@/components/FormPlugin'; import { GapBox } from '@/components/GapBox'; import PageContainerPlugin from '@/components/PageContainer/PageContainerPlugin'; @@ -34,7 +33,6 @@ const CompanyListForm: React.FC = () => { const [ajaxData, setAjaxData] = useState({ count: 0, data: [] }); const [showMoreSearch, setShowMoreSearch] = useState(false); const CompanyEditModalRef = useRef(null); - const nav = useNavigate(); const { loading: userLoading, request: userRequest } = useRequest(CompanyServices.getCompanyList, { onSuccessCodeZero: (res) => { diff --git a/src/pages/User/List/index.tsx b/src/pages/User/List/index.tsx index 963d0cb..013262a 100644 --- a/src/pages/User/List/index.tsx +++ b/src/pages/User/List/index.tsx @@ -1,7 +1,6 @@ import { Button, DatePicker, Input, Select } from 'antd'; import { stringify } from 'qs'; import { useEffect, useRef, useState } from 'react'; -import { useSearchParams } from 'react-router-dom'; import { FormItemPlugin, FormPlugin } from '@/components/FormPlugin'; import { GapBox } from '@/components/GapBox'; import PageContainerPlugin from '@/components/PageContainer/PageContainerPlugin'; @@ -14,6 +13,7 @@ import { stateOptions, userSex, userState } from '@/configs/usersConfig'; import type { IAjaxDataBase, IParamsBase } from '@/interfaces/common'; import CompanySelect from '@/pages/Company/List/components/CompanySelect'; import { type IUserEditModalType, UserEditModal } from '@/pages/User/List/components/UserEditModal'; +import { getURLSearchParams } from '@/router/routerUtils'; import { UserServices } from '@/services/UserServices'; import { useAuthStore } from '@/store/AuthStore'; import { tableFixedByPhone, toArray } from '@/utils/common'; @@ -38,7 +38,7 @@ const UserListForm: React.FC = () => { const [ajaxData, setAjaxData] = useState({ count: 0, data: [] }); const [showMoreSearch, setShowMoreSearch] = useState(false); const UserEditModalRef = useRef(null); - const [searchParams] = useSearchParams(); + const searchParams = getURLSearchParams(); const company_id = searchParams.get('company_id'); const [params, setParams] = useState({ curr_page: 1, page_count: 20, company_id }); diff --git a/src/utils/commonUtils.ts b/src/utils/commonUtils.ts index f8428fd..0b02fc9 100644 --- a/src/utils/commonUtils.ts +++ b/src/utils/commonUtils.ts @@ -62,39 +62,6 @@ export const navigateBackIfEmpty = (dataLength: number, curr_page: number, page: /** 检测支持语言 */ export const checkSupportLanguage = (lang?: string | null) => (lang && ['zh-cn', 'en'].includes(lang) ? lang : 'zh-cn'); -// export const notificationFun = (option: { -// title?: React.ReactNode; -// type?: 'info' | 'success' | 'warning' | 'error' | 'normal'; -// content?: React.ReactNode; -// }) => { -// const { title = t('系统提示'), type = 'success' } = option; -// Notification[type]({ -// title: title, -// content: option.content || '', -// }); -// }; - -// export const modalFun = (option: { -// title?: React.ReactNode; -// type?: 'info' | 'success' | 'warning' | 'error' | 'confirm'; -// content?: React.ReactNode; -// onOk: (e?: MouseEvent) => Promise; -// okText?: string; -// okButtonProps?: ButtonProps; -// }) => { -// const { title = t('系统提示'), type = 'confirm', onOk } = option; -// Modal[type]({ -// title: title, -// content: option.content || '', -// okButtonProps: { -// autoFocus: true, -// ...option.okButtonProps, -// }, -// onOk: onOk, -// okText: option.okText, -// }); -// }; - /** 笛卡尔积 */ export const cartesianProduct = (...arrays: any[]) => { let result: any[] = [];