取消新增/Excel 导入档案时自动创建账号。

取消修改人员档案时同步登录账号。
Excel 人员模板恢复为不含“初始密码”。
登录页新增“学生首次登录?自助激活账号”入口。
公开激活地址:http://127.0.0.1:5255/activate
This commit is contained in:
2026-07-25 07:55:49 +08:00 Unverified
parent 27c3944c28
commit 30c15f89e5
11 changed files with 434 additions and 287 deletions
+4 -34
View File
@@ -113,7 +113,6 @@ function resetForm(row?: any) {
phone: '',
email: '',
notes: '',
initialPassword: '',
}, row ?? {})
} else {
const currentYear = new Date().getFullYear()
@@ -129,7 +128,6 @@ function resetForm(row?: any) {
phone: '',
email: '',
notes: '',
initialPassword: '',
}, row ?? {})
}
}
@@ -268,22 +266,11 @@ async function save() {
ElMessage.warning(`请填写${numberLabel.value}和姓名。`)
return
}
if ((!editingId.value || !form.userId) && String(form.initialPassword ?? '').length < 8) {
ElMessage.warning('请设置至少 8 位初始密码,系统会同时创建同号登录账号。')
return
}
try {
const path = `/personnel/${active.value}`
const payload = { ...form }
if (editingId.value && form.userId) {
delete payload.initialPassword
}
if (editingId.value) {
await http.put(`${path}/${editingId.value}`, payload)
} else {
await http.post(path, payload)
}
ElMessage.success(editingId.value ? '档案与登录账号已同步' : '档案和同号登录账号已建立')
if (editingId.value) await http.put(`${path}/${editingId.value}`, form)
else await http.post(path, form)
ElMessage.success(editingId.value ? '档案已更新' : '档案已建立')
dialogVisible.value = false
await load()
} catch (error) {
@@ -423,7 +410,7 @@ watch(active, async () => {
<el-table-column label="登录账号" width="105">
<template #default="{ row }">
<span class="table-status" :class="{ off: !row.userId }">
{{ row.userId ? '已开通' : '未开通' }}
{{ row.userId ? '已激活' : '未激活' }}
</span>
</template>
</el-table-column>
@@ -521,23 +508,6 @@ watch(active, async () => {
<el-form-item label="电子邮箱"><el-input v-model="form.email" /></el-form-item>
</div>
<el-form-item label="备注"><el-input v-model="form.notes" type="textarea" :rows="3" /></el-form-item>
<el-alert
v-if="!editingId || !form.userId"
type="info"
:closable="false"
:title="editingId
? '该历史档案尚未开通账号,本次保存会以工号或学号补建登录账号。'
: '保存档案后,系统会以工号或学号作为登录账号,并自动分配对应角色。'"
/>
<el-form-item v-if="!editingId || !form.userId" label="初始密码" required>
<el-input
v-model="form.initialPassword"
type="password"
show-password
autocomplete="new-password"
placeholder="至少 8 位,仅用于创建密码哈希"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>