diff --git a/src/api/modules/auth/client.ts b/src/api/modules/auth/client.ts new file mode 100644 index 0000000000000000000000000000000000000000..844c9a9e582962cc51e45c86d0811a059baaad59 --- /dev/null +++ b/src/api/modules/auth/client.ts @@ -0,0 +1,24 @@ +import axios from "axios"; +import { ExampleClient } from "@/types/modules/auth"; + +const contentPath = '/auth/client' + +export function create(client: ExampleClient) { + return axios.post(`${contentPath}`, client) +} + +export function update(client: ExampleClient) { + return axios.put(`${contentPath}`, client) +} + +export function deleteById(id: string) { + return axios.delete(`${contentPath}/${id}`) +} + +export function findById(id: string) { + return axios.get(`${contentPath}/${id}`) +} + +export function findList() { + return axios.get(`${contentPath}/list`) +} diff --git a/src/api/modules/auth/oauth.ts b/src/api/modules/auth/oauth.ts index 8579d067511583e4f375b5d3bccd4d0d2d561c71..dce964e4e4a4974f0e57e801e89b98a7423c419c 100644 --- a/src/api/modules/auth/oauth.ts +++ b/src/api/modules/auth/oauth.ts @@ -3,7 +3,6 @@ import qs from "query-string"; import { grantTypes, client } from '@/config/website.json' import type { LoginData, OAuth2AccessToken, UserToken } from '@/types/modules/auth' import { Pageable, Pagination } from '@/types/global' -import { ExampleClient } from "@/types/modules/auth"; const contentPath = '/auth/oauth' @@ -40,23 +39,3 @@ export function tokenWithPagination(pageable: Pageable) { } }) } - -export function createClient(client: ExampleClient) { - return axios.post(`${contentPath}/client`, client) -} - -export function updateClient(client: ExampleClient) { - return axios.put(`${contentPath}/client`, client) -} - -export function deleteClientById(id: string) { - return axios.delete(`${contentPath}/client/${id}`) -} - -export function findClientById(id: string) { - return axios.get(`${contentPath}/client/${id}`) -} - -export function findClientList() { - return axios.get(`${contentPath}/client/list`) -} diff --git a/src/api/modules/system/dict.ts b/src/api/modules/system/dict.ts new file mode 100644 index 0000000000000000000000000000000000000000..2775dc648fc5c8568578ca8c1d9c6236dde71902 --- /dev/null +++ b/src/api/modules/system/dict.ts @@ -0,0 +1,38 @@ +import axios from "axios"; +import { Pageable, Pagination } from '@/types/global' +import { DictDto, DictItemVo, DictQry, DictVo } from '@/types/modules/system' + +const contentPath = '/system/dict' + +export function create(dictDto: DictDto) { + return axios.post(`${contentPath}`, dictDto) +} + +export function addItem(id: number, dictItemDto: DictItemVo) { + return axios.post(`${contentPath}/${id}/item`, dictItemDto) +} + +export function update(dictDto: DictDto) { + return axios.put(`${contentPath}`, dictDto) +} + +export function deleteById(id: number) { + return axios.delete(`${contentPath}/${id}`) +} + +export function findById(id: number) { + return axios.get(`${contentPath}/${id}`) +} + +export function listWithPagination(pageable: Pageable, qry: DictQry) { + return axios.get>(`${contentPath}/pagination`, { + params: { + ...pageable, + ...qry + } + }) +} + +export function findAllItemByDictId(id: number) { + return axios.get(`${contentPath}/${id}/item`) +} diff --git a/src/types/modules/system.ts b/src/types/modules/system.ts index 7ed6dee76aa483c098dc7afc4f3fa8625328a262..0e7ebdbddff6f2b27b3149bf88e29846e17f73ba 100644 --- a/src/types/modules/system.ts +++ b/src/types/modules/system.ts @@ -145,3 +145,35 @@ export interface DeptVo { createTime?: number updateTime?: number } + +export interface DictDto { + id: number + name: string + code: string +} + +export interface DictVo { + id: number + name: string + code: string + createTime: string + updateTime: string +} + +export interface DictQry { + name: string + code: string +} + +export interface DictItemVo { + id: number + dictId: number + name: string + value: string +} +export interface DictItemDto { + id: number + dictId: number + name: string + value: string +} diff --git a/src/views/system/client/components/client-drawer.vue b/src/views/system/client/components/client-drawer.vue index 54d4bc385da1a1df7670ab0eaf21874cf588bfd3..54afc0a6f0240832b8b39387df682e733e8d1e63 100644 --- a/src/views/system/client/components/client-drawer.vue +++ b/src/views/system/client/components/client-drawer.vue @@ -82,8 +82,8 @@ import useLoading from "@/hooks/loading"; import { Operation } from "@/types/global"; import { ExampleClient } from "@/types/modules/auth"; import { ValidatedError } from "@arco-design/web-vue/es/form/interface"; -import { createClient, findClientById, updateClient } from "@/api/modules/auth/oauth"; import { Message } from "@arco-design/web-vue"; +import { create, findById, update } from "@/api/modules/auth/client"; const defaultFormData = () => ({ clientId: undefined, @@ -110,7 +110,7 @@ const createHandle = async () => { } const updateHandle = async (id: string) => { - const { data } = await findClientById(id) + const { data } = await findById(id) formData.value = { ...data } @@ -119,7 +119,7 @@ const updateHandle = async (id: string) => { } const previewHandle = async (id: string) => { - formData.value = (await findClientById(id)).data + formData.value = (await findById(id)).data openModel('预览客户端信息', true, false, Operation.PREVIEW) } @@ -138,13 +138,13 @@ const handleOk = async () => { clientDrawerForm.value?.validate(async (errors: undefined | Record) => { if (!errors) { if (dataModel.type === Operation.CREATE) { - await createClient(formData.value) + await create(formData.value) Message.success({ content: "添加成功", duration: 2000 }); } else if (dataModel.type === Operation.UPDATE) { - await updateClient(formData.value) + await update(formData.value) Message.success({ content: "修改成功", duration: 2000 diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index fcced1fd7a9339293dd8ccab6169b73d96a0df1c..093df46b2b87f7f12d3c44fe050847cadc065dec 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -43,7 +43,7 @@ import { onMounted, ref } from "vue"; // eslint-disable-next-line @typescript-eslint/no-unused-vars import ClientDrawer from "@/views/system/client/components/client-drawer.vue"; import useLoading from "@/hooks/loading"; -import { deleteClientById, findClientList } from "@/api/modules/auth/oauth"; +import { deleteById, findList } from "@/api/modules/auth/client"; import { ExampleClient } from "@/types/modules/auth"; const tableColumns = [{ @@ -118,14 +118,14 @@ const { loading, setLoading } = useLoading(); const refresh = async () => { setLoading(true) - tbData.value = (await findClientList()).data + tbData.value = (await findList()).data setLoading(false) } const onDelete = async (clientId: string) => { try { setLoading(true) - await deleteClientById(clientId) + await deleteById(clientId) setLoading(false) } finally { await refresh() diff --git a/src/views/system/dict/components/dict-drawer.vue b/src/views/system/dict/components/dict-drawer.vue new file mode 100644 index 0000000000000000000000000000000000000000..736721a2cdb58997cfa498d1272ad15f776c3f53 --- /dev/null +++ b/src/views/system/dict/components/dict-drawer.vue @@ -0,0 +1,129 @@ + + + + + + + diff --git a/src/views/system/dict/components/dict-item-drawer.vue b/src/views/system/dict/components/dict-item-drawer.vue new file mode 100644 index 0000000000000000000000000000000000000000..53a548c9313ce178ba1f6f29d8a7ee394d9c5014 --- /dev/null +++ b/src/views/system/dict/components/dict-item-drawer.vue @@ -0,0 +1,117 @@ + + + + + + + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..34c7285e346c22fa96658ee13746d683f01a5619 --- /dev/null +++ b/src/views/system/dict/index.vue @@ -0,0 +1,233 @@ + + + + + + + diff --git a/src/views/system/role/components/role-drawer.vue b/src/views/system/role/components/role-drawer.vue index 908b9281be1c7d2d70f50237fb42b37d98af555a..90e6646db1f09fc7b198dc516101d81c46852e75 100644 --- a/src/views/system/role/components/role-drawer.vue +++ b/src/views/system/role/components/role-drawer.vue @@ -47,9 +47,7 @@ import { Operation } from "@/types/global"; const defaultFormData = () => ({ id: -1, name: "", - code: "", - parentId: 0, - order: 1 + code: "" }); const formData = ref(defaultFormData());