Browse Source

api请求两次问题修改

dev
wenlele 3 years ago
parent
commit
b3c26d3067
  1. 6
      web/client/src/sections/problem/components/tableData.jsx
  2. 19
      web/client/src/sections/problem/containers/dataAlarm.jsx

6
web/client/src/sections/problem/components/tableData.jsx

@ -8,7 +8,7 @@ import { emit } from "superagent";
const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition, const TableData = ({ route,dispatch, actions, collectData, setSetup, exhibition,
selected, setSelected, setIfBulk, setConfirm, setGenre, query, setQuery }) => { selected, setSelected, setIfBulk, setConfirm, setGenre, query, setQuery }) => {
const { problem } = actions const { problem } = actions
@ -101,13 +101,13 @@ const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition
break; break;
} }
}, [route, query, search]) }, [query, search])
return ( return (
<> <>
<div style={{ backgroundColor: '#FFFFFF',paddingTop:8 }}> <div style={{ backgroundColor: '#FFFFFF', paddingTop: 8 }}>
<div style={{}}> <div style={{}}>
<div style={{ display: "flex", marginBottom: 16, marginLeft: 20 }}> <div style={{ display: "flex", marginBottom: 16, marginLeft: 20 }}>
<Form <Form

19
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -12,8 +12,7 @@ import '../style.less'
import { request } from 'screenfull'; import { request } from 'screenfull';
const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
let route = match.url.substring(match.url.lastIndexOf("/") + 1, match.url.length)
const [route, setRoute] = useState('') //
const [abnormalLenght, setAbnormalLenght] = useState(0) // const [abnormalLenght, setAbnormalLenght] = useState(0) //
const [collect, setCollect] = useState([]) // const [collect, setCollect] = useState([]) //
const [setup, setSetup] = useState(false); // const [setup, setSetup] = useState(false); //
@ -33,16 +32,6 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' } const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' }
const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' } const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' }
useEffect(() => {
setRoute(match.url.substring(match.url.lastIndexOf("/") + 1, match.url.length))
// console.log(match.url)
// console.log(tableType);
}, [])
useEffect(() => { useEffect(() => {
if (route) { if (route) {
@ -57,7 +46,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
: ""; : "";
} }
attribute(tableType[route], route); attribute(tableType[route], route);
}, [route]) }, [])
// //
@ -285,7 +274,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
// } // }
console.log(data) // console.log(data)
// let TableDisplay = [] // let TableDisplay = []
let TableDisplay = data?.map(v => { let TableDisplay = data?.map(v => {
@ -295,7 +284,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
} }
}) })
console.log(TableDisplay); // console.log(TableDisplay);
TableDisplay.push({ TableDisplay.push({
title: '操作', title: '操作',

Loading…
Cancel
Save