feat: 电子签全场景集成+场景筛选+设置开关

- ESignRecord 模型新增 scene 字段(CONTRACT/RESIGNATION/POLICY/PAYSLIP/ONBOARDING)
- Organization 模型新增3个电子签开关:esignPolicyEnabled/esignPayslipEnabled/esignOnboardingEnabled
- 设置页面企业信息新增电子签署设置区域,3个开关各自独立,缺省关闭
- 规章制度签收:开启电子签后,员工阅读确认时自动创建POLICY场景签署记录
- 工资条确认:开启电子签后,员工确认工资条时自动创建PAYSLIP场景签署记录
- 入职文件签署:开启电子签后,HR审批通过入职流程时自动创建ONBOARDING场景签署记录
- 电子签署列表增加场景筛选下拉(全部场景/劳动合同/离职协议/规章制度/工资条/入职文件)
- 管理端和员工端列表均展示场景标签(基于scene字段,替代硬编码判断)
- 合同和离职流程的esign调用已加scene参数
This commit is contained in:
freedakgmail
2026-08-05 07:47:00 +08:00
parent e8cd0f472b
commit 9512b555ee
11 changed files with 153 additions and 16 deletions
+21 -7
View File
@@ -19,9 +19,18 @@ const STATUS_CONFIG: Record<string, { label: string; color: string }> = {
CANCELLED: { label: '已取消', color: 'bg-gray-100 text-gray-500' },
}
const SCENE_CONFIG: Record<string, { label: string; color: string }> = {
CONTRACT: { label: '劳动合同', color: 'bg-blue-50 text-blue-600 border border-blue-200' },
RESIGNATION: { label: '离职协议', color: 'bg-orange-50 text-orange-600 border border-orange-200' },
POLICY: { label: '规章制度', color: 'bg-amber-50 text-amber-600 border border-amber-200' },
PAYSLIP: { label: '工资条', color: 'bg-emerald-50 text-emerald-600 border border-emerald-200' },
ONBOARDING: { label: '入职文件', color: 'bg-purple-50 text-purple-600 border border-purple-200' },
}
export default function ESign() {
const queryClient = useQueryClient()
const [filterStatus, setFilterStatus] = useState('')
const [filterScene, setFilterScene] = useState('')
const [showCreate, setShowCreate] = useState(false)
const [formData, setFormData] = useState({
employeeId: '',
@@ -30,9 +39,9 @@ export default function ESign() {
})
const { data: records = [], isLoading } = useQuery<any[]>({
queryKey: ['esign-records', filterStatus],
queryKey: ['esign-records', filterStatus, filterScene],
queryFn: async () => {
return await esignApi.list(filterStatus || undefined)
return await esignApi.list({ status: filterStatus || undefined, scene: filterScene || undefined })
},
})
@@ -114,6 +123,14 @@ export default function ESign() {
<option value=""></option>
{Object.entries(STATUS_CONFIG).map(([k, v]) => <option key={k} value={k}>{v.label}</option>)}
</select>
<select
value={filterScene}
onChange={(e) => setFilterScene(e.target.value)}
className="h-9 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-700 shadow-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10"
>
<option value=""></option>
{Object.entries(SCENE_CONFIG).map(([k, v]) => <option key={k} value={k}>{v.label}</option>)}
</select>
</div>
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus className="w-4 h-4 mr-1" />
@@ -149,11 +166,8 @@ export default function ESign() {
<div className="flex items-center gap-1.5">
<FileText className="w-3.5 h-3.5 text-gray-400 shrink-0" />
<span className="font-medium truncate max-w-[200px]">{r.documentTitle}</span>
{r.contractId && (
<span className="px-1.5 py-0.5 rounded text-xs bg-blue-50 text-blue-600 border border-blue-200 shrink-0"></span>
)}
{!r.contractId && r.documentTitle?.includes('离职') && (
<span className="px-1.5 py-0.5 rounded text-xs bg-orange-50 text-orange-600 border border-orange-200 shrink-0"></span>
{r.scene && SCENE_CONFIG[r.scene] && (
<span className={`px-1.5 py-0.5 rounded text-xs shrink-0 ${SCENE_CONFIG[r.scene].color}`}>{SCENE_CONFIG[r.scene].label}</span>
)}
</div>
{r.remark && <div className="text-xs text-gray-400 mt-0.5">{r.remark}</div>}