| | |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | // 实时模拟的结果 |
| | | export async function getSimresult(ids) { |
| | | try { |
| | | const res = await instance.get(`/simu/results?id=${ids}`); |
| | | return res.data; |
| | | } catch (error) { |
| | | console.error("Error deleting simulation data:", error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | // 结束实时模拟 |
| | | export async function stopSim(ids) { |
| | | try { |
| | | const res = await instance.get(`/simu/stop?id=${ids}`); |
| | | return res.data; |
| | | } catch (error) { |
| | | console.error("Error deleting simulation data:", error); |
| | | throw error; |
| | | } |
| | | } |
| | | // ************************************************************************************************************** |
| | | // 解析json获取泥石流参数 |
| | | export function parseWaterSimulationData(jsonData) { |
| | |
| | | let fileName = timestamp ? timestamp : 'layer.json'; |
| | | const url = `/simu/${serviceInfo}/${fileName}`; |
| | | |
| | | const response = await fetch(url); // 发起请求 |
| | | const response = await fetch(url); // 发起请求 |
| | | |
| | | // console.log(url,'aaaaaaaaa') |
| | | |
| | |
| | | throw error; // 抛出错误,让调用方可以捕获 |
| | | } |
| | | } |
| | | |
| | | export async function getCrossSection(data) { |
| | | // console.log(data,'发送的数据!'); |
| | | |
| | | try { |
| | | const res = await instance.get("/simu/crossSection", { |
| | | params: data |
| | | }); |
| | | return res.data; // 返回实际数据(通常 res.data 才是接口返回的内容) |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | | throw error; // 抛出错误,让调用方可以捕获 |
| | | } |
| | | } |
| | | // ************************************************************************************************************** |