dict.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import axios from 'axios';
  2. import type { RouteRecordNormalized } from 'vue-router';
  3. import { UserState } from '@/store/modules/user/types';
  4. import instance from './interceptor';
  5. export interface DataList {
  6. id?: number;
  7. name?: string;
  8. description?: string;
  9. }
  10. export interface DictRes {
  11. success: boolean;
  12. data: DataList[];
  13. message: string;
  14. code: string;
  15. }
  16. export interface DictParams {
  17. name: string | null;
  18. description: string | null;
  19. pageIndex: number;
  20. pageSize: number;
  21. }
  22. export interface DictItemParams {
  23. dictId: number;
  24. name: string;
  25. dictCode: number;
  26. description: string;
  27. }
  28. export interface ItemDataList {
  29. id?: number;
  30. dictId?: number;
  31. dictCode?: string | null;
  32. number?: number | null;
  33. name: string;
  34. chsName?: string;
  35. chtName?: string;
  36. order: number;
  37. status: number;
  38. lastModifiedTime?: string;
  39. description?: string;
  40. }
  41. export interface DictItemList {
  42. success: boolean;
  43. message: string;
  44. code: string;
  45. data: ItemDataList[];
  46. }
  47. export interface SuccessRes {
  48. success: boolean;
  49. message: string;
  50. code: string;
  51. data: number;
  52. }
  53. export interface AdditionalProp {
  54. dictCode: number;
  55. name: string;
  56. chsName: string;
  57. chtName: string;
  58. }
  59. export interface AdditionalProp {
  60. dictCode: number;
  61. name: string;
  62. chsName: string;
  63. chtName: string;
  64. }
  65. export interface DictQueryList {
  66. [key: string]: AdditionalProp[]; // 索引签名,允许任意字符串键
  67. }
  68. export interface DictQueryRes {
  69. success: boolean;
  70. message: string;
  71. code: string;
  72. data: DictQueryList;
  73. }
  74. export async function getDictList(params: object): Promise<DictRes> {
  75. const res = await instance.post('/api/Dict/List', params);
  76. return res.data;
  77. }
  78. export async function fetchSaveDict(params: object): Promise<SuccessRes> {
  79. const res = await instance.post('/api/Dict/Save', params);
  80. return res.data;
  81. }
  82. export async function fetchDeleteDict(params: object): Promise<SuccessRes> {
  83. const res = await instance.post('/api/Dict/Delete', params);
  84. return res.data;
  85. }
  86. export async function getDictQueryList(params: object): Promise<DictQueryRes> {
  87. const res = await instance.post('/api/Dict/DictQuery', params);
  88. return res.data;
  89. }
  90. export async function getDictItemList(params: object): Promise<DictItemList> {
  91. const res = await instance.post('/api/DictItem/List', params);
  92. return res.data;
  93. }
  94. export async function fetchSaveDictItem(params: object): Promise<SuccessRes> {
  95. const res = await instance.post('/api/DictItem/Save', params);
  96. return res.data;
  97. }
  98. export async function fetchDeleteDictItem(params: object): Promise<SuccessRes> {
  99. const res = await instance.post('/api/DictItem/Delete', params);
  100. return res.data;
  101. }