From acd364f29910c598438f802e2812468d44ff224d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=91=9E=E5=AE=81?= <3134191406@qq.com> Date: Mon, 22 Jan 2024 08:59:57 +0800 Subject: [PATCH] fix --- config/routes/index.ts | 7 ++ src/components/NodeInitWrap/index.less | 54 ++++++++++++++++ src/components/NodeInitWrap/index.tsx | 64 +++++++++++++++++++ src/layouts/index.tsx | 20 +++--- .../MachineManage/MachineRegister/index.less | 6 ++ .../MachineManage/MachineRegister/index.tsx | 43 +++++++++++++ .../index.less} | 0 src/pages/MachineManage/index.tsx | 35 ++++++++++ src/pages/NodeInitTool/index.less | 0 src/pages/NodeInitTool/index.tsx | 36 +++++++++++ src/pages/index.tsx | 58 ++++++----------- src/utils/menu.ts | 45 +++++++------ 12 files changed, 298 insertions(+), 70 deletions(-) create mode 100644 src/components/NodeInitWrap/index.less create mode 100644 src/components/NodeInitWrap/index.tsx create mode 100644 src/pages/MachineManage/MachineRegister/index.less create mode 100644 src/pages/MachineManage/MachineRegister/index.tsx rename src/pages/{restartSystem.tsx => MachineManage/index.less} (100%) create mode 100644 src/pages/MachineManage/index.tsx create mode 100644 src/pages/NodeInitTool/index.less create mode 100644 src/pages/NodeInitTool/index.tsx diff --git a/config/routes/index.ts b/config/routes/index.ts index 0ca1156..82f5206 100644 --- a/config/routes/index.ts +++ b/config/routes/index.ts @@ -1,6 +1,13 @@ const routes = [ { path: '/', redirect: '/index', }, // 本地跑时为了方便先使用这个 // { path: '/', redirect: '/404', }, // 后续上线时开放 + + // 节点初始化工具 + { path: '/nodeInit', name: '节点初始化工具', component: '@/pages/NodeInitTool', layout: false }, + + // ------------------------------设备管理---------------------------------- + { path: '/machineManage/register', name: '设备注册', component: '@/pages/MachineManage/MachineRegister' }, + // --------------------------------------------------------------------------- // 桌面 { path: '/index', name: '桌面', component: '@/pages/index', layout: false }, diff --git a/src/components/NodeInitWrap/index.less b/src/components/NodeInitWrap/index.less new file mode 100644 index 0000000..2d1959e --- /dev/null +++ b/src/components/NodeInitWrap/index.less @@ -0,0 +1,54 @@ +.cont_warp { + border: 1px solid #000; + + .header { + height: 40px; + line-height: 40px; + font-size: 16px; + font-weight: 600; + text-align: center; + border-bottom: 1px solid #000; + } + + .main_body { + display: flex; + align-items: center; + justify-content: flex-start; + border-bottom: 1px solid #000; + height: 500px; + + .body_left { + width: 200px; + height: 100%; + line-height:500px; + border-right: 1px solid #000; + + } + + .body_right { + display:flex; + flex-direction: column; + justify-content: flex-start; + height:100%; + + .stepTitle{ + margin-top:30px; + } + .stepDesc{ + margin-top:30px; + } + } + } + + .footer { + display: flex; + align-items: center; + justify-content: space-between; + margin: 0 10px; + .btns { + display: flex; + align-items: center; + justify-content: space-between; + } + } +} \ No newline at end of file diff --git a/src/components/NodeInitWrap/index.tsx b/src/components/NodeInitWrap/index.tsx new file mode 100644 index 0000000..41518ef --- /dev/null +++ b/src/components/NodeInitWrap/index.tsx @@ -0,0 +1,64 @@ +import { FC, useEffect, useState } from 'react'; +import styles from './index.less'; +import ButtonComp from '@/components/ButtonComp'; + +interface PageProps { + headTitle: string; //顶部标题 + stepTitle: string; //步骤标题 + stepDesc: string; //步骤描述 + leftStep: string; //左侧步骤描述 + nextbtn?:boolean; //下一步按钮是否显示 + prebtn?:boolean; //上一步按钮是否显示 + finishbtn?:boolean; //完成按钮是否显示 + cancelbtn?:boolean; //取消按钮是否显示 + children?: any; // 插槽内容 + onNext?: () => void; + onPre?: () => void; + onFinish?: () => void; + onCancel?: () => void; +} + +const NodeInitWrap: FC = ({ + headTitle, + stepTitle, + stepDesc, + leftStep, + nextbtn=false, + prebtn=false, + finishbtn=false, + cancelbtn=false, + onNext = () => {}, + onPre = () => {}, + onFinish = () => {}, + onCancel = () => {}, + ...props +}) => { + + return ( +
+ {/* 标题 */} +
{headTitle}
+ {/* 中间左右结构的主体 */} +
+
{leftStep}
+
+
{stepTitle}
+
{stepDesc}
+
{props?.children}
+
+
+ {/* 底部 */} +
+
注意:xxx
+
+ {nextbtn && } + {prebtn && } + {finishbtn && } + {cancelbtn && } +
+
+
+ ) +} + +export default NodeInitWrap \ No newline at end of file diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 719d41f..ce68177 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -19,19 +19,19 @@ moment.locale('ZH-cn') const options2 = [ - { value: 1, label: 'GLQ管理' }, + { value: 1, label: '设备管理' }, { value: 2, label: 'MY管理' }, { value: 3, label: 'SB管理' }, { value: 4, label: 'SF管理' }, { value: 5, label: 'SBJK二维版', disabled: true }, - { value: 6, label: '设备注册' } + { value: 6, label: '日志管理' } ] const leftMenuType: any = { - // GLQ管理 - 'GLQ远程维护': , - '网络MMJ管理': , - '网络GLQ配置': , + // 设备管理 + '设备注册': , + '在线管理': , + '离线管理': , // MY管理 '密钥体管理': , '密钥管理': , @@ -57,9 +57,9 @@ export default function Layout() { const location = useLocation(); const [routeName, setRouteName] = useState(''); - const [selectVal, setSelectVal] = useState(1); - const [tabList, setTabList] = useState([]); - const [active, setActive] = useState(1); + const [selectVal, setSelectVal] = useState(1); //当前选中的是哪个一级菜单 + const [tabList, setTabList] = useState([]); //一级菜单包含的二级菜单列表 + const [active, setActive] = useState(1); //当前选中的是哪个二级菜单 const [activeName, setActiveName] = useState('GLQ远程维护'); const [treeData, setTreeData] = useState([ { @@ -144,7 +144,7 @@ export default function Layout() { // 校验是否是树结构列表 const isTreeType = (info: any) => { if (info.length > 0) { - if (info[0]?.name === '设备注册') { + if (info[0]?.name === '设备xx') { return navigateToPath(info, '/registerManage/deviceRegister/{key}'); } if (info[0]?.name === '单位位置管理') { diff --git a/src/pages/MachineManage/MachineRegister/index.less b/src/pages/MachineManage/MachineRegister/index.less new file mode 100644 index 0000000..3b15597 --- /dev/null +++ b/src/pages/MachineManage/MachineRegister/index.less @@ -0,0 +1,6 @@ +.nav{ + display:flex; + align-items: center; + margin-left:20px; + margin-top:10px; +} \ No newline at end of file diff --git a/src/pages/MachineManage/MachineRegister/index.tsx b/src/pages/MachineManage/MachineRegister/index.tsx new file mode 100644 index 0000000..486252b --- /dev/null +++ b/src/pages/MachineManage/MachineRegister/index.tsx @@ -0,0 +1,43 @@ +import { FC, useEffect, useState } from 'react'; +import { history, useLocation, useParams } from 'umi'; +import ButtonComp from '@/components/ButtonComp'; +import ClearInfoDialog from '@/components/ClearInfoDialog'; +import { getPlugCordResult } from '@/services/api'; +import { validateNumber } from '@/utils/validate'; +import theme from '@/styles/antd.theme'; +import { Select,Form } from 'antd'; +import styles from './index.less'; + +interface PageProps { + data: Array<{ + // 菜单名称 + name: string; + // 是否展开 + check: boolean; + // 内容是否有目录结构 + isTree?: boolean; + // 菜单列表 : name: 名称; url: 路由; img: 图标; + data: Array<{ name: string; url: string; img: any; }> + }>; +} + +const MachineRegister: FC = ({ }) => { + + + return ( +
+
+ { }} style={{marginRight:'20px'}} /> + { }} /> +
+
+
+ +
+
+
+ ) + +} + +export default MachineRegister \ No newline at end of file diff --git a/src/pages/restartSystem.tsx b/src/pages/MachineManage/index.less similarity index 100% rename from src/pages/restartSystem.tsx rename to src/pages/MachineManage/index.less diff --git a/src/pages/MachineManage/index.tsx b/src/pages/MachineManage/index.tsx new file mode 100644 index 0000000..0c4b41e --- /dev/null +++ b/src/pages/MachineManage/index.tsx @@ -0,0 +1,35 @@ +import { FC, useEffect, useState } from 'react'; +import { history, useLocation, useParams } from 'umi'; +import ButtonComp from '@/components/ButtonComp'; +import ClearInfoDialog from '@/components/ClearInfoDialog'; +import { getPlugCordResult } from '@/services/api'; +import { validateNumber } from '@/utils/validate'; +import theme from '@/styles/antd.theme'; +import { Button, ConfigProvider, Form, Input, Modal, Radio, message } from 'antd'; +// import styles from './index.less'; + +interface PageProps { + data: Array<{ + // 菜单名称 + name: string; + // 是否展开 + check: boolean; + // 内容是否有目录结构 + isTree?: boolean; + // 菜单列表 : name: 名称; url: 路由; img: 图标; + data: Array<{ name: string; url: string; img: any; }> + }>; +} + +const PageName: FC = ({ }) => { + + + return ( +
+ +
+ ) + +} + +export default PageName \ No newline at end of file diff --git a/src/pages/NodeInitTool/index.less b/src/pages/NodeInitTool/index.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/NodeInitTool/index.tsx b/src/pages/NodeInitTool/index.tsx new file mode 100644 index 0000000..90292ec --- /dev/null +++ b/src/pages/NodeInitTool/index.tsx @@ -0,0 +1,36 @@ +import { FC, useEffect, useState } from 'react'; +import { history, useLocation, useParams } from 'umi'; +import ButtonComp from '@/components/ButtonComp'; +import ClearInfoDialog from '@/components/ClearInfoDialog'; +import NodeInitWrap from '@/components/NodeInitWrap'; +import { getPlugCordResult } from '@/services/api'; +import { validateNumber } from '@/utils/validate'; +import theme from '@/styles/antd.theme'; +import { Button, ConfigProvider, Form, Input, Modal, Radio, message } from 'antd'; +import styles from './index.less'; + +interface PageProps { + +} + +const NodeInitTool: FC = ({ }) => { + + + return ( +
+ + + +
+ ) + +} + +export default NodeInitTool \ No newline at end of file diff --git a/src/pages/index.tsx b/src/pages/index.tsx index f3cbbcd..5a14b1f 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -45,28 +45,23 @@ export default function IndexPage() { const onFinish = async (data: any) => { setLoading(true) - await getPlugCordResult(data).then(res => { - // if (res?.result == 'success' && JSON.parse(res?.data[0]).data) { - // setIsAuth(true) - // localStorage.setItem('is_auth', JSON.stringify(true)); - // message.success("系统连接检测成功!") - // } else if (!JSON.parse(res?.data[0]).data) { - // message.error("系统连接检测失败!") - // } - if (res?.result == 'success') { - setIsAuth(true) - localStorage.setItem('is_auth', JSON.stringify(true)); - message.success("系统连接检测成功!") - } else if (!JSON.parse(res?.data[0]).data) { - message.error("系统连接检测失败!") - } - }) + setIsAuth(true) + // await getPlugCordResult(data).then(res => { + // if (res?.result == 'success') { + // setIsAuth(true) + // localStorage.setItem('is_auth', JSON.stringify(true)); + // message.success("系统连接检测成功!") + // } else if (!JSON.parse(res?.data[0]).data) { + // message.error("系统连接检测失败!") + // } + // }) setLoading(false) }; return (
+ {setVisibility(true)}} /> { isAuth ? list.map((item, index) => { @@ -84,36 +79,19 @@ export default function IndexPage() {
{item.name}
) - }) : - {setVisibility(false)}} + onOk={()=>{form.submit()}} >
- - - 49 - 52 - - - - +
-
- form.submit()} /> -
-
+ }
diff --git a/src/utils/menu.ts b/src/utils/menu.ts index 5032a5a..fa98639 100644 --- a/src/utils/menu.ts +++ b/src/utils/menu.ts @@ -1,8 +1,10 @@ export const tabsType: any = { 1: [ - { id: 1, name: 'GLQ远程维护', }, - { id: 2, name: '网络MMJ管理' }, - { id: 3, name: '网络GLQ配置' } + { id: 1, name: '设备注册', }, + { id: 2, name: '在线管理' }, + { id: 3, name: '离线管理' }, + { id: 4, name: '黑名单' }, + { id: 5, name: '报表管理' }, ], 2: [ { id: 1, name: '密钥体管理' }, @@ -31,31 +33,34 @@ export const tabsType: any = { } export const MenuType: any = { - 'GLQ远程维护': [ + '设备注册': [ { - name: '建立远程连接', - check: true, - data: [{ name: '参数设置', url: '/teamViewer/paramsSetting', img: '' }] - }, { - name: '交互维护命令', + name: '设备注册', check: true, - data: [ - { name: '系统时间', url: '/teamViewer/systemTime', img: '' }, - { name: '当前IP', url: '/teamViewer/currentIP', img: '' }, - { name: 'PING命令', url: '/teamViewer/pingCommand', img: '' }, - { name: 'TELNET命令', url: '/teamViewer/telnetCommand', img: '' }, - { name: '其他命令', url: '/teamViewer/otherCommand', img: '' }, - ] - }, - ], - '网络MMJ管理': [ + isTree:true, + url:'/machineManage/register', + // data: [{ name: '参数设置', url: '/teamViewer/paramsSetting', img: '' }] + }, + // { + // name: '交互维护命令', + // check: true, + // data: [ + // { name: '系统时间', url: '/teamViewer/systemTime', img: '' }, + // { name: '当前IP', url: '/teamViewer/currentIP', img: '' }, + // { name: 'PING命令', url: '/teamViewer/pingCommand', img: '' }, + // { name: 'TELNET命令', url: '/teamViewer/telnetCommand', img: '' }, + // { name: '其他命令', url: '/teamViewer/otherCommand', img: '' }, + // ] + // }, + ], + '在线管理': [ { name: 'MMJ初装', url: '/webMMJ/mmjInitInstall', img: '' }, { name: '状态查询', url: '/webMMJ/statusQuery', img: '' }, { name: '密钥销毁', url: '/webMMJ/keyDestruction', img: '' }, { name: '密钥遥毙', url: '/webMMJ/keyRemoteKill', img: '' }, { name: 'MMJ遥毙', url: '/webMMJ/mmjRemoteKill', img: '' }, ], - '网络GLQ配置': [ + '离线管理': [ { name: '获取配置信息', check: true,