Industrial-image-management.../src/apis/common/common.ts

48 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-07-02 21:02:18 +08:00
import type { TreeNodeData } from '@arco-design/web-vue'
import http from '@/utils/http'
import type { LabelValueState } from '@/types/global'
import { getDeptTree } from '@/apis/system/dept'
const BASE_URL = '/common'
/** @desc 查询部门树 */
export function listDeptTree(query: { description?: string | unknown }) {
// 兼容旧接口将description映射为deptName
return getDeptTree({ deptName: query.description as string })
}
/** @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[]>(`/role/list`, query)
}
/** @desc 查询字典列表 */
export function listCommonDict(code: string) {
return http.get<LabelValueState[]>(`${BASE_URL}/dict/${code}`)
}
/** @desc 查询系统配置参数 */
export function listSiteOptionDict() {
return http.get<LabelValueState[]>(`${BASE_URL}/dict/option/site`)
}
/** @desc 查询菜单类型列表 */
export function listMenuType() {
return http.get<Record<string, string>[]>(`${BASE_URL}/list/menu-type`)
}
/** @desc 上传文件 */
export function uploadFile(data: FormData) {
return http.post(`${BASE_URL}/file`, data)
}