This commit is contained in:
chenbo 2024-02-26 17:33:27 +08:00
parent 60bc509523
commit 5154e38137
3 changed files with 12 additions and 4 deletions

View File

@ -55,7 +55,7 @@ class TaskAllocationLists extends BaseAdminDataLists implements ListsSearchInter
*/ */
public function lists(): array public function lists(): array
{ {
return TaskAllocation::where($this->searchWhere) return TaskAllocation::where($this->searchWhere)->with(['taskTypeInfo', 'projectInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()

View File

@ -94,7 +94,6 @@ class TaskAllocationLogic extends BaseLogic
Db::startTrans(); Db::startTrans();
try { try {
TaskAllocation::where('id', $params['id'])->update([ TaskAllocation::where('id', $params['id'])->update([
'num' => generate_sn(self::class, 'num'),
'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'],
@ -132,6 +131,6 @@ class TaskAllocationLogic extends BaseLogic
*/ */
public static function detail($params): array public static function detail($params): array
{ {
return TaskAllocation::findOrEmpty($params['id'])->toArray(); return TaskAllocation::findOrEmpty($params['id'])->with(['taskTypeInfo', 'projectInfo'])->toArray();
} }
} }

View File

@ -16,6 +16,7 @@ namespace app\common\model\task;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\cost_project\CostProject;
use think\model\concern\SoftDelete; use think\model\concern\SoftDelete;
@ -30,5 +31,13 @@ class TaskAllocation extends BaseModel
protected $name = 'task_allocation'; protected $name = 'task_allocation';
protected $deleteTime = 'delete_time'; protected $deleteTime = 'delete_time';
public function taskTypeInfo()
{
return $this->hasOne(TaskType::class, 'id', 'task_type_id');
}
public function projectInfo()
{
return $this->hasOne(CostProject::class, 'id', 'cost_project_id');
}
} }