| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import axios from "axios";
- import { ZichanCategory } from "../../share/monitorTypes.ts";
- // 资产分类API接口定义
- export const ZichanCategoryAPI = {
- // 获取资产分类列表
- getZichanCategoryList: async (params?: {
- page?: number,
- limit?: number,
- name?: string,
- code?: string
- }) => {
- try {
- const response = await axios.get(`/zichan-categories`, { params });
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 获取单个资产分类信息
- getZichanCategory: async (id: number) => {
- try {
- const response = await axios.get(`/zichan-categories/${id}`);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 创建资产分类
- createZichanCategory: async (data: Partial<ZichanCategory>) => {
- try {
- const response = await axios.post(`/zichan-categories`, data);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 更新资产分类
- updateZichanCategory: async (id: number, data: Partial<ZichanCategory>) => {
- try {
- const response = await axios.put(`/zichan-categories/${id}`, data);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 删除资产分类
- deleteZichanCategory: async (id: number) => {
- try {
- const response = await axios.delete(`/zichan-categories/${id}`);
- return response.data;
- } catch (error) {
- throw error;
- }
- }
- };
|