From 20f7e338d07efee98595daea280237303eb94076 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=B2=81=E8=AA=89=E7=A8=8B?= <2659568239@qq.com>
Date: Tue, 19 Dec 2023 10:08:46 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=AE=8Cgql=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/GLQ/WebGLQ/ManageConfig/index.tsx | 57 +++--
src/pages/GLQ/WebGLQ/SecurityPolicy/index.tsx | 52 +++--
src/pages/GLQ/WebGLQ/VpnPolicy/index.tsx | 205 ++++++++++++------
3 files changed, 224 insertions(+), 90 deletions(-)
diff --git a/src/pages/GLQ/WebGLQ/ManageConfig/index.tsx b/src/pages/GLQ/WebGLQ/ManageConfig/index.tsx
index d74b17b..3ea73e9 100644
--- a/src/pages/GLQ/WebGLQ/ManageConfig/index.tsx
+++ b/src/pages/GLQ/WebGLQ/ManageConfig/index.tsx
@@ -1,17 +1,48 @@
import ContentWarp from '@/components/ContentWarp';
import styles from '../../index.less';
-import { Form, Input, Select } from 'antd';
+import { Form, Input, Select, message } from 'antd';
import ButtonComp from '@/components/ButtonComp';
+import { useEffect } from 'react';
+import { remoteFileConfiSendData, remoteFileConfigClean } from '@/services/gql';
// 网络GLQ配置 --> 远程文件配置--> 管理配置
export default function Page() {
const [form] = Form.useForm();
+ useEffect(() => {
+ form.setFieldsValue({
+ deviceLocation: '前端机平台',
+ deviceType: '类型1',
+ hotStandby: 'no',
+ deviceId: '',
+ })
+ }, [])
+
const onFinish = (values: any) => {
- console.log('表单提交:', values);
+ remoteFileConfiSendData({
+ jsonStr: JSON.stringify(values),
+ type: 4
+ }).then((res) => {
+ if (res?.result == "success") {
+ message.success('文件提交成功');
+ form.resetFields();
+ } else {
+ message.error(res?.errorMsg);
+ }
+ })
};
+ const clearInfo = () => {
+ remoteFileConfigClean({type: 4}).then(res => {
+ if (res?.result == "success") {
+ message.success('清除信息成功');
+ }else {
+ message.error(res?.errorMsg);
+ }
+ })
+ }
+
return (
@@ -24,7 +55,7 @@ export default function Page() {
onFinish={onFinish}
>
{ }}
options={[
- { label: '前端机平台', value: 1 },
- { label: '后端机平台', value: 2 }
+ { label: '前端机平台', value: '前端机平台' },
+ { label: '后端机平台', value: '后端机平台' }
]}
/>
{ }}
options={[
- { label: '前端机平台', value: 1 },
- { label: '后端机平台', value: 2 }
+ { label: '类型1', value: '类型1' },
+ { label: '类型2', value: '类型2' }
]}
/>
{ }}
options={[
- { label: 'no', value: 1 },
- { label: 'yes', value: 2 }
+ { label: 'no', value: 'no' },
+ { label: 'yes', value: 'yes' }
]}
/>
form.submit()} />
- form.resetFields()} />
+ clearInfo()} />
diff --git a/src/pages/GLQ/WebGLQ/SecurityPolicy/index.tsx b/src/pages/GLQ/WebGLQ/SecurityPolicy/index.tsx
index 9b63f91..1bf2858 100644
--- a/src/pages/GLQ/WebGLQ/SecurityPolicy/index.tsx
+++ b/src/pages/GLQ/WebGLQ/SecurityPolicy/index.tsx
@@ -5,7 +5,7 @@ import ButtonComp from '@/components/ButtonComp';
import { useEffect, useState } from 'react';
import { rowClassName } from '@/utils';
-import { getTextSecretInfo } from '@/services/gql';
+import { getTextSecretInfo, remoteFileConfiSendData } from '@/services/gql';
import { validateIPAddress } from '@/utils/validate';
// 网络GLQ配置 --> 远程文件配置--> 安全策略
@@ -17,9 +17,26 @@ export default function Page() {
form.setFieldsValue({ip: '114.114.114.114'})
}, [])
+
+ const columns: any = [
+ {
+ title: '序号', key: 'index', align: 'center', width: 100,
+ render: (a: any, b: any, c: any) => {
+ return {c + 1};
+ },
+ },
+ { title: '单位名称', dataIndex: '单位名称', key: '单位名称', align: 'center' },
+ { title: '设备名称', dataIndex: '设备名称', key: '设备名称', align: 'center' },
+ { title: '设备IP', dataIndex: '设备ip', key: '设备ip', align: 'center' },
+ { title: '电话号码', dataIndex: '电话号码', key: '电话号码', align: 'center' },
+ { title: '设备属性', dataIndex: '设备属性', key: '设备属性', align: 'center' },
+ { title: '设备型号', dataIndex: '设备型号', key: '设备型号', align: 'center' },
+ ]
+
const onFinish = (values: any) => {
getTextSecretInfo(values).then(res => {
if (res?.result == "success") {
+ setTableData(res?.data[0].jsonStr)
message.success('获取成功');
} else {
message.error(res?.errorMsg);
@@ -27,20 +44,23 @@ export default function Page() {
})
};
- const columns: any = [
- {
- title: '序号', key: 'index', align: 'center', width: 100,
- render: (a: any, b: any, c: any) => {
- return {c + 1};
- },
- },
- { title: '单位名称', dataIndex: 'name', key: 'name', align: 'center' },
- { title: '设备名称', dataIndex: 'name', key: 'name', align: 'center' },
- { title: '设备IP', dataIndex: 'name', key: 'name', align: 'center' },
- { title: '电话号码', dataIndex: 'name', key: 'name', align: 'center' },
- { title: '设备属性', dataIndex: 'name', key: 'name', align: 'center' },
- { title: '设备型号', dataIndex: 'name', key: 'name', align: 'center' },
- ]
+ const sending = () => {
+ if (tableData.length == 0) {
+ message.info('请获取普密信息后再发送数据');
+ return
+ }
+
+ remoteFileConfiSendData({
+ jsonStr: JSON.stringify(tableData),
+ type: 3
+ }).then( (res) => {
+ if (res?.result == "success") {
+ message.success('发送数据成功');
+ }else {
+ message.error(res?.errorMsg);
+ }
+ })
+ }
return (
@@ -72,7 +92,7 @@ export default function Page() {
尚未连接普密对外服务器!
- { }} />
+ sending()} />
diff --git a/src/pages/GLQ/WebGLQ/VpnPolicy/index.tsx b/src/pages/GLQ/WebGLQ/VpnPolicy/index.tsx
index 5a6d976..0ebd79c 100644
--- a/src/pages/GLQ/WebGLQ/VpnPolicy/index.tsx
+++ b/src/pages/GLQ/WebGLQ/VpnPolicy/index.tsx
@@ -1,18 +1,85 @@
import ContentWarp from '@/components/ContentWarp';
import styles from '../../index.less';
import styles1 from './index.less';
-import { Form, Input, Select } from 'antd';
+import { Form, Input, Select, Table, message } from 'antd';
import ButtonComp from '@/components/ButtonComp';
+import { useEffect, useState } from 'react';
+import { rowClassName } from '@/utils';
+import { validateIPAddress } from '@/utils/validate';
+import { remoteFileConfiSendData, remoteFileConfigClean } from '@/services/gql';
// 网络GLQ配置 --> 远程文件配置--> VPN策略
export default function Page() {
const [form] = Form.useForm();
+ const [tableData, setTableData] = useState([]);
+ const [activeList, setActiveList] = useState([]);
+
+ useEffect(() => {
+ form.setFieldsValue({
+ unitName: '',
+ deviceName: '',
+ deviceIp: '',
+ deviceId: '',
+ messageComm: 1,
+ pingComm: 1,
+ })
+ }, [])
+
+ const columns: any = [
+ {
+ title: '序号', key: 'index', align: 'center', width: 100,
+ render: (a: any, b: any, c: any) => {
+ return {c + 1};
+ },
+ },
+ { title: '单位名称', dataIndex: 'unitName', key: 'unitName', align: 'center' },
+ { title: '设备名称', dataIndex: 'deviceName', key: 'deviceName', align: 'center' },
+ { title: '设备IP', dataIndex: 'deviceIp', key: 'deviceIp', align: 'center' },
+ { title: '设备ID', dataIndex: 'deviceId', key: 'deviceId', align: 'center' },
+ { title: '报文通信策略', dataIndex: 'messageComm', key: 'messageComm', align: 'center' },
+ { title: 'PING通信策略', dataIndex: 'pingComm', key: 'pingComm', align: 'center' },
+ ]
const onFinish = (values: any) => {
- console.log('表单提交:', values);
+ values.rowKey = Math.floor(Math.random() * 10000);
+ setTableData([...tableData, values])
};
+ const sending = () => {
+ if (tableData.length == 0) {
+ message.info('请添加数据');
+ return
+ }else if (activeList.length == 0) {
+ message.info('请勾选需要发送的数据');
+ return
+ }
+
+ let serviceList = activeList.map(({ unitName, deviceName, deviceIp, deviceId, messageComm, pingComm }: any) => {
+ return { unitName, deviceName, deviceIp, deviceId, messageComm, pingComm }
+ })
+ remoteFileConfiSendData({
+ jsonStr: JSON.stringify({ serviceList: serviceList }),
+ type: 5
+ }).then((res) => {
+ if (res?.result == "success") {
+ message.success('发送数据成功');
+ form.resetFields();
+ } else {
+ message.error(res?.errorMsg);
+ }
+ })
+ }
+
+ const clearInfo = () => {
+ remoteFileConfigClean({ type: 5 }).then(res => {
+ if (res?.result == "success") {
+ message.success('清除信息成功');
+ } else {
+ message.error(res?.errorMsg);
+ }
+ })
+ }
return (
@@ -25,84 +92,100 @@ export default function Page() {
onFinish={onFinish}
>
-
+
-
-
-
-
-
-
-
+
-
-