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