新增:新增系统管理/部门管理/导出功能(引入 Easy Excel 依赖用于导出 Excel,详情可见 README 介绍。另请注意:测试导出功能时,前端需要关闭 mockjs,否则 responseType 会被 mockjs 设置为 '',导致导出的文件无法打开)

This commit is contained in:
2023-02-06 23:02:23 +08:00
parent 4bde837649
commit ceba8e9e53
30 changed files with 536 additions and 82 deletions

View File

@@ -1,9 +1,9 @@
import axios from 'axios';
import qs from 'query-string';
import { DeptParams } from '@/api/system/dept';
import { DeptParam } from '@/api/system/dept';
import { TreeNodeData } from '@arco-design/web-vue';
export default function listDeptTree(params: DeptParams) {
export default function listDeptTree(params: DeptParam) {
return axios.get<TreeNodeData[]>('/common/tree/dept', {
params,
paramsSerializer: (obj) => {

View File

@@ -17,12 +17,12 @@ export interface DeptRecord {
children?: Array<DeptRecord>,
}
export interface DeptParams {
export interface DeptParam {
deptName?: string;
status?: number;
}
export function listDept(params: DeptParams) {
export function listDept(params: DeptParam) {
return axios.get<DeptRecord[]>(`${BASE_URL}/all`, {
params,
paramsSerializer: (obj) => {
@@ -45,4 +45,14 @@ export function updateDept(req: DeptRecord) {
export function deleteDept(ids: number | Array<number>) {
return axios.delete(`${BASE_URL}/${ids}`);
}
export function exportDept(params: DeptParam) {
return axios.get(`${BASE_URL}/export`, {
params,
paramsSerializer: (obj) => {
return qs.stringify(obj);
},
responseType: 'blob',
});
}