fix(): 修复时间问题
parent
0ac52e4e9e
commit
a6fd12bbf0
|
|
@ -29,8 +29,8 @@ module.exports = function (app) {
|
||||||
app.use(
|
app.use(
|
||||||
'/gunshiApp/dcpj',
|
'/gunshiApp/dcpj',
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
// target: 'http://local.gunshiiot.com:18083',
|
target: 'http://local.gunshiiot.com:18083',
|
||||||
target: 'http://192.168.66.30:24107',
|
// target: 'http://192.168.66.30:24107',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ const handlePredictRainfallChanges =(data, value, index) => {
|
||||||
const getHistoryData = async (params) => {
|
const getHistoryData = async (params) => {
|
||||||
params.stcd = obj[params.code];
|
params.stcd = obj[params.code];
|
||||||
params.predictRainfallList = tableUpdataRef.current;
|
params.predictRainfallList = tableUpdataRef.current;
|
||||||
|
// debugger
|
||||||
if (tableUpdataRef.current.length && tableUpdataRef.current.some(item => item.predictRainfall === '' || item.predictRainfall == null || item.predictRainfall == undefined)) {
|
if (tableUpdataRef.current.length && tableUpdataRef.current.some(item => item.predictRainfall === '' || item.predictRainfall == null || item.predictRainfall == undefined)) {
|
||||||
message.warning(`请输入${searchVal.time}个预测雨量值`)
|
message.warning(`请输入${searchVal.time}个预测雨量值`)
|
||||||
return
|
return
|
||||||
|
|
@ -187,13 +188,18 @@ const handlePredictRainfallChanges =(data, value, index) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setHistoryData(responseData)
|
setHistoryData(responseData)
|
||||||
|
let subResponseData = JSON.parse(JSON.stringify(responseData)).slice(-searchVal.time)
|
||||||
const allBatches = getAllHydroBatches(responseData);
|
const allBatches = getAllHydroBatches(responseData);
|
||||||
let needData = responseData;
|
let needData = responseData;
|
||||||
let type = tableUpdataRef.current.length > 0 ? 2 :1
|
let type = tableUpdataRef.current.length > 0 ? 2 :1
|
||||||
if (tableUpdataRef.current.length > 0) {
|
if (tableUpdataRef.current.length > 0) {
|
||||||
needData = tableUpdataRef.current;
|
needData = tableUpdataRef.current.map((item,i) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
tm:subResponseData[i]?.tm
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// debugger
|
|
||||||
const res = await processPredictions(allBatches, params.code, needData, type)
|
const res = await processPredictions(allBatches, params.code, needData, type)
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|
@ -318,10 +324,23 @@ const handlePredictRainfallChanges =(data, value, index) => {
|
||||||
// }
|
// }
|
||||||
// }, [searchVal.tm])
|
// }, [searchVal.tm])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (searchVal.etm && tableUpdataRef.current.length > 0) {
|
||||||
|
tableUpdataRef.current = [...tableUpdataRef.current.map((item,index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
tm:moment(searchVal.etm).add(index + 1, 'hours').format('YYYY-MM-DD HH:00:00')
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
}
|
||||||
|
}, [searchVal.etm])
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchVal) {
|
if (searchVal) {
|
||||||
getHistoryData(searchVal)
|
getHistoryData(searchVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [searchVal])
|
}, [searchVal])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue