* [task#135788,doing,0.5h].

This commit is contained in:
songchenxuan
2025-01-07 11:10:07 +08:00
committed by 周鑫
parent 609f205c3a
commit cdfb83c3e0
2 changed files with 37 additions and 0 deletions
+35
View File
@@ -295,3 +295,38 @@ $('#dragModal').on('click', '[data-dismiss=modal]', function()
{
loadCurrentPage({cache: false});
});
window.insertListToDoc = function()
{
const dtable = zui.DTable.query($('#testcases'));
const checkedList = dtable.$.getChecks();
if(!checkedList.length) return;
let {cols, data} = dtable.options;
data = data.filter((item) => checkedList.includes(item.id + ''));
const docID = getDocApp()?.docID;
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=case&blockID=${blockID}`);
const formData = new FormData();
formData.append('cols', JSON.stringify(cols));
formData.append('data', JSON.stringify(data));
formData.append('idList', checkedList.join(','));
formData.append('url', insertListLink);
$.post(url, formData, function(resp)
{
resp = JSON.parse(resp);
if(resp.result == 'success')
{
const blockID = resp.blockID;
zui.Modal.hide();
window.insertZentaoList && window.insertZentaoList('case', blockID, null, true);
}
});
}
window.toggleCheckRows = function(idList)
{
if(!idList?.length) return;
const dtable = zui.DTable.query($('#testcases'));
dtable.$.toggleCheckRows(idList.split(','), true);
}