From 080ff682a0ce42d69a2e5facec8c873b580de1f9 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 28 May 2024 14:59:56 +0800 Subject: [PATCH] * [refac, 1h] add researchtaskbasicinfo. --- lib/zin/wg/researchtaskbasicinfo/v1.php | 76 +++++++++++++++++++++++++ module/programplan/model.php | 1 - 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 lib/zin/wg/researchtaskbasicinfo/v1.php diff --git a/lib/zin/wg/researchtaskbasicinfo/v1.php b/lib/zin/wg/researchtaskbasicinfo/v1.php new file mode 100644 index 0000000000..234b44638a --- /dev/null +++ b/lib/zin/wg/researchtaskbasicinfo/v1.php @@ -0,0 +1,76 @@ + '?object', // 当前任务。 + 'product' => '?object', // 当前产品。 + 'execution' => '?object', // 当前执行。 + 'users' => '?array', // 用户信息。 + 'users' => '?array', // 用户列表。 + 'statusText' => '?string', // 状态信息。 + ); + + protected function getItems(): array + { + global $lang, $config; + + $task = $this->prop('task', data('task')); + if(!$task) return array(); + + $execution = $this->prop('execution', data('execution')); + $users = $this->prop('users', data('users')); + $statusText = $this->prop('statusText', $task->status); + + $items = array(); + if($execution->multiple) + { + $items[$lang->marketresearch->execution] = array('control' => 'text', 'text' => $execution->name, 'title' => $execution->name); + if(!isInModal()) + { + $items[$lang->marketresearch->execution]['control'] = 'link'; + $items[$lang->marketresearch->execution]['url'] = createLink('execution', 'view', "executionID=$execution->id"); + } + } + + if($config->edition == 'max' && $execution->type == 'stage') + { + $items[$lang->task->design] = array('control' => 'text', 'text' => $task->designName, 'title' => $task->designName, 'control' => 'link', 'url' => createLink('design', 'view', "designID=$task->design")); + } + + $items[$lang->task->assignedTo] = zget($users, $task->assignedTo, ''); + + $items[$lang->task->status] = array + ( + 'control' => 'status', + 'class' => 'task-status', + 'status' => $task->status, + 'text' => $statusText + ); + + $items[$lang->task->progress] = "$task->progress %"; + + $items[$lang->task->pri] = array + ( + 'control' => 'pri', + 'pri' => $task->pri, + 'text' => $lang->task->priList + ); + + return $items; + } + + protected function build() + { + return new datalist + ( + set::className('task-basic-info'), + set::items($this->getItems()) + ); + } +} diff --git a/module/programplan/model.php b/module/programplan/model.php index b2dc91c426..0c31fba4d9 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -99,7 +99,6 @@ class programplanModel extends model public function getPairs(int $executionID, int $productID = 0, string $type = 'all'): array { $plans = $this->getStage($executionID, $productID, $type); - $pairs = array(0 => ''); $parents = array(); if(strpos($type, 'leaf') !== false) array_map(function($plan) use(&$parents){$parents[$plan->parent] = true;}, $plans);