* [bug#59554,done,4h] Get checked rows.

This commit is contained in:
daitingting
2025-02-17 17:38:37 +08:00
committed by 谢杞钰
parent a8c5e74165
commit 84aedf9265
22 changed files with 169 additions and 35 deletions
+14 -3
View File
@@ -64,14 +64,25 @@ window.onRenderCell = function(result, {row, col})
return result;
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#bugs'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=bug&blockID=${blockID}`);
+1
View File
@@ -285,6 +285,7 @@ dtable
set::footPager(usePager()),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::height(400),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
$isFromDoc ? null : set::customCols(true),
$isFromDoc ? null : set::sortLink(inlink('browse', "product={$product->id}&branch={$branch}&browseType={$browseType}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}")),
set::onRenderCell(jsRaw('window.onRenderCell')),
+14 -3
View File
@@ -60,14 +60,25 @@ window.toggleCheckRows = function(idList)
dtable.$.toggleCheckRows(idList.split(','), true);
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#caselib'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=caselib&blockID=${blockID}`);
+1
View File
@@ -260,6 +260,7 @@ dtable
$isFromDoc ? null : set::createTip($lang->testcase->create),
$isFromDoc ? null : set::createLink($canCreateCase ? createLink('caselib', 'createCase', "libID={$libID}&moduleID={$moduleID}") : ''),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400)
);
+14 -3
View File
@@ -173,14 +173,25 @@ window.setShowGrades = function()
$.get(link, function() { loadCurrentPage(); });
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#table-execution-story'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=executionStory&blockID=${blockID}`);
+14 -3
View File
@@ -198,14 +198,25 @@ $(document).off('click', '.switchButton').on('click', '.switchButton', function(
loadCurrentPage();
});
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#tasks'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=task&blockID=${blockID}`);
+3
View File
@@ -570,6 +570,8 @@ foreach($stories as $story)
if(!isset($story->children)) continue;
}
if($isFromDoc) $footToolbar = array(array('text' => $lang->doc->insertText, 'data-on' => 'click', 'data-call' => "insertListToDoc"));
jsVar('cases', $storyCases);
jsVar('summary', $summary);
jsVar('checkedSummary', $lang->product->checkedAllSummary);
@@ -593,6 +595,7 @@ dtable
))),
set::emptyTip($lang->execution->noStory),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc ? null : set::customCols(array('url' => createLink('datatable', 'ajaxcustom', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"), 'globalUrl' => createLink('datatable', 'ajaxsaveglobal', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"))),
$isFromDoc ? null : set::sortLink(createLink('execution', 'story', "executionID={$execution->id}&storyType={$storyType}&orderBy={name}_{sortType}&type={$type}&param={$param}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&page={$pager->pageID}")),
+1
View File
@@ -334,6 +334,7 @@ dtable
'linkCreator' => helper::createLink('execution', 'task', "executionID={$execution->id}&status={$status}&param={$param}&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}") . "#app={$app->tab}"
))),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc ? null : set::customCols(true),
$isFromDoc ? null : set::sortLink(createLink('execution', 'task', "executionID={$execution->id}&status={$status}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}")),
+14 -3
View File
@@ -200,14 +200,25 @@ window.importToLib = function()
$('#storyIdList').val(storyIdList);
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#stories'));
const checkedList = Object.keys(dtable.$.state.checkedRows);
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
let blockType = 'productStory';
+1
View File
@@ -540,6 +540,7 @@ dtable
set::emptyTip($emptyTip),
set::footToolbar($footToolbar),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc ? null : set::customCols(array('url' => createLink('datatable', 'ajaxcustom', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"), 'globalUrl' => createLink('datatable', 'ajaxsaveglobal', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"), 'resetUrl' => createLink('datatable', 'ajaxreset', "module={$app->moduleName}&method={$app->methodName}&system=0&confirm=no&extra={$storyType}"), 'resetGlobalUrl' => createLink('datatable', 'ajaxreset', "module={$app->moduleName}&method={$app->methodName}&system=1&confirm=no&extra={$storyType}"))),
$isFromDoc ? null : set::sortLink($sortLink),
+14 -3
View File
@@ -350,14 +350,25 @@ window.getPlanID = function(event)
$('[name=planID]').val(planID);
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#productPlans'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=productPlan&blockID=${blockID}`);
+14 -3
View File
@@ -1,11 +1,22 @@
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#bugs'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
let blockType = 'planBug';
+14 -3
View File
@@ -12,14 +12,25 @@ window.renderStoryCell = function(result, info)
return result;
};
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#stories'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
let blockType = 'planStory';
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=${blockType}&blockID=${blockID}`);
@@ -214,6 +214,7 @@ dtable
usePager(array('linkCreator' => createLink($app->rawModule, 'browse', "productID={$productID}&branch={$branch}&browseType={$browseType}&queryID={$queryID}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={recPerPage}&pageID={page}&from=$from&blockID=$blockID"))),
),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc ? null : set::customCols(true),
$isFromDoc ? null : set::sortLink($sortLink),
+2 -1
View File
@@ -104,7 +104,8 @@ dtable
set::emptyTip($lang->bug->notice->noBug),
set::footToolbar($footToolbar),
set::height(400),
set::afterRender(jsCallback()->call('toggleCheckRows', $idList))
set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
set::onCheckChange(jsRaw('window.checkedChange'))
);
render();
+2 -1
View File
@@ -115,7 +115,8 @@ dtable
set::emptyTip($lang->story->noStory),
set::footToolbar($footToolbar),
set::height(400),
set::afterRender(jsCallback()->call('toggleCheckRows', $idList))
set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
set::onCheckChange(jsRaw('window.checkedChange'))
);
render();
+14 -3
View File
@@ -28,14 +28,25 @@ window.renderCell = function(result, info)
return result;
};
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#stories'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const blockType = 'projectStory';
+1
View File
@@ -125,6 +125,7 @@ dtable
set::emptyTip($lang->story->noStory),
set::footToolbar($footToolbar),
set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
set::onCheckChange(jsRaw('window.checkedChange')),
set::height(400)
);
+14 -3
View File
@@ -47,14 +47,25 @@ window.getCellSpan = function(cell)
}
}
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#releases'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const blockType = 'productRelease';
+1
View File
@@ -143,6 +143,7 @@ dtable
set::checkable($isFromDoc),
$isFromDoc ? set::footToolbar(array(array('text' => $lang->doc->insertText, 'data-on' => 'click', 'data-call' => 'insertListToDoc'))) : set::footer([jsRaw("function(){return {html: '{$pageSummary}'};}"), 'flex', 'pager']),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc ? null : set::customCols(true),
$isFromDoc ? null : set::sortLink(createLink('release', 'browse', "productID={$product->id}&branch={$branch}&type={$type}&orderBy={name}_{sortType}&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
+14 -3
View File
@@ -296,14 +296,25 @@ $('#dragModal').on('click', '[data-dismiss=modal]', function()
loadCurrentPage({cache: false});
});
window.checkedChange = function(changes)
{
if(!this._checkedRows) this._checkedRows = {};
Object.keys(changes).forEach((rowID) =>
{
const row = this.getRowInfo(rowID);
this._checkedRows[rowID] = row.data;
});
}
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#testcases'));
const checkedList = dtable.$.getChecks();
const myTable = dtable.$;
const checkedList = Object.keys(myTable.state.checkedRows);
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
let {cols} = dtable.options;
const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=productCase&blockID=${blockID}`);
+1
View File
@@ -162,6 +162,7 @@ div(
set::onSortEnd(strpos($orderBy, 'sort_asc') !== false ? jsRaw('window.onSortEnd') : null),
set::canSortTo(strpos($orderBy, 'sort_asc') !== false ? jsRaw('window.canSortTo') : null),
!$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)),
!$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')),
!$isFromDoc ? null : set::height(400),
$isFromDoc || $isOnlyScene ? null : set::customCols(true),
$isFromDoc ? null : set::sortLink(createLink($app->rawModule, $app->rawMethod, $linkParams)),