diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx
index 8c649c6..7486d04 100644
--- a/web/client/src/sections/problem/components/tableData.jsx
+++ b/web/client/src/sections/problem/components/tableData.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux";
-import { Button, Form, Modal, Skeleton, Pagination, Table } from "@douyinfe/semi-ui";
+import { Button, Form, Modal, Skeleton, Pagination, Table, Tooltip, Toast } from "@douyinfe/semi-ui";
import { SkeletonScreen, } from "$components";
import moment from "moment";
import { validate } from "schema-utils";
@@ -122,7 +122,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
useEffect(() => {
if (location) {
search.current = { ...search.current, ...location, state: 'new' }
- api.current?.setValues({...location, state: 'new'})
+ api.current?.setValues({ ...location, state: 'new' })
}
if (route !== 'videoAbnormal' && route !== 'useAbnormal') {
dispatch(problem.getAlarmDataGroup()).then((res) => {
@@ -159,29 +159,77 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
const handleExport = () => {
let url = ''
let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current
+ if (sustainTimeStart && sustainTimeEnd) {
+ let range = moment(sustainTimeEnd).diff(moment(sustainTimeStart), 'minutes')
+ if (range > 24 * 60 * 7) {
+ Toast.warning({
+ content: '导出自定义时间跨度不超过7天',
+ duration: 3,
+ })
+ return false;
+ }
+ } else {
+ sustainTimeStart = moment().add(-7, 'day').format("YYYY-MM-DD HH:mm:ss")
+ sustainTimeEnd = moment().format("YYYY-MM-DD HH:mm:ss")
+ }
switch (route) {
case 'useAbnormal':
- url = `alarm/application/api?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType}
- &state=${state}stainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}`
+ dispatch(problem.getAlarmLnspectionApi({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
+ if (res.success) {
+ if (res.payload.data.count) {
+ url = `alarm/application/api?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType}
+ &state=${state}stainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}`
+ setExportUrl(url);
+ } else {
+ Toast.info({
+ content: '暂无可导出的数据',
+ duration: 3,
+ })
+ }
+ }
+ })
break;
case 'videoAbnormal':
- url = `alarm/video/list?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keywordTarget=${keywordTarget}
- &keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}
- &pepProjectId=${pepProjectId || ''}`
+ dispatch(problem.getAlarmVideoList({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
+ if (res.success) {
+ if (res.payload.data.count) {
+ url = `alarm/video/list?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keywordTarget=${keywordTarget}
+ &keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}
+ &pepProjectId=${pepProjectId || ''}`
+ setExportUrl(url);
+ } else {
+ Toast.info({
+ content: '暂无可导出的数据',
+ duration: 3,
+ })
+ }
+ }
+ })
break;
default:
- let groups = {
- "dataLnterrupt": "1",
- "dataAbnormal": "2",
- "strategyHit": "3",
- "deviceAbnormal": "4,5"
- }
- url = `alarm/data/list?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&state=${state}&keywordTarget=${keywordTarget}&keyword=${keyword}&kindId=${kindId}
- &groupUnitId=${groupUnitId}&errType=${errType}&confirmState=${confirmState}&onlineState=${onlineState}&sustainTimeStart=${sustainTimeStart}
- &sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}&groupId=${groups[route]}`
+ dispatch(problem.getAlarmDataList({ ...query, ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, groupId: groupId.current.map(v => v.id).join(), pepProjectId: pepProjectId })).then((res) => {
+ if (res.success) {
+ if (res.payload.data.count) {
+ let groups = {
+ "dataLnterrupt": "1",
+ "dataAbnormal": "2",
+ "strategyHit": "3",
+ "deviceAbnormal": "4,5"
+ }
+ url = `alarm/data/list?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&state=${state}&keywordTarget=${keywordTarget}&keyword=${keyword}&kindId=${kindId}
+ &groupUnitId=${groupUnitId}&errType=${errType}&confirmState=${confirmState}&onlineState=${onlineState}&sustainTimeStart=${sustainTimeStart}
+ &sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}&groupId=${groups[route]}`
+ setExportUrl(url);
+ } else {
+ Toast.info({
+ content: '暂无可导出的数据',
+ duration: 3,
+ })
+ }
+ }
+ })
break;
}
- setExportUrl(url);
}
return (
@@ -269,25 +317,27 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
marginBottom: 16
}}
>
-
{
- api.current.validate().then((v) => {
- search.current = {
- state: v.state,
- keywordTarget: v.keywordTarget,
- keyword: v.keyword,
- kindId: v.kindId,
- groupUnitId: v.groupUnitId,
- errType: v.errType,
- confirmState: v.confirmState,
- onlineState: v.onlineState,
- sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
- sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
- }
- handleExport();
- });
- }} />
-
setSetup(true)} />
+
+
{
+ api.current.validate().then((v) => {
+ search.current = {
+ state: v.state,
+ keywordTarget: v.keywordTarget,
+ keyword: v.keyword,
+ kindId: v.kindId,
+ groupUnitId: v.groupUnitId,
+ errType: v.errType,
+ confirmState: v.confirmState,
+ onlineState: v.onlineState,
+ sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
+ sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
+ }
+ handleExport();
+ });
+ }} />
+
+
setSetup(true)} />