新增角色菜单数据导出

This commit is contained in:
不做码农 2023-06-17 16:03:29 +08:00
parent e6508d1a11
commit d1b1575535
2 changed files with 22 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
import { downFile } from '@/utils/request'
// 查询角色列表 // 查询角色列表
export function listRole(query) { export function listRole(query) {
@ -22,7 +23,7 @@ export const addRole = (data) => {
return request({ return request({
url: '/system/role/edit', url: '/system/role/edit',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
@ -73,3 +74,7 @@ export function exportRole(query) {
params: query params: query
}) })
} }
// 导出角色菜单
export async function exportRoleMenu(query) {
await downFile('/system/role/exportRoleMenu', { ...query })
}

View File

@ -70,6 +70,7 @@
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="handleDataScope" icon="circle-check">{{ $t('menu.menuPermi') }}</el-dropdown-item> <el-dropdown-item command="handleDataScope" icon="circle-check">{{ $t('menu.menuPermi') }}</el-dropdown-item>
<el-dropdown-item command="handleAuthUser" icon="user">{{ $t('menu.assignUsers') }}</el-dropdown-item> <el-dropdown-item command="handleAuthUser" icon="user">{{ $t('menu.assignUsers') }}</el-dropdown-item>
<el-dropdown-item command="handleExportMenu" icon="download">导出菜单</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
@ -187,7 +188,7 @@
</template> </template>
<script setup name="role"> <script setup name="role">
import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from '@/api/system/role' import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus, exportRoleMenu } from '@/api/system/role'
import { roleMenuTreeselect } from '@/api/system/menu' import { roleMenuTreeselect } from '@/api/system/menu'
import { treeselect as deptTreeselect, roleDeptTreeselect } from '@/api/system/dept' import { treeselect as deptTreeselect, roleDeptTreeselect } from '@/api/system/dept'
@ -403,6 +404,8 @@ function handleCommand(command, row) {
case 'handleAuthUser': case 'handleAuthUser':
handleAuthUser(row) handleAuthUser(row)
break break
case 'handleExportMenu':
handleExportMenu(row)
default: default:
break break
} }
@ -597,7 +600,18 @@ function handleExport() {
proxy.download(response.data.path) proxy.download(response.data.path)
}) })
} }
//
function handleExportMenu(row) {
proxy.$modal
.confirm('是否确认导出所有角色菜单数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
await exportRoleMenu({ roleId: row.roleId })
})
}
getList() getList()
proxy.getDicts('sys_normal_disable').then((response) => { proxy.getDicts('sys_normal_disable').then((response) => {
statusOptions.value = response.data statusOptions.value = response.data