feat: 接口联调
parent
310471c1bb
commit
5214210ad6
@ -0,0 +1,57 @@
|
||||
.alarmImgBox {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
.alarmImgLeft {
|
||||
position: relative;
|
||||
margin-right: 32px;
|
||||
width: 120px;
|
||||
// height: 600px;
|
||||
.alarmImgLeftBox {
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
// border-radius: 4px;
|
||||
// background: skyblue;
|
||||
}
|
||||
.shadowBox {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0px;
|
||||
width: 112px;
|
||||
height: 20px;
|
||||
background: #FFF;
|
||||
z-index: 999;
|
||||
}
|
||||
}
|
||||
.alarmImgRight{
|
||||
flex: 1;
|
||||
position: relative;
|
||||
.alarmImgRightTopBox {
|
||||
width: 640px;
|
||||
height: 640px;
|
||||
background: skyblue;
|
||||
}
|
||||
.alarmDetails {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
padding-left: 24px;
|
||||
line-height: 38px;
|
||||
margin-bottom: 16px;
|
||||
font-family: PingFang SC;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
|
||||
.alarmSpan {
|
||||
// color: #333;
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.myButtonDisabled{
|
||||
visibility: hidden;
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
import { putDeviceCategoryUpdateDeviceCategory } from '@/services/device/DeviceCategory';
|
||||
import { postDeviceGroupGetDeviceGroupFkSelect } from '@/services/device/DeviceGroup';
|
||||
import { ModalForm, ProForm, ProFormFieldSet, ProFormSelect, ProFormSwitch, ProFormText } from '@ant-design/pro-components';
|
||||
import { FormattedMessage, useIntl } from '@umijs/max';
|
||||
import { Form, message,Image } from 'antd';
|
||||
import React from 'react';
|
||||
import {
|
||||
proFormSmallItemStyleProps,
|
||||
proFormSmallModelWidth,
|
||||
} from '../../../../../config/defaultForm';
|
||||
import { postIgnoringvents } from '@/services/alarm/Alarmlist';
|
||||
// Import Swiper React components
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
import { Navigation, Pagination } from 'swiper/modules';
|
||||
// Import Swiper styles
|
||||
import 'swiper/css';
|
||||
import 'swiper/css/navigation';
|
||||
import 'swiper/css/pagination';
|
||||
import styles from './AlarmDetails.less'
|
||||
import moment from 'moment';
|
||||
export type FormValueType = {
|
||||
target?: string;
|
||||
template?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
frequency?: string;
|
||||
} & Partial<API.AlarmDetailsParams>;
|
||||
|
||||
export type UpdateFormProps = {
|
||||
updateModalOpen: boolean;
|
||||
handleModal: () => void;
|
||||
values: Partial<API.AlarmDetailsParams>;
|
||||
reload: any;
|
||||
};
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
const [form] = Form.useForm<API.AlarmDetailsParams>();
|
||||
|
||||
return (
|
||||
<ModalForm<any>
|
||||
width={832}
|
||||
title={intl.formatMessage({
|
||||
id: 'alarm.list.table.form.title',
|
||||
defaultMessage: `编辑${props.values.warning_name}`,
|
||||
})}
|
||||
open={props.updateModalOpen}
|
||||
form={form}
|
||||
autoFocusFirstInput
|
||||
modalProps={{
|
||||
destroyOnClose: true,
|
||||
onCancel: () => props.handleModal(),
|
||||
}}
|
||||
submitter={{
|
||||
resetButtonProps: {
|
||||
style: {
|
||||
display: 'none',
|
||||
},
|
||||
},
|
||||
searchConfig: {
|
||||
submitText: '忽略此事件',
|
||||
},
|
||||
}}
|
||||
submitTimeout={2000}
|
||||
onFinish={async (values) => {
|
||||
// values.is_ignore = true
|
||||
// values.person_id = props.values.person_id
|
||||
console.log(values);
|
||||
// postIgnoringvents(values)
|
||||
// .then(() => {
|
||||
// message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
|
||||
props.reload();
|
||||
// })
|
||||
// .catch(() => {
|
||||
// message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
|
||||
// });
|
||||
|
||||
// props.handleModal();
|
||||
// return true;
|
||||
}}
|
||||
>
|
||||
{/* <ProForm.Group> */}
|
||||
{/* <div className={styles.alarmDetails}>
|
||||
告警名称: <span className={styles.alarmSpan}>单人徘徊告警</span>来源设备: <span className={styles.alarmSpan}>北广场检票口1#摄像头</span>触发时间: <span className={styles.alarmSpan}>2023-01-15 22:00:03</span>
|
||||
</div> */}
|
||||
<div className={styles.alarmImgBox}>
|
||||
<div className={styles.alarmImgLeft}>
|
||||
<Swiper
|
||||
style={{height:660}}
|
||||
slidesPerView={5}
|
||||
spaceBetween={20}
|
||||
direction='vertical'
|
||||
// pagination={{
|
||||
// clickable: true,
|
||||
// }}
|
||||
// modules={[Pagination]}
|
||||
>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
<SwiperSlide>
|
||||
<div className={styles.alarmImgLeftBox}>
|
||||
<Image
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
</Swiper>
|
||||
<div className={styles.shadowBox}></div>
|
||||
</div>
|
||||
<div className={styles.alarmImgRight}>
|
||||
<div className={styles.alarmImgRightTopBox}>
|
||||
<Image
|
||||
width={640}
|
||||
height={640}
|
||||
preview={false}
|
||||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.alarmDetails}>
|
||||
来源: <span className={styles.alarmSpan}>{props.values.device_name}</span>触发时间: <span className={styles.alarmSpan}>{moment(props.values.trigger_time).format('YYYY-MM-DD hh:mm:ss')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* </ProForm.Group> */}
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
export default UpdateForm;
|
@ -0,0 +1,41 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
/** 告警列表 */
|
||||
export async function getAlarmRules(
|
||||
params: API.SearchAlarmRulesParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/warning_rule/`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新告警列表 */
|
||||
export async function postAlarmRules(
|
||||
body: API.UpdateAlarmRulesParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/warning_rule/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
/** 告警列表 */
|
||||
export async function postAlarmList(
|
||||
params: API.SearchAlarmListParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/warning_info/`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
/** 忽略事件 */
|
||||
export async function postIgnoringvents(
|
||||
body: API.IgnoringventsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/detect_result/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
/** 接口列表 */
|
||||
export async function getInterfaces(
|
||||
params: API.SearchAlarmRulesParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/device/`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新接口列表 */
|
||||
export async function postInterfaces(
|
||||
body: API.UpdateAlarmRulesParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PageResult; msg?: string }>(
|
||||
`/api/device/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as Alarmlist from './Alarmlist';
|
||||
import * as AlarmRules from './AlarmRules';
|
||||
import * as Interfaces from './Interfaces';
|
||||
export default {
|
||||
Alarmlist,
|
||||
AlarmRules,
|
||||
Interfaces
|
||||
};
|
@ -0,0 +1,96 @@
|
||||
declare namespace API {
|
||||
type ActionDetection = {
|
||||
id?: string;
|
||||
source?: string;
|
||||
configFile?: string;
|
||||
type?: string;
|
||||
remark?: string;
|
||||
time?: number;
|
||||
imagesPath?: string;
|
||||
};
|
||||
|
||||
type PageResult = {
|
||||
list?: any;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
total?: number;
|
||||
};
|
||||
|
||||
type AlarmListResponse = {
|
||||
code?: number;
|
||||
data?: any;
|
||||
msg?: string;
|
||||
success?: boolean;
|
||||
// count?: number,
|
||||
// next?: any,
|
||||
// previous?: any,
|
||||
// results?:any
|
||||
};
|
||||
|
||||
type SearchAlarmListParams = {
|
||||
warning_type?: string;
|
||||
/** 排序方式:升序false(默认)|降序true */
|
||||
desc?: boolean;
|
||||
/** 页码 */
|
||||
page?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
};
|
||||
type SearchAlarmRulesParams = {
|
||||
id?: string;
|
||||
};
|
||||
type InterfacesForm = {
|
||||
code?: string;
|
||||
createTime?: string;
|
||||
id?: number;
|
||||
is_use?: number;
|
||||
device_name?: string;
|
||||
remark?: string;
|
||||
device_api?: string;
|
||||
};
|
||||
type UpdateAlarmRulesForm = {
|
||||
warning_name?: string; // 告警规则名称
|
||||
warning_type?: string; // 告警类型
|
||||
is_use?: number; // 是否启用
|
||||
person_number?: number; // 人数
|
||||
appear_number?: number; // 出现次数
|
||||
time_interval?: string; // 时间间隔(小时)
|
||||
time_period?: string; // 时间段(小时)
|
||||
trigger_start_time?: string;// 敏感起始时间
|
||||
trigger_end_time?: string; // 敏感结束时间
|
||||
id?: number;
|
||||
}
|
||||
type UpdateAlarmRulesParams = {
|
||||
warning_name?: string; // 告警规则名称
|
||||
warning_type?: string; // 告警类型
|
||||
is_use?: number; // 是否启用
|
||||
person_number?: number; // 人数
|
||||
appear_number?: number; // 出现次数
|
||||
time_interval?: string; // 时间间隔(小时)
|
||||
time_period?: string; // 时间段(小时)
|
||||
trigger_start_time?: string;// 敏感起始时间
|
||||
trigger_end_time?: string; // 敏感结束时间
|
||||
id?: string;
|
||||
}
|
||||
type UpdateInterfacesParams = {
|
||||
device_name?: string; // 设备名称
|
||||
device_code?: string; // 设备代码
|
||||
is_use?: number; // 是否启用
|
||||
device_api?: string; // 设备地址
|
||||
note?: string; // 备注
|
||||
device_status?: string; // 设备状态
|
||||
id?: string;
|
||||
}
|
||||
type AlarmDetailsParams = {
|
||||
warning_name?: string; // 设备名称
|
||||
picture_path?: any; // 设备代码
|
||||
device_name?: string; // 是否启用
|
||||
person_id?: string;
|
||||
trigger_time?: string;
|
||||
}
|
||||
type IgnoringventsParams = {
|
||||
is_ignore?: any; // 设备代码 // 是否启用
|
||||
person_id?: string;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue