创建路径

dev
陈博文 3 years ago
parent 5c4c86429b
commit 8f71dd2f76

@ -53,14 +53,16 @@ export default defineConfig({
path: '/equipment/index',
component: '@/pages/Equipment/List/Index',
},
// {
// path: '/basic/device',
// component: '@/pages/Basic/List/Device',
// },
// {
// path: '/basic/certificate',
// component: '@/pages/Basic/List/Certificate',
// },
],
},
{
path: '/encrypt',
component: '@/pages/Encrypt/Header',
routes: [
{
path: '/encrypt/index',
component: '@/pages/Encrypt/List/Index',
},
],
},
],

@ -5,7 +5,7 @@ const Header = ({ ...props }) => {
return (
<Fragment>
<div className={styles.head}>
<i className="iconfont icon-a-dashujushujujiegouguanxiguanxifenxigongtonglianxirenzuzhi mr10" />
<i className="iconfont icon-a-dashujushujujiegouguanxiguanxifenxigongtonglianxirenzuzhi1 mr10" />
</div>
<div className={styles.content}>{props.children}</div>

@ -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,36 @@
import styles from './index.less';
import { Fragment } from 'react';
const Header = ({ ...props }) => {
const menu = [
{
id: 1,
name: '基础设施开通',
},
// {
// id: 2,
// name: '基础设施开通2',
// }
];
return (
<Fragment>
<div className={styles.head}>
<section>
<i className="iconfont icon-a-dashujushujujiegouguanxiguanxifenxigongtonglianxirenzuzhi1 mr10 font26" />
<span></span>
<ul>
{menu.map((e: any) => (
<li key={e.id}>
<span>{e.name}</span>
<b />
</li>
))}
</ul>
<div className="font14">V0.4.0.0</div>
</section>
</div>
<div className={styles.content}>{props.children}</div>
</Fragment>
);
};
export default Header;

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

@ -16,7 +16,7 @@ const Header = ({ ...props }) => {
<Fragment>
<div className={styles.head}>
<section>
<i className="iconfont icon-a-dashujushujujiegouguanxiguanxifenxigongtonglianxirenzuzhi mr10 font26" />
<i className="iconfont icon-a-dashujushujujiegouguanxiguanxifenxigongtonglianxirenzuzhi1 mr10 font26" />
<span></span>
<ul>
{menu.map((e: any) => (

@ -532,7 +532,7 @@
}
.font26 {
font-size: 26px;
font-size: 26px !important;
}
.font28 {

Loading…
Cancel
Save