Merge branch dev/bug-64357 of zentao/zentaopms (#10711)

This commit is contained in:
刘刚
2025-08-01 10:19:40 +08:00
committed by Gitfox
4 changed files with 35 additions and 9 deletions
+6 -8
View File
@@ -2830,17 +2830,15 @@ class execution extends control
*/
public function storySort(int $executionID)
{
if($_SERVER['REQUEST_METHOD'] !== 'POST') return $this->sendError($this->lang->error->unsupportedReq);
$storyIdList = json_decode($this->post->storyIdList, true);
$storyIdList = array_flip($storyIdList);
$orderBy = $this->post->orderBy;
$idList = explode(',', trim($this->post->storyList, ','));
$orderBy = $this->post->orderBy;
$order = $this->dao->select('`order`')->from(TABLE_PROJECTSTORY)->where('story')->in($idList)->andWhere('project')->eq($executionID)->orderBy('order_asc')->fetch('order');
if(strpos($orderBy, 'order_desc') !== false) $idList = array_reverse($idList);
foreach($idList as $storyID)
krsort($storyIdList);
$order = $this->dao->select('`order`')->from(TABLE_PROJECTSTORY)->where('story')->in($storyIdList)->andWhere('project')->eq($executionID)->orderBy('order_asc')->fetch('order');
foreach($storyIdList as $storyID)
{
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($storyID)->andWhere('project')->eq($executionID)->exec();
if(dao::isError()) return $this->sendError(dao::getError());
$order++;
}
+20
View File
@@ -161,6 +161,10 @@ window.renderStoryCell = function(result, info)
{
if(info.row.data.URChanged == '1') result[0] = {html: "<span class='status-changed'>" + URChanged + "</span>"};
}
if(info.col.name == 'order')
{
result[0] = {html: "<i class='icon-move'></i>", className: 'text-gray cursor-move move-plan'};
}
return result;
};
@@ -181,3 +185,19 @@ window.toggleCheckRows = function(idList)
const dtable = zui.DTable.query($('#table-execution-story'));
dtable.$.toggleCheckRows(idList.split(','), true);
}
window.onSortEnd = function(from, to, type)
{
if(!from || !to) return false;
const url = $.createLink('execution', 'storySort', `execution=${executionID}`);
const form = new FormData();
form.append('storyIdList', JSON.stringify(this.state.rowOrders));
form.append('orderBy', orderBy);
form.append('pageID', storyPageID);
form.append('recPerPage', storyRecPerPage);
$.ajaxSubmit({url, data:form});
return true;
}
+7
View File
@@ -12,6 +12,9 @@ declare(strict_types=1);
namespace zin;
data('activeMenuID', $storyType);
jsVar('orderBy', $orderBy);
jsVar('storyPageID', $pager->pageID);
jsVar('storyRecPerPage', $pager->recPerPage);
jsVar('executionID', $execution->id);
jsVar('childrenAB', $lang->story->childrenAB);
jsVar('modulePairs', $modulePairs);
@@ -583,6 +586,10 @@ dtable
set::groupDivider(true),
set::cols($cols),
set::data($data),
set::plugins(array('sortable')),
set::sortHandler('.move-plan'),
set::sortable($orderBy == 'order_desc'),
set::onSortEnd($orderBy == 'order_desc' ? jsRaw('window.onSortEnd') : null),
set::noNestedCheck(),
set::footToolbar($footToolbar),
set::onRenderCell(jsRaw('window.renderStoryCell')),
+2 -1
View File
@@ -19,8 +19,9 @@ if($app->tab == 'execution')
$config->story->dtable->fieldList['order']['name'] = 'order';
$config->story->dtable->fieldList['order']['title'] = $lang->story->order;
$config->story->dtable->fieldList['order']['fixed'] = 'left';
$config->story->dtable->fieldList['order']['sortType'] = false;
$config->story->dtable->fieldList['order']['sortType'] = true;
$config->story->dtable->fieldList['order']['width'] = '45';
$config->story->dtable->fieldList['order']['show'] = true;
}
$config->story->dtable->fieldList['title']['name'] = 'title';