智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

132 lines
3.6 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\salary;
use app\service\admin\salary\PayrollService;
use core\base\BaseAdminController;
/**
* 工资条管理控制器
* Class Payroll
* @package app\adminapi\controller\salary
*/
class Payroll extends BaseAdminController
{
/**
* 获取工资条列表
* @return \think\Response
*/
public function list()
{
$data = $this->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('导入功能开发中');
}
}