|
@@ -12,7 +12,7 @@ import {
|
|
|
} from '@ant-design/icons';
|
|
} from '@ant-design/icons';
|
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
|
import { useRef, useState } from 'react';
|
|
import { useRef, useState } from 'react';
|
|
|
-import { message, Space } from 'antd';
|
|
|
|
|
|
|
+import { Badge, message, Space } from 'antd';
|
|
|
import ProTableCard from '@/components/ProTableCard';
|
|
import ProTableCard from '@/components/ProTableCard';
|
|
|
import Save from './Save';
|
|
import Save from './Save';
|
|
|
import Service from '@/pages/rule-engine/Alarm/Configuration/service';
|
|
import Service from '@/pages/rule-engine/Alarm/Configuration/service';
|
|
@@ -46,7 +46,9 @@ const Configuration = () => {
|
|
|
{
|
|
{
|
|
|
title: '状态',
|
|
title: '状态',
|
|
|
dataIndex: 'state',
|
|
dataIndex: 'state',
|
|
|
- renderText: (state) => state.text,
|
|
|
|
|
|
|
+ renderText: (state) => (
|
|
|
|
|
+ <Badge text={state?.text} status={state?.value === 'disabled' ? 'error' : 'success'} />
|
|
|
|
|
+ ),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '说明',
|
|
title: '说明',
|
|
@@ -60,6 +62,8 @@ const Configuration = () => {
|
|
|
record.sceneTriggerType === 'manual' && (
|
|
record.sceneTriggerType === 'manual' && (
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
key="trigger"
|
|
key="trigger"
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
isPermission={true}
|
|
isPermission={true}
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: '确认手动触发?',
|
|
title: '确认手动触发?',
|
|
@@ -103,18 +107,16 @@ const Configuration = () => {
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
|
id: `pages.data.option.${
|
|
id: `pages.data.option.${
|
|
|
- record?.state?.value === 'disable' ? 'disabled' : 'enabled'
|
|
|
|
|
|
|
+ record.state?.value !== 'disabled' ? 'disabled' : 'disabled'
|
|
|
}.tips`,
|
|
}.tips`,
|
|
|
- defaultMessage: `确认${record?.state?.value === 'disable' ? '禁用' : '启用'}?`,
|
|
|
|
|
|
|
+ defaultMessage: `确认${record.state?.value !== 'disabled' ? '禁用' : '启用'}?`,
|
|
|
}),
|
|
}),
|
|
|
onConfirm: async () => {
|
|
onConfirm: async () => {
|
|
|
- if (record?.state?.value === 'disable') {
|
|
|
|
|
|
|
+ if (record.state?.value === 'disabled') {
|
|
|
await service._enable(record.id);
|
|
await service._enable(record.id);
|
|
|
} else {
|
|
} else {
|
|
|
await service._disable(record.id);
|
|
await service._disable(record.id);
|
|
|
}
|
|
}
|
|
|
- setVisible(true);
|
|
|
|
|
- setCurrent(record);
|
|
|
|
|
message.success(
|
|
message.success(
|
|
|
intl.formatMessage({
|
|
intl.formatMessage({
|
|
|
id: 'pages.data.option.success',
|
|
id: 'pages.data.option.success',
|
|
@@ -127,19 +129,20 @@ const Configuration = () => {
|
|
|
tooltip={{
|
|
tooltip={{
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
|
id: `pages.data.option.${
|
|
id: `pages.data.option.${
|
|
|
- record?.state?.value === 'disable' ? 'disabled' : 'enabled'
|
|
|
|
|
|
|
+ record.state?.value !== 'disabled' ? 'disabled' : 'enabled'
|
|
|
}`,
|
|
}`,
|
|
|
- defaultMessage: record?.state?.value === 'disable' ? '禁用' : '启用',
|
|
|
|
|
|
|
+ defaultMessage: record.state?.value !== 'disabled' ? '禁用' : '启用',
|
|
|
}),
|
|
}),
|
|
|
}}
|
|
}}
|
|
|
type="link"
|
|
type="link"
|
|
|
>
|
|
>
|
|
|
- {record.state.value === 'disable' ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
|
|
|
|
|
|
|
+ {record.state?.value === 'disabled' ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
|
|
|
</PermissionButton>,
|
|
</PermissionButton>,
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
type="link"
|
|
type="link"
|
|
|
isPermission={true}
|
|
isPermission={true}
|
|
|
key="delete"
|
|
key="delete"
|
|
|
|
|
+ disabled={record.state?.value !== 'disabled'}
|
|
|
style={{ padding: 0 }}
|
|
style={{ padding: 0 }}
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: '确认删除?',
|
|
title: '确认删除?',
|
|
@@ -181,9 +184,10 @@ const Configuration = () => {
|
|
|
<AlarmConfig
|
|
<AlarmConfig
|
|
|
{...record}
|
|
{...record}
|
|
|
actions={[
|
|
actions={[
|
|
|
- record.sceneTriggerType === 'manual' && (
|
|
|
|
|
|
|
+ record.sceneTriggerType === 'manual' ? (
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
key="trigger"
|
|
key="trigger"
|
|
|
|
|
+ type="link"
|
|
|
isPermission={true}
|
|
isPermission={true}
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: '确认手动触发?',
|
|
title: '确认手动触发?',
|
|
@@ -202,10 +206,11 @@ const Configuration = () => {
|
|
|
<LikeOutlined />
|
|
<LikeOutlined />
|
|
|
手动触发
|
|
手动触发
|
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
|
- ),
|
|
|
|
|
|
|
+ ) : null,
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
isPermission={true}
|
|
isPermission={true}
|
|
|
key="edit"
|
|
key="edit"
|
|
|
|
|
+ type="link"
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
setCurrent(record);
|
|
setCurrent(record);
|
|
|
setVisible(true);
|
|
setVisible(true);
|
|
@@ -220,18 +225,16 @@ const Configuration = () => {
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
|
id: `pages.data.option.${
|
|
id: `pages.data.option.${
|
|
|
- record.state?.value === 'disable' ? 'disabled' : 'enabled'
|
|
|
|
|
|
|
+ record.state?.value !== 'disabled' ? 'disabled' : 'enabled'
|
|
|
}.tips`,
|
|
}.tips`,
|
|
|
- defaultMessage: `确认${record.state.value === 'disable' ? '禁用' : '启用'}?`,
|
|
|
|
|
|
|
+ defaultMessage: `确认${record.state?.value !== 'disabled' ? '禁用' : '启用'}?`,
|
|
|
}),
|
|
}),
|
|
|
onConfirm: async () => {
|
|
onConfirm: async () => {
|
|
|
- if (record.state?.value === 'disable') {
|
|
|
|
|
|
|
+ if (record.state?.value === 'disabled') {
|
|
|
await service._enable(record.id);
|
|
await service._enable(record.id);
|
|
|
} else {
|
|
} else {
|
|
|
await service._disable(record.id);
|
|
await service._disable(record.id);
|
|
|
}
|
|
}
|
|
|
- setVisible(true);
|
|
|
|
|
- setCurrent(record);
|
|
|
|
|
message.success(
|
|
message.success(
|
|
|
intl.formatMessage({
|
|
intl.formatMessage({
|
|
|
id: 'pages.data.option.success',
|
|
id: 'pages.data.option.success',
|
|
@@ -244,22 +247,27 @@ const Configuration = () => {
|
|
|
tooltip={{
|
|
tooltip={{
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
|
id: `pages.data.option.${
|
|
id: `pages.data.option.${
|
|
|
- record.state.value === 'disable' ? 'disabled' : 'enabled'
|
|
|
|
|
|
|
+ record.state?.value !== 'disabled' ? 'disabled' : 'enabled'
|
|
|
}`,
|
|
}`,
|
|
|
- defaultMessage: record.state.value === 'disable' ? '禁用' : '启用',
|
|
|
|
|
|
|
+ defaultMessage: record.state?.value !== 'disabled' ? '禁用' : '启用',
|
|
|
}),
|
|
}),
|
|
|
}}
|
|
}}
|
|
|
key="action"
|
|
key="action"
|
|
|
type="link"
|
|
type="link"
|
|
|
>
|
|
>
|
|
|
- {record.state.value === 'disable' ? (
|
|
|
|
|
|
|
+ {record.state?.value !== 'disabled' ? (
|
|
|
<CloseCircleOutlined />
|
|
<CloseCircleOutlined />
|
|
|
) : (
|
|
) : (
|
|
|
<PlayCircleOutlined />
|
|
<PlayCircleOutlined />
|
|
|
)}
|
|
)}
|
|
|
- {record.state.value === 'disable' ? '禁用' : '启用'}
|
|
|
|
|
|
|
+ {record.state?.value !== 'disabled' ? '禁用' : '启用'}
|
|
|
</PermissionButton>,
|
|
</PermissionButton>,
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ tooltip={{
|
|
|
|
|
+ title: '删除',
|
|
|
|
|
+ }}
|
|
|
|
|
+ disabled={record.state?.value !== 'disabled'}
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
title: '确认删除?',
|
|
title: '确认删除?',
|
|
|
onConfirm: async () => {
|
|
onConfirm: async () => {
|
|
@@ -295,7 +303,14 @@ const Configuration = () => {
|
|
|
</Space>
|
|
</Space>
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
- <Save data={current} visible={visible} close={() => setVisible(false)} />
|
|
|
|
|
|
|
+ <Save
|
|
|
|
|
+ data={current}
|
|
|
|
|
+ visible={visible}
|
|
|
|
|
+ close={() => {
|
|
|
|
|
+ setVisible(false);
|
|
|
|
|
+ actionRef.current?.reset?.();
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
</PageContainer>
|
|
</PageContainer>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|