From d1ab3f2f726f66cd0f941615e234d3cb122fb8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E8=AA=89=E7=A8=8B?= <2659568239@qq.com> Date: Fri, 2 Feb 2024 10:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E7=89=88=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=88=B0=E7=AE=A1=E7=90=86=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=95=B0=E6=8D=AE=E7=9B=98=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MY/KeyManage/DataMaintenance/index.tsx | 14 +- .../MY/KeyManage/KeyConfigQuery/index.tsx | 31 ++- src/pages/MY/KeyManage/ManageKeys/index.tsx | 184 +++++++++++++----- src/pages/MY/KeyManage/PrivateKey/index.tsx | 2 +- src/pages/MY/KeyManage/UserKey/index.tsx | 2 +- .../SB/DeviceManage/DutyAreaConfig/index.tsx | 2 +- src/services/register.ts | 2 +- src/utils/env/dev.ts | 3 +- src/utils/request.ts | 16 +- 9 files changed, 166 insertions(+), 90 deletions(-) diff --git a/src/pages/MY/KeyManage/DataMaintenance/index.tsx b/src/pages/MY/KeyManage/DataMaintenance/index.tsx index 5dbcd3a..5f50310 100644 --- a/src/pages/MY/KeyManage/DataMaintenance/index.tsx +++ b/src/pages/MY/KeyManage/DataMaintenance/index.tsx @@ -20,11 +20,11 @@ export default function Page() { return {c + 1}; }, }, - { title: '管理盘号', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '密钥种类', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '当前版本号', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '导入时间', dataIndex: 'importTime', key: 'importTime', align: 'center' }, , - { title: '数据长度', dataIndex: 'name', key: 'name', align: 'center' } + { title: '管理盘号', dataIndex: 'managementDiskNumber', key: 'managementDiskNumber', align: 'center' }, + { title: '密钥种类', dataIndex: 'carrierModel', key: 'carrierModel', align: 'center' }, + { title: '当前版本号', dataIndex: 'version', key: 'version', align: 'center' }, + { title: '导入时间', dataIndex: 'createTime', key: 'createTime', align: 'center' }, , + { title: '数据长度', dataIndex: 'dataLength', key: 'dataLength', align: 'center' } ] const props: UploadProps = { @@ -51,11 +51,11 @@ export default function Page() { }) } - // 获取密钥体列表 + // 管理系统管理盘数据维护 -- 列表 const getList = () => { secretFormatList({ pageNumber: 1, pageSize: 50 }).then((res) => { if (res?.result == "success") { - setTableData(res.data[0].list) + setTableData(res.data[0]) } else { message.error(res?.errorMsg); } diff --git a/src/pages/MY/KeyManage/KeyConfigQuery/index.tsx b/src/pages/MY/KeyManage/KeyConfigQuery/index.tsx index c0d8f19..e875efd 100644 --- a/src/pages/MY/KeyManage/KeyConfigQuery/index.tsx +++ b/src/pages/MY/KeyManage/KeyConfigQuery/index.tsx @@ -26,19 +26,19 @@ export default function Page() { return {c + 1}; }, }, - { title: '产品名称', dataIndex: 'productName', key: 'productName', align: 'center' }, - { title: '管理实体标识', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '000标识', 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' }, + { title: '设备名称', dataIndex: 'deviceName', key: 'deviceName', align: 'center' }, + { title: '管理实体标识', dataIndex: 'managerModelId', key: 'managerModelId', align: 'center' }, + { title: '310标识', dataIndex: 'deviceMarkId', key: 'deviceMarkId', align: 'center' }, + { title: 'IP地址', dataIndex: 'ip', key: 'ip', align: 'center' }, + { title: '密钥种类名称', dataIndex: 'keyTypeName', key: 'keyTypeName', align: 'center' }, + { title: '密钥类型', dataIndex: 'keyType', key: 'keyType', align: 'center' }, + { title: '使用区/备用区', dataIndex: 'usageReserveArea', key: 'usageReserveArea', align: 'center' }, { title: '产品编号', dataIndex: 'productNum', key: 'productNum', align: 'center' }, - { title: '安装方式', 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' }, - { title: '协同管理标志', dataIndex: 'name', key: 'name', align: 'center' } + { title: '安装方式', dataIndex: 'installMethod', key: 'installMethod', align: 'center' }, + { title: '启用日期', dataIndex: 'activeDate', key: 'activeDate', align: 'center' }, + { title: '终止日期', dataIndex: 'enterDate', key: 'enterDate', align: 'center' }, + { title: '密钥套号', dataIndex: 'setNumber', key: 'setNumber', align: 'center' }, + { title: '协同管理标志', dataIndex: 'managementFlag', key: 'managementFlag', align: 'center' } ] const columns1: any = [ @@ -68,8 +68,7 @@ export default function Page() { } secretInstallSearch({deviceId: selectedRowKeys[0]}).then((res) => { if (res?.result == "success") { - let data = res.data[0].filter((val: any) => { return val.delFlag == 0 }) - setTableData([...data]) + setTableData(res.data[0]) setVisibility(false) setSelectedRowKeys([]) } else { @@ -139,13 +138,13 @@ export default function Page() { dataSource={tableData1} rowKey={(record: any) => record?.id} rowClassName={rowClassName} - rowSelection={{ + rowSelection={tableData1.length > 0 ? { type: 'radio', selectedRowKeys, onChange: (selectedKeys: any) => { setSelectedRowKeys(selectedKeys); } - }} + } : null} />
diff --git a/src/pages/MY/KeyManage/ManageKeys/index.tsx b/src/pages/MY/KeyManage/ManageKeys/index.tsx index 810004b..1592875 100644 --- a/src/pages/MY/KeyManage/ManageKeys/index.tsx +++ b/src/pages/MY/KeyManage/ManageKeys/index.tsx @@ -1,14 +1,28 @@ import styles from '../../../GLQ/index.less'; -import { useState } from 'react'; -import { ConfigProvider, DatePicker, Modal, Radio, Select, Table } from 'antd'; +import { useEffect, useState } from 'react'; +import { ConfigProvider, DatePicker, Form, Modal, Pagination, Radio, Select, Table, message } from 'antd'; import { rowClassName } from '@/utils'; import ButtonComp from '@/components/ButtonComp'; import moment from 'moment'; +import { secretFormatList, secretList } from '@/services/my'; export default function Page() { const [tableData, setTableData] = useState([]); + const [tableData1, setTableData1] = useState([]); const [visibility, setVisibility] = useState(false); + const [form] = Form.useForm(); + const [pageNumber, setPageNumber] = useState(1); + const [pageSize, setpageSize] = useState(10); + const [total, setTotal] = useState(); + + const [usageReserveArea, setUsageReserveArea] = useState('1'); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [allRowKeys, setAllRowKeys] = useState([]); + + useEffect(() => { + initForm() + }, []) const columns: any = [ { title: '产品名称', dataIndex: 'productName', key: 'productName', align: 'center' }, @@ -23,85 +37,129 @@ export default function Page() { return {c + 1}; }, }, - { title: '设备名称', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '管理实体标识', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '000标识', dataIndex: 'name', key: 'name', align: 'center' }, + { title: '设备名称', dataIndex: 'deviceName', key: 'deviceName', align: 'center' }, + { title: '管理实体标识', dataIndex: 'managementFlag', key: 'managementFlag', align: 'center' }, + { title: '310标识', dataIndex: 'distType', key: 'distType', align: 'center' }, { title: '产品名称', dataIndex: 'productName', key: 'productName', align: 'center' }, { title: '产品编号', dataIndex: 'productNum', key: 'productNum', align: 'center' }, - { title: '使用期/备用区', dataIndex: 'name', key: 'name', align: 'center' }, + { title: '使用区/备用区', dataIndex: 'usageReserveArea', key: 'usageReserveArea', align: 'center' }, { title: '分发状态', 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' }, + { title: '安装方式', dataIndex: 'installMethod', key: 'installMethod', align: 'center' }, + { + title: '启用日期', dataIndex: 'activeDate', key: 'activeDate', align: 'center', + render: (text: any) => { + return {text || '--'}; + }, + }, + { title: '套号', dataIndex: 'setNumber', key: 'setNumber', align: 'center' }, { title: '载体类型', dataIndex: 'carrierType', key: 'carrierType', align: 'center' }, { title: '输出日期', dataIndex: 'name', key: 'name', align: 'center' }, { title: '协同管理标志', dataIndex: 'name', key: 'name', align: 'center' } ] + const formItemSty = { width: 'auto', marginBottom: 20, marginRight: 30 }; + + const initForm = () => { + } + + const onFinish = () => { + pageNumber == 1 ? getList() : setPageNumber(1); + }; + + useEffect(() => { + getList(); + setSelectedRowKeys([]) + }, [pageNumber]); + + // 管理系统管理盘数据维护 -- 列表 + const _secretFormatList = () => { + let res = false + secretFormatList({ pageNumber: 1, pageSize: 10 }).then((res) => { + if (res?.result == "success") { + if (res.data[0].length > 0) { res = true } + } else { + message.error(res?.errorMsg); + } + }) + return res + } + + // 获取密钥体列表 + const getList = () => { + if (_secretFormatList()) { + message.info('请先完成管理系统管理盘数据维护--数据导入!') + return + } + + secretList({ pageNumber, pageSize }).then((res) => { + if (res?.result == "success") { + res.data[0].list = res.data[0].list.filter((val: any) => { return val?.content != 'PMCS' }) + setTotal(res.data[0].total - 1) + setTableData(res.data[0].list) + const keys = res.data[0].list.map((item: any) => item?.id); + setAllRowKeys(keys); + } else { + message.error(res?.errorMsg); + } + }) + } + + const pageOnChange = (pageNumber: number) => { + setPageNumber(pageNumber); + } + + const onShowSizeChange = (current: any, pageSize: any) => { + setpageSize(pageSize); + getList(); + } const disabledDate = (current: any) => { return current && current < moment().startOf('day'); }; - - const disabledTime = (current, type) => { - if (type === 'start' && current && current.isSame(moment(), 'day')) { - const currentTime = moment(); - const disabledHours = generateOptions(0, currentTime.hour()); - const disabledMinutes = generateOptions(0, currentTime.minute()); - return { - disabledHours: () => disabledHours, - disabledMinutes: () => disabledMinutes, - }; - } - return {}; - }; - - const generateOptions = (start, end) => Array.from({ length: end - start }, (_, i) => start + i); return (
{ }} />
- - 使用区密钥状态 + + 使用区密钥状态 备用区密钥装配
-
-
密钥类型
- - -
启用日期
- -
+
+ + + + + + +
可装配的密钥体列表
0 ? { y: 41 * 5 } : {}} + scroll={tableData1.length > 0 ? { y: 41 * 5 } : {}} pagination={false} bordered columns={columns} - dataSource={tableData} + dataSource={tableData1} rowKey={(record: any) => record?.id} rowClassName={rowClassName} /> @@ -111,6 +169,7 @@ export default function Page() {
管理密钥装配列表
+
0 ? { y: 41 * 5 } : {}} pagination={false} @@ -119,8 +178,27 @@ export default function Page() { dataSource={tableData} rowKey={(record: any) => record?.id} rowClassName={rowClassName} + rowSelection={tableData.length > 0 ? { + type: 'radio', + selectedRowKeys, + onChange: (selectedKeys: any) => { + setSelectedRowKeys(selectedKeys); + } + } : null} /> + {total > 0 &&
+
共 {total} 条
+ +
} +
{ }} /> { }} /> diff --git a/src/pages/MY/KeyManage/PrivateKey/index.tsx b/src/pages/MY/KeyManage/PrivateKey/index.tsx index dbc4f7c..ed893c9 100644 --- a/src/pages/MY/KeyManage/PrivateKey/index.tsx +++ b/src/pages/MY/KeyManage/PrivateKey/index.tsx @@ -17,7 +17,7 @@ export default function Page() { }, { title: '设备名称', dataIndex: 'name', key: 'name', align: 'center' }, { title: '管理实体标识', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '000标识', dataIndex: 'name', key: 'name', align: 'center' }, + { title: '310标识', dataIndex: 'name', key: 'name', align: 'center' }, { title: '密钥种类名称', dataIndex: 'name', key: 'name', align: 'center' }, { title: '安装方式', dataIndex: 'name', key: 'name', align: 'center' }, { title: '载体类型', dataIndex: 'carrierType', key: 'carrierType', align: 'center' }, diff --git a/src/pages/MY/KeyManage/UserKey/index.tsx b/src/pages/MY/KeyManage/UserKey/index.tsx index 4b708ec..d944601 100644 --- a/src/pages/MY/KeyManage/UserKey/index.tsx +++ b/src/pages/MY/KeyManage/UserKey/index.tsx @@ -23,7 +23,7 @@ export default function Page() { }, { title: '设备名称', dataIndex: 'name', key: 'name', align: 'center' }, { title: '管理实体标识', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '000标识', dataIndex: 'name', key: 'name', align: 'center' }, + { title: '310标识', dataIndex: 'name', key: 'name', align: 'center' }, { title: '产品名称', dataIndex: 'productName', key: 'productName', align: 'center' }, { title: '产品编号', dataIndex: 'productNum', key: 'productNum', align: 'center' }, { title: '安装方式', dataIndex: 'name', key: 'name', align: 'center' }, diff --git a/src/pages/SB/DeviceManage/DutyAreaConfig/index.tsx b/src/pages/SB/DeviceManage/DutyAreaConfig/index.tsx index 101ae1d..1bc43cd 100644 --- a/src/pages/SB/DeviceManage/DutyAreaConfig/index.tsx +++ b/src/pages/SB/DeviceManage/DutyAreaConfig/index.tsx @@ -26,7 +26,7 @@ export default function Page() { }, { title: '设备名称', dataIndex: 'name', key: 'name', align: 'center' }, { title: '管理实体标识', dataIndex: 'name', key: 'name', align: 'center' }, - { title: '000标识', dataIndex: 'name', key: 'name', align: 'center' }, + { title: '310标识', dataIndex: 'name', key: 'name', align: 'center' }, { title: '产品名称', dataIndex: 'productName', key: 'productName', align: 'center' }, { title: '产品编号', dataIndex: 'productNum', key: 'productNum', align: 'center' }, { title: '使用期/备用区', dataIndex: 'name', key: 'name', align: 'center' }, diff --git a/src/services/register.ts b/src/services/register.ts index 0a14b08..dedf51b 100644 --- a/src/services/register.ts +++ b/src/services/register.ts @@ -67,5 +67,5 @@ export async function manageDiskDataImport(formData: any) { // 管理系统管理盘数据维护 - 列表 export async function secretFormatList(params: any) { - return getRequest(`/xgd/secretInstall/secretFormatList`, params); + return getRequest(`/xgd/secretInstall/managerSysDataList`, params); } diff --git a/src/utils/env/dev.ts b/src/utils/env/dev.ts index a7a1b61..37087ff 100644 --- a/src/utils/env/dev.ts +++ b/src/utils/env/dev.ts @@ -2,7 +2,8 @@ export const DEV = { PROXY_SERVER: 'http://localhost:8088', // PROXY_SERVER: 'http://127.0.0.1:8088', LOCAL_URL: 'http://localhost:8000', - FILE_URL: 'C:/Users/lyc/Desktop' // 快捷方式储存的路径 + FILE_URL: 'C:/Users/lyc/Desktop', // 快捷方式储存的路径 + HARD_CODE: false, // 是否写死接口的请求地址 }; export default DEV; diff --git a/src/utils/request.ts b/src/utils/request.ts index d673bbb..1c160ea 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,7 +1,5 @@ import { DEV } from './env/dev' -// 是否写死请求地址 -const hardCode = false; /** * GET 请求 @@ -16,7 +14,7 @@ export function getRequest(url: string, params: object) { .join('&'); // 拼接查询字符串到 URL - let urlWithParams = ((hardCode ? DEV.PROXY_SERVER : '')) + url; + let urlWithParams = ((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url; if (queryString) { urlWithParams += `?${queryString}`; } @@ -43,7 +41,7 @@ export function getRequest(url: string, params: object) { * @returns {Promise} - 返回一个 Promise 对象,包含 response 数据或 error 信息 */ export function postRequest(url: string, data: object) { - return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { + return fetch(((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url, { method: 'POST', headers: { 'Content-Type': 'application/json'}, mode: "cors", @@ -69,7 +67,7 @@ export function postFormDataRequest(url: string, data: object) { formData.append(key, data[key]); } - return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { + return fetch(((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url, { method: 'POST', mode: "cors", body: formData @@ -89,7 +87,7 @@ export function postFormDataRequest(url: string, data: object) { */ export function deleteRequest(url: string, params: object) { const searchParams = new URLSearchParams(params); - return fetch(`${((hardCode ? DEV.PROXY_SERVER : '')) + url}?${searchParams.toString()}`, { + return fetch(`${((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url}?${searchParams.toString()}`, { method: 'DELETE', mode: "cors", }) @@ -108,7 +106,7 @@ export function deleteRequest(url: string, params: object) { * @returns {Promise} - 返回一个 Promise 对象,表示请求的结果(成功或失败) */ export function putRequest(url: string, data: object) { - return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { + return fetch(((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url, { method: 'PUT', headers: { 'Content-Type': 'application/json' @@ -131,7 +129,7 @@ export function putRequest(url: string, data: object) { * @returns {Promise} - 返回一个 Promise 对象,包含文件 blob 数据或 error 信息 */ export function downloadFile(url: string, fileName?: string) { - return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { + return fetch(((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url, { method: 'GET', mode: "cors", }) @@ -158,7 +156,7 @@ export function downloadFile(url: string, fileName?: string) { * @returns {Promise} - 返回一个 Promise 对象,表示请求的结果(成功或失败) */ export function uploadFile(url: string, formData: any) { - return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { + return fetch(((DEV.HARD_CODE ? DEV.PROXY_SERVER : '')) + url, { method: 'POST', body: formData, mode: "cors"