评标场所、区域、设备代码完善
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
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 { deviceList, getplaceareaList, roomList } from './service';
|
||||
import { deviceList, getplaceareaList, deleteDevice } from './service';
|
||||
import '@/assets/ld_style.less';
|
||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||
import ProCard from "@ant-design/pro-card";
|
||||
@ -91,6 +91,24 @@ const DeviceManage: React.FC<{}> = () => {
|
||||
setType("read");
|
||||
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
|
||||
@ -176,9 +194,20 @@ const DeviceManage: React.FC<{}> = () => {
|
||||
<Button type="text" onClick={() => {toEdit(record.id)}} danger>
|
||||
编辑
|
||||
</Button>
|
||||
<Button type="text" onClick={() => {}} danger>
|
||||
删除
|
||||
</Button>
|
||||
<Popconfirm
|
||||
placement="topRight"
|
||||
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',
|
||||
optionRender: (searchConfig: any, { form }) => {
|
||||
return [
|
||||
<Button
|
||||
key="resetText"
|
||||
onClick={() => {
|
||||
form?.setFieldsValue({
|
||||
current: 1,
|
||||
});
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.resetText}
|
||||
</Button>,
|
||||
<Button key="toCreate"
|
||||
type="primary" onClick={() => toAdd()}>
|
||||
新建
|
||||
</Button>,
|
||||
<Button
|
||||
key="searchText"
|
||||
onClick={() => {
|
||||
@ -251,10 +273,18 @@ const DeviceManage: React.FC<{}> = () => {
|
||||
>
|
||||
{searchConfig?.searchText}
|
||||
</Button>,
|
||||
<Button key="toCreate"
|
||||
type="primary" onClick={() => toAdd()}>
|
||||
新建
|
||||
</Button>,
|
||||
<Button
|
||||
key="resetText"
|
||||
onClick={() => {
|
||||
form?.resetFields();
|
||||
form?.setFieldsValue({
|
||||
current: 1,
|
||||
});
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.resetText}
|
||||
</Button>,
|
||||
];
|
||||
},
|
||||
}}
|
||||
|
Reference in New Issue
Block a user