Customize user account exports

This commit is contained in:
biss committed 2026-11-22 21:27:55 +08:00
1 parent 1f48660d49
commit bce04b768c
2 files changed
+25 -3

No files matched your search

+13 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import CustomExportDialog from "../components/CustomExportDialog.vue";
import { useI18n } from "vue-i18n";
import { getDisplayLocale } from "../i18n";
const { t, te } = useI18n();
@@ -202,7 +203,14 @@ async function downloadTemplate() {
}
}
async function exportRows() {
const exportDialog = ref<InstanceType<typeof CustomExportDialog>>();
async function openExportDialog() {
try {
const { data } = await http.get<string[]>("/users/export-columns");
exportDialog.value?.open(data, t("usersBatch.usersAndPermissionsXlsx"));
} catch (error) { ElMessage.error(apiErrorMessage(error)); }
}
async function exportRows(columns: number[], filename: string, format: string) {
try {
await downloadApiFile(
"/users/export",
@@ -214,8 +222,10 @@ async function exportRows() {
collegeId: collegeFilter.value,
isEnabled: enabledFilter.value,
hasLoggedIn: loginFilter.value,
columns: columns.join(","), format,
},
},
filename,
);
ElMessage.success(t("usersBatch.usersAndPermissionsExported"));
} catch (error) {
@@ -646,7 +656,7 @@ onMounted(load);
@click="chooseImportFile"
>{{ t("courses.excelImport") }}</el-button
>
<el-button :icon="Download" @click="exportRows">{{
<el-button :icon="Download" @click="openExportDialog">{{
t("businessLabels.exportAll")
}}</el-button>
<input
@@ -1044,6 +1054,7 @@ onMounted(load);
</template>
</el-dialog>
</div>
<CustomExportDialog ref="exportDialog" @export="exportRows" />
</template>
<style scoped>