R7E-16E/R7E-16F 高风险操作确认统一

这个提交包含在:
2026-05-15 22:55:00 +08:00
父节点 5c38d810c1
当前提交 bf791d7a67
共修改 18 个文件,包含 979 行新增和 68 行删除
+31 -8
查看文件
@@ -34,6 +34,7 @@ import { fetchEmployeePerformanceTimeline } from "../api/performance";
import { useAuth } from "../auth/AuthContext";
import { hasPermission } from "../auth/permissions";
import { EmployeeAvatar } from "../components/common/EmployeeAvatar";
import { ActionConfirmDialog } from "../components/common/ActionConfirmDialog";
import { PageHeader } from "../components/common/PageHeader";
import { EmployeePerformancePanel } from "../components/people/EmployeePerformancePanel";
import { EmployeeSalaryPanel } from "../components/people/EmployeeSalaryPanel";
@@ -178,6 +179,8 @@ export function EmployeeProfilePage() {
const [trainingForm, setTrainingForm] = useState<TrainingFormState>(buildEmptyTrainingForm());
const [editingCertificateId, setEditingCertificateId] = useState<string | null>(null);
const [certificateForm, setCertificateForm] = useState<CertificateFormState>(buildEmptyCertificateForm());
const [deleteAvatarConfirmOpen, setDeleteAvatarConfirmOpen] = useState(false);
const [deleteContractTarget, setDeleteContractTarget] = useState<EmployeeContract | null>(null);
const [form, setForm] = useState({
title: "",
hireDate: "",
@@ -644,10 +647,7 @@ export function EmployeeProfilePage() {
}
function handleDeleteAvatar() {
if (!window.confirm("确认删除当前头像?")) {
return;
}
deleteAvatarMutation.mutate();
setDeleteAvatarConfirmOpen(true);
}
function handleDeleteContract(contract: EmployeeContract) {
@@ -655,13 +655,11 @@ export function EmployeeProfilePage() {
toast.error("生效中的合同需先终止后再删除");
return;
}
if (!window.confirm(`确认删除合同 ${contract.contractNo}?`)) {
return;
}
deleteContractMutation.mutate(contract.id);
setDeleteContractTarget(contract);
}
return (
<>
<div className="space-y-6">
<PageHeader
title={`${profile.employee.name} 档案`}
@@ -1437,6 +1435,31 @@ export function EmployeeProfilePage() {
) : null}
</Tabs>
</div>
<ActionConfirmDialog
open={deleteAvatarConfirmOpen}
onOpenChange={setDeleteAvatarConfirmOpen}
kind="delete"
targetName="当前头像"
description="删除后个人档案将不再显示当前头像,需要重新上传才能恢复。"
onConfirm={async () => {
deleteAvatarMutation.mutate();
}}
/>
<ActionConfirmDialog
open={Boolean(deleteContractTarget)}
onOpenChange={(open) => {
if (!open) setDeleteContractTarget(null);
}}
kind="delete"
targetName={deleteContractTarget ? `合同 ${deleteContractTarget.contractNo}` : undefined}
description="删除后该合同记录和附件引用将从员工档案中移除,生效中的合同不能删除。"
onConfirm={async () => {
if (deleteContractTarget) {
deleteContractMutation.mutate(deleteContractTarget.id);
}
}}
/>
</>
);
}