Commit 078005dd authored by 邓超's avatar 邓超

fix: 宿主管理添加生成编号功能

parent 5c72167c
Pipeline #68227 passed with stages
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Button, Descriptions, Input, Card, Divider, Row, Col } from 'antd'; import { Button, Descriptions, Input, Card, Divider, Row, Col, message } from 'antd';
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import styles from './BaseConfig.less'; import styles from './BaseConfig.less';
import { GetDataBaseConfig, GetBasicInfo } from '@/services/hostmanager/hostmanager'; import {
GetDataBaseConfig,
GetBasicInfo,
CreateSiteCode,
} from '@/services/hostmanager/hostmanager';
import servie from '../../../../assets/images/icons/服务器管理.svg'; import servie from '../../../../assets/images/icons/服务器管理.svg';
import configuration from '../../../../assets/images/icons/站点配置.svg'; import configuration from '../../../../assets/images/icons/站点配置.svg';
...@@ -14,6 +18,7 @@ const BaseConfig = () => { ...@@ -14,6 +18,7 @@ const BaseConfig = () => {
ip: '', ip: '',
}); });
const [currentSiteInfo, setcurrentSiteInfo] = useState(''); const [currentSiteInfo, setcurrentSiteInfo] = useState('');
const [isLoading, setLoading] = useState(false);
const key = CryptoJS.enc.Utf8.parse('1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'); // 十六位十六进制数作为密钥 const key = CryptoJS.enc.Utf8.parse('1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'); // 十六位十六进制数作为密钥
const iv = CryptoJS.enc.Utf8.parse('1234567890000000'); const iv = CryptoJS.enc.Utf8.parse('1234567890000000');
...@@ -56,6 +61,7 @@ const BaseConfig = () => { ...@@ -56,6 +61,7 @@ const BaseConfig = () => {
}; };
const getSiteCode = () => { const getSiteCode = () => {
GetBasicInfo().then(res => { GetBasicInfo().then(res => {
setLoading(true);
if (res.code === 0) { if (res.code === 0) {
setcurrentSiteInfo(res.data); setcurrentSiteInfo(res.data);
} }
...@@ -70,7 +76,16 @@ const BaseConfig = () => { ...@@ -70,7 +76,16 @@ const BaseConfig = () => {
} }
return encryptStr; return encryptStr;
}; };
const createCode = () => {
CreateSiteCode().then(res => {
if (res.code === 0) {
getSiteCode();
message.success('生成成功');
} else {
message.error(res.msg);
}
});
};
return ( return (
<div className={styles.base_container}> <div className={styles.base_container}>
<Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}> <Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}>
...@@ -85,6 +100,16 @@ const BaseConfig = () => { ...@@ -85,6 +100,16 @@ const BaseConfig = () => {
站点编号: 站点编号:
</span> </span>
<Input value={currentSiteInfo} disabled style={{ width: '300px' }} /> <Input value={currentSiteInfo} disabled style={{ width: '300px' }} />
<Button
style={{
marginLeft: '10px',
display: `${!currentSiteInfo && isLoading ? 'inline-block' : 'none'}`,
}}
type="primary"
onClick={createCode}
>
生成编号
</Button>
<br /> <br />
<div style={{ marginTop: '50px', display: 'flex', alignItems: 'center' }}> <div style={{ marginTop: '50px', display: 'flex', alignItems: 'center' }}>
<img src={servie} style={{ height: '16px' }} alt="" /> <img src={servie} style={{ height: '16px' }} alt="" />
......
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-01-13 17:26:14 * @Date: 2022-01-13 17:26:14
* @LastEditTime: 2023-01-30 17:52:29 * @LastEditTime: 2023-03-01 09:29:38
* @LastEditors: dengchao 754083046@qq.com * @LastEditors: dengchao 754083046@qq.com
*/ */
import { get, post, PUBLISH_SERVICE, CITY_SERVICE, PandaCore } from '@/services/index'; import { get, post, PUBLISH_SERVICE, CITY_SERVICE, PandaCore } from '@/services/index';
// 生成站点编号
export const CreateSiteCode = param => get(`${PUBLISH_SERVICE}/HostManager/CreateSiteCode`, param);
// ETL配置 // ETL配置
// 保存数据中台地址 // 保存数据中台地址
export const SaveETLConfig = param => get(`${PUBLISH_SERVICE}/HostManager/SaveETLConfig`, param); export const SaveETLConfig = param => get(`${PUBLISH_SERVICE}/HostManager/SaveETLConfig`, param);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment