master_055
张瑞宁 9 months ago
parent dea0676e4a
commit 1fa1cfafe6

@ -1,6 +1,6 @@
import GlobalConfig from '../src/utils/env/dev';
const proxy = {
'/xgd': {
'/055': {
target: GlobalConfig['PROXY_SERVER'],
changeOrigin: true,
withCredentials: true,

@ -73,41 +73,34 @@ const MachineRegister: FC<PageProps> = ({ }) => {
dataIndex: 'school_info',
key: 'school_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '设备编号',
dataIndex: 'department_info',
key: 'department_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '设备名称',
dataIndex: 'teacher_count',
key: 'teacher_count',
width: 90,
ellipsis: true,
render: (text: any, record: any) => <span style={{ color: '#165DFF', cursor: 'pointer' }} onClick={() => { history.push(`/colleges/${record?.school_info?.id}/statistics`) }}>{text}</span>
}, {
title: '工作状态',
dataIndex: 'student_count',
key: 'student_count',
width: 90,
ellipsis: true,
render: (text: any, record: any) => <span style={{ color: '#165DFF', cursor: 'pointer' }} onClick={() => { history.push(`/colleges/${record?.school_info?.id}/statistics`) }}>{text}</span>
}, {
title: '使用单位',
dataIndex: 'type_cn',
key: 'type_cn',
width: 100,
ellipsis: true,
render: (text: any) => <span style={{ color: "#333" }}>{text}</span>
}, {
title: '监控日志',
dataIndex: 'service_end_time',
key: 'service_end_time',
ellipsis: true,
render: (text: any, record: any, index: any) => <span title={(record?.service_start_time && record?.service_end_time) ? `${moment(record?.service_start_time).format('YYYY-MM-DD HH:mm')} - ${moment(record?.service_end_time).format('YYYY-MM-DD HH:mm')}` : '--'}
style={{ color: "#000" }}> {(record?.service_start_time && record?.service_end_time) ? `${moment(record?.service_start_time).format('YYYY-MM-DD HH:mm')} - ${moment(record?.service_end_time).format('YYYY-MM-DD HH:mm')}` : '--'}</span>
},]
// 查找

@ -4,7 +4,8 @@ import ButtonComp from '@/components/ButtonComp';
import ClearInfoDialog from '@/components/ClearInfoDialog';
import NodeInitWrap from '@/components/NodeInitWrap';
import ContentWarp from '@/components/ContentWarp';
import { Button, ConfigProvider, Form, Input, Modal, Radio, Upload,UploadProps, Checkbox, message, Space,Select } from 'antd';
import { Modal, Radio, Upload, UploadProps, message, Table } from 'antd';
import { device_keyImport } from '@/services/m063';
interface PageProps {
@ -13,29 +14,192 @@ interface PageProps {
const NodeInitTool: FC<PageProps> = ({ }) => {
const [fileOpen, setFileOpen] = useState(true);
const [params, setParams] = useState({
page: 1,
limit: 10,
mdepart: null, //设备使用单位
mposition: null,//设备部署地点
mstate: null,//设备使用状态
midentifer: null,// 密码实体标识
mnumber: null,//上级设备编号
});
const [clearAll, setclearAll] = useState(false) // 点击复位按钮时所有的chebox都变为false
const [result, setResult] = useState({})
const [addModalVisible, setAddModalVisible] = useState<boolean>(false) //控制新增弹窗显隐
const urlParams = useParams();
let sysInfo = localStorage.getItem(`${urlParams?.fileType}`);
let info = sysInfo ? JSON.parse(sysInfo) : null;
useEffect(() => {
}, [])
const uploadprops: UploadProps = {
maxCount: 1,
beforeUpload: (file: any) => {
const formData = new FormData();
formData.append('file', file, '11');
formData.append('file', file);
console.log("file--", file)
console.log("formData--", formData)
// secretInit_loadData(formData).then((res) => {
// if (res?.result == "success" && res?.data.length > 0) {
// message.success('加载数据成功');
const body={
device:{
createTime:'11',
deviceEntityIdentifier:'22',
deviceName:'33',
id:'44',
log:'55',
unit:'66',
updateTime:'77',
workStatus:'88',
},
endDate:'99',
keywords:'01',
orderDirection:'02',
orderField:'03',
pageNumber:'04',
pageSize:'05',
pageStart:'06',
startDate:'07',
}
device_keyImport({...body}).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
message.success('加载数据成功');
// form.setFieldsValue({ ...res?.data[0] })
// localStorage.setItem('MMJInit', JSON.stringify(res?.data[0]));
// setDataLoading(true);
// } else {
// message.error(res?.errorMsg);
// }
// })
} else {
message.error(res?.errorMsg);
}
})
}
};
const columns = [{
title: '序号',
dataIndex: 'name',
key: 'name',
ellipsis: true,
fixed: 'left',
width: 60,
render: (text: any, record: any, index: any) => {
return (
<span style={{ color: "#333" }}>{params.limit * (params.page - 1) + index + 1}</span>
)
}
}, {
title: '设备实体标识',
dataIndex: 'school_info',
key: 'school_info',
ellipsis: true,
}, {
title: '设备编号',
dataIndex: 'department_info',
key: 'department_info',
ellipsis: true,
}, {
title: '设备名称',
dataIndex: 'teacher_count',
key: 'teacher_count',
width: 90,
ellipsis: true,
}, {
title: '工作状态',
dataIndex: 'student_count',
key: 'student_count',
width: 90,
ellipsis: true,
}, {
title: '使用单位',
dataIndex: 'type_cn',
key: 'type_cn',
width: 100,
ellipsis: true,
}, {
title: '监控日志',
dataIndex: 'service_end_time',
key: 'service_end_time',
ellipsis: true,
},]
// 查找
const handleSearch = () => {
console.log("params-", params)
}
// 复位
const handleClear = () => {
params.mdepart = null;
params.mposition = null;
params.mstate = null;
params.midentifer = null;
params.mnumber = null;
setParams({ ...params })
setclearAll(true)
}
const getList = () => {
}
// 查询条件改变时设置参数
const handleChange = (value: any, param: string) => {
params[`${param}`] = value;
setParams({ ...params })
setclearAll(false)
}
return (
<section>
<section style={{ margin: '20px' }}>
<div style={{ marginTop: '20px' }}>
<Table
columns={columns}
// loading={tableLoading}
dataSource={result?.list}
pagination={{
size: 'default',
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ['10', '15', '50', '100', '200'],
hideOnSinglePage: true,
pageSize: params.limit,
current: params.page,
position: ["bottomRight"],
onChange: (page, pagesize) => {
params.page = page;
params.limit = pagesize;
setParams({ ...params });
getList();
},
total: result?.count,
showTotal: (total, range) => <span><span style={{ color: '#165DFF' }}> {total} </span></span>
}}
/>
</div>
<div className='flex_aiC_jB mt30 mb30'>
<div className='flex_aiC'>
<ButtonComp style={{ marginRight: 20 }} text={'第一页'} onClick={() => { }} />
<ButtonComp style={{ marginRight: 20 }} text={'上一页'} onClick={() => { }} />
<ButtonComp style={{ marginRight: 20 }} text={'下一页'} onClick={() => { }} />
<ButtonComp text={'最后一页'} onClick={() => { }} />
</div>
<div className='flex_aiC'>
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'新增'} onClick={() => { setAddModalVisible(true) }} />
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'修改'} onClick={() => { }} />
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'删除'} onClick={() => { }} />
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'退出'} onClick={() => { }} />
</div>
</div>
<Modal
title="导入"
open={fileOpen}
@ -59,6 +223,7 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
}} />
</div>
</Modal>
</section>
)

@ -1,6 +1,7 @@
import React, { useEffect, useState, useRef } from 'react';
import { Modal, Form, Input } from 'antd';
import { Modal, Form, Input,message,DatePicker } from 'antd';
import ButtonComp from '@/components/ButtonComp';
import { addPasswordDeviceInfo } from '@/services/device';
interface PageProps {
title?: string;
@ -17,6 +18,39 @@ const AddModal = ({
...props
}: PageProps) => {
const [form] = Form.useForm();
const passwordDeviceInfo= {
"belongCryptoSystem": "string",
"communicationAddressType": "string",
"createTime": "string",
"deviceAliases": "string",
"equipmentDeploymentLocation": "string",
"equipmentManagementUnit": "string",
"equipmentManufacturer": "string",
"equipmentType": "string",
"equipmentUserUnit": "string",
"id": 0,
"isolatorExternalNetworkIp": "string",
"memo": "string",
"passwordDeviceNumber": "string",
"passwordDeviceSerialNumber": "string",
"passwordEntityIdentifier": "string",
"registrationDate": "string",
"superiorEquipmentNumber": "string",
"sysType": "string",
"updateTime": "string"
};
const onFinish = (values: any) => {
values.registrationDate=values['registrationDate'].format('YYYY-MM-DD'),
addPasswordDeviceInfo({...values,passwordDeviceInfo}).then((res) => {
if (res?.result == "success") {
message.success('新增成功');
form.resetFields();
} else {
message.error(res?.errorMsg);
}
})
};
return (
<>
@ -28,63 +62,69 @@ const AddModal = ({
onCancel={onCancel}
footer={null}
maskClosable={false}
>
<Form
onFinish={onFinish}
form={form}
style={{maxHeight:'500px',overflow:'auto'}}
>
<Form.Item name="sysName" label="所属密码系统">
<Form.Item name="belongCryptoSystem" label="所属密码系统">
<Input placeholder="请输入所属密码系统" />
</Form.Item>
<Form.Item name="systype" label="所属设备类型">
<Form.Item name="equipmentType" label="所属设备类型">
<Input placeholder="请输入所属设备类型" />
</Form.Item>
<div style={{ display: 'flex' }}>
<Form.Item name="identifier" label="密码实体标识" rules={[{ required: true, message: '请选择密码实体标识' },]}>
<Form.Item name="passwordEntityIdentifier" label="密码实体标识" rules={[{ required: true, message: '请选择密码实体标识' },]}>
<Input placeholder="请选择密码实体标识" />
</Form.Item>
<ButtonComp text={'选择'} style={{ marginLeft: '20px' }} onClick={() => { }} />
{/* <ButtonComp text={'选择'} style={{ marginLeft: '20px' }} onClick={() => { }} /> */}
</div>
<div style={{ display: 'flex' }}>
<Form.Item name="order" label="密码设备序号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="passwordDeviceSerialNumber" label="密码设备序号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入密码设备序号" />
</Form.Item>
<div style={{ marginLeft: '20px' }}>0000001</div>
</div>
<Form.Item name="order" label="密码设备编号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="passwordDeviceNumber" label="密码设备编号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入密码设备编号" />
</Form.Item>
<Form.Item name="order" label="上级设备编号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="superiorEquipmentNumber" label="上级设备编号" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入上级设备编号" />
</Form.Item>
<Form.Item name="order" label="设备使用单位" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="equipmentUserUnit" label="设备使用单位" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入设备使用单位" />
</Form.Item>
<Form.Item name="order" label="设备部署地点" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="equipmentDeploymentLocation" label="设备部署地点" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入设备部署地点" />
</Form.Item>
<Form.Item name="order" label="设备管理单位" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="equipmentManagementUnit" label="设备管理单位" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择设备管理单位" />
</Form.Item>
<Form.Item name="order" label="通信地址类型" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="communicationAddressType" label="通信地址类型" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择通信地址类型" />
</Form.Item>
<Form.Item name="order" label="隔离器外网Ip" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请选择密码设备序号" />
<Form.Item name="isolatorExternalNetworkIp" label="隔离器外网IP" rules={[{ required: true, message: '请选择密码设备序号' },]}>
<Input placeholder="请输入隔离器外网IP" />
</Form.Item>
<Form.Item name="order" label="设备生产厂商(可空)">
<Input placeholder="请选择密码设备序号" />
<Form.Item name="equipmentManufacturer" label="设备生产厂商(可空)">
<Input placeholder="请选择设备生产厂商" />
</Form.Item>
<Form.Item name="order" label="设备别名(可空)">
<Form.Item name="deviceAliases" label="设备别名(可空)">
<Input placeholder="请选择设备别名" />
</Form.Item>
<Form.Item name="order" label="备注信息(可空)">
<Input placeholder="注册日期" />
<Form.Item name="memo" label="备注信息(可空)">
<Input placeholder="请输入备注信息" />
</Form.Item>
<Form.Item name="registrationDate" label="注册日期(可空)">
<DatePicker />
</Form.Item>
</Form>
<div className='flex_jE mt20'>
<ButtonComp style={{ marginRight: 20 }} text={'确定'} onClick={onOk} />
<ButtonComp style={{ marginRight: 20 }} text={'确定'} onClick={()=>{
form.submit();
// onOk();
}} />
<ButtonComp type="cancel" text={'取消'} onClick={onCancel} />
</div>
</Modal>

@ -5,10 +5,12 @@ import ClearInfoDialog from '@/components/ClearInfoDialog';
import { getPlugCordResult } from '@/services/api';
import { validateNumber } from '@/utils/validate';
import theme from '@/styles/antd.theme';
import { Radio, Space, Upload, UploadProps, } from 'antd';
import { Radio, Space, Upload, UploadProps, message,} from 'antd';
import styles from './index.less';
import StepHeader from '@/components/StepHeader';
import ContentWarp from '@/components/ContentWarp';
import {offlineImport} from '@/services/device';
import { fileStr, sysType,sysTypeStr } from '@/utils/sysType';
interface PageProps {
data: Array<{
@ -26,23 +28,24 @@ interface PageProps {
const ImportStep: FC<PageProps> = ({ }) => {
const [step, setStep] = useState(2)
const uploadprops: UploadProps = {
const props: UploadProps = {
maxCount: 1,
beforeUpload: (file: any) => {
let str: string = sysType[urlParams?.fileType] + fileStr[urlParams?.fileType]
const formData = new FormData();
formData.append('file', file, '11');
console.log("file--", file)
formData.append('file', file);
formData.append('sysType ', sysTypeStr[str]);
console.log("formData--", formData)
// secretInit_loadData(formData).then((res) => {
// if (res?.result == "success" && res?.data.length > 0) {
// message.success('加载数据成功');
offlineImport(formData).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
message.success('加载数据成功');
// form.setFieldsValue({ ...res?.data[0] })
// localStorage.setItem('MMJInit', JSON.stringify(res?.data[0]));
// setDataLoading(true);
// } else {
// message.error(res?.errorMsg);
// }
// })
} else {
message.error(res?.errorMsg);
}
})
}
};
@ -61,7 +64,7 @@ const ImportStep: FC<PageProps> = ({ }) => {
<div className='flex_jE mt20'>
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'下一步'} onClick={() => { }} />
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'上一步'} onClick={() => { history.back() }} />
<Upload {...uploadprops} showUploadList={false}>
<Upload {...props} showUploadList={false}>
<ButtonComp style={{ marginRight: 20 }} text={'加载数据'} />
</Upload>
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'退出'} onClick={() => { }} />

@ -23,6 +23,7 @@ import styles from './index.less';
import DEV from '@/utils/env/dev';
import { countType, fileStr, sysType, sysTypeStr } from '@/utils/sysType';
import { nodeInit_step2, nodeInit_step4 } from '@/services/nodeinit';
import moment from 'moment'
interface PageProps {
@ -32,13 +33,13 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
const urlParams = useParams();
const [authOpen, setAuthOpen] = useState(false);
const [stepOpen,setStepOpen] = useState(false);
const [stepOpen, setStepOpen] = useState(false);
const [step, setStep] = useState(1)
const [pin, setPin] = useState<any>('');
const [radioValue, setRadioValue] = useState(1)
const [configRadio, setConfigRadio] = useState(1)
const [curform] = Form.useForm();
const [preform] = Form.useForm();
const [form] = Form.useForm();
const [fileInfo, setFileInfo] = useState({
"secret": "",
@ -66,9 +67,9 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
useEffect(() => {
installSuccess()
if(info?.auth === 'admin'){
if (info?.pingLoginStatus) {
setStepOpen(true);
}else{
} else {
setAuthOpen(true)
}
}, [])
@ -80,13 +81,12 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
const formData = new FormData();
formData.append('file', file);
formData.append('sysType ', sysTypeStr[str]);
console.log("formData--",formData)
nodeInit_step2(formData).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
message.success('数据加载成功')
console.log("res--",res)
console.log("res--", res)
setFileInfo(res?.data[0]);
localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify({ ...info, deviceInit: {data: res?.data[0], install: false} }));
localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify({ ...info, deviceInit: { data: res?.data[0], install: false } }));
// setDataLoading(true);
} else {
message.error(res?.errorMsg);
@ -115,6 +115,21 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
}
const onFinish = (values: any) => {
nodeInit_step4({
...values,
updateTime: moment().format('YYYY-MM-DD HH:mm:ss')
}).then((res) => {
if (res?.result == "success") {
message.success('初始化成功');
form.resetFields();
} else {
message.error(res?.errorMsg);
}
})
};
return (
<section style={{ width: '1200px', margin: '20px auto' }}>
<Modal
@ -129,7 +144,9 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<div style={{ marginRight: '10px' }}></div>
<div style={{ flex: 1 }}><Input /></div>
<div style={{ flex: 1 }}>
<Input placeholder="请输入口令" value={pin} onChange={(e) => setPin(e.target.value)} />
</div>
</div>
<div className='flex_jE_AC mt30' >
@ -137,8 +154,16 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
setAuthOpen(false)
}} />
<ButtonComp type={'confirm'} text={'确定'} onClick={() => {
if (pin == 'admin') {
setPin('')
setStep(1)
// 记录登陆成功状态
localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify({ ...info, pingLoginStatus: true, layoutInfo: null }))
setAuthOpen(false)
setStepOpen(true)
} else {
message.error('口令错误,请重新输入')
}
}} />
</div>
@ -232,30 +257,34 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
prebtn={true}
cancelbtn={true}
onNext={() => (setStep(4))}
onPre={() => (setStep(2))}
onPre={() => (setStep(3))}
onFinish={() => {
form.submit()
}}
>
<div style={{ marginTop: '20px' }}>
<ContentWarp text='本级设备及上级设备基本信息'>
<div style={{ margin:'0 20px',display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<div>
<div className='mt10 mb10'></div>
<div>
{/* <div style={{ margin:'0 20px',display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}> */}
<div style={{ margin: '0 20px' }}>
<Form
form={curform}
// onFinish={onFinish}
form={form}
onFinish={onFinish}
// initialValues={{ residence: ['zhejiang', 'hangzhou', 'xihu'], prefix: '86' }}
// style={{ maxWidth: 600 }}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}
scrollToFirstError
>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<div>
<div className='mt10 mb10'></div>
<Form.Item
name="id"
name={['certificate', 'systemNumber']}
label="系统编号"
>
<Input />
</Form.Item>
<Form.Item
name="gender"
name={['certificate', 'deviceName']}
label="设备名称"
>
<Select placeholder="请选择设备名称">
@ -266,48 +295,38 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
</Form.Item>
<Form.Item
name="level"
name={['certificate', 'managementLevel']}
label="管理级别"
>
<Input />
</Form.Item>
<Form.Item
name="num"
name={['certificate', 'deviceNumber']}
label="设备编号"
>
<Input />
</Form.Item>
<Form.Item
name="identifier"
name={['certificate', 'entityIdentifier']}
label="实体标识"
>
<Input />
</Form.Item>
</Form>
</div>
</div>
<div style={{marginLeft:'50px'}}>
<div style={{ marginLeft: '50px' }}>
<div className='mt10 mb10'></div>
<div>
<Form
form={preform}
// onFinish={onFinish}
// initialValues={{ residence: ['zhejiang', 'hangzhou', 'xihu'], prefix: '86' }}
// style={{ maxWidth: 600 }}
scrollToFirstError
>
<Form.Item
name="id"
name="systemNumber"
label="系统编号"
>
<Input />
</Form.Item>
<Form.Item
name="gender"
name="deviceName"
label="设备名称"
>
<Select placeholder="请选择设备名称">
@ -318,29 +337,28 @@ const NodeInitTool: FC<PageProps> = ({ }) => {
</Form.Item>
<Form.Item
name="level"
name="managementLevel"
label="管理级别"
>
<Input />
</Form.Item>
<Form.Item
name="num"
name="deviceNumber"
label="设备编号"
>
<Input />
</Form.Item>
<Form.Item
name="identifier"
name="entityIdentifier"
label="实体标识"
>
<Input />
</Form.Item>
</Form>
</div>
</div>
</Form>
</div>
</ContentWarp>
</div>

@ -5,11 +5,11 @@ import ClearInfoDialog from '@/components/ClearInfoDialog';
import { getPlugCordResult } from '@/services/api';
import { validateNumber } from '@/utils/validate';
import theme from '@/styles/antd.theme';
import { Radio, Space, Upload, UploadProps, } from 'antd';
import { Radio, Space, Upload, UploadProps, message} from 'antd';
import styles from './index.less';
import StepHeader from '@/components/StepHeader';
import ContentWarp from '@/components/ContentWarp';
import {offlineImport} from '@/services/device';
interface PageProps {
data: Array<{
// 菜单名称
@ -33,16 +33,16 @@ const ImportStep: FC<PageProps> = ({ }) => {
formData.append('file', file, '11');
console.log("file--", file)
console.log("formData--", formData)
// secretInit_loadData(formData).then((res) => {
// if (res?.result == "success" && res?.data.length > 0) {
// message.success('加载数据成功');
offlineImport(formData).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
message.success('导入成功');
// form.setFieldsValue({ ...res?.data[0] })
// localStorage.setItem('MMJInit', JSON.stringify(res?.data[0]));
localStorage.setItem('MMJInit', JSON.stringify(res?.data[0]));
// setDataLoading(true);
// } else {
// message.error(res?.errorMsg);
// }
// })
} else {
message.error(res?.errorMsg);
}
})
}
};

@ -1,8 +1,10 @@
import { FC, useEffect, useState } from 'react';
import { history, useLocation, useParams } from 'umi';
import { Form, Input, Select, Button, Row, Col } from 'antd';
import { Form, Input, Select, Button, Row, Col, Upload,message } from 'antd';
// import styles from './index.less';
import ContentWarp from '@/components/ContentWarp';
import { UploadOutlined } from '@ant-design/icons';
import {device_keyImport} from '@/services/secret';
interface PageProps {
data: Array<{
@ -21,38 +23,62 @@ const ReceiveSecret: FC<PageProps> = ({ }) => {
const [form] = Form.useForm();
const formItemSty = { width: 'auto', marginBottom: 20, marginRight: 30 };
const onFinish = () => {
const onFinish = (values: any) => {
device_keyImport({...values}).then((res) => {
if (res?.result == "success") {
message.success('密钥接收成功!');
form.resetFields();
} else {
message.error(res?.errorMsg);
}
})
}
const normFile = (e: any) => {
console.log('Upload event:', e);
if (Array.isArray(e)) {
return e;
}
return e?.fileList;
};
return (
<section style={{ margin: '20px' }}>
<ContentWarp text='接收预制密钥体'>
<Form form={form} onFinish={onFinish} className='mt20 ml20'>
<Row>
<Form.Item name="productNum" label="预制密钥代号" style={formItemSty}>
<Form.Item name={['receivePrefabricatedKeyBody','keyNumber']} label="预制密钥代号" style={formItemSty}>
<Input placeholder="请输入预制密钥代号" style={{ width: 260 }} />
</Form.Item>
<Form.Item name="askType" label="密钥记录格式" style={formItemSty}>
<Form.Item name={['receivePrefabricatedKeyBody','keyRecordFormat']} label="密钥记录格式" style={formItemSty}>
<Select style={{ width: 260 }} placeholder={'请选择密钥记录格式'} onChange={(e) => { }} options={[{ label: '11', value: '11' }]} />
</Form.Item>
</Row>
<Row>
<Form.Item name="productNum" label="每群密钥长度" style={formItemSty}>
<Form.Item name={['receivePrefabricatedKeyBody','keyLengthPer']} label="每群密钥长度" style={formItemSty}>
<Input placeholder="请输入每群密钥长度" style={{ width: 260 }} />
</Form.Item>
<Form.Item name="productNum" label="预制密钥群数" style={formItemSty}>
<Form.Item name={['receivePrefabricatedKeyBody','numberKeyGroups']} label="预制密钥群数" style={formItemSty}>
<Input placeholder="请输入预制密钥群数" style={{ width: 260 }} />
</Form.Item>
</Row>
<div>
<div className='mb10'></div>
<Form.Item name="askType" style={formItemSty}>
<Select style={{ width: 740 }} placeholder={'请选择从机要局申请的预制密钥体数据文件'} onChange={(e) => { }} options={[{ label: '11', value: '11' }]} />
<Form.Item
name={['receivePrefabricatedKeyBody','filename']}
valuePropName="fileList"
getValueFromEvent={normFile}
>
<Upload >
<Button icon={<UploadOutlined />}></Button>
</Upload>
</Form.Item>
</div>
</Form>
<div style={{display:'flex',justifyContent:'center',marginBottom:'20px'}}><Button></Button></div>
<div style={{ display: 'flex', justifyContent: 'center', marginBottom: '20px' }}><Button onClick={()=>{form.submit()}}></Button></div>
</ContentWarp>
</section>
)

@ -1,10 +1,11 @@
import { FC, useEffect, useState } from 'react';
import { history, useLocation, useParams } from 'umi';
import ButtonComp from '@/components/ButtonComp';
import { Table } from 'antd';
import { Table,message } from 'antd';
// import styles from './index.less';
import CheckSelect from '@/components/CheckSelect';
import CheckInput from '@/components/CheckInput';
import {device_secretInstallList} from '@/services/secret'
interface PageProps {
@ -23,7 +24,7 @@ const MachineRegister: FC<PageProps> = ({ }) => {
keystatus:null,//密钥装配状态
});
const [clearAll, setclearAll] = useState(false) // 点击复位按钮时所有的chebox都变为false
const [result, setResult] = useState({})
const [result, setResult] = useState([])
const columns = [{
title: '序号',
@ -42,25 +43,23 @@ const MachineRegister: FC<PageProps> = ({ }) => {
dataIndex: 'school_info',
key: 'school_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '设备类型名称',
dataIndex: 'department_info',
key: 'department_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '密码实体标识',
dataIndex: 'teacher_count',
key: 'teacher_count',
ellipsis: true,
render: (text: any, record: any) => <span style={{ color: '#165DFF', cursor: 'pointer' }} onClick={() => { history.push(`/colleges/${record?.school_info?.id}/statistics`) }}>{text}</span>
}, {
title: '所属密码系统',
dataIndex: 'student_count',
key: 'student_count',
ellipsis: true,
render: (text: any, record: any) => <span style={{ color: '#165DFF', cursor: 'pointer' }} onClick={() => { history.push(`/colleges/${record?.school_info?.id}/statistics`) }}>{text}</span>
}, {
title: '上级设备编号',
dataIndex: 'type_cn',
@ -72,8 +71,6 @@ const MachineRegister: FC<PageProps> = ({ }) => {
dataIndex: 'service_end_time',
key: 'service_end_time',
ellipsis: true,
render: (text: any, record: any, index: any) => <span title={(record?.service_start_time && record?.service_end_time) ? `${moment(record?.service_start_time).format('YYYY-MM-DD HH:mm')} - ${moment(record?.service_end_time).format('YYYY-MM-DD HH:mm')}` : '--'}
style={{ color: "#000" }}> {(record?.service_start_time && record?.service_end_time) ? `${moment(record?.service_start_time).format('YYYY-MM-DD HH:mm')} - ${moment(record?.service_end_time).format('YYYY-MM-DD HH:mm')}` : '--'}</span>
}, ]
// 查找
@ -93,9 +90,6 @@ const MachineRegister: FC<PageProps> = ({ }) => {
setclearAll(true)
}
const getList = () => {
}
// 查询条件改变时设置参数
const handleChange = (value:any,param:string) =>{
@ -104,6 +98,20 @@ const MachineRegister: FC<PageProps> = ({ }) => {
setclearAll(false)
}
const getList = () => {
device_secretInstallList({}).then((res) => {
if (res?.result == "success") {
setResult([...res?.data])
} else {
message.error(res?.errorMsg);
}
})
}
useEffect(()=>{
getList()
},[])
return (
<section style={{ margin: '20px' }}>
@ -173,7 +181,7 @@ const MachineRegister: FC<PageProps> = ({ }) => {
<Table
columns={columns}
// loading={tableLoading}
dataSource={result?.list}
dataSource={result}
pagination={{
size: 'default',
showQuickJumper: true,
@ -189,7 +197,7 @@ const MachineRegister: FC<PageProps> = ({ }) => {
setParams({ ...params });
getList();
},
total: result?.count,
total: result?.length,
showTotal: (total, range) => <span><span style={{ color: '#165DFF' }}> {total} </span></span>
}}
/>

@ -1,16 +1,17 @@
import { FC, useEffect, useState } from 'react';
import { history, useLocation, useParams } from 'umi';
import { Table, Input } from 'antd';
import { Table, Input, message } from 'antd';
// import styles from './index.less';
import ContentWarp from '@/components/ContentWarp';
import ButtonComp from '@/components/ButtonComp';
import {device_secretList} from '@/services/secret';
interface PageProps {
}
const ReceiveSecret: FC<PageProps> = ({ }) => {
const [result, setResult] = useState({});
const [result, setResult] = useState([]);
const [params, setParams] = useState({
page: 1,
limit: 10,
@ -33,13 +34,11 @@ const ReceiveSecret: FC<PageProps> = ({ }) => {
dataIndex: 'school_info',
key: 'school_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '密钥编号',
dataIndex: 'department_info',
key: 'department_info',
ellipsis: true,
render: (text: any, record: any, index: any) => <span style={{ color: "#333" }}>{text.name}</span>
}, {
title: '密钥组长',
dataIndex: 'teacher_count',
@ -61,9 +60,20 @@ const ReceiveSecret: FC<PageProps> = ({ }) => {
},]
const getList = () => {
device_secretList({}).then((res) => {
if (res?.result == "success") {
// message.success('密钥接收成功!');
setResult([...res?.data])
} else {
message.error(res?.errorMsg);
}
})
}
useEffect(()=>{
getList()
},[])
const handleSearch = () => {
}
@ -75,7 +85,7 @@ const ReceiveSecret: FC<PageProps> = ({ }) => {
<Table
columns={columns}
// loading={tableLoading}
dataSource={result?.list}
dataSource={result}
pagination={{
size: 'default',
showQuickJumper: true,
@ -91,7 +101,7 @@ const ReceiveSecret: FC<PageProps> = ({ }) => {
setParams({ ...params });
getList();
},
total: result?.count,
total: result?.length,
showTotal: (total, range) => <span><span style={{ color: '#165DFF' }}> {total} </span></span>
}}
/>

@ -0,0 +1,12 @@
import { getRequest, postRequest, uploadFile } from '@/utils/request';
// 设备管理 - 密码设备信息----新增
export async function addPasswordDeviceInfo(data: any) {
return postRequest(`/055/device/addPasswordDeviceInfo`, data);
}
// 离线管理--导入
export async function offlineImport(data: any) {
return postRequest(`/055/device/offlineManagement`, data);
}

@ -0,0 +1,8 @@
import { getRequest, postRequest, uploadFile } from '@/utils/request';
// 一体化管理- 导入
export async function device_keyImport(data: any) {
return postRequest(`/063/keyImport`, data);
}

@ -0,0 +1,17 @@
import { getRequest, postRequest, uploadFile } from '@/utils/request';
// 接收预制秘钥--导入
export async function device_keyImport(data: any) {
return postRequest(`/055/device/keyImport`, data);
}
// 预制秘钥信息列表
export async function device_secretList(data: any) {
return getRequest(`/055/device/secretList`, data);
}
// 秘钥装配列表
export async function device_secretInstallList(data: any) {
return getRequest(`/055/device/secretInstallList`, data);
}

@ -2,7 +2,8 @@ export const DEV = {
PROXY_SERVER: 'http://localhost:8088',
// PROXY_SERVER: 'http://127.0.0.1:8088',
LOCAL_URL: 'http://localhost:8001',
FILE_URL: 'C:/Users/灯台百合/Desktop' // 快捷方式储存的路径
FILE_URL: 'C:/Users/灯台百合/Desktop', // 快捷方式储存的路径
HARD_CODE: false
};
export default DEV;

@ -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"

Loading…
Cancel
Save