Procházet zdrojové kódy

修改文件导入内容错误

wyn před 5 měsíci
rodič
revize
0d34c41540
3 změnil soubory, kde provedl 115 přidání a 0 odebrání
  1. 59 0
      src/api/DictData.ts
  2. 55 0
      src/api/DictType.ts
  3. 1 0
      src/components/DictTypeManagement.tsx

+ 59 - 0
src/api/DictData.ts

@@ -0,0 +1,59 @@
+import axiosInstance from '../utils/axios';
+
+// 分页参数类型
+export interface PageParam {
+  pageNo?: number;
+  pageSize?: number;
+  dictType?: string;
+  label?: string;
+  [key: string]: any;
+}
+
+// 分页响应类型
+export interface PageResponse<T> {
+  list: T[];
+  total: number;
+}
+
+// 字典数据 VO 类型
+export interface DictDataVO {
+  id?: number;
+  dictType: string;
+  label: string;
+  value: string;
+  sort: number;
+  status: number;
+  colorType?: string;
+  cssClass?: string;
+  remark?: string;
+  createTime?: Date | string;
+}
+
+// 字典数据管理 API
+export const dictDataApi = {
+  // 查询字典数据分页列表
+  getDictDataPage: (params: PageParam): Promise<PageResponse<DictDataVO>> => {
+    return axiosInstance.get('/system/dict-data/page', { params });
+  },
+
+  // 查询字典数据详情
+  getDictData: (id: number): Promise<DictDataVO> => {
+    return axiosInstance.get(`/system/dict-data/get?id=${id}`);
+  },
+
+  // 新增字典数据
+  createDictData: (data: DictDataVO): Promise<void> => {
+    return axiosInstance.post('/system/dict-data/create', data);
+  },
+
+  // 修改字典数据
+  updateDictData: (data: DictDataVO): Promise<void> => {
+    return axiosInstance.put('/system/dict-data/update', data);
+  },
+
+  // 删除字典数据
+  deleteDictData: (id: number): Promise<void> => {
+    return axiosInstance.delete(`/system/dict-data/delete?id=${id}`);
+  },
+};
+

+ 55 - 0
src/api/DictType.ts

@@ -0,0 +1,55 @@
+import axiosInstance from '../utils/axios';
+
+// 分页参数类型
+export interface PageParam {
+  pageNo?: number;
+  pageSize?: number;
+  name?: string;
+  type?: string;
+  [key: string]: any;
+}
+
+// 分页响应类型
+export interface PageResponse<T> {
+  list: T[];
+  total: number;
+}
+
+// 字典类型 VO 类型
+export interface DictTypeVO {
+  id?: number;
+  name: string;
+  type: string;
+  status: number;
+  remark?: string;
+  createTime?: Date | string;
+}
+
+// 字典类型管理 API
+export const dictTypeApi = {
+  // 查询字典类型分页列表
+  getDictTypePage: (params: PageParam): Promise<PageResponse<DictTypeVO>> => {
+    return axiosInstance.get('/system/dict-type/page', { params });
+  },
+
+  // 查询字典类型详情
+  getDictType: (id: number): Promise<DictTypeVO> => {
+    return axiosInstance.get(`/system/dict-type/get?id=${id}`);
+  },
+
+  // 新增字典类型
+  createDictType: (data: DictTypeVO): Promise<void> => {
+    return axiosInstance.post('/system/dict-type/create', data);
+  },
+
+  // 修改字典类型
+  updateDictType: (data: DictTypeVO): Promise<void> => {
+    return axiosInstance.put('/system/dict-type/update', data);
+  },
+
+  // 删除字典类型
+  deleteDictType: (id: number): Promise<void> => {
+    return axiosInstance.delete(`/system/dict-type/delete?id=${id}`);
+  },
+};
+

+ 1 - 0
src/components/DictTypeManagement.tsx

@@ -14,6 +14,7 @@ import DictDataForm, { DictDataFormRef } from './DictDataForm';
 import type { ColumnsType } from 'antd/es/table';
 import type { ColumnsType } from 'antd/es/table';
 
 
 const { Search: AntSearch } = Input;
 const { Search: AntSearch } = Input;
+const AntButton = Button;
 
 
 export default function DictTypeManagement() {
 export default function DictTypeManagement() {
   const [loading, setLoading] = useState(true);
   const [loading, setLoading] = useState(true);