diff --git a/src/api/service/Api.ts b/src/api/service/Api.ts index 9a4ef07..5692535 100644 --- a/src/api/service/Api.ts +++ b/src/api/service/Api.ts @@ -73,8 +73,35 @@ export interface User { * @example "example@mail.com" */ email: string; - /** 用户角色ID */ + /** 角色ID数组 */ roleIds: number[]; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface UpdateUserDto { @@ -136,6 +163,33 @@ export interface Permission { * @example "文章列表" */ description: string; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface CreateRoleDto { @@ -210,6 +264,33 @@ export interface LoginLog { * @example "windows 10" */ os: string; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface UpdateLogDto { @@ -287,6 +368,33 @@ export interface Upload { * @example ".jpg" */ extension: string; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface CreatePostDto { @@ -319,6 +427,33 @@ export interface Post { * @example "文章作者" */ author: User; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface UpdatePostDto { @@ -404,6 +539,33 @@ export interface Category { * @example 0 */ parentId?: number; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface UpdateCategoryDto { @@ -504,7 +666,37 @@ export interface Menu { * @example 1 */ type: number; + /** 父级ID */ parentId: number; + /** 子项数组 */ + children: Menu[]; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; } export interface UpdateMenuDto { @@ -540,6 +732,166 @@ export interface UpdateMenuDto { type?: number; } +export interface CreateDictTypeDto { + /** + * 类型名称 + * @example "性别" + */ + name: string; + /** + * 标识 + * @example "gender" + */ + code: string; + /** 描述 */ + description: string; +} + +export interface DictType { + /** + * 类型名称 + * @example "性别" + */ + name: string; + /** + * 标识 + * @example "gender" + */ + code: string; + /** + * 状态 + * @example true + */ + status: boolean; + /** 描述 */ + description: string; + /** 字典数组 */ + dicts: Dict[]; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; +} + +export interface Dict { + /** + * 类型名称 + * @example "性别" + */ + name: string; + /** + * 标识 + * @example "gender" + */ + code: string; + /** + * 状态 + * @example true + */ + status: boolean; + /** 描述 */ + description: string; + /** 字段类型 */ + type: DictType; + /** + * 自增ID + * @example 1 + */ + id: number; + /** + * 创建时间 + * @format date-time + * @example "2022-01-01 10:10:10" + */ + createdAt: string; + /** + * 创建人 + * @example "绝弹" + */ + createdBy: string; + /** + * 更新时间 + * @format date-time + * @example "2022-01-02 11:11:11" + */ + updatedAt: string; + /** + * 更新人 + * @example "绝弹" + */ + updatedBy: string; +} + +export interface UpdateDictTypeDto { + id: number; + /** + * 类型名称 + * @example "性别" + */ + name?: string; + /** + * 标识 + * @example "gender" + */ + code?: string; + /** 描述 */ + description?: string; +} + +export interface CreateDictDto { + /** + * 类型名称 + * @example "性别" + */ + name: string; + /** + * 标识 + * @example "gender" + */ + code: string; + /** 描述 */ + description: string; +} + +export interface UpdateDictDto { + id: number; + /** + * 类型名称 + * @example "性别" + */ + name?: string; + /** + * 标识 + * @example "gender" + */ + code?: string; + /** 描述 */ + description?: string; +} + export interface Response { /** * 状态码 @@ -741,6 +1093,70 @@ export interface GetMenusParams { createdFrom?: string; } +export interface GetDictTypesParams { + /** + * 字段描述(Swagger用途) + * @example "示例值" + */ + demo?: string; + /** + * 排序规则 + * @default "id:desc" + * @pattern /^(\w+:\w+,)*\w+:\w+$/ + * @example "id:desc" + */ + sort?: string; + /** + * 页码 + * @min 1 + * @example 1 + */ + page?: number; + /** + * 每页条数 + * @min 0 + * @example 10 + */ + size?: number; + /** + * 创建起始事件 + * @example "2020-02-02 02:02:02" + */ + createdFrom?: string; +} + +export interface GetDictsParams { + /** + * 字段描述(Swagger用途) + * @example "示例值" + */ + demo?: string; + /** + * 排序规则 + * @default "id:desc" + * @pattern /^(\w+:\w+,)*\w+:\w+$/ + * @example "id:desc" + */ + sort?: string; + /** + * 页码 + * @min 1 + * @example 1 + */ + page?: number; + /** + * 每页条数 + * @min 0 + * @example 10 + */ + size?: number; + /** + * 创建起始事件 + * @example "2020-02-02 02:02:02" + */ + createdFrom?: string; +} + export namespace User { /** * @description 添加用户 @@ -1920,7 +2336,293 @@ export namespace Menu { */ export namespace DelMenu { export type RequestParams = { - id: string; + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = Response; + } +} + +export namespace DictType { + /** + * @description 新增字典类型 + * @tags dictType + * @name AddDictType + * @request POST:/api/v1/dictTypes + */ + export namespace AddDictType { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = CreateDictTypeDto; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: number; + }; + } + /** + * @description 查询字典类型 + * @tags dictType + * @name GetDictTypes + * @request GET:/api/v1/dictTypes + */ + export namespace GetDictTypes { + export type RequestParams = {}; + export type RequestQuery = { + /** + * 字段描述(Swagger用途) + * @example "示例值" + */ + demo?: string; + /** + * 排序规则 + * @default "id:desc" + * @pattern /^(\w+:\w+,)*\w+:\w+$/ + * @example "id:desc" + */ + sort?: string; + /** + * 页码 + * @min 1 + * @example 1 + */ + page?: number; + /** + * 每页条数 + * @min 0 + * @example 10 + */ + size?: number; + /** + * 创建起始事件 + * @example "2020-02-02 02:02:02" + */ + createdFrom?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: DictType[]; + }; + } + /** + * @description 获取字典类型 + * @tags dictType + * @name GetDictType + * @request GET:/api/v1/dictTypes/{id} + */ + export namespace GetDictType { + export type RequestParams = { + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: DictType; + }; + } + /** + * @description 更新字典类型 + * @tags dictType + * @name SetDictType + * @request PATCH:/api/v1/dictTypes/{id} + */ + export namespace SetDictType { + export type RequestParams = { + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = UpdateDictTypeDto; + export type RequestHeaders = {}; + export type ResponseBody = Response; + } + /** + * @description 删除字典类型 + * @tags dictType + * @name DelDictType + * @request DELETE:/api/v1/dictTypes/{id} + */ + export namespace DelDictType { + export type RequestParams = { + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = Response; + } +} + +export namespace Dict { + /** + * @description 新增字典 + * @tags dict + * @name AddDict + * @request POST:/api/v1/dicts + */ + export namespace AddDict { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = CreateDictDto; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: number; + }; + } + /** + * @description 查询字典 + * @tags dict + * @name GetDicts + * @request GET:/api/v1/dicts + */ + export namespace GetDicts { + export type RequestParams = {}; + export type RequestQuery = { + /** + * 字段描述(Swagger用途) + * @example "示例值" + */ + demo?: string; + /** + * 排序规则 + * @default "id:desc" + * @pattern /^(\w+:\w+,)*\w+:\w+$/ + * @example "id:desc" + */ + sort?: string; + /** + * 页码 + * @min 1 + * @example 1 + */ + page?: number; + /** + * 每页条数 + * @min 0 + * @example 10 + */ + size?: number; + /** + * 创建起始事件 + * @example "2020-02-02 02:02:02" + */ + createdFrom?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: Dict[]; + }; + } + /** + * @description 获取字典 + * @tags dict + * @name GetDict + * @request GET:/api/v1/dicts/{id} + */ + export namespace GetDict { + export type RequestParams = { + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: Dict; + }; + } + /** + * @description 更新字典 + * @tags dict + * @name SetDict + * @request PATCH:/api/v1/dicts/{id} + */ + export namespace SetDict { + export type RequestParams = { + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = UpdateDictDto; + export type RequestHeaders = {}; + export type ResponseBody = Response; + } + /** + * @description 删除字典 + * @tags dict + * @name DelDict + * @request DELETE:/api/v1/dicts/{id} + */ + export namespace DelDict { + export type RequestParams = { + id: number; }; export type RequestQuery = {}; export type RequestBody = never; @@ -3258,7 +3960,7 @@ export class Api extends HttpClient { + delMenu: (id: number, params: RequestParams = {}) => { return this.request({ path: `/api/v1/menus/${id}`, method: "DELETE", @@ -3267,4 +3969,272 @@ export class Api extends HttpClient { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: number; + }, + any + >({ + path: `/api/v1/dictTypes`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }); + }, + + /** + * 查询字典类型 + * + * @tags dictType + * @name GetDictTypes + * @request GET:/api/v1/dictTypes + */ + getDictTypes: (query: GetDictTypesParams, params: RequestParams = {}) => { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: DictType[]; + }, + any + >({ + path: `/api/v1/dictTypes`, + method: "GET", + query: query, + format: "json", + ...params, + }); + }, + + /** + * 获取字典类型 + * + * @tags dictType + * @name GetDictType + * @request GET:/api/v1/dictTypes/{id} + */ + getDictType: (id: number, params: RequestParams = {}) => { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: DictType; + }, + any + >({ + path: `/api/v1/dictTypes/${id}`, + method: "GET", + format: "json", + ...params, + }); + }, + + /** + * 更新字典类型 + * + * @tags dictType + * @name SetDictType + * @request PATCH:/api/v1/dictTypes/{id} + */ + setDictType: (id: number, data: UpdateDictTypeDto, params: RequestParams = {}) => { + return this.request({ + path: `/api/v1/dictTypes/${id}`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }); + }, + + /** + * 删除字典类型 + * + * @tags dictType + * @name DelDictType + * @request DELETE:/api/v1/dictTypes/{id} + */ + delDictType: (id: number, params: RequestParams = {}) => { + return this.request({ + path: `/api/v1/dictTypes/${id}`, + method: "DELETE", + format: "json", + ...params, + }); + }, + }; + dict = { + /** + * 新增字典 + * + * @tags dict + * @name AddDict + * @request POST:/api/v1/dicts + */ + addDict: (data: CreateDictDto, params: RequestParams = {}) => { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: number; + }, + any + >({ + path: `/api/v1/dicts`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }); + }, + + /** + * 查询字典 + * + * @tags dict + * @name GetDicts + * @request GET:/api/v1/dicts + */ + getDicts: (query: GetDictsParams, params: RequestParams = {}) => { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: Dict[]; + }, + any + >({ + path: `/api/v1/dicts`, + method: "GET", + query: query, + format: "json", + ...params, + }); + }, + + /** + * 获取字典 + * + * @tags dict + * @name GetDict + * @request GET:/api/v1/dicts/{id} + */ + getDict: (id: number, params: RequestParams = {}) => { + return this.request< + { + /** + * 状态码 + * @format int32 + * @example 2000 + */ + code: number; + /** + * 提示信息 + * @example "请求成功" + */ + message: string; + data?: Dict; + }, + any + >({ + path: `/api/v1/dicts/${id}`, + method: "GET", + format: "json", + ...params, + }); + }, + + /** + * 更新字典 + * + * @tags dict + * @name SetDict + * @request PATCH:/api/v1/dicts/{id} + */ + setDict: (id: number, data: UpdateDictDto, params: RequestParams = {}) => { + return this.request({ + path: `/api/v1/dicts/${id}`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }); + }, + + /** + * 删除字典 + * + * @tags dict + * @name DelDict + * @request DELETE:/api/v1/dicts/{id} + */ + delDict: (id: number, params: RequestParams = {}) => { + return this.request({ + path: `/api/v1/dicts/${id}`, + method: "DELETE", + format: "json", + ...params, + }); + }, + }; } diff --git a/src/components/breadcrumb/temp.dev1.vue b/src/components/breadcrumb/temp.dev1.vue new file mode 100644 index 0000000..36d8559 --- /dev/null +++ b/src/components/breadcrumb/temp.dev1.vue @@ -0,0 +1,156 @@ + + + + + + + +{ + "meta": { + "sort": 10302, + "title": "菜单管理", + "icon": "icon-park-outline-add-subtract" + } +} + diff --git a/src/components/form/form-modal.tsx b/src/components/form/form-modal.tsx index 9ac0159..24a51f1 100644 --- a/src/components/form/form-modal.tsx +++ b/src/components/form/form-modal.tsx @@ -143,7 +143,7 @@ export const FormModal = defineComponent({ } if (typeof props.trigger === "object") { content = ( - ); diff --git a/src/pages/dev/openapi.vue b/src/pages/dev/openapi.vue index 2f96ac9..68a4fc4 100644 --- a/src/pages/dev/openapi.vue +++ b/src/pages/dev/openapi.vue @@ -1,10 +1,12 @@ diff --git a/src/dd.json b/src/pages/my/data.json similarity index 100% rename from src/dd.json rename to src/pages/my/data.json diff --git a/src/pages/my/dev.vue b/src/pages/my/dev.vue index 0bc5579..ffdf2ba 100644 --- a/src/pages/my/dev.vue +++ b/src/pages/my/dev.vue @@ -65,7 +65,7 @@ diff --git a/src/pages/system/dict/components/group.vue b/src/pages/system/dict/components/group.vue index c91f828..8d5f880 100644 --- a/src/pages/system/dict/components/group.vue +++ b/src/pages/system/dict/components/group.vue @@ -1,8 +1,8 @@ - + diff --git a/src/pages/system/dict/index.vue b/src/pages/system/dict/index.vue index daecd76..1cc05ba 100644 --- a/src/pages/system/dict/index.vue +++ b/src/pages/system/dict/index.vue @@ -3,56 +3,125 @@
-
+
- +
-
+ + {{ current?.name }} +
描述:{{ current?.description }}
+
- diff --git a/src/pages/system/menu/index.vue b/src/pages/system/menu/index.vue index faf615c..ac72551 100644 --- a/src/pages/system/menu/index.vue +++ b/src/pages/system/menu/index.vue @@ -18,7 +18,6 @@ const menuArr = flatedMenus.map((i) => ({ label: i.title, value: i.id })); const expanded = ref(false); const toggleExpand = () => { - console.log(menu.tableRef.value); expanded.value = !expanded.value; menu.tableRef.value?.tableRef?.expandAll(expanded.value); }; @@ -64,12 +63,7 @@ const [menuTable, menu] = useAniTable({ {record.name ?? "无"} {id} - - {{ - "checked-icon": () => , - "unchecked-icon": () => , - }} - + ); @@ -102,13 +96,6 @@ const [menuTable, menu] = useAniTable({ }, ], }, - // { - // title: "启用", - // dataIndex: "createdAt", - // width: 80, - // align: "center", - // render: ({ record }) => , - // }, ], search: { items: [ @@ -137,10 +124,9 @@ const [menuTable, menu] = useAniTable({ initial: 0, label: "父级", type: "treeSelect", - async options(arg) { + async options() { const res = await api.menu.getMenus({ size: 0, tree: true }); const data = res.data.data; - console.log(arg); return [ { id: 0, diff --git a/src/types/auto-component.d.ts b/src/types/auto-component.d.ts index ce2c22d..62f3178 100644 --- a/src/types/auto-component.d.ts +++ b/src/types/auto-component.d.ts @@ -17,7 +17,6 @@ declare module '@vue/runtime-core' { ACheckbox: typeof import('@arco-design/web-vue')['Checkbox'] ACheckboxGroup: typeof import('@arco-design/web-vue')['CheckboxGroup'] AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider'] - ADatePicker: typeof import('@arco-design/web-vue')['DatePicker'] ADivider: typeof import('@arco-design/web-vue')['Divider'] ADoption: typeof import('@arco-design/web-vue')['Doption'] ADrawer: typeof import('@arco-design/web-vue')['Drawer'] @@ -68,6 +67,7 @@ declare module '@vue/runtime-core' { Editor: typeof import('./../components/editor/index.vue')['default'] Header: typeof import('./../components/editor/panel-main/components/header.vue')['default'] ImagePicker: typeof import('./../components/editor/components/ImagePicker.vue')['default'] + 'Index.dev1': typeof import('./../components/breadcrumb/index.dev1.vue')['default'] InputColor: typeof import('./../components/editor/components/InputColor.vue')['default'] InputImage: typeof import('./../components/editor/components/InputImage.vue')['default'] Marquee: typeof import('./../components/editor/blocks/text/marquee.vue')['default'] @@ -81,6 +81,7 @@ declare module '@vue/runtime-core' { Render: typeof import('./../components/editor/blocks/date/render.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + 'Temp.dev1': typeof import('./../components/breadcrumb/temp.dev1.vue')['default'] Texter: typeof import('./../components/editor/panel-main/components/texter.vue')['default'] Toast: typeof import('./../components/toast/toast.vue')['default'] } diff --git a/src/utils/listToTree.ts b/src/utils/listToTree.ts index 0a5d328..543411c 100644 --- a/src/utils/listToTree.ts +++ b/src/utils/listToTree.ts @@ -1,3 +1,11 @@ +/** + * 列表转树结构 + * @param list 数组 + * @param id ID key + * @param pid 父级key + * @param cid 子项key + * @returns + */ export const listToTree = (list: any[], id = "id", pid = "parentId", cid = "children") => { const map = list.reduce((res, v) => ((res[v[id]] = v), res), {}); return list.filter((item) => { @@ -10,11 +18,18 @@ export const listToTree = (list: any[], id = "id", pid = "parentId", cid = "chil }); }; -export function treeEach(tree: any[], fn: (item: any) => void) { +/** + * 遍历树结构 + * @param tree 数组 + * @param fn 函数 + * @param before 是否广度遍历 + */ +export function treeEach(tree: any[], fn: (item: any) => void, before = true) { for (const item of tree) { - fn(item); + before && fn(item); if (item.children) { treeEach(item.children, fn); } + !before && fn(item); } }