fix: 修复前后端编译警告 — 移除未使用变量/导入/函数
前端: - 移除未使用导入: FileText, AlertCircle, RefreshCw, Signal, QrCode, Upload, Save, Bell, History, useMemo, Select - 移除未使用变量/函数: scope, cfg, org, paged, salaryNum, ackColor, resultColor, maxEmployees, compareVersions, showRenewPreview, showEvidence, handleStartDateChange, ResultRow, previewEmployeeId, updateMutation - 修复 vite.config.ts: 安装 @types/node 并配置 tsconfig.node.json - 将未使用参数 req/s 改为 _req/_s 后端: - 移除未使用导入: Request, Response, NextFunction, decrypt, ContractType, ensureDefaultTemplate - 移除未使用变量/常量: scope, cfg, org, orgId(preview), monthNum, TAX_BRACKETS, months, daysBetween - 将未使用参数 req 改为 _req
This commit is contained in:
@@ -207,7 +207,6 @@ async function main() {
|
||||
console.log('\n生成 1-6 月历史工资条...')
|
||||
const socialConfig = await prisma.socialInsuranceConfig.findFirst({ where: { orgId: org.id, isCurrent: true } })
|
||||
const allEmployees = await prisma.employee.findMany({ where: { orgId: org.id } })
|
||||
const months = ['2026-01', '2026-02', '2026-03', '2026-04', '2026-05', '2026-06']
|
||||
|
||||
for (const emp of allEmployees) {
|
||||
// 跳过 2026 年之后入职的员工
|
||||
|
||||
@@ -188,7 +188,6 @@ router.post('/case-to-todo', authMiddleware, async (req: AuthRequest, res, next)
|
||||
|
||||
router.get('/predict', authMiddleware, async (req: AuthRequest, res, next) => {
|
||||
try {
|
||||
const scope = (req.query.scope as string) || 'all'
|
||||
const department = req.query.department as string
|
||||
const employeeId = req.query.employeeId as string
|
||||
const riskType = req.query.riskType as string
|
||||
@@ -339,7 +338,7 @@ router.get('/review/employee/:employeeId', authMiddleware, async (req: AuthReque
|
||||
})
|
||||
|
||||
// RAG 知识库管理
|
||||
router.post('/rag/seed', authMiddleware, async (req: AuthRequest, res, next) => {
|
||||
router.post('/rag/seed', authMiddleware, async (_req: AuthRequest, res, next) => {
|
||||
try {
|
||||
await seedKnowledgeBase()
|
||||
res.json({ success: true, data: { message: '知识库初始化完成' } })
|
||||
|
||||
@@ -88,7 +88,6 @@ function num(v: any): number {
|
||||
router.post('/excel/preview', authMiddleware, upload.single('file'), async (req: AuthRequest, res: Response, next) => {
|
||||
try {
|
||||
if (!req.file) return res.status(400).json({ success: false, error: { code: 'BAD_REQUEST', message: '请上传文件' } })
|
||||
const orgId = req.user!.orgId
|
||||
|
||||
const wb = XLSX.read(req.file.buffer, { type: 'buffer', cellDates: true })
|
||||
const preview: any = { employees: [], contracts: [], overtime: [], disciplinary: [], attendance: [], errors: [] as any[] }
|
||||
@@ -385,7 +384,7 @@ router.post('/excel', authMiddleware, upload.single('file'), async (req: AuthReq
|
||||
}
|
||||
})
|
||||
|
||||
router.get('/template', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
router.get('/template', authMiddleware, async (_req: AuthRequest, res: Response) => {
|
||||
const wb = XLSX.utils.book_new()
|
||||
|
||||
const empData = [
|
||||
@@ -582,7 +581,7 @@ router.post('/monthly', authMiddleware, upload.single('file'), async (req: AuthR
|
||||
}
|
||||
})
|
||||
|
||||
router.get('/monthly-template', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
router.get('/monthly-template', authMiddleware, async (_req: AuthRequest, res: Response) => {
|
||||
const wb = XLSX.utils.book_new()
|
||||
|
||||
const attData = [{ '姓名': '张三', '身份证号': '110101199001011234', '日期': '2024-06-01', '考勤状态': '正常', '上班时间': '09:00', '下班时间': '18:00', '备注': '' }]
|
||||
|
||||
@@ -427,7 +427,6 @@ router.post('/overtime/import-to-batch/:batchId', async (req: AuthRequest, res:
|
||||
// 获取加班费计算规则
|
||||
let config = await prisma.overtimeConfig.findUnique({ where: { orgId } })
|
||||
if (!config) config = await prisma.overtimeConfig.create({ data: { orgId } })
|
||||
const cfg = config
|
||||
|
||||
// 获取该月未关联批次的加班记录
|
||||
const overtimeRecords = await prisma.overtimeRecord.findMany({
|
||||
|
||||
@@ -4,7 +4,6 @@ import { authMiddleware, AuthRequest } from '../middleware/auth'
|
||||
import { z } from 'zod'
|
||||
import { decrypt } from '../lib/crypto'
|
||||
import {
|
||||
ensureDefaultTemplate,
|
||||
getTemplate,
|
||||
calcBatchEntry,
|
||||
getPayrollRiskWarnings,
|
||||
@@ -228,9 +227,6 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti
|
||||
})
|
||||
const batchNo = existingBatches + 1
|
||||
|
||||
// 获取组织发薪频率
|
||||
const org = await prisma.organization.findUnique({ where: { id: orgId } })
|
||||
|
||||
// 获取在职员工 + 本月离职员工
|
||||
const monthStart = new Date(`${month}-01`)
|
||||
const monthEnd = new Date(monthStart.getFullYear(), monthStart.getMonth() + 1, 0, 23, 59, 59)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Router, Request, Response, NextFunction } from 'express'
|
||||
import { Router } from 'express'
|
||||
import { authMiddleware, AuthRequest } from '../middleware/auth'
|
||||
import { auditLog } from '../middleware/auditLog'
|
||||
import prisma from '../lib/prisma'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Router, Request, Response, NextFunction } from 'express'
|
||||
import { Router } from 'express'
|
||||
import bcrypt from 'bcryptjs'
|
||||
import prisma from '../lib/prisma'
|
||||
import { authMiddleware, AuthRequest } from '../middleware/auth'
|
||||
|
||||
@@ -4,7 +4,6 @@ import { auditLog } from '../middleware/auditLog'
|
||||
import { terminationChecklistSchema } from '../schemas/termination.schema'
|
||||
import { createTermination, createResignation, revokeTermination, getTerminations, getChecklistForReason, assessRisk, batchTerminatePreview, batchTerminate } from '../services/termination.service'
|
||||
import prisma from '../lib/prisma'
|
||||
import { decrypt } from '../lib/crypto'
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import prisma from '../lib/prisma'
|
||||
import { decrypt } from '../lib/crypto'
|
||||
|
||||
// ========== 薪酬模版 ==========
|
||||
|
||||
@@ -51,16 +50,6 @@ export function calcHousingFund(base: number, config: any) {
|
||||
|
||||
// ========== 累计预扣个税 ==========
|
||||
|
||||
const TAX_BRACKETS = [
|
||||
{ rate: 0.03, quickDeduction: 0 },
|
||||
{ rate: 0.10, quickDeduction: 2520 },
|
||||
{ rate: 0.20, quickDeduction: 16920 },
|
||||
{ rate: 0.25, quickDeduction: 31920 },
|
||||
{ rate: 0.30, quickDeduction: 52920 },
|
||||
{ rate: 0.35, quickDeduction: 85920 },
|
||||
{ rate: 0.45, quickDeduction: 181920 },
|
||||
]
|
||||
|
||||
export function calcTax(taxableIncome: number): number {
|
||||
if (taxableIncome <= 0) return 0
|
||||
let tax = 0
|
||||
@@ -291,7 +280,6 @@ export async function generatePayslipFromBatches(orgId: string, month: string) {
|
||||
|
||||
// 计算累计数据
|
||||
const year = month.slice(0, 4)
|
||||
const monthNum = Number(month.slice(5, 7))
|
||||
|
||||
let generated = 0
|
||||
for (const [employeeId, summary] of employeeMap) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import prisma from '../lib/prisma'
|
||||
import { decrypt } from '../lib/crypto'
|
||||
import type { ContractType, RiskLevel, RiskType } from '@prisma/client'
|
||||
import type { RiskLevel, RiskType } from '@prisma/client'
|
||||
|
||||
function daysBetween(a: Date, b: Date): number {
|
||||
return Math.floor((a.getTime() - b.getTime()) / (1000 * 60 * 60 * 24))
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import prisma from '../lib/prisma'
|
||||
import { decrypt } from '../lib/crypto'
|
||||
import { RiskAssessment, TerminationReason } from '@prisma/client'
|
||||
|
||||
function daysBetween(a: Date, b: Date): number {
|
||||
return Math.floor((a.getTime() - b.getTime()) / (1000 * 60 * 60 * 24))
|
||||
}
|
||||
|
||||
function dateToMonth(date: Date): string {
|
||||
const y = date.getFullYear()
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||
|
||||
Reference in New Issue
Block a user