| 123456789101112131415161718192021222324252627282930313233343536373839 |
- $(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);
- }
- });
- /**
- * 设置表格的统计信息。
- * Set summary for table footer.
- *
- * @param element element
- * @param array checkedIDList
- * @access public
- * @return object
- */
- window.setStatistics = function(element, checks)
- {
- let failCount = 0;
- checks.forEach((checkID) => {
- const caseInfo = element.getRowInfo(checkID).data;
- if(caseInfo.lastRunResult != unexecuted && caseInfo.lastRunResult != 'pass') failCount ++;
- })
- if(checks.length) return {html: element.options.checkedSummary.replaceAll('%total%', `${checks.length}`).replaceAll('%fail%', failCount)};
- return zui.formatString(element.options.defaultSummary);
- }
|