|
@@ -15,15 +15,19 @@
|
|
clearable
|
|
clearable
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="状态">
|
|
|
|
|
|
+ <el-form-item label="来源">
|
|
<el-select
|
|
<el-select
|
|
- v-model="searchModel.enable"
|
|
|
|
- placeholder="请选择状态"
|
|
|
|
|
|
+ v-model="searchModel.source"
|
|
|
|
+ placeholder="请选择来源"
|
|
clearable
|
|
clearable
|
|
- style="width: 100px"
|
|
|
|
|
|
+ style="width: 120px"
|
|
>
|
|
>
|
|
- <el-option label="启用" :value="true" />
|
|
|
|
- <el-option label="禁用" :value="false" />
|
|
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(val, key) in USER_SOURCE"
|
|
|
|
+ :key="key"
|
|
|
|
+ :label="val"
|
|
|
|
+ :value="key"
|
|
|
|
+ />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="角色">
|
|
<el-form-item label="角色">
|
|
@@ -41,6 +45,17 @@
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="状态">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="searchModel.enable"
|
|
|
|
+ placeholder="请选择状态"
|
|
|
|
+ clearable
|
|
|
|
+ style="width: 120px"
|
|
|
|
+ >
|
|
|
|
+ <el-option label="启用" :value="true" />
|
|
|
|
+ <el-option label="禁用" :value="false" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-space wrap>
|
|
<el-space wrap>
|
|
<el-button type="primary" @click="toPage(1)">查询</el-button>
|
|
<el-button type="primary" @click="toPage(1)">查询</el-button>
|
|
@@ -69,11 +84,11 @@
|
|
</el-button>
|
|
</el-button>
|
|
<template #dropdown>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-menu>
|
|
- <el-dropdown-item command="kzz">导出</el-dropdown-item>
|
|
|
|
- <el-dropdown-item command="fhy"
|
|
|
|
|
|
+ <el-dropdown-item command="exportUser">导出</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item command="exportUserByExam"
|
|
>按考试导出全部</el-dropdown-item
|
|
>按考试导出全部</el-dropdown-item
|
|
>
|
|
>
|
|
- <el-dropdown-item command="fhy"
|
|
|
|
|
|
+ <el-dropdown-item command="exportUserBySubject"
|
|
>按考试导出科目拆分表</el-dropdown-item
|
|
>按考试导出科目拆分表</el-dropdown-item
|
|
>
|
|
>
|
|
</el-dropdown-menu>
|
|
</el-dropdown-menu>
|
|
@@ -117,10 +132,14 @@
|
|
<el-table-column prop="loginName" label="登录名" />
|
|
<el-table-column prop="loginName" label="登录名" />
|
|
<el-table-column prop="name" label="名称" />
|
|
<el-table-column prop="name" label="名称" />
|
|
<el-table-column prop="employeeId" label="工号" />
|
|
<el-table-column prop="employeeId" label="工号" />
|
|
- <el-table-column prop="source" label="来源" />
|
|
|
|
|
|
+ <el-table-column prop="source" label="来源">
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
+ {{ dictFilter.userSource(row.source) }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column prop="role" label="角色">
|
|
<el-table-column prop="role" label="角色">
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
- {{ formatRole(row.role) }}
|
|
|
|
|
|
+ {{ dictFilter.role(row.role) }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="enable" label="状态">
|
|
<el-table-column prop="enable" label="状态">
|
|
@@ -161,19 +180,25 @@
|
|
<!-- 导入用户 -->
|
|
<!-- 导入用户 -->
|
|
<ImportDialog
|
|
<ImportDialog
|
|
ref="importUserDialogRef"
|
|
ref="importUserDialogRef"
|
|
- title="导入用户"
|
|
|
|
|
|
+ :title="importData.isHeader ? '导入科组长' : '导入复核员'"
|
|
upload-url="/api/admin/site/import"
|
|
upload-url="/api/admin/site/import"
|
|
|
|
+ :upload-data="importData"
|
|
:format="['xls', 'xlsx']"
|
|
:format="['xls', 'xlsx']"
|
|
- :download-handle="downloadTemplate"
|
|
|
|
- download-filename="用户导入模板.xlsx"
|
|
|
|
|
|
+ :download-handle="
|
|
|
|
+ () =>
|
|
|
|
+ downloadExport('headerInspectorTemplate', {
|
|
|
|
+ isHeader: importData.isHeader,
|
|
|
|
+ })
|
|
|
|
+ "
|
|
|
|
+ download-filename="导入模板.xlsx"
|
|
/>
|
|
/>
|
|
<!-- 导入班级评卷员 -->
|
|
<!-- 导入班级评卷员 -->
|
|
<ImportDialog
|
|
<ImportDialog
|
|
ref="importMarkerDialogRef"
|
|
ref="importMarkerDialogRef"
|
|
title="导入班级评卷员"
|
|
title="导入班级评卷员"
|
|
- upload-url="/api/admin/site/import"
|
|
|
|
|
|
+ upload-url="/api/admin/user/class/import"
|
|
:format="['xls', 'xlsx']"
|
|
:format="['xls', 'xlsx']"
|
|
- :download-handle="downloadTemplate"
|
|
|
|
|
|
+ :download-handle="() => downloadExport('markerClassTemplate')"
|
|
download-filename="导入班级评卷员模板.xlsx"
|
|
download-filename="导入班级评卷员模板.xlsx"
|
|
/>
|
|
/>
|
|
|
|
|
|
@@ -189,7 +214,9 @@
|
|
import type { UserItem, UserListFilter } from '@/api/types/user';
|
|
import type { UserItem, UserListFilter } from '@/api/types/user';
|
|
import useTable from '@/hooks/table';
|
|
import useTable from '@/hooks/table';
|
|
import { modalConfirm } from '@/utils/ui';
|
|
import { modalConfirm } from '@/utils/ui';
|
|
- import { ROLE_TYPE } from '@/constants/enumerate';
|
|
|
|
|
|
+ import { dictFilter } from '@/utils/filter';
|
|
|
|
+ import { ROLE_TYPE, USER_SOURCE } from '@/constants/enumerate';
|
|
|
|
+ import { downloadExport } from '@/utils/download-export';
|
|
|
|
|
|
import ModifyUser from './ModifyUser.vue'; // 引入弹窗组件
|
|
import ModifyUser from './ModifyUser.vue'; // 引入弹窗组件
|
|
import BatchCreateUserDialog from './components/BatchCreateUserDialog.vue';
|
|
import BatchCreateUserDialog from './components/BatchCreateUserDialog.vue';
|
|
@@ -248,8 +275,7 @@
|
|
if (!confirm) return;
|
|
if (!confirm) return;
|
|
|
|
|
|
try {
|
|
try {
|
|
- // 调用重置密码接口,不传递新密码,由后端处理
|
|
|
|
- await resetUserPassword({ ids: [row.id] });
|
|
|
|
|
|
+ await resetUserPassword({ ids: [row.id], password: '123456' });
|
|
ElMessage.success('密码重置成功!');
|
|
ElMessage.success('密码重置成功!');
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('操作失败:', error);
|
|
console.error('操作失败:', error);
|
|
@@ -275,32 +301,15 @@
|
|
// }
|
|
// }
|
|
// };
|
|
// };
|
|
|
|
|
|
- const formatRole = (roleKey: string) => {
|
|
|
|
- const roleMap: Record<string, string> = {
|
|
|
|
- school_admin: '学校管理员',
|
|
|
|
- scanner: '扫描员',
|
|
|
|
- user: '普通用户',
|
|
|
|
- };
|
|
|
|
- return roleMap[roleKey] || roleKey;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
// 导入用户
|
|
// 导入用户
|
|
const importUserDialogRef = ref();
|
|
const importUserDialogRef = ref();
|
|
const importData = reactive({
|
|
const importData = reactive({
|
|
- importType: 'kzz',
|
|
|
|
|
|
+ isHeader: false,
|
|
});
|
|
});
|
|
- const onImportCommand = (command: string) => {
|
|
|
|
- console.log('导入命令:', command);
|
|
|
|
- importData.importType = command;
|
|
|
|
|
|
+ const onImportCommand = (command: 'kzz' | 'fhy') => {
|
|
|
|
+ importData.isHeader = command === 'kzz';
|
|
importUserDialogRef.value?.open();
|
|
importUserDialogRef.value?.open();
|
|
};
|
|
};
|
|
- async function downloadTemplate() {
|
|
|
|
- // const res = await downloadByApi(() => agentTemplate()).catch((e) => {
|
|
|
|
- // Message.error(e || '下载失败,请重新尝试!');
|
|
|
|
- // });
|
|
|
|
- // if (!res) return;
|
|
|
|
- // Message.success('下载成功!');
|
|
|
|
- }
|
|
|
|
|
|
|
|
// 导入班级评卷员
|
|
// 导入班级评卷员
|
|
const importMarkerDialogRef = ref();
|
|
const importMarkerDialogRef = ref();
|
|
@@ -309,8 +318,10 @@
|
|
};
|
|
};
|
|
|
|
|
|
// 导出
|
|
// 导出
|
|
- const onExportCommand = (command: string) => {
|
|
|
|
- console.log('导出命令:', command);
|
|
|
|
|
|
+ const onExportCommand = async (
|
|
|
|
+ command: 'exportUser' | 'exportUserByExam' | 'exportUserBySubject'
|
|
|
|
+ ) => {
|
|
|
|
+ await downloadExport(command);
|
|
};
|
|
};
|
|
|
|
|
|
// 批量启用、禁用
|
|
// 批量启用、禁用
|
|
@@ -355,6 +366,7 @@
|
|
// 调用重置密码接口,不传递新密码,由后端处理
|
|
// 调用重置密码接口,不传递新密码,由后端处理
|
|
await resetUserPassword({
|
|
await resetUserPassword({
|
|
ids: selectedRows.value.map((user) => user.id),
|
|
ids: selectedRows.value.map((user) => user.id),
|
|
|
|
+ password: '123456',
|
|
});
|
|
});
|
|
ElMessage.success('操作成功!');
|
|
ElMessage.success('操作成功!');
|
|
} catch (error) {
|
|
} catch (error) {
|