Files
MrleeAdmin/backend/plugin/produce/app/validate/RepairRecordValidate.php
T

50 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
namespace plugin\produce\app\validate;
use core\base\BaseValidate;
class RepairRecordValidate extends BaseValidate
{
public function rules(): array
{
return [
'repair_no' => ['required', 'max:100'],
'order_no' => ['max:100'],
'product_code' => ['max:100'],
'product_name' => ['max:200'],
'category_id' => ['integer'],
'category_ids' => ['array'],
'category_ids.*' => ['integer'],
'fault_description_id' => ['integer'],
'repair_result' => ['max:50'],
'operator' => ['max:100'],
'repaired_at' => ['integer'],
'remark' => ['max:1000'],
];
}
protected array $message = [
'repair_no.required' => '维修单号不能为空',
'repair_no.max' => '维修单号不能超过100个字符',
'order_no.max' => '订单号不能超过100个字符',
'product_code.max' => '商品编码不能超过100个字符',
'product_name.max' => '商品名称不能超过200个字符',
'category_id.integer' => '物料分类不正确',
'category_ids.array' => '物料分类集合格式不正确',
'category_ids.*.integer' => '物料分类不正确',
'fault_description_id.integer' => '硬件故障描述不正确',
'repair_result.max' => '维修判定不能超过50个字符',
'operator.max' => '维修人员不能超过100个字符',
'repaired_at.integer' => '维修时间不正确',
'remark.max' => '备注不能超过1000个字符',
];
protected array $scene = [
'store' => ['repair_no', 'order_no', 'product_code', 'product_name', 'category_id', 'category_ids', 'fault_description_id', 'repair_result', 'parts', 'operator', 'repaired_at', 'remark'],
'update' => ['repair_no', 'order_no', 'product_code', 'product_name', 'category_id', 'category_ids', 'fault_description_id', 'repair_result', 'parts', 'operator', 'repaired_at', 'remark'],
];
}