型号管理完成

dev
陈博文 3 years ago
parent 5af575607d
commit cae9ef9fee

@ -84,6 +84,10 @@ export default defineConfig({
path: '/manager/basicManager/register',
component: '@/pages/Manager/BasicManager/List/Register',
},
{
path: '/manager/basicManager/model',
component: '@/pages/Manager/BasicManager/List/Model',
},
{
path: '/manager/basicManager/manufacturer',
component: '@/pages/Manager/BasicManager/List/Manufacturer',

@ -57,7 +57,6 @@ const Page: FC<PageProps> = () => {
}, []);
const getFacilityData = async (record: any) => {
setLoading(true);
const res = await Fetch('/openi/device/page', {
method: 'get',
params: {

@ -218,7 +218,7 @@ const Page: FC<PageProps> = () => {
/>
<Modal
centered
title="厂商信息注册"
title={`${editId.current ? '编辑' : '添加'}厂商信息`}
visible={visible}
okText="保存"
width={924}

@ -0,0 +1,41 @@
.page {
.title {
height: 36px;
background: #e3effc;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
font-weight: 500;
color: #464f66;
i {
cursor: pointer;
}
}
.btn {
padding: 13px 20px;
i {
font-size: 14px;
margin-right: 5px;
}
}
.action {
cursor: pointer;
color: #6b758b;
padding: 0 10px;
&:hover {
color: @primary-color;
}
}
}
.li {
div[class~='ant-form-item-control'] {
width: 388px;
}
}

@ -0,0 +1,382 @@
import styles from './index.less';
import {
Button,
Select,
Row,
Modal,
Form,
message,
Empty,
Table,
InputNumber,
Input,
Col,
} from 'antd';
import Fetch from '@/utils/fetch';
import { useEffect, useState, FC, useRef, Fragment } from 'react';
import { downLoadLink } from '@/utils/download';
import url from '@/utils/url';
import { ColumnsType } from 'antd/lib/table';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
interface PageProps {}
const Page: FC<PageProps> = () => {
const [data, setData] = useState<any>([]);
const [firmList, setFirmList] = useState<any[]>([]);
const [loading, setLoading] = useState<boolean>(true);
const [total, setTotal] = useState<number>(0);
const [value, setValue] = useState<string>('');
const [visible, setVisible] = useState<boolean>(false);
const [form] = Form.useForm();
const [params, setParams] = useState<any>({
pageNumber: 1,
pageSize: 20,
keywords: '',
});
const editId = useRef(null);
useEffect(() => {
getData(params);
getFirmList();
}, []);
const getData = async (record: any) => {
setLoading(true);
const res = await Fetch('/openi/deviceType/page', {
method: 'get',
params: record,
});
if (res.result === 'success') {
setData(res?.data?.[0]?.list);
setTotal(res?.data?.[0]?.total);
}
setLoading(false);
};
const getFirmList = async () => {
const res = await Fetch('/openi/producer/list');
if (res.result === 'success') {
const data = res?.data?.[0];
setFirmList(data);
}
};
const columns: ColumnsType<any> = [
{
title: '序号',
align: 'center',
dataIndex: 'index',
render: (text: string, record: any, index: number) =>
params.pageSize * (params.pageNumber - 1) + index + 1,
},
{
title: '装备代号',
dataIndex: 'typeNumber',
},
{
title: '装备名称',
dataIndex: 'name',
},
{
title: '工作模式',
dataIndex: 'pattern',
},
{
title: '管理层级',
dataIndex: 'managementLevel',
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 110,
render: (v: any, r: any) => (
<span>
<i
onClick={() => handleEdit(r)}
title="修改"
className={'iconfont icon-xiugaikucundixian ' + styles.action}
/>
<i
onClick={() => handleDelete(r.id)}
title="删除"
className={'iconfont icon-shanchuzhuangbeixinghao ' + styles.action}
/>
</span>
),
},
];
const handleChangePage = (param: any) => {
params.pageNumber = param?.current;
params.pageSize = param?.pageSize;
setParams({ ...params });
getData(params);
};
const handleFinish = async (v: any) => {
const res = await Fetch(`/openi/deviceType/editOrAdd`, {
method: 'post',
data: {
...v,
id: editId.current,
},
});
if (res.result === 'success') {
params.pageNumber = editId.current ? params.pageNumber : 1;
setParams({ ...params });
getData(params);
setVisible(false);
}
};
const handleEdit = (param: any) => {
form.setFieldsValue({
...param,
producerIdList: param?.producerList?.map((e: any) => e.id),
});
editId.current = param.id;
setVisible(true);
};
const handleAdd = () => {
form.setFieldsValue({ producerIdList: [''] });
setVisible(true);
};
const handleDelete = (id: any) => {
Modal.confirm({
title: '提示',
okText: '确认',
cancelText: '取消',
content: '确认删除吗?',
onOk: async () => {
const res = await Fetch(`/openi/deviceType/delete/${id}`, {
method: 'post',
});
if (res.result === 'success') {
const page =
1 === data.length && params.pageNumber > 1
? params.pageNumber - 1
: params.pageNumber;
params.pageNumber = page;
setParams({ ...params });
getData(params);
}
},
});
};
return (
<div className={styles.page}>
<div className={styles.title}>
<span></span>
<i
onClick={() => getData(params)}
className="iconfont icon-a-shuaxin2"
/>
</div>
<Row justify="end" className={styles.btn}>
<Input.Search
placeholder="搜索装备代号/装备名称"
value={value}
onChange={(k) => setValue(k.target.value)}
onSearch={(e) => {
params.keywords = e;
params.pageNumber = 1;
setParams({ ...params });
getData(params);
}}
style={{ width: 400 }}
/>
<Button
onClick={handleAdd}
style={{ marginLeft: 'auto' }}
icon={<i className="iconfont icon-tianjia" />}
>
</Button>
</Row>
<Table
dataSource={data}
bordered={false}
rowKey="id"
columns={columns}
// scroll={{ x: 1800 }}
loading={loading}
className="pr20 pl20"
onChange={handleChangePage}
pagination={{
pageSize: params.per_page,
total: total,
current: params.page,
showQuickJumper: true,
hideOnSinglePage: true,
position: ['bottomCenter'],
showTotal: (total) => (
<span className="mr10">
<span>{total}</span>
</span>
),
}}
/>
<Modal
centered
title={`${editId.current ? '编辑' : '新建'}设备型号`}
visible={visible}
okText="保存"
width={924}
afterClose={() => {
form.resetFields();
editId.current = null;
}}
cancelText="取消"
onOk={() => {
form.submit();
}}
onCancel={() => {
setVisible(false);
}}
>
<Form
form={form}
colon={false}
layout="horizontal"
onFinish={handleFinish}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
style={{
maxHeight: 500,
overflow: 'auto',
}}
>
<Row align="middle">
<Col span={12}>
<Form.Item
label="装备名称"
name="name"
rules={[
{
required: true,
message: `请输入装备名称`,
},
]}
>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
label="装备代号"
name="typeNumber"
rules={[
{
required: true,
message: `请输入装备代号`,
},
]}
>
<Input />
</Form.Item>
</Col>
</Row>
<Row align="middle">
<Col span={12}>
<Form.Item
label="工作模式"
name="pattern"
rules={[
{
required: true,
message: `请输入工作模式`,
},
]}
>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
label="装备密级"
name="secretLevel"
rules={[
{
required: true,
message: `请输入装备密级`,
},
]}
>
<Input />
</Form.Item>
</Col>
</Row>
<Row align="middle">
<Col span={12}>
<Form.Item
label="管理层级"
name="managementLevel"
rules={[
{
required: true,
message: `请输入管理层级`,
},
]}
>
<Input />
</Form.Item>
</Col>
</Row>
<Form.List name="producerIdList">
{(fields, { add, remove }, { errors }) => (
<>
{fields.map(({ key, name, ...restField }, index) => (
<Row align="middle" key={key}>
<Form.Item
className={styles.li}
{...restField}
label="厂商"
name={[name]}
rules={[
{
required: true,
message: '请输入厂商',
},
]}
>
<Select>
{firmList?.map((e) => (
<Select.Option value={e.id} key={e.id}>
{e.name}
</Select.Option>
))}
</Select>
</Form.Item>
{fields.length > 1 ? (
<MinusCircleOutlined
style={{ margin: '0px 0px 23px 10px' }}
onClick={() => remove(name)}
/>
) : null}
</Row>
))}
<Row align="middle" justify="center">
<Button
type="dashed"
onClick={() => add()}
style={{ width: 400 }}
icon={<PlusOutlined />}
>
</Button>
</Row>
</>
)}
</Form.List>
</Form>
</Modal>
</div>
);
};
export default Page;

@ -13,7 +13,7 @@ const Header = ({ ...props }) => {
{
id: '/basicManager',
name: '基础设施管理',
url: '/manager/basicManager/manufacturer',
url: '/manager/basicManager/register',
},
];
return (

@ -54,6 +54,24 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe670;</span>
<div class="name">下载</div>
<div class="code-name">&amp;#xe670;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe66e;</span>
<div class="name">选择设备</div>
<div class="code-name">&amp;#xe66e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe66f;</span>
<div class="name">导入设备</div>
<div class="code-name">&amp;#xe66f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe716;</span>
<div class="name">导入数据</div>
@ -342,12 +360,12 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.eot?t=1660555520778'); /* IE9 */
src: url('iconfont.eot?t=1660555520778#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff2?t=1660555520778') format('woff2'),
url('iconfont.woff?t=1660555520778') format('woff'),
url('iconfont.ttf?t=1660555520778') format('truetype'),
url('iconfont.svg?t=1660555520778#iconfont') format('svg');
src: url('iconfont.eot?t=1660727403452'); /* IE9 */
src: url('iconfont.eot?t=1660727403452#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff2?t=1660727403452') format('woff2'),
url('iconfont.woff?t=1660727403452') format('woff'),
url('iconfont.ttf?t=1660727403452') format('truetype'),
url('iconfont.svg?t=1660727403452#iconfont') format('svg');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -373,6 +391,33 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-xiazai"></span>
<div class="name">
下载
</div>
<div class="code-name">.icon-xiazai
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-xuanzeshebei"></span>
<div class="name">
选择设备
</div>
<div class="code-name">.icon-xuanzeshebei
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-daorushebei"></span>
<div class="name">
导入设备
</div>
<div class="code-name">.icon-daorushebei
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-daorushuju2"></span>
<div class="name">
@ -805,6 +850,30 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xiazai"></use>
</svg>
<div class="name">下载</div>
<div class="code-name">#icon-xiazai</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xuanzeshebei"></use>
</svg>
<div class="name">选择设备</div>
<div class="code-name">#icon-xuanzeshebei</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daorushebei"></use>
</svg>
<div class="name">导入设备</div>
<div class="code-name">#icon-daorushebei</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daorushuju2"></use>

@ -1,11 +1,11 @@
@font-face {
font-family: "iconfont"; /* Project id 3579477 */
src: url('iconfont.eot?t=1660555520778'); /* IE9 */
src: url('iconfont.eot?t=1660555520778#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff2?t=1660555520778') format('woff2'),
url('iconfont.woff?t=1660555520778') format('woff'),
url('iconfont.ttf?t=1660555520778') format('truetype'),
url('iconfont.svg?t=1660555520778#iconfont') format('svg');
src: url('iconfont.eot?t=1660727403452'); /* IE9 */
src: url('iconfont.eot?t=1660727403452#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff2?t=1660727403452') format('woff2'),
url('iconfont.woff?t=1660727403452') format('woff'),
url('iconfont.ttf?t=1660727403452') format('truetype'),
url('iconfont.svg?t=1660727403452#iconfont') format('svg');
}
.iconfont {
@ -16,6 +16,18 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-xiazai:before {
content: "\e670";
}
.icon-xuanzeshebei:before {
content: "\e66e";
}
.icon-daorushebei:before {
content: "\e66f";
}
.icon-daorushuju2:before {
content: "\e716";
}

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -5,6 +5,27 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "31306044",
"name": "下载",
"font_class": "xiazai",
"unicode": "e670",
"unicode_decimal": 58992
},
{
"icon_id": "31305208",
"name": "选择设备",
"font_class": "xuanzeshebei",
"unicode": "e66e",
"unicode_decimal": 58990
},
{
"icon_id": "31305209",
"name": "导入设备",
"font_class": "daorushebei",
"unicode": "e66f",
"unicode_decimal": 58991
},
{
"icon_id": "31258224",
"name": "导入数据",

@ -14,6 +14,12 @@
/>
<missing-glyph />
<glyph glyph-name="xiazai" unicode="&#58992;" d="M620.8 51.2c-6.4 0-12.8 0-19.2 6.4l-172.8 128 32 32 160-121.6 160 121.6 38.4-32-179.2-128c-6.4-6.4-12.8-6.4-19.2-6.4zM268.8 96H128c-51.2 0-96 44.8-96 96V768C32 819.2 76.8 864 128 864h576c51.2 0 96-44.8 96-96v-140.8h-64V768c0 19.2-12.8 32-32 32H128c-19.2 0-32-12.8-32-32v-576c0-19.2 12.8-32 32-32h140.8v-64zM896-96H320c-51.2 0-96 44.8-96 96V576c0 51.2 44.8 96 96 96h576c51.2 0 96-44.8 96-96v-576c0-51.2-44.8-96-96-96z m-576 704c-19.2 0-32-12.8-32-32v-576c0-19.2 12.8-32 32-32h576c19.2 0 32 12.8 32 32V576c0 19.2-12.8 32-32 32H320zM582.4 480h64v-403.2h-64z" horiz-adv-x="1024" />
<glyph glyph-name="xuanzeshebei" unicode="&#58990;" d="M279.272727 616.727273h279.272728v-93.090909H279.272727zM651.636364 616.727273h93.090909v-93.090909H651.636364zM651.636364 430.545455h93.090909v-93.09091H651.636364zM279.272727 430.545455h279.272728v-93.09091H279.272727zM763.345455-72.145455H130.327273c-46.545455 0-83.781818 37.236364-83.781818 74.472728V765.672727c0 46.545455 37.236364 83.781818 83.781818 83.781818h1238.109091c46.545455 0 74.472727-37.236364 74.472727-83.781818v-279.272727h-93.090909V756.363636h-1210.181818v-735.418181h623.709091v-93.09091zM1284.654545-81.454545c-9.309091 0-27.927273 9.309091-37.236363 18.618181L912.290909 356.072727c-18.618182 18.618182-18.618182 46.545455 0 65.163637 27.927273 18.618182 55.854545 9.309091 74.472727-9.309091l335.127273-418.909091c18.618182-18.618182 9.309091-46.545455-9.309091-65.163637-9.309091-9.309091-18.618182-9.309091-27.927273-9.30909zM949.527273 67.490909c-27.927273 0-46.545455 18.618182-46.545455 46.545455V384c0 9.309091 9.309091 27.927273 18.618182 37.236364 9.309091 9.309091 18.618182 9.309091 27.927273 9.309091l297.890909-55.854546c27.927273 0 46.545455-27.927273 37.236363-55.854545-9.309091-27.927273-27.927273-37.236364-55.854545-37.236364l-232.727273 46.545455v-214.109091c0-27.927273-27.927273-46.545455-46.545454-46.545455z" horiz-adv-x="1489" />
<glyph glyph-name="daorushebei" unicode="&#58991;" d="M850.707692 486.4H252.061538c-63.015385 0-118.153846 55.138462-118.153846 118.153846V777.846154C141.784615 840.861538 189.046154 896 252.061538 896h590.769231c63.015385 0 118.153846-55.138462 118.153846-118.153846v-173.292308c0-70.892308-47.261538-118.153846-110.276923-118.153846zM252.061538 817.230769c-15.753846 0-31.507692-15.753846-31.507692-39.384615v-173.292308c0-23.630769 15.753846-39.384615 31.507692-39.384615h590.769231c23.630769 0 39.384615 15.753846 39.384616 39.384615V777.846154c0 23.630769-15.753846 39.384615-31.507693 39.384615H252.061538zM519.876923 486.4h78.769231v-315.076923h-78.769231zM1008.246154 194.953846h-78.769231V313.107692H181.169231v-118.153846h-78.769231V391.876923h905.846154zM204.8-64.984615H70.892308c-39.384615 0-70.892308 31.507692-70.892308 70.892307V131.938462c0 39.384615 31.507692 70.892308 70.892308 70.892307h133.907692c39.384615 0 70.892308-31.507692 70.892308-70.892307v-133.907693c0-31.507692-31.507692-63.015385-70.892308-63.015384z m-126.030769 78.76923h118.153846V124.061538H78.769231v-110.276923zM622.276923-64.984615H480.492308c-39.384615 0-70.892308 31.507692-70.892308 70.892307V131.938462c0 39.384615 31.507692 70.892308 70.892308 70.892307h133.907692c39.384615 0 70.892308-31.507692 70.892308-70.892307v-133.907693c7.876923-31.507692-31.507692-63.015385-63.015385-63.015384z m-133.907692 78.76923h118.153846V124.061538H488.369231v-110.276923zM1031.876923-64.984615h-133.907692c-39.384615 0-70.892308 31.507692-70.892308 70.892307V131.938462c0 39.384615 31.507692 70.892308 70.892308 70.892307h133.907692c39.384615 0 70.892308-31.507692 70.892308-70.892307v-133.907693c0-31.507692-31.507692-63.015385-70.892308-63.015384z m-126.030769 78.76923H1024V124.061538h-118.153846v-110.276923zM346.584615 691.2m-78.76923 0a78.769231 78.769231 0 1 1 157.538461 0 78.769231 78.769231 0 1 1-157.538461 0Z" horiz-adv-x="1102" />
<glyph glyph-name="daorushuju2" unicode="&#59158;" d="M526.848-54.784H102.4c-14.848 0-29.184 14.848-29.184 36.352V808.448c0 22.016 14.848 36.352 29.184 36.352h834.048c14.848 0 29.184-14.848 29.184-36.352v-467.968c0-14.848-14.848-29.184-29.184-29.184s-29.184 14.848-29.184 36.352V778.752H131.584v-768h394.752c14.848 0 29.184-14.848 29.184-36.352 0.512-14.848-7.168-29.184-28.672-29.184zM680.448-47.616c-7.168 0-14.848 7.168-22.016 7.168l-131.584 153.6c-14.848 14.848-14.848 36.352 0 51.2l131.584 153.6c14.848 14.848 29.184 14.848 44.032 0 14.848-14.848 14.848-36.352 0-51.2l-109.568-124.416 109.568-124.416c14.848-14.848 14.848-36.352 0-51.2-0.512-7.168-7.68-14.336-22.016-14.336zM936.448 105.984h-256c-14.848 0-29.184 14.848-29.184 36.352 0 22.016 14.848 36.352 29.184 36.352h256c14.848 0 29.184-14.848 29.184-36.352 0-21.504-14.848-36.352-29.184-36.352zM745.984 588.8H300.032c-22.016 0-36.352 14.848-36.352 29.184s14.848 29.184 29.184 29.184h445.952c14.848 0 29.184-14.848 29.184-29.184s-7.168-29.184-22.016-29.184z m0-189.952H300.032c-14.848 0-22.016 7.168-29.184 14.848-7.168 7.168-7.168 22.016 0 29.184 7.168 14.848 14.848 14.848 29.184 14.848h445.952c14.848 0 29.184-14.848 29.184-29.184 0-15.36-14.336-29.696-29.184-29.696z" horiz-adv-x="1024" />
<glyph glyph-name="weitongguo" unicode="&#58988;" d="M721.92 552.96l-153.6-153.6 153.6-153.6-56.32-56.32-153.6 153.6-153.6-153.6-56.32 56.32 153.6 153.6-153.6 153.6 56.32 51.2 153.6-153.6 153.6 153.6 56.32-51.2zM512-128C230.4-128 0 102.4 0 384S230.4 896 512 896s512-230.4 512-512-230.4-512-512-512z m0 947.2c-240.64 0-435.2-194.56-435.2-435.2s194.56-435.2 435.2-435.2 435.2 194.56 435.2 435.2-194.56 435.2-435.2 435.2z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save