|
|
@@ -25,7 +25,6 @@ interface Props {
|
|
|
}
|
|
|
|
|
|
const ChildDevice = (props: Props) => {
|
|
|
- console.log(props.data);
|
|
|
const intl = useIntl();
|
|
|
const [visible, setVisible] = useState<boolean>(false);
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
@@ -44,6 +43,19 @@ const ChildDevice = (props: Props) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handleUnBind = async () => {
|
|
|
+ if (bindKeys.length) {
|
|
|
+ const resp = await service.unbindBatchDevice(InstanceModel.detail.id!, bindKeys);
|
|
|
+ if (resp.status === 200) {
|
|
|
+ onlyMessage('操作成功!');
|
|
|
+ setBindKeys([]);
|
|
|
+ actionRef.current?.reset?.();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ onlyMessage('请勾选需要解绑的数据', 'warning');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const columns: ProColumns<LogItem>[] = [
|
|
|
{
|
|
|
title: 'ID',
|
|
|
@@ -238,19 +250,7 @@ const ChildDevice = (props: Props) => {
|
|
|
>
|
|
|
绑定
|
|
|
</Button>,
|
|
|
- <Popconfirm
|
|
|
- key="unbind"
|
|
|
- onConfirm={async () => {
|
|
|
- if (bindKeys.length === 0) return onlyMessage('请先勾选数据!', 'error');
|
|
|
- const resp = await service.unbindBatchDevice(InstanceModel.detail.id!, bindKeys);
|
|
|
- if (resp.status === 200) {
|
|
|
- onlyMessage('操作成功!');
|
|
|
- setBindKeys([]);
|
|
|
- actionRef.current?.reset?.();
|
|
|
- }
|
|
|
- }}
|
|
|
- title={'确认解绑吗?'}
|
|
|
- >
|
|
|
+ <Popconfirm key="unbind" onConfirm={handleUnBind} title={'确认解绑吗?'}>
|
|
|
<Button>批量解绑</Button>
|
|
|
</Popconfirm>,
|
|
|
]}
|