import axios from "axios"; import { ZichanArea } from "../../share/monitorTypes.ts"; // 资产归属区域API接口定义 export const ZichanAreaAPI = { // 获取资产归属区域列表 getZichanAreaList: async (params?: { page?: number, limit?: number, name?: string, code?: string }) => { try { const response = await axios.get(`/zichan-areas`, { params }); return response.data; } catch (error) { throw error; } }, // 获取单个资产归属区域信息 getZichanArea: async (id: number) => { try { const response = await axios.get(`/zichan-areas/${id}`); return response.data; } catch (error) { throw error; } }, // 创建资产归属区域 createZichanArea: async (data: Partial) => { try { const response = await axios.post(`/zichan-areas`, data); return response.data; } catch (error) { throw error; } }, // 更新资产归属区域 updateZichanArea: async (id: number, data: Partial) => { try { const response = await axios.put(`/zichan-areas/${id}`, data); return response.data; } catch (error) { throw error; } }, // 删除资产归属区域 deleteZichanArea: async (id: number) => { try { const response = await axios.delete(`/zichan-areas/${id}`); return response.data; } catch (error) { throw error; } } };