From 3e2cfa01d7a539cf66debec85401babbee3b06eb Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 10 Nov 2022 09:42:59 +0800 Subject: [PATCH] * Add batchEdit function of program list. --- module/program/js/browse.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/module/program/js/browse.js b/module/program/js/browse.js index 97b46de840..418e98d208 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -8,7 +8,8 @@ $(function() }); if($.cookie('editProject') == 1) $('input#editProject1').prop('checked', 'true'); - var isEditMode = $('input#editProject1').is(':checked'); + var isEditMode = $('input#editProject1').is(':checked'); + var projectIdList = []; dtableWithZentao.render({ checkable: isEditMode, canRowCheckable(id) @@ -40,6 +41,8 @@ $(function() const statistic = () => { const checkedCount = this.getChecks().length; const text = isEditMode && checkedCount ? checkedProjects.replace('%s', checkedCount) : programSummary; + + projectIdList = this.getChecks(); return [{children: text, className: 'text-dark'}]; }; if (isEditMode) { @@ -59,10 +62,21 @@ $(function() }, }); - $('.dtable').on('click', ".edit-btn", function() + $(document).on('click', ".dtable-footer .edit-btn.toolbar-item", function() { - console.log(11111); - debugger + var batchEditLink = createLink('project', 'batchEdit'); + var tempform = document.createElement("form"); + tempform.action = batchEditLink; + tempform.method = "post"; + tempform.style.display = "none"; + + var opt = document.createElement("input"); + opt.name = 'projectIdList'; + opt.value = projectIdList; + + tempform.appendChild(opt); + document.body.appendChild(tempform); + tempform.submit(); }); if(status == 'bySearch') $('.dtable-footer').hide();