request->params([ ['page', 1], ['limit', 20], ['campus_id', ''], ['salary_month', ''], ['staff_name', ''], ['status', ''] ]); return success('操作成功', (new PayrollService())->getPage($data)); } /** * 获取工资条详情 * @param int $id * @return \think\Response */ public function info(int $id) { return success('操作成功', (new PayrollService())->getInfo($id)); } /** * 创建工资条 * @return \think\Response */ public function add() { $data = $this->request->params([ ['staff_id', 0], ['campus_id', 0], ['salary_month', ''], ['base_salary', 0], ['full_attendance_days', 22], ['attendance', 0], ['mgr_performance', 0], ['performance_bonus', 0], ['other_subsidies', 0], ['deductions', 0], ['social_security', 0], ['individual_income_tax', 0], ['remarks', ''] ]); $this->validate($data, 'app\adminapi\validate\salary\Payroll.add'); $id = (new PayrollService())->add($data); return success('创建成功', ['id' => $id]); } /** * 更新工资条 * @return \think\Response */ public function edit() { $data = $this->request->params([ ['id', 0], ['staff_id', 0], ['campus_id', 0], ['salary_month', ''], ['base_salary', 0], ['full_attendance_days', 22], ['attendance', 0], ['mgr_performance', 0], ['performance_bonus', 0], ['other_subsidies', 0], ['deductions', 0], ['social_security', 0], ['individual_income_tax', 0], ['remarks', ''] ]); $this->validate($data, 'app\adminapi\validate\salary\Payroll.edit'); (new PayrollService())->edit($data['id'], $data); return success('更新成功'); } /** * 删除工资条 * @return \think\Response */ public function delete() { $data = $this->request->params([ ['id', 0] ]); (new PayrollService())->del($data['id']); return success('删除成功'); } /** * 批量导入工资条 * @return \think\Response */ public function import() { // TODO: 后续实现Excel导入功能 return success('导入功能开发中'); } }