plugin.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import axios from 'axios';
  2. import type { TableData } from '@arco-design/web-vue/es/table/interface';
  3. import instance from './interceptor';
  4. export interface DataRes {
  5. success: boolean;
  6. message: string;
  7. code: string;
  8. data: DataList;
  9. }
  10. export interface DataList {
  11. id?: number;
  12. userId?: number | null;
  13. server?: string;
  14. user?: string;
  15. password?: string;
  16. location: string;
  17. hostName: string;
  18. }
  19. export interface ExportUrl {
  20. success: boolean;
  21. message: string;
  22. code: string;
  23. data: string;
  24. }
  25. export interface PluginList {
  26. success: boolean;
  27. message: string;
  28. code: string;
  29. data: DataList[];
  30. totalCount: number;
  31. totalPage: number;
  32. }
  33. export interface PluginParams {
  34. pageIndex: number;
  35. pageSize: number;
  36. hostName: string | null;
  37. address: string | null;
  38. server: string | null;
  39. location: string | null;
  40. }
  41. export async function queryPluginList(
  42. params: Record<string, any>
  43. ): Promise<PluginList> {
  44. const formData = new URLSearchParams();
  45. Object.keys(params).forEach(key => {
  46. formData.append(key, params[key]);
  47. });
  48. const res = await instance.post('/api/Plugin/PluginList', formData, {
  49. headers: {
  50. 'Content-Type': 'application/x-www-form-urlencoded',
  51. },
  52. });
  53. return res.data;
  54. }
  55. export async function deletePluginDetails(params: object): Promise<DataRes> {
  56. const res = await instance.post('/api/Plugin/DeletePlugin', params);
  57. return res.data;
  58. }
  59. export async function getPluginDetails(params: object): Promise<DataRes> {
  60. const res = await instance.post('/api/Plugin/PluginDetail', params);
  61. return res.data;
  62. }
  63. export async function savePluginDetails(
  64. params: Record<string, any>
  65. ): Promise<DataRes> {
  66. const formData = new URLSearchParams();
  67. Object.keys(params).forEach(key => {
  68. formData.append(key, params[key]);
  69. });
  70. const res = await instance.post('/api/Plugin/SavePlugin', formData, {
  71. headers: {
  72. 'Content-Type': 'application/x-www-form-urlencoded',
  73. },
  74. });
  75. return res.data;
  76. }
  77. export async function exportPluginList(params: object): Promise<ExportUrl> {
  78. const res = await instance.post('/api/Author/Export', params);
  79. return res.data;
  80. }