This commit is contained in:
weiz 2024-03-13 09:46:31 +08:00
parent d44e65536c
commit cfd5b4ca6d
2 changed files with 97 additions and 96 deletions

View File

@ -58,7 +58,7 @@ class TaskAllocationLogic extends BaseLogic
'task_type_id' => $taskType['id'], // 任务类别id 'task_type_id' => $taskType['id'], // 任务类别id
'cost_project_id' => $taskType['cost_project_id'], // 项目id 'cost_project_id' => $taskType['cost_project_id'], // 项目id
'apptime' => $params['apptime'], 'apptime' => $params['apptime'],
'annex' => json_encode($params['annex']), 'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]); ]);
// 任务明细 // 任务明细
$taskDetail = $params['task_detail']; $taskDetail = $params['task_detail'];
@ -99,7 +99,7 @@ class TaskAllocationLogic extends BaseLogic
'task_type_id' => $taskType['id'], // 任务类别id 'task_type_id' => $taskType['id'], // 任务类别id
'cost_project_id' => $taskType['cost_project_id'], // 项目id 'cost_project_id' => $taskType['cost_project_id'], // 项目id
'apptime' => $params['apptime'], 'apptime' => $params['apptime'],
'annex' => json_encode($params['annex']), 'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]); ]);
Db::commit(); Db::commit();
return true; return true;
@ -134,7 +134,6 @@ class TaskAllocationLogic extends BaseLogic
public static function detail($params): array public static function detail($params): array
{ {
$data = TaskAllocation::with(['taskTypeInfo', 'projectInfo'])->findOrEmpty($params['id'])->toArray(); $data = TaskAllocation::with(['taskTypeInfo', 'projectInfo'])->findOrEmpty($params['id'])->toArray();
$data['annex'] = json_decode($data['annex'], true);
$data['task_detail'] = TaskDetail::where('task_allocation_id', $data['id'])->select()->each(function ($item){ $data['task_detail'] = TaskDetail::where('task_allocation_id', $data['id'])->select()->each(function ($item){
$taskTypeInfo = TaskType::findOrEmpty($item['task_type_id'])->toArray(); $taskTypeInfo = TaskType::findOrEmpty($item['task_type_id'])->toArray();
$item['task_name'] = $taskTypeInfo['name']; $item['task_name'] = $taskTypeInfo['name'];

View File

@ -32,6 +32,7 @@ class TaskAllocationValidate extends BaseValidate
*/ */
protected $rule = [ protected $rule = [
'id' => 'require', 'id' => 'require',
'annex' => 'checkAnnex'
]; ];
@ -41,6 +42,7 @@ class TaskAllocationValidate extends BaseValidate
*/ */
protected $field = [ protected $field = [
'id' => 'id', 'id' => 'id',
]; ];
@ -64,7 +66,7 @@ class TaskAllocationValidate extends BaseValidate
*/ */
public function sceneEdit() public function sceneEdit()
{ {
return $this->only(['id']); return $this->only(['id','annex']);
} }