Skip to content

Commit

Permalink
导出用户信息模板
Browse files Browse the repository at this point in the history
  • Loading branch information
tangllty committed Dec 26, 2023
1 parent b4e406d commit 6fe70d2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/api/system/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ export const exportUser = (queryParams: SysUserQuery) => {
responseType: 'arraybuffer'
})
}

// 导出用户信息模板
export const exportUserTemplate = () => {
return request({
url: '/system/user/export-template',
method: 'get',
responseType: 'arraybuffer'
})
}
22 changes: 21 additions & 1 deletion src/views/system/user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@
:icon="Upload"
@click="handleImport"
>导入</el-button>
<el-dropdown
type="info"
:icon="Upload"
split-button
@click="handleImport"
class="ml-12 mr-12"
>
<el-icon><Upload /></el-icon>导入
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="handleExportTemplate">下载模板</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button
type="warning"
:icon="Download"
Expand Down Expand Up @@ -370,7 +384,7 @@ import { onMounted, reactive, ref, toRefs } from 'vue'
import { FormInstance, FormRules } from 'element-plus'
import { Plus, Edit, Delete, Download, Upload, Search, Refresh } from '@element-plus/icons-vue'
import { getProxy } from '@/utils/getCurrentInstance'
import { listUser, addUser, getUser, getRoleSelect as selectRoleSelect, editUser, changeStatus, deleteUser, deleteUsers, exportUser } from '@/api/system/user'
import { listUser, addUser, getUser, getRoleSelect as selectRoleSelect, editUser, changeStatus, deleteUser, deleteUsers, exportUser, exportUserTemplate } from '@/api/system/user'
import { deptTree as selectDeptTree } from '@/api/system/dept'
import { SysUser, SysUserForm, SysUserQuery } from '@/api/system/user/types'
import DeptTree from './DeptTree.vue'
Expand Down Expand Up @@ -525,6 +539,12 @@ const handleExport = async () => {
proxy.$download(res)
}
// 导出用户信息模板
const handleExportTemplate = async () => {
const res: any = await exportUserTemplate()
proxy.$download(res)
}
// 查询部门树
const getDeptTree = async () => {
const res: any = await selectDeptTree()
Expand Down

0 comments on commit 6fe70d2

Please sign in to comment.