mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-08 12:57:11 +08:00
refactor: 适配后端部分字典接口变化
This commit is contained in:
@@ -1,29 +1,8 @@
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
const BASE_URL = '/system/common'
|
||||
|
||||
/** @desc 查询部门树 */
|
||||
export function listDeptTree(query: { description: string | unknown }) {
|
||||
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/dept`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询菜单树 */
|
||||
export function listMenuTree(query: { description: string }) {
|
||||
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/menu`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询用户列表 */
|
||||
export function listUserDict(query?: { status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/user`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询角色列表 */
|
||||
export function listRoleDict(query?: { name: string, status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/role`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询字典列表 */
|
||||
export function listCommonDict(code: string) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/${code}`)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import type * as T from './type'
|
||||
import http from '@/utils/http'
|
||||
|
||||
@@ -34,3 +35,8 @@ export function deleteDept(id: string) {
|
||||
export function exportDept(query: T.DeptQuery) {
|
||||
return http.download(`${BASE_URL}/export`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询部门字典树 */
|
||||
export function listDeptDictTree(query: { description: string | unknown }) {
|
||||
return http.get<TreeNodeData[]>(`${BASE_URL}/dict/tree`, query)
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import type * as T from './type'
|
||||
import http from '@/utils/http'
|
||||
|
||||
@@ -34,3 +35,8 @@ export function deleteMenu(id: string) {
|
||||
export function clearMenuCache() {
|
||||
return http.del(`${BASE_URL}/cache`)
|
||||
}
|
||||
|
||||
/** @desc 查询菜单字典树 */
|
||||
export function listMenuDictTree(query: { description: string }) {
|
||||
return http.get<TreeNodeData[]>(`${BASE_URL}/dict/tree`, query)
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import type * as T from './type'
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
export type * from './type'
|
||||
|
||||
@@ -54,3 +55,8 @@ export function unassignFromUsers(userRoleIds: Array<string | number>) {
|
||||
export function listRoleUserId(id: string) {
|
||||
return http.get(`${BASE_URL}/${id}/user/id`)
|
||||
}
|
||||
|
||||
/** @desc 查询角色字典 */
|
||||
export function listRoleDict(query?: { name: string, status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict`, query)
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import type * as T from './type'
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
const BASE_URL = '/system/user'
|
||||
|
||||
@@ -62,3 +63,8 @@ export function resetUserPwd(data: any, id: string) {
|
||||
export function updateUserRole(data: { roleIds: string[] }, id: string) {
|
||||
return http.patch(`${BASE_URL}/${id}/role`, data)
|
||||
}
|
||||
|
||||
/** @desc 查询用户字典 */
|
||||
export function listUserDict(query?: { status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict`, query)
|
||||
}
|
||||
|
@@ -1,13 +1,7 @@
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
const BASE_URL = '/tenant/common'
|
||||
|
||||
/** @desc 查询租户套餐列表 */
|
||||
export function listTenantPackageDict(query?: { description: string, status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/package`, query)
|
||||
}
|
||||
|
||||
/** @desc 根据域名查询租户 ID */
|
||||
export function getTenantIdByDomain(domain: string) {
|
||||
return http.get<string>(`${BASE_URL}/id`, { domain })
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import type * as T from './type'
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
export type * from './type'
|
||||
|
||||
@@ -30,9 +31,9 @@ export function deleteTenantPackage(id: string) {
|
||||
return http.del(`${BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 查询所有套餐 */
|
||||
export function listAllTenantPackage() {
|
||||
return http.get<T.TenantPackageResp[]>(`${BASE_URL}/list`)
|
||||
/** @desc 查询租户套餐字典 */
|
||||
export function listTenantPackageDict(query?: { description: string, status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询套餐菜单 */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ref } from 'vue'
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import { listDeptTree } from '@/apis/system'
|
||||
import { listDeptDictTree } from '@/apis/system'
|
||||
|
||||
/** 部门模块 */
|
||||
export function useDept(options?: { onSuccess?: () => void }) {
|
||||
@@ -10,7 +10,7 @@ export function useDept(options?: { onSuccess?: () => void }) {
|
||||
const getDeptList = async (name?: string) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await listDeptTree({ description: name })
|
||||
const res = await listDeptDictTree({ description: name })
|
||||
deptList.value = res.data
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ref } from 'vue'
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import { listMenuTree } from '@/apis/system'
|
||||
import { listMenuDictTree } from '@/apis/system'
|
||||
import { listTenantPackageMenu } from '@/apis/tenant/package'
|
||||
|
||||
/** 菜单模块 */
|
||||
@@ -11,7 +11,7 @@ export function useMenu(options?: { onSuccess?: () => void }) {
|
||||
const getMenuList = async (name?: string) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await listMenuTree({ description: name })
|
||||
const res = await listMenuDictTree({ description: name })
|
||||
menuList.value = res.data
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user