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