|
|
|
@ -6,7 +6,11 @@ import { proTablePaginationOptions } from '../../../../config/defaultTable';
|
|
|
|
|
// import DeviceStatusCard from './components/DeviceStatusCard';
|
|
|
|
|
// import CreateForm from './components/CreateForm';
|
|
|
|
|
import { useMoment } from '@/hooks/useMoment';
|
|
|
|
|
import { postAlarmList, postWarningStatistics } from '@/services/realTime/alarmlist';
|
|
|
|
|
import {
|
|
|
|
|
postAlarmList,
|
|
|
|
|
postAlarmListIschecked,
|
|
|
|
|
postWarningStatistics,
|
|
|
|
|
} from '@/services/realTime/alarmlist';
|
|
|
|
|
import Alarm_list_bg from '../../../../public/Alarm_list_bg.png';
|
|
|
|
|
import { ReactComponent as NoData } from '../../../../public/images/no_data.svg';
|
|
|
|
|
import AlarmDetails from './components/AlarmDetails';
|
|
|
|
@ -86,6 +90,7 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
display: 'inline-block',
|
|
|
|
|
marginLeft: 5,
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
background: '#E80D0D',
|
|
|
|
@ -111,7 +116,10 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
// const [tabs, setTabs] = useState<any>([]);
|
|
|
|
|
const changeProjectTab = (key: string) => {
|
|
|
|
|
setTab(key);
|
|
|
|
|
console.log(key);
|
|
|
|
|
console.log(key, 'setTab');
|
|
|
|
|
setCurrentPage(1);
|
|
|
|
|
setCurrentPageSize(10);
|
|
|
|
|
pollServer();
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
|
|
|
initList(key);
|
|
|
|
|
};
|
|
|
|
@ -126,7 +134,7 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理初始值
|
|
|
|
|
function initDataTestList(dataList: Record<string, any>[]) {
|
|
|
|
|
function initDataTestList(dataList: Record<string, any>[], tabId: string, selectValues: any) {
|
|
|
|
|
console.log(dataList, 'initDataTestList');
|
|
|
|
|
let finalList: { content: React.JSX.Element }[] = [];
|
|
|
|
|
if (Array.isArray(dataList) && dataList.length) {
|
|
|
|
@ -152,6 +160,9 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
}}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
console.log(index, 'index');
|
|
|
|
|
console.log(tab, selectValue, record.id);
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
|
|
|
initListRead(tabId, selectValues, record.id, 1);
|
|
|
|
|
setUpdateModalOpen(true);
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
}}
|
|
|
|
@ -209,6 +220,20 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{record.is_checked === 0 && (
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
display: 'inline-block',
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
top: '10px',
|
|
|
|
|
right: '10px',
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
background: '#E80D0D',
|
|
|
|
|
borderRadius: '50%',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</ProCard>
|
|
|
|
|
),
|
|
|
|
@ -236,34 +261,30 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
// console.log(resp,'resp');
|
|
|
|
|
// setCurrentPageSize(resp?.data?.count)
|
|
|
|
|
setTotal(resp?.data?.count);
|
|
|
|
|
initDataTestList(resp?.data?.results);
|
|
|
|
|
// request={async (params = {}, sort) => {
|
|
|
|
|
// const { current, ...rest } = params;
|
|
|
|
|
// const reqParams = {
|
|
|
|
|
// page: current,
|
|
|
|
|
// desc: false,
|
|
|
|
|
// warning_type: tab,
|
|
|
|
|
// ...rest,
|
|
|
|
|
// };
|
|
|
|
|
// if (sort && Object.keys(sort).length) {
|
|
|
|
|
// reqParams.orderKey = Object.keys(sort)[0];
|
|
|
|
|
// let sort_select = sort[reqParams.orderKey];
|
|
|
|
|
// reqParams.desc = sort_select === 'descend';
|
|
|
|
|
// }
|
|
|
|
|
// // TODO 联调查询设备状态接口
|
|
|
|
|
// console.log(reqParams, 'reqParams');
|
|
|
|
|
// let resp = await postAlarmList({ ...reqParams });
|
|
|
|
|
// console.log(resp, 'postAlarmList_result');
|
|
|
|
|
|
|
|
|
|
// initDataTestList(resp.result);
|
|
|
|
|
// // return {
|
|
|
|
|
// // data: resp.result,
|
|
|
|
|
// // success: resp.success,
|
|
|
|
|
// // total: resp.count,
|
|
|
|
|
// // current: resp.count,
|
|
|
|
|
// // pageSize: resp.count,
|
|
|
|
|
// // };
|
|
|
|
|
// }}
|
|
|
|
|
initDataTestList(resp?.data?.results, tabId, selectValues);
|
|
|
|
|
}
|
|
|
|
|
// 初始化加载
|
|
|
|
|
async function initListRead(
|
|
|
|
|
tabId: string = tab,
|
|
|
|
|
selectValues: any = selectValue,
|
|
|
|
|
id: any,
|
|
|
|
|
is_checked: any,
|
|
|
|
|
) {
|
|
|
|
|
const reqParams = {
|
|
|
|
|
page: currentPage,
|
|
|
|
|
pageSize: currentPageSize,
|
|
|
|
|
// desc: false,
|
|
|
|
|
platform_id: selectValues,
|
|
|
|
|
warning_type: tabId,
|
|
|
|
|
id: id,
|
|
|
|
|
is_checked: is_checked,
|
|
|
|
|
// ...rest,
|
|
|
|
|
};
|
|
|
|
|
await postAlarmListIschecked({ ...reqParams }).then(() => {
|
|
|
|
|
initList(tabId, selectValues);
|
|
|
|
|
});
|
|
|
|
|
// console.log(resp,'resp');
|
|
|
|
|
// setCurrentPageSize(resp?.data?.count)
|
|
|
|
|
}
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// getTabs();
|
|
|
|
@ -326,7 +347,6 @@ const AlarmList: React.FC = () => {
|
|
|
|
|
查询
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
style={{ borderRadius: 4 }}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
// setCreateModalOpen(true);
|
|
|
|
|