zichan_transfer.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import axios from "axios";
  2. import { AssetTransferType, ZichanTransLog } from "../../share/monitorTypes.ts";
  3. // 资产流转API接口定义
  4. export const ZichanTransferAPI = {
  5. // 获取资产流转记录列表
  6. getTransferList: async (params?: { page?: number, limit?: number, asset_id?: number, asset_transfer?: AssetTransferType }) => {
  7. try {
  8. const response = await axios.get(`/zichan-transfer`, { params });
  9. return response.data;
  10. } catch (error) {
  11. throw error;
  12. }
  13. },
  14. // 获取资产流转记录详情
  15. getTransfer: async (id: number) => {
  16. try {
  17. const response = await axios.get(`/zichan-transfer/${id}`);
  18. return response.data;
  19. } catch (error) {
  20. throw error;
  21. }
  22. },
  23. // 创建资产流转记录
  24. createTransfer: async (data: Partial<ZichanTransLog>) => {
  25. try {
  26. const response = await axios.post(`/zichan-transfer`, data);
  27. return response.data;
  28. } catch (error) {
  29. throw error;
  30. }
  31. },
  32. // 更新资产流转记录
  33. updateTransfer: async (id: number, data: Partial<ZichanTransLog>) => {
  34. try {
  35. const response = await axios.put(`/zichan-transfer/${id}`, data);
  36. return response.data;
  37. } catch (error) {
  38. throw error;
  39. }
  40. },
  41. // 删除资产流转记录
  42. deleteTransfer: async (id: number) => {
  43. try {
  44. const response = await axios.delete(`/zichan-transfer/${id}`);
  45. return response.data;
  46. } catch (error) {
  47. throw error;
  48. }
  49. }
  50. };