评标场所、区域、设备代码完善
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
|
import { ForkOutlined } from "@ant-design/icons";
|
||||||
import { Button, Form, Input, message, Modal, Select, Spin, Row, Col } from "antd"
|
import { Button, Form, Input, message, Modal, Select, Spin, Row, Col } from "antd"
|
||||||
import Password from "antd/lib/input/Password";
|
import Password from "antd/lib/input/Password";
|
||||||
import { fromPairs, values } from "lodash";
|
import { fromPairs, values } from "lodash";
|
||||||
import React, { useEffect, useState } from "react"
|
import React, { useEffect, useRef, useState } from "react"
|
||||||
import SelectDeviceModal from "./SelectDeviceModal";
|
import SelectDeviceModal from "./SelectDeviceModal";
|
||||||
import { getDeviceById, saveDevice } from "./service";
|
import { getDeviceById, saveDevice } from "./service";
|
||||||
|
|
||||||
@ -65,9 +66,12 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
|
|
||||||
const [selectDeviceStatus, setSelectDeviceStatus] = useState<boolean>(false);
|
const [selectDeviceStatus, setSelectDeviceStatus] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const deviceRelData = useRef<DeviceRel>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
//清除form中数据
|
||||||
|
form.resetFields();
|
||||||
Int();
|
Int();
|
||||||
form.resetFields();//清除form中数据
|
|
||||||
}, [type, deviceId]);
|
}, [type, deviceId]);
|
||||||
const Int = () => {
|
const Int = () => {
|
||||||
setSping(true);
|
setSping(true);
|
||||||
@ -81,10 +85,19 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
"areaId" : deviceRel.areaId,
|
"areaId" : deviceRel.areaId,
|
||||||
"areaName" : deviceRel.areaName,
|
"areaName" : deviceRel.areaName,
|
||||||
})
|
})
|
||||||
|
deviceRelData.current = deviceRel;
|
||||||
setEditInformation(false);//可编辑
|
setEditInformation(false);//可编辑
|
||||||
} else if (type == "edit") {//=========================================================修改
|
} else if (type == "edit") {//=========================================================修改
|
||||||
getDeviceById(deviceId).then(res => {
|
getDeviceById(deviceId).then(res => {
|
||||||
setFilesData(res.data);
|
setFilesData(res.data);
|
||||||
|
deviceRelData.current = {
|
||||||
|
placeId: res.data.placeId,
|
||||||
|
placeName: res.data.placeName,
|
||||||
|
areaId: res.data.areaId,
|
||||||
|
areaName: res.data.areaName,
|
||||||
|
platformId: res.data.platform.id,
|
||||||
|
platformName: res.data.platform.platformName,
|
||||||
|
};
|
||||||
setSping(false);
|
setSping(false);
|
||||||
setEditInformation(false);//可编辑
|
setEditInformation(false);//可编辑
|
||||||
});
|
});
|
||||||
@ -92,6 +105,14 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
getDeviceById(deviceId).then(res => {
|
getDeviceById(deviceId).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
setFilesData(res.data);
|
setFilesData(res.data);
|
||||||
|
deviceRelData.current = {
|
||||||
|
placeId: res.data.placeId,
|
||||||
|
placeName: res.data.placeName,
|
||||||
|
areaId: res.data.areaId,
|
||||||
|
areaName: res.data.areaName,
|
||||||
|
platformId: res.data.platform.id,
|
||||||
|
platformName: res.data.platform.platformName,
|
||||||
|
};
|
||||||
setSping(false);
|
setSping(false);
|
||||||
setEditInformation(true)
|
setEditInformation(true)
|
||||||
}
|
}
|
||||||
@ -162,8 +183,16 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
setSelectDeviceStatus(true);
|
setSelectDeviceStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const returnEvalData = (value:any) => {
|
const SelectDeviceData = (value:any) => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
deviceAbility: value.deviceAbility,
|
||||||
|
deviceCode: value.deviceCode,
|
||||||
|
deviceName: value.deviceName,
|
||||||
|
devicePlatform: value.devicePlatform,
|
||||||
|
deviceProtocol: value.deviceProtocol,
|
||||||
|
deviceType: value.deviceType,
|
||||||
|
deviceVender: value.deviceVender
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -198,19 +227,19 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
<Form.Item name="placeId" label="评标场所id" hidden>
|
<Form.Item name="placeId" label="评标场所id" hidden>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="areadId" label="评标区域id" hidden>
|
<Form.Item name="areaId" label="评标区域id" hidden>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="placeName" label="评标场所" rules={[{ required: true }]}>
|
<Form.Item name="placeName" label="评标场所" rules={[{ required: true }]}>
|
||||||
<Input placeholder="评标场所" disabled={true} maxLength={50} />
|
<Input placeholder="评标场所" disabled={true}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="areaName" label="评标区域" rules={[{ required: true }]}>
|
<Form.Item name="areaName" label="评标区域" rules={[{ required: true }]}>
|
||||||
<Input placeholder="评标区域" disabled={true} maxLength={50} />
|
<Input placeholder="评标区域" disabled={true}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="platformName" label="管理平台" rules={[{ required: true }]}>
|
<Form.Item name="platformName" label="管理平台" rules={[{ required: true }]}>
|
||||||
<Input placeholder="管理平台" disabled={true} maxLength={50} />
|
<Input placeholder="管理平台" disabled={true}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceType" label="设备类型" rules={[{ required: true }]}>
|
<Form.Item name="deviceType" label="设备类型" rules={[{ required: true, message: '请选择设备类型' }]}>
|
||||||
<Select
|
<Select
|
||||||
placeholder="请选择设备类型"
|
placeholder="请选择设备类型"
|
||||||
allowClear
|
allowClear
|
||||||
@ -219,8 +248,8 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="设备名称">
|
<Form.Item label="设备名称">
|
||||||
<Form.Item name="deviceName" noStyle rules={[{ required: true }]}>
|
<Form.Item name="deviceName" noStyle rules={[{ required: true, message:'请填写设备名称/选择设备' }]}>
|
||||||
<Input style={{ width: 'calc(85% - 8px)' }} placeholder="设备名称" maxLength={50} />
|
<Input style={{ width: 'calc(85% - 8px)' }} placeholder="请填写设备名称/选择设备" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button style= {{width: 'calc(15%)', margin: '0 0 0 8px'}} type='primary' onClick={() => selectDevice()}>选择</Button>
|
<Button style= {{width: 'calc(15%)', margin: '0 0 0 8px'}} type='primary' onClick={() => selectDevice()}>选择</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -234,10 +263,10 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item> */}
|
</Form.Item> */}
|
||||||
<Form.Item name="deviceCode" label="设备标识">
|
<Form.Item name="deviceCode" label="设备标识">
|
||||||
<Input placeholder="请填写设备标识" maxLength={50} />
|
<Input placeholder="请填写设备标识/选择设备" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceAbility" label="设备能力">
|
<Form.Item name="deviceAbility" label="设备能力">
|
||||||
<Input placeholder="请填写设备能力" maxLength={50} />
|
<Input placeholder="请填写设备能力/选择设备" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceVender" label="设备厂家">
|
<Form.Item name="deviceVender" label="设备厂家">
|
||||||
<Select
|
<Select
|
||||||
@ -248,13 +277,13 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceProtocol" label="设备接入协议">
|
<Form.Item name="deviceProtocol" label="设备接入协议">
|
||||||
<Input placeholder="请填写设备接入协议" maxLength={50} />
|
<Input placeholder="请填写设备接入协议" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceManagementIp" label="网络IP">
|
<Form.Item name="deviceManagementIp" label="网络IP">
|
||||||
<Input placeholder="请填写网络IP" maxLength={50} />
|
<Input placeholder="请填写网络IP" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="deviceManagementPort" label="端口">
|
<Form.Item name="deviceManagementPort" label="端口">
|
||||||
<Input placeholder="请填写端口" maxLength={50} />
|
<Input placeholder="请填写端口" maxLength={200} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/* <Form.Item name="deviceManagementLogin" label="管理平台登录账号" >
|
{/* <Form.Item name="deviceManagementLogin" label="管理平台登录账号" >
|
||||||
<Input placeholder="管理平台登录账号" maxLength={50} />
|
<Input placeholder="管理平台登录账号" maxLength={50} />
|
||||||
@ -282,7 +311,7 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
|||||||
</Form>
|
</Form>
|
||||||
</Spin>
|
</Spin>
|
||||||
</Modal>
|
</Modal>
|
||||||
<SelectDeviceModal modalVisible={selectDeviceStatus} onCancel={() => setSelectDeviceStatus(false)} onSubmit = {(value: any) => returnEvalData(value)} values ={{deviceId}}> </SelectDeviceModal>
|
<SelectDeviceModal modalVisible={selectDeviceStatus} onCancel={() => setSelectDeviceStatus(false)} onSubmit = {(value: any) => SelectDeviceData(value)} values ={deviceRelData?.current}> </SelectDeviceModal>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { Form, Input, message, Modal, Spin } from 'antd';
|
import { Button, Form, Input, message, Modal, Spin } from 'antd';
|
||||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||||
import { getExternDevicesAboveArea } from './service';
|
import { getExternDevicesAboveArea } from './service';
|
||||||
|
|
||||||
@ -13,11 +13,10 @@ interface SelectDeviceProps {
|
|||||||
const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
||||||
const { modalVisible, onCancel, onSubmit, values } = props;
|
const { modalVisible, onCancel, onSubmit, values } = props;
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [form] = Form.useForm();
|
|
||||||
//当前选择行areaId
|
//当前选择行areaId
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||||
//当前选择行数据
|
//当前选择行数据
|
||||||
const [selectedRecord, setSelectedRecord] = useState<any>();
|
const selectedRecord = useRef<any>();
|
||||||
//loading
|
//loading
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
@ -30,6 +29,7 @@ const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
|||||||
title: '设备编码',
|
title: '设备编码',
|
||||||
dataIndex: 'deviceCode',
|
dataIndex: 'deviceCode',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备名称',
|
title: '设备名称',
|
||||||
@ -44,26 +44,33 @@ const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
|||||||
message.info("请选择设备");
|
message.info("请选择设备");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
form.validateFields().then(value => {
|
onSubmit(selectedRecord?.current);
|
||||||
value["areaId"] = selectedRecord.id;
|
onCancel();
|
||||||
value["placeId"] = selectedRecord.placeId;
|
|
||||||
value["areaAddress"] = selectedRecord.areaAddress;
|
|
||||||
value["areaName"] = selectedRecord.areaName;
|
|
||||||
value["contactName"] = selectedRecord.contactName;
|
|
||||||
value["contactTel"] = selectedRecord.contactTel;
|
|
||||||
value["areaNumber"] = selectedRecord.areaNumber;
|
|
||||||
onSubmit(value);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedRowKeys([]);
|
setSelectedRowKeys([]);
|
||||||
setSelectedRecord(null);
|
selectedRecord.current = null;
|
||||||
}, [values])
|
}, [values])
|
||||||
|
|
||||||
useEffect(() => {
|
const queryDeviceList = async () => {
|
||||||
|
setLoading(true);
|
||||||
}, [selectedRowKeys])
|
return await getExternDevicesAboveArea({platformId: values?.platformId, areaId: values?.areaId}).then(res => {
|
||||||
|
if (res?.code == 200) {
|
||||||
|
return {
|
||||||
|
data: res?.data,
|
||||||
|
success: res?.success
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
success: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).finally(()=>{
|
||||||
|
setLoading(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@ -79,6 +86,22 @@ const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
|||||||
bodyStyle={{ overflowY: 'auto', }}
|
bodyStyle={{ overflowY: 'auto', }}
|
||||||
className="confirm table-no-alert"
|
className="confirm table-no-alert"
|
||||||
centered
|
centered
|
||||||
|
footer = {[
|
||||||
|
<Button key="cancel" onClick={()=>{onCancel();}}>
|
||||||
|
关闭
|
||||||
|
</Button>,
|
||||||
|
<Button key="submit" type="primary" loading={loading} onClick={()=>{onOk();}}>
|
||||||
|
确定
|
||||||
|
</Button>,
|
||||||
|
<Button
|
||||||
|
key="query"
|
||||||
|
type="primary"
|
||||||
|
loading={loading}
|
||||||
|
onClick={()=>{actionRef?.current?.reload();}}
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<ProTable<any>
|
<ProTable<any>
|
||||||
@ -86,68 +109,23 @@ const SelectDevice: React.FC<SelectDeviceProps> = (props) => {
|
|||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
bordered={false}
|
bordered={false}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
setLoading(true);
|
return queryDeviceList();
|
||||||
return await getExternDevicesAboveArea(params).then(res => {
|
|
||||||
if (res?.code == 200) {
|
|
||||||
return {
|
|
||||||
data: res?.data.records,
|
|
||||||
success: res?.success,
|
|
||||||
total: res?.data.total,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
data: [],
|
|
||||||
success: false,
|
|
||||||
total: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).finally(()=>{
|
|
||||||
setLoading(false);
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
rowKey="id"
|
|
||||||
search={{
|
|
||||||
labelWidth: 'auto',
|
|
||||||
}}
|
}}
|
||||||
|
rowKey="deviceCode"
|
||||||
|
search={false}
|
||||||
options={false}
|
options={false}
|
||||||
pagination={{
|
pagination={false}
|
||||||
size: "small",
|
|
||||||
defaultPageSize: 5,
|
|
||||||
showSizeChanger: false,
|
|
||||||
}}
|
|
||||||
rowSelection={{
|
rowSelection={{
|
||||||
type: "radio",
|
type: "radio",
|
||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
onChange: (selectedRowKeys, selectedRows) => {
|
||||||
setSelectedRowKeys(selectedRowKeys);
|
setSelectedRowKeys(selectedRowKeys);
|
||||||
setSelectedRecord(selectedRows[0]);
|
selectedRecord.current = selectedRows[0];
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
dateFormatter="string"
|
dateFormatter="string"
|
||||||
toolBarRender={false}
|
toolBarRender={false}
|
||||||
/>
|
/>
|
||||||
<Form
|
|
||||||
name="basic"
|
|
||||||
form={form}
|
|
||||||
labelCol={{ span: 8 }}
|
|
||||||
wrapperCol={{ span: 16 }}
|
|
||||||
preserve={false}
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
label="设备编码"
|
|
||||||
name="deviceCode"
|
|
||||||
hidden
|
|
||||||
>
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label="设备名称"
|
|
||||||
name="deviceName"
|
|
||||||
hidden
|
|
||||||
>
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Spin>
|
</Spin>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useRef, useEffect } from 'react';
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
import { Button, message, Spin, Tabs, Tree} from 'antd';
|
import { Button, message, Popconfirm, Spin, Tabs, Tree} from 'antd';
|
||||||
import ProTable, { ActionType } from '@ant-design/pro-table';
|
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||||
import { deviceList, getplaceareaList, roomList } from './service';
|
import { deviceList, getplaceareaList, deleteDevice } from './service';
|
||||||
import '@/assets/ld_style.less';
|
import '@/assets/ld_style.less';
|
||||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import ProCard from "@ant-design/pro-card";
|
import ProCard from "@ant-design/pro-card";
|
||||||
@ -91,6 +91,24 @@ const DeviceManage: React.FC<{}> = () => {
|
|||||||
setType("read");
|
setType("read");
|
||||||
setUpdateVisible(true);
|
setUpdateVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toDelete = async (id: string) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
try {
|
||||||
|
const success = await deleteDevice(id).then((res) => {
|
||||||
|
return res.success
|
||||||
|
});
|
||||||
|
hide();
|
||||||
|
if (success) {
|
||||||
|
message.success('删除成功');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败请重试!');
|
||||||
|
checkRelationRef.current?.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备管理
|
* 设备管理
|
||||||
* @param record
|
* @param record
|
||||||
@ -176,9 +194,20 @@ const DeviceManage: React.FC<{}> = () => {
|
|||||||
<Button type="text" onClick={() => {toEdit(record.id)}} danger>
|
<Button type="text" onClick={() => {toEdit(record.id)}} danger>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="text" onClick={() => {}} danger>
|
<Popconfirm
|
||||||
删除
|
placement="topRight"
|
||||||
</Button>
|
title={"确定删除么?"}
|
||||||
|
onConfirm={async () => {
|
||||||
|
spinSet(true)
|
||||||
|
await toDelete(record.id);
|
||||||
|
checkRelationRef.current?.reload();
|
||||||
|
spinSet(false)
|
||||||
|
}}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
>
|
||||||
|
<Button type='text' >删除</Button>
|
||||||
|
</Popconfirm>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -232,17 +261,10 @@ const DeviceManage: React.FC<{}> = () => {
|
|||||||
filterType: 'query',
|
filterType: 'query',
|
||||||
optionRender: (searchConfig: any, { form }) => {
|
optionRender: (searchConfig: any, { form }) => {
|
||||||
return [
|
return [
|
||||||
<Button
|
<Button key="toCreate"
|
||||||
key="resetText"
|
type="primary" onClick={() => toAdd()}>
|
||||||
onClick={() => {
|
新建
|
||||||
form?.setFieldsValue({
|
</Button>,
|
||||||
current: 1,
|
|
||||||
});
|
|
||||||
form?.submit();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{searchConfig?.resetText}
|
|
||||||
</Button>,
|
|
||||||
<Button
|
<Button
|
||||||
key="searchText"
|
key="searchText"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -251,10 +273,18 @@ const DeviceManage: React.FC<{}> = () => {
|
|||||||
>
|
>
|
||||||
{searchConfig?.searchText}
|
{searchConfig?.searchText}
|
||||||
</Button>,
|
</Button>,
|
||||||
<Button key="toCreate"
|
<Button
|
||||||
type="primary" onClick={() => toAdd()}>
|
key="resetText"
|
||||||
新建
|
onClick={() => {
|
||||||
</Button>,
|
form?.resetFields();
|
||||||
|
form?.setFieldsValue({
|
||||||
|
current: 1,
|
||||||
|
});
|
||||||
|
form?.submit();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{searchConfig?.resetText}
|
||||||
|
</Button>,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
@ -56,9 +56,20 @@ export async function saveDevice(params: any) {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export async function getExternDevicesAboveArea(params: any) {
|
export async function getExternDevicesAboveArea(params: any) {
|
||||||
return request('/api/biz-service-ebtp-evaluation/v1/eval/device/queryByParam', {
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/devices', {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
data: params
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备
|
||||||
|
* @param id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function deleteDevice(id: string) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/device/delete/'+id, {
|
||||||
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { isNotEmpty } from '@/utils/CommonUtils';
|
import { isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||||
import { Button, Spin, message } from 'antd';
|
import { Button, Spin, message, Popconfirm } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import { useHistory } from 'umi';
|
import { useHistory } from 'umi';
|
||||||
import AreasModal from './modal/AreasModal';
|
import AreasModal from './modal/AreasModal';
|
||||||
@ -36,18 +36,23 @@ const AreasManage: React.FC<{}> = () => {
|
|||||||
const closeAreasModal = () => {
|
const closeAreasModal = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
//删除
|
//删除区域
|
||||||
const deleteAreas = async(id: string) => {
|
const deleteAreas = async (id: string) => {
|
||||||
await deleteAreasInfo(id).then((res) => {
|
const hide = message.loading('正在删除');
|
||||||
if (res?.success) {
|
try {
|
||||||
message.success('删除成功');
|
const success = await deleteAreasInfo(id).then((res) => {
|
||||||
}
|
return res.success
|
||||||
})
|
});
|
||||||
.finally(()=>{
|
hide();
|
||||||
actionRef?.current?.reload();
|
if (success) {
|
||||||
});
|
message.success('删除成功');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败请重试!');
|
||||||
|
actionRef.current?.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns: ProColumns<any>[] = [
|
const columns: ProColumns<any>[] = [
|
||||||
{
|
{
|
||||||
title: '序号',
|
title: '序号',
|
||||||
@ -122,15 +127,20 @@ const AreasManage: React.FC<{}> = () => {
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Popconfirm
|
||||||
key="deleteAreas"
|
placement="topRight"
|
||||||
type="text"
|
title={"确定删除么?"}
|
||||||
onClick={() =>
|
onConfirm={async () => {
|
||||||
deleteAreas(record.id)
|
spinSet(true)
|
||||||
}
|
await deleteAreas(record.id);
|
||||||
|
actionRef.current?.reload();
|
||||||
|
spinSet(false)
|
||||||
|
}}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
删除
|
<Button type='text' >删除</Button>
|
||||||
</Button>
|
</Popconfirm>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { isNotEmpty } from '@/utils/CommonUtils';
|
import { isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||||
import { Button, Spin, message } from 'antd';
|
import { Button, Spin, message, Popconfirm } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import { useHistory } from 'umi';
|
import { useHistory } from 'umi';
|
||||||
import PlaceModal from './modal/PlaceModal';
|
import PlaceModal from './modal/PlaceModal';
|
||||||
@ -59,18 +59,22 @@ const PlaceManage: React.FC<{}> = () => {
|
|||||||
const closePlaceModal = () => {
|
const closePlaceModal = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
//删除
|
//删除场所
|
||||||
const deletePlace = async(id: string) => {
|
const deletePlace = async (id: string) => {
|
||||||
await deletePlaceInfo(id).then((res) => {
|
const hide = message.loading('正在删除');
|
||||||
if (res?.success) {
|
try {
|
||||||
message.success('删除成功');
|
const success = await deletePlaceInfo(id).then((res) => {
|
||||||
}
|
return res.success
|
||||||
})
|
});
|
||||||
.catch(e => {
|
hide();
|
||||||
message.error('删除失败');
|
if (success) {
|
||||||
}).finally(()=>{
|
message.success('删除成功');
|
||||||
actionRef?.current?.reload();
|
}
|
||||||
});
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败请重试!');
|
||||||
|
actionRef.current?.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const columns: ProColumns<any>[] = [
|
const columns: ProColumns<any>[] = [
|
||||||
{
|
{
|
||||||
@ -181,15 +185,20 @@ const PlaceManage: React.FC<{}> = () => {
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Popconfirm
|
||||||
key="deletePlace"
|
placement="topRight"
|
||||||
type="text"
|
title={"确定删除么?"}
|
||||||
onClick={() =>
|
onConfirm={async () => {
|
||||||
deletePlace(record.id)
|
spinSet(true)
|
||||||
}
|
await deletePlace(record.id);
|
||||||
|
actionRef.current?.reload();
|
||||||
|
spinSet(false)
|
||||||
|
}}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
删除
|
<Button type='text' >删除</Button>
|
||||||
</Button>
|
</Popconfirm>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user