diff --git a/src/api/v1/system/power.ts b/src/api/v1/system/power.ts index fd20b39..6b59e12 100644 --- a/src/api/v1/system/power.ts +++ b/src/api/v1/system/power.ts @@ -24,8 +24,8 @@ export const deletePermission = (data: any) => { }; /** 权限---导出权限 */ -export const exportPermission = () => { - return http.request('get', 'permission/file/export', { responseType: 'blob' }); +export const exportPermission = (data: any) => { + return http.request('get', 'permission/file/export', { params: data }, { responseType: 'blob' }); }; /** 权限---导入权限权限 */ diff --git a/src/store/system/power.ts b/src/store/system/power.ts index 59288b7..bae7922 100644 --- a/src/store/system/power.ts +++ b/src/store/system/power.ts @@ -83,8 +83,8 @@ export const usePermissionStore = defineStore('PermissionStore', { }, /* 使用Excel导出权限 */ - async downloadPermissionByFile() { - const result = await exportPermission(); + async downloadPermissionByFile(data: any) { + const result = await exportPermission(data); downloadBlob(result, 'role.zip'); }, diff --git a/src/views/system/permission/index.vue b/src/views/system/permission/index.vue index e02d5ec..4c172be 100644 --- a/src/views/system/permission/index.vue +++ b/src/views/system/permission/index.vue @@ -55,12 +55,12 @@ const resetForm = async (formEl: FormInstance) => { }; /* 导出权限 */ -const downloadPermission = () => { - powerStore.downloadPermissionByFile(); +const downloadPermission = (type: string) => { + powerStore.downloadPermissionByFile({ type }); }; /* 导入权限 */ -const uploadPermission = async () => { +const uploadPermission = async (type: string) => { addDialog({ title: `${$t('modify')}${$t('role')}`, width: '30%', @@ -74,7 +74,7 @@ const uploadPermission = async () => { formRef.value.formRef.validate(async (valid: any) => { if (!valid) return; // 更新文件 data - const data = { file: form.file[0].raw }; + const data = { file: form.file[0].raw, type }; const result = await powerStore.uploadPermissionByFile(data); if (!result) return; @@ -125,14 +125,29 @@ onMounted(() => { @refresh="onSearch" >