66 lines
1.5 KiB
JavaScript
66 lines
1.5 KiB
JavaScript
$(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
|
|
{
|
|
const dtable = zui.DTable.query($(this).target);
|
|
const checkedList = dtable.$.getChecks();
|
|
if(!checkedList.length) return;
|
|
|
|
const url = $(this).data('url');
|
|
const form = new FormData();
|
|
checkedList.forEach((id) => form.append('caseIdList[]', id));
|
|
|
|
if($(this).hasClass('ajax-btn'))
|
|
{
|
|
$.ajaxSubmit({url, data:form});
|
|
}
|
|
else
|
|
{
|
|
postAndLoadPage(url, form);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* 移除场景名称的链接。
|
|
* Remove link of scene's title.
|
|
*
|
|
* @param object result
|
|
* @param object info
|
|
* @access public
|
|
* @return object
|
|
*/
|
|
window.onRenderCell = function(result, {row, col})
|
|
{
|
|
if(result && row.data.isCase == 2 && col.name == 'title')
|
|
{
|
|
result.pop();
|
|
result.push({html: row.data.title});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* 计算表格信息的统计。
|
|
* Set summary for table footer.
|
|
*
|
|
* @param element element
|
|
* @param array checks
|
|
* @access public
|
|
* @return object
|
|
*/
|
|
window.setStatistics = function(element, checks)
|
|
{
|
|
if(checks.length)
|
|
{
|
|
runCaseCount = 0;
|
|
checks.forEach((id) => {
|
|
const scene = element.getRowInfo(id).data;
|
|
if(scene.isCase == 1 && scene.lastRunResult != '') runCaseCount++;
|
|
});
|
|
return zui.formatString(checkedSummary, {
|
|
checked: checks.length,
|
|
run: runCaseCount
|
|
});
|
|
}
|
|
|
|
return pageSummary;
|
|
}
|