33 lines
830 B
PHP
33 lines
830 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\adminapi\validate\finance;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
class DeptPerformanceTargetValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'year_month' => 'require|regex:/^\d{4}-\d{2}$/',
|
|
'items' => 'require|array',
|
|
];
|
|
|
|
protected $message = [
|
|
'year_month.require' => '请选择月份',
|
|
'year_month.regex' => '月份格式须为 YYYY-MM',
|
|
'items.require' => '请提交目标数据',
|
|
'items.array' => '目标数据格式错误',
|
|
];
|
|
|
|
public function sceneMonthMatrix(): DeptPerformanceTargetValidate
|
|
{
|
|
return $this->only(['year_month']);
|
|
}
|
|
|
|
public function sceneBatchSave(): DeptPerformanceTargetValidate
|
|
{
|
|
return $this->only(['year_month', 'items']);
|
|
}
|
|
}
|