已完成“组织与权限”优化:

基础数据拆分为:组织机构、学年学期、教学场所。
人员档案拆分为:教师档案、学生档案。
基础数据、教师、学生、用户权限均支持 Excel 模板下载、批量导入和导出。
导入按编码/工号/学号/账号新增或更新;整批校验,失败不写入,限制 2000 条、10 MB。
用户列表新增密码重置,包含双重确认、最低 8 位校验和服务端权限保护。
导入严格执行角色及学院数据范围校验,并保护当前超级管理员账号。
保留旧地址重定向,原有入口不会失效。
This commit is contained in:
2026-07-24 18:12:56 +08:00 Unverified
parent 662aa1051f
commit 022e79c48d
13 changed files with 2133 additions and 59 deletions
+38
View File
@@ -0,0 +1,38 @@
import type { AxiosRequestConfig } from 'axios'
import http from './http'
function responseFileName(header: string | undefined, fallback: string) {
if (!header) return fallback
const encoded = header.match(/filename\*=UTF-8''([^;]+)/i)?.[1]
if (encoded) return decodeURIComponent(encoded)
const plain = header.match(/filename="?([^";]+)"?/i)?.[1]
return plain || fallback
}
export async function downloadApiFile(
path: string,
fallbackName: string,
config?: AxiosRequestConfig,
) {
const response = await http.get(path, {
...config,
responseType: 'blob',
})
const url = URL.createObjectURL(response.data)
const anchor = document.createElement('a')
anchor.href = url
anchor.download = responseFileName(response.headers['content-disposition'], fallbackName)
document.body.appendChild(anchor)
anchor.click()
anchor.remove()
URL.revokeObjectURL(url)
}
export async function importExcel(path: string, file: File) {
const form = new FormData()
form.append('file', file)
return http.post(path, form, {
headers: { 'Content-Type': 'multipart/form-data' },
timeout: 60000,
})
}