From 785fc21f85637f2aedd57775e611038ea590341b Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 21 Jan 2026 10:32:44 +0800 Subject: [PATCH] * [refac bug #66978] Add pinyin key for batch assign. --- module/bug/ui/browse.html.php | 14 +++++++------- module/execution/ui/bug.html.php | 5 +++-- module/execution/ui/story.html.php | 4 +++- module/execution/ui/task.html.php | 5 +++-- module/my/ui/epic.html.php | 3 ++- module/my/ui/feedback.html.php | 14 +++++++------- module/my/ui/requirement.html.php | 3 ++- module/my/ui/story.html.php | 3 ++- module/product/ui/browse.html.php | 4 +++- module/productplan/ui/view.html.php | 4 +++- module/project/ui/bug.html.php | 5 +++-- module/testtask/ui/cases.html.php | 7 ++++--- 12 files changed, 42 insertions(+), 29 deletions(-) diff --git a/module/bug/ui/browse.html.php b/module/bug/ui/browse.html.php index 6478dc4bac..b212b437db 100644 --- a/module/bug/ui/browse.html.php +++ b/module/bug/ui/browse.html.php @@ -215,13 +215,6 @@ foreach($modules as $moduleID => $module) $moduleItems[] = array('text' => $module, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('bug', 'batchChangeModule', "moduleID=$moduleID")); } -$assignedToItems = array(); -foreach ($memberPairs as $key => $value) -{ - $key = base64_encode((string)$key); // 编码用户名中的特殊字符 - $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('bug', 'batchAssignTo', "assignedTo=$key&productID={$product->id}&type=product")); -} - $footToolbar = array(); if($canBatchAction) { @@ -241,6 +234,13 @@ if($canBatchAction) } if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($memberPairs); + $assignedToItems = array(); + foreach($memberPairs as $key => $value) + { + $key = base64_encode((string)$key); // 编码用户名中的特殊字符 + $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('bug', 'batchAssignTo', "assignedTo=$key&productID={$product->id}&type=product")); + } $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'type' => 'dropdown', 'data-placement' => 'top-start', 'items' => $assignedToItems, 'data-menu' => array('searchBox' => true)); } $footToolbar['btnProps'] = array('size' => 'sm', 'btnType' => 'secondary'); diff --git a/module/execution/ui/bug.html.php b/module/execution/ui/bug.html.php index abfdda80a8..863425ee6d 100644 --- a/module/execution/ui/bug.html.php +++ b/module/execution/ui/bug.html.php @@ -60,12 +60,13 @@ $canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo'); if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); $assignedToItems = array(); - foreach ($users as $account => $name) + foreach($users as $account => $name) { if(empty($account)) continue; $account = base64_encode((string)$account); // 编码用户名中的特殊字符 - if($account != 'closed') $assignedToItems[] = array('text' => $name, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo={$account}&objectID={$execution->id}")); + if($account != 'closed') $assignedToItems[] = array('text' => $name, 'keys' => zget($pinyinItems, $name, ''), 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo={$account}&objectID={$execution->id}")); } $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'className' => 'btn btn-caret size-sm secondary', 'items' => $assignedToItems, 'type' => 'dropdown', 'data-placement' => 'top', 'data-menu' => array('searchBox' => true)); diff --git a/module/execution/ui/story.html.php b/module/execution/ui/story.html.php index 826f58120e..166627e014 100644 --- a/module/execution/ui/story.html.php +++ b/module/execution/ui/story.html.php @@ -453,13 +453,15 @@ if($canBatchAction && !$isFromDoc && !$isFromAI) if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); $assignedToItems = array(); - foreach ($users as $account => $name) + foreach($users as $account => $name) { if($account == 'closed' || !$name) continue; $assignedToItems[] = array( 'text' => $name, + 'keys' => zget($pinyinItems, $name, ''), 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('story', 'batchAssignTo', "toryType={$storyType}&assignedTo={$account}") ); diff --git a/module/execution/ui/task.html.php b/module/execution/ui/task.html.php index ee843ca9b2..635449be09 100644 --- a/module/execution/ui/task.html.php +++ b/module/execution/ui/task.html.php @@ -281,10 +281,11 @@ if($canBatchAction) if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($memberPairs); $assignedToItems = array(); - foreach ($memberPairs as $account => $name) + foreach($memberPairs as $account => $name) { - $assignedToItems[] = array('text' => $name, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('task', 'batchAssignTo', "executionID={$execution->id}&assignedTo={$account}")); + $assignedToItems[] = array('text' => $name, 'keys' => zget($pinyinItems, $name, ''), 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('task', 'batchAssignTo', "executionID={$execution->id}&assignedTo={$account}")); } } diff --git a/module/my/ui/epic.html.php b/module/my/ui/epic.html.php index 22e37f11c3..a2d8955133 100644 --- a/module/my/ui/epic.html.php +++ b/module/my/ui/epic.html.php @@ -77,10 +77,11 @@ if($canBatchReview) $assignedToItems = array(); if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); foreach($users as $key => $value) { if(empty($key) || $key == 'closed') continue; - $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('epic', 'batchAssignTo', "storyType=epic&assignedTo={$key}")); + $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('epic', 'batchAssignTo', "storyType=epic&assignedTo={$key}")); } } diff --git a/module/my/ui/feedback.html.php b/module/my/ui/feedback.html.php index efbb6883c1..4903d45db3 100644 --- a/module/my/ui/feedback.html.php +++ b/module/my/ui/feedback.html.php @@ -40,13 +40,7 @@ $canBatchClose = common::hasPriv('feedback', 'batchClose'); $canBatchAssignTo = common::hasPriv('feedback', 'batchAssignTo'); $canBatchAction = $canBatchEdit || $canBatchClose || $canBatchAssignTo; -$footToolbar = array(); -$assignedToItems = array(); -foreach($users as $key => $value) -{ - if($value) $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('feedback', 'batchAssignTo', "assignedTo=$key")); -} - +$footToolbar = array(); if($canBatchAction) { $footToolbar['items'] = array(); @@ -60,6 +54,12 @@ if($canBatchAction) } if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); + $assignedToItems = array(); + foreach($users as $key => $value) + { + if($value) $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('feedback', 'batchAssignTo', "assignedTo=$key")); + } $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->feedback->assignedTo, 'type' => 'dropdown', 'data-placement' => 'top-start', 'items' => $assignedToItems, 'data-menu' => array('searchBox' => true)); } $footToolbar['btnProps'] = array('size' => 'sm', 'btnType' => 'secondary'); diff --git a/module/my/ui/requirement.html.php b/module/my/ui/requirement.html.php index 06a36ce218..d88cc8b257 100644 --- a/module/my/ui/requirement.html.php +++ b/module/my/ui/requirement.html.php @@ -80,10 +80,11 @@ if($canBatchReview) $assignedToItems = array(); if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); foreach($users as $key => $value) { if(empty($key) || $key == 'closed') continue; - $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('requirement', 'batchAssignTo', "storyType=requirement&assignedTo={$key}")); + $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('requirement', 'batchAssignTo', "storyType=requirement&assignedTo={$key}")); } } diff --git a/module/my/ui/story.html.php b/module/my/ui/story.html.php index 5ad2aed2f4..993593ac2f 100644 --- a/module/my/ui/story.html.php +++ b/module/my/ui/story.html.php @@ -80,10 +80,11 @@ if($canBatchReview) $assignedToItems = array(); if($canBatchAssignTo) { + $pinyinItems = common::convert2Pinyin($users); foreach($users as $key => $value) { if(empty($key) || $key == 'closed') continue; - $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('story', 'batchAssignTo', "storyType=story&assignedTo={$key}")); + $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('story', 'batchAssignTo', "storyType=story&assignedTo={$key}")); } } diff --git a/module/product/ui/browse.html.php b/module/product/ui/browse.html.php index 8cf86851b9..b350fa97fe 100644 --- a/module/product/ui/browse.html.php +++ b/module/product/ui/browse.html.php @@ -315,10 +315,12 @@ $fnGenerateFootToolbar = function() use ($lang, $app, $product, $productID, $pro if(!str_contains('|tested|verified|rejected|released|closed|', "|$key|")) continue; $stageItems[] = array('text' => $stageName, 'class' => 'batch-btn', 'data-formaction' => $this->createLink('story', 'batchChangeStage', "stage=$key")); } + + $pinyinItems = common::convert2Pinyin($users); foreach($users as $account => $realname) { if($account == 'closed') continue; - $assignItems[] = array('text' => $realname, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($storyModule, 'batchAssignTo', "productID={$productID}"), 'data-account' => $account); + $assignItems[] = array('text' => $realname, 'keys' => zget($pinyinItems, $realname, ''), 'class' => 'batch-btn', 'data-formaction' => $this->createLink($storyModule, 'batchAssignTo', "productID={$productID}"), 'data-account' => $account); } if(isset($reviewResultItems['reject'])) $reviewResultItems['reject'] = array('class' => 'not-hide-menu', 'text' => $lang->story->reviewResultList['reject'], 'items' => $reviewRejectItems); diff --git a/module/productplan/ui/view.html.php b/module/productplan/ui/view.html.php index 0e38bc7f3a..59b7b74c74 100644 --- a/module/productplan/ui/view.html.php +++ b/module/productplan/ui/view.html.php @@ -100,10 +100,12 @@ foreach($branchTagOption as $branchID => $branchName) $branchItems[] foreach($modules as $moduleID => $moduleName) $moduleItems[] = array('text' => $moduleName, 'class' => 'batch-btn', 'data-type' => 'story', 'data-url' => $this->createLink('story', 'batchChangeModule', "moduleID=$moduleID")); foreach($plans as $planID => $planName) $planItems[] = array('text' => $planName, 'class' => 'batch-btn', 'data-type' => 'story', 'data-url' => $this->createLink('story', 'batchChangePlan', "planID=$planID&oldPlanID={$plan->id}")); foreach($lang->story->stageList as $key => $stageName) $stageItems[] = array('text' => $stageName, 'class' => 'batch-btn', 'data-type' => 'story', 'data-url' => $this->createLink('story', 'batchChangeStage', "stage=$key")); + +$pinyinItems = common::convert2Pinyin($users); foreach($users as $account => $realname) { if($account == 'closed') continue; - $assignItems[] = array('text' => $realname, 'class' => 'batch-btn', 'data-type' => 'story', 'data-url' => $this->createLink('story', 'batchAssignTo', "productID=$plan->product"), 'data-account' => $account); + $assignItems[] = array('text' => $realname, 'keys' => zget($pinyinItems, $realname, ''), 'class' => 'batch-btn', 'data-type' => 'story', 'data-url' => $this->createLink('story', 'batchAssignTo', "productID=$plan->product"), 'data-account' => $account); } if(isset($reviewResultItems['reject'])) $reviewResultItems['reject'] = array('class' => 'not-hide-menu', 'text' => $lang->story->reviewResultList['reject'], 'items' => $reviewRejectItems); diff --git a/module/project/ui/bug.html.php b/module/project/ui/bug.html.php index 3b260049ef..de28ae6b73 100644 --- a/module/project/ui/bug.html.php +++ b/module/project/ui/bug.html.php @@ -77,10 +77,11 @@ $footToolbar = array(); if($canBatchAssignTo) { $assignedToItems = array(); - foreach ($memberPairs as $key => $value) + $pinyinItems = common::convert2Pinyin($memberPairs); + foreach($memberPairs as $key => $value) { $key = base64_encode((string)$key); // 编码用户名中的特殊字符 - if(!empty($key)) $assignedToItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo=$key&projectID={$project->id}&type=project")); + if(!empty($key)) $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo=$key&projectID={$project->id}&type=project")); } $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'className' => 'btn btn-caret size-sm secondary', 'items' => $assignedToItems, 'type' => 'dropdown', 'data-placement' => 'top'); diff --git a/module/testtask/ui/cases.html.php b/module/testtask/ui/cases.html.php index 295c5f03b9..59be1f0fff 100644 --- a/module/testtask/ui/cases.html.php +++ b/module/testtask/ui/cases.html.php @@ -137,10 +137,11 @@ if($canBatchAction) if(!$canBatchEdit && $canBatchUnlink) $footToolbar['items'][] = array('text' => $lang->unlink, 'className' => 'batch-btn not-open-url', 'btnType' => 'secondary', 'data-url' => inlink('batchUnlinkCases', "taskID={$task->id}")); if($canBatchAssign) { - $userItems = array(); - foreach($assignedToList as $account => $realname) $userItems[] = array('text' => $realname, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => inlink('batchAssign', "taskID={$task->id}"), 'data-account' => $account); + $pinyinItems = common::convert2Pinyin($assignedToList); + $assignItems = array(); + foreach($assignedToList as $account => $realname) $assignItems[] = array('text' => $realname, 'keys' => zget($pinyinItems, $realname, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => inlink('batchAssign', "taskID={$task->id}"), 'data-account' => $account); - $footToolbar['items'][] = array('text' => $lang->testtask->assign, 'caret' => 'up', 'btnType' => 'secondary', 'type' => 'dropdown', 'items' => $userItems, 'data-placement' => 'top-start', 'data-menu' => array('searchBox' => true)); + $footToolbar['items'][] = array('text' => $lang->testtask->assign, 'caret' => 'up', 'btnType' => 'secondary', 'type' => 'dropdown', 'items' => $assignItems, 'data-placement' => 'top-start', 'data-menu' => array('searchBox' => true)); } if($canBatchRun) $footToolbar['items'][] = array('text' => $lang->testtask->runCase, 'className' => 'batch-btn batch-run not-open-url', 'btnType' => 'secondary', 'data-url' => inlink('batchRun', "productID={$productID}&orderBy=id_desc&from=testtask&taskID={$task->id}&confirm=yes")); }