| | |
| | | } |
| | | } |
| | | |
| | | // 根据方案id获取方案列表 |
| | | export async function getSimDataById(id) { |
| | | try { |
| | | const res = await instance.get(`/simu/selectPage?id=${id}`); |
| | | return res.data; // 返回实际数据(通常 res.data 才是接口返回的内容) |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | | throw error; // 抛出错误,让调用方可以捕获 |
| | | } |
| | | } |
| | | |
| | | // 新建仿真方案 |
| | | export async function createSimData(simData) { |
| | | try { |
| | |
| | | export async function deleteSimData(ids) { |
| | | try { |
| | | const res = await instance.delete(`/simu/deleteByIds?ids=${ids}`); |
| | | return res.data; |
| | | } catch (error) { |
| | | console.error("Error deleting simulation data:", error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | // 开始模拟 |
| | | export async function getSimStart(ids) { |
| | | try { |
| | | const res = await instance.get(`/simu/start?id=${ids}`); |
| | | return res.data; |
| | | } catch (error) { |
| | | console.error("Error deleting simulation data:", error); |
| | |
| | | // 通过接口去请求json,将请求的json解析获取泥石流参数 |
| | | export async function fetchWaterSimulationData(serviceInfo) { |
| | | try { |
| | | // const response = await fetch(`/simu/${serviceInfo}/layer.json`); // 发起请求 |
| | | const response = await fetch(`/simu/c2h1dc/layer.json`); // 发起请求 |
| | | const response = await fetch(`/simu/${serviceInfo}/layer.json`); // 发起请求 |
| | | // const response = await fetch(`/simu/c2h1dc/layer.json`); // 发起请求 |
| | | if (!response.ok) { |
| | | throw new Error(`HTTP error! status: ${response.status}`); |
| | | } |