parent
5c4c86429b
commit
8f71dd2f76
@ -0,0 +1,57 @@
|
||||
.head {
|
||||
height: 60px;
|
||||
background: #001628;
|
||||
|
||||
> section {
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
width: 1200px;
|
||||
|
||||
> span {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 18px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
> ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
margin-left: 100px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #28b1ff;
|
||||
position: relative;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
b {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: -9px;
|
||||
width: 40px;
|
||||
height: 2px;
|
||||
background: #28b1ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
height: calc(100vh - 60px);
|
||||
background-color: #fafafa;
|
||||
overflow: auto;
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
.page {
|
||||
width: 1200px;
|
||||
margin: 22px auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
width: 146px;
|
||||
height: 334px;
|
||||
background: #ffffff;
|
||||
border-radius: 4px;
|
||||
padding-top: 18px;
|
||||
|
||||
> a {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #464f66;
|
||||
padding: 20px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: @primary-color;
|
||||
}
|
||||
|
||||
i {
|
||||
padding-right: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 1034px;
|
||||
border-radius: 4px;
|
||||
|
||||
.info {
|
||||
background: #ffffff;
|
||||
border-radius: 4px;
|
||||
|
||||
.name {
|
||||
width: 250px;
|
||||
height: 36px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
background: #eef2f8;
|
||||
line-height: 48px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #165dff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
background: #eef2f8;
|
||||
height: 154px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
> aside {
|
||||
width: 994px;
|
||||
height: 124px;
|
||||
background: #ffffff;
|
||||
|
||||
> div:first-child {
|
||||
height: 36px;
|
||||
background: #98bdf7;
|
||||
line-height: 36px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #232b40;
|
||||
}
|
||||
}
|
||||
|
||||
.li {
|
||||
display: flex;
|
||||
|
||||
> div {
|
||||
width: 50%;
|
||||
padding: 16px;
|
||||
color: #464f66;
|
||||
|
||||
span:first-child {
|
||||
color: #9096a3;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
> div:first-child {
|
||||
border-right: 1px solid #e3effc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
margin-top: 10px;
|
||||
|
||||
.head {
|
||||
height: 72px;
|
||||
background: #ffffff;
|
||||
border-radius: 4px 4px 0 0;
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
div {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #464f66;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
border-radius: 0 0 4px 4px;
|
||||
padding: 0 20px;
|
||||
|
||||
> aside {
|
||||
background: #ffffff;
|
||||
|
||||
> div:first-child {
|
||||
height: 36px;
|
||||
background: #e3effc;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
color: #232b40;
|
||||
padding: 0 20px;
|
||||
|
||||
div {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.li {
|
||||
display: flex;
|
||||
border: 1px solid #ebf3ff;
|
||||
border-top: 0;
|
||||
i {
|
||||
font-size: 34px;
|
||||
color: #a0a4f7;
|
||||
padding: 16px 50px 16px 16px;
|
||||
}
|
||||
|
||||
> div {
|
||||
padding: 16px 80px 16px 16px;
|
||||
color: #464f66;
|
||||
|
||||
span:first-child {
|
||||
color: #9096a3;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,414 @@
|
||||
import styles from './index.less';
|
||||
import {
|
||||
Select,
|
||||
Input,
|
||||
Button,
|
||||
Row,
|
||||
Modal,
|
||||
Form,
|
||||
message,
|
||||
Empty,
|
||||
Spin,
|
||||
} from 'antd';
|
||||
import Fetch from '@/utils/fetch';
|
||||
import { useEffect, useState, FC, useRef } from 'react';
|
||||
import { Link } from 'umi';
|
||||
import { downLoadLink } from '@/utils/download';
|
||||
import url from '@/utils/url';
|
||||
|
||||
interface PageProps {}
|
||||
|
||||
const Page: FC<PageProps> = () => {
|
||||
const [facilityList, setFacilityList] = useState<any[]>([]);
|
||||
const [localList, setLocalList] = useState<any[]>([]);
|
||||
const [firmList, setFirmList] = useState<any[]>([]);
|
||||
const [visible, setVisible] = useState<any>(false);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [form] = Form.useForm();
|
||||
const editId = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
getData('1');
|
||||
getData('2');
|
||||
getFirmList();
|
||||
}, []);
|
||||
|
||||
const getData = async (type: string) => {
|
||||
setLoading(true);
|
||||
const res = await Fetch(
|
||||
`/openi/${type === '1' ? 'dataCenter' : 'localManager'}/page`,
|
||||
{
|
||||
method: 'get',
|
||||
params: {
|
||||
type,
|
||||
pageSize: 1000000,
|
||||
pageNumber: 1,
|
||||
},
|
||||
},
|
||||
);
|
||||
if (res.result === 'success') {
|
||||
const data = res?.data?.[0];
|
||||
if (type === '1') {
|
||||
setFacilityList(data.list || []);
|
||||
} else {
|
||||
setLocalList(data.list || []);
|
||||
}
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const getFirmList = async () => {
|
||||
const res = await Fetch('/openi/producer/list');
|
||||
if (res.result === 'success') {
|
||||
const data = res?.data?.[0];
|
||||
setFirmList(data);
|
||||
}
|
||||
};
|
||||
|
||||
const handleFinish = async (v: any) => {
|
||||
const res = await Fetch(
|
||||
`/openi/${visible === '1' ? 'dataCenter' : 'localManager'}/editOrAdd`,
|
||||
{
|
||||
method: 'post',
|
||||
data: {
|
||||
...v,
|
||||
type: visible,
|
||||
id: editId.current,
|
||||
},
|
||||
},
|
||||
);
|
||||
if (res.result === 'success') {
|
||||
getData(visible);
|
||||
setVisible(false);
|
||||
}
|
||||
};
|
||||
|
||||
const addList = (type: string) => {
|
||||
setVisible(type);
|
||||
};
|
||||
|
||||
const deleteList = (type: string, id: any) => {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
content: '确认删除吗?',
|
||||
onOk: async () => {
|
||||
const res = await Fetch(
|
||||
`/openi/${type === '1' ? 'dataCenter' : 'localManager'}/delete/${id}`,
|
||||
{
|
||||
method: 'post',
|
||||
},
|
||||
);
|
||||
if (res.result === 'success') {
|
||||
getData(type);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const editList = (type: string, param: any) => {
|
||||
form.setFieldsValue({ ...param });
|
||||
editId.current = param.id;
|
||||
setVisible(type);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<div className={styles.left}>
|
||||
<Link to={'/equipment/dataCenter'} target="_blank">
|
||||
<i className="iconfont icon-shuju" />
|
||||
数据中心
|
||||
</Link>
|
||||
<Link to={'/equipment/localManager'} target="_blank">
|
||||
<i className="iconfont icon-jiedian" />
|
||||
管理节点
|
||||
</Link>
|
||||
</div>
|
||||
<div className={styles.right}>
|
||||
<div className={styles.info}>
|
||||
<div className={styles.name}>设备管理</div>
|
||||
<div className={styles.wrap}>
|
||||
<aside>
|
||||
<div>数据中心基本信息</div>
|
||||
<div className={styles.li}>
|
||||
<div>
|
||||
<p>
|
||||
<span>数据中心编号</span>
|
||||
<span>22</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>数据中心名称</span>
|
||||
<span>未定义数据中心名称</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<span>所属单位</span>
|
||||
<span>未定义所属单位</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>管理设备编号</span>
|
||||
<span>NO.88888888888</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
<Spin spinning={loading}>
|
||||
<div className={styles.list}>
|
||||
<div className={styles.head}>
|
||||
<div>数据中心设备列表</div>
|
||||
<Button onClick={() => addList('1')} type="primary" ghost>
|
||||
新增数据中心设备
|
||||
</Button>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
{!facilityList.length && <Empty style={{ margin: '20px 0' }} />}
|
||||
{!!facilityList.length &&
|
||||
facilityList.map((e: any, i: number) => {
|
||||
return (
|
||||
<aside key={i}>
|
||||
<div>
|
||||
<span>{e.name}</span>
|
||||
<div style={{ visibility: 'hidden' }}>
|
||||
<i className="iconfont icon-mimaruanjianjiami mr5" />
|
||||
<span>收起</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.li}>
|
||||
<i className="iconfont icon-fuwuqi"></i>
|
||||
<div>
|
||||
<p>
|
||||
<span>数据中心编号</span>
|
||||
<span>{e.physicsNum}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>数据中心名称</span>
|
||||
<span>{e.number}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<span>所属单位</span>
|
||||
<span>{e.managerNum}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>管理设备编号</span>
|
||||
<span>{e.producerId}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Row justify="end" className="mt10 mb20">
|
||||
<Button
|
||||
onClick={() => editList('1', e)}
|
||||
type="primary"
|
||||
ghost
|
||||
>
|
||||
修改设备
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
downLoadLink(
|
||||
url + `/openi/dataCenter/resourceExport/${e.id}`,
|
||||
)
|
||||
}
|
||||
className="ml10"
|
||||
type="primary"
|
||||
ghost
|
||||
>
|
||||
导出初装资源
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => deleteList('1', e.id)}
|
||||
className="ml10"
|
||||
type="primary"
|
||||
danger
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Row>
|
||||
</aside>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.list}>
|
||||
<div className={styles.head}>
|
||||
<div>数据管理终端列表</div>
|
||||
<Button onClick={() => addList('2')} type="primary" ghost>
|
||||
新增数据管理终端
|
||||
</Button>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
{!localList.length && <Empty style={{ margin: '20px 0' }} />}
|
||||
{!!localList.length &&
|
||||
localList.map((e: any, i: number) => {
|
||||
return (
|
||||
<aside key={i}>
|
||||
<div>
|
||||
<span>{e.name}</span>
|
||||
<div style={{ visibility: 'hidden' }}>
|
||||
<i className="iconfont icon-mimaruanjianjiami mr5" />
|
||||
<span>收起</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.li}>
|
||||
<i className="iconfont icon-zhongduan"></i>
|
||||
<div>
|
||||
<p>
|
||||
<span>数据中心编号</span>
|
||||
<span>{e.physicsNum}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>数据中心名称</span>
|
||||
<span>{e.number}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<span>所属单位</span>
|
||||
<span>{e.managerNum}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>管理设备编号</span>
|
||||
<span>{e.producerId}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Row justify="end" className="mt10 mb20">
|
||||
<Button
|
||||
onClick={() => editList('2', e)}
|
||||
type="primary"
|
||||
ghost
|
||||
>
|
||||
修改设备
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
downLoadLink(
|
||||
url +
|
||||
`/openi/localManager/resourceExport/${e.id}`,
|
||||
)
|
||||
}
|
||||
className="ml10"
|
||||
type="primary"
|
||||
ghost
|
||||
>
|
||||
导出初装资源
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => deleteList('2', e.id)}
|
||||
className="ml10"
|
||||
type="primary"
|
||||
danger
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Row>
|
||||
</aside>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<Modal
|
||||
centered
|
||||
title="新增设备"
|
||||
visible={visible}
|
||||
afterClose={() => {
|
||||
form.resetFields();
|
||||
editId.current = null;
|
||||
}}
|
||||
okText="保存"
|
||||
cancelText="取消"
|
||||
onOk={() => {
|
||||
form.submit();
|
||||
}}
|
||||
onCancel={() => {
|
||||
setVisible(false);
|
||||
}}
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
layout="horizontal"
|
||||
colon={false}
|
||||
onFinish={handleFinish}
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
>
|
||||
<Form.Item
|
||||
label="名称"
|
||||
name="name"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: `请输入名称`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="物理标识"
|
||||
name="physicsNum"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: `请输入物理标识`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="铭牌编码"
|
||||
name="number"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: `请输入铭牌编码`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="管理标识"
|
||||
name="managerNum"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: `请输入管理标识`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="生产厂商"
|
||||
name="producerId"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: `请输入生产厂商`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{firmList?.map((e) => (
|
||||
<Select.Option value={e.id} key={e.id}>
|
||||
{e.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default Page;
|
Loading…
Reference in new issue