fix(): 修复时间问题

test1
李神峰 2025-04-01 17:42:10 +08:00
parent 0ac52e4e9e
commit a6fd12bbf0
2 changed files with 23 additions and 4 deletions

View File

@ -29,8 +29,8 @@ module.exports = function (app) {
app.use(
'/gunshiApp/dcpj',
createProxyMiddleware({
// target: 'http://local.gunshiiot.com:18083',
target: 'http://192.168.66.30:24107',
target: 'http://local.gunshiiot.com:18083',
// target: 'http://192.168.66.30:24107',
changeOrigin: true,
})
);

View File

@ -173,6 +173,7 @@ const handlePredictRainfallChanges =(data, value, index) => {
const getHistoryData = async (params) => {
params.stcd = obj[params.code];
params.predictRainfallList = tableUpdataRef.current;
// debugger
if (tableUpdataRef.current.length && tableUpdataRef.current.some(item => item.predictRainfall === '' || item.predictRainfall == null || item.predictRainfall == undefined)) {
message.warning(`请输入${searchVal.time}个预测雨量值`)
return
@ -187,13 +188,18 @@ const handlePredictRainfallChanges =(data, value, index) => {
return
}
setHistoryData(responseData)
let subResponseData = JSON.parse(JSON.stringify(responseData)).slice(-searchVal.time)
const allBatches = getAllHydroBatches(responseData);
let needData = responseData;
let type = tableUpdataRef.current.length > 0 ? 2 :1
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)
if (res.length > 0) {
setLoading(false)
@ -318,10 +324,23 @@ const handlePredictRainfallChanges =(data, value, index) => {
// }
// }, [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(() => {
if (searchVal) {
getHistoryData(searchVal)
}
}, [searchVal])