From d0bc7f93de42d511456abe0c8b2ee6727c61db19 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 20 Jun 2024 10:42:37 +0800 Subject: [PATCH] * [bug#37402,done,0.2h] move js to common and set renderRowData. --- module/story/js/batchcreate.ui.js | 39 -------------------------- module/story/js/common.ui.js | 39 ++++++++++++++++++++++++++ module/transfer/ui/showimport.html.php | 8 ++++++ 3 files changed, 47 insertions(+), 39 deletions(-) diff --git a/module/story/js/batchcreate.ui.js b/module/story/js/batchcreate.ui.js index b9101ada46..95e8ae83dc 100644 --- a/module/story/js/batchcreate.ui.js +++ b/module/story/js/batchcreate.ui.js @@ -1,42 +1,3 @@ -window.setModuleAndPlanByBranch = function(e) -{ - const $branch = $(e.target); - const branchID = $branch.val(); - let $row = $branch.closest('tr'); - - var moduleLink = $.createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&extra=nodeleted'); - - while($row.length) - { - const $modulePicker = $row.find('[name^=module]').zui('picker'); - const moduleID = $row.find('[name^=module]').val(); - $.getJSON(moduleLink, function(data) - { - $modulePicker.render({items: data.items}) - $modulePicker.$.setValue(moduleID); - }); - - $row = $row.next('tr'); - if(!$row.find('td[data-name="module"][data-ditto="on"]').length) break; - } - - var planLink = $.createLink('productPlan', 'ajaxGetProductPlans', 'productID=' + productID + '&branch=' + branchID); - let $rows = $branch.closest('tr'); - while($rows.length) - { - const $planPicker = $rows.find('[name^=plan]').zui('picker'); - const planID = $rows.find('[name^=plan]').val(); - $.getJSON(planLink, function(data) - { - $planPicker.render({items: data}) - $planPicker.$.setValue(planID); - }); - - $rows = $rows.next('tr'); - if(!$rows.find('td[data-name="plan"][data-ditto="on"]').length) break; - } -} - window.changeRegion = function(e) { const $region = $(e.target); diff --git a/module/story/js/common.ui.js b/module/story/js/common.ui.js index 965182fd50..89b2300ede 100644 --- a/module/story/js/common.ui.js +++ b/module/story/js/common.ui.js @@ -134,3 +134,42 @@ window.loadBranch = function() window.loadBranchModule(productID); window.loadURS(); }; + +window.setModuleAndPlanByBranch = function(e) +{ + const $branch = $(e.target); + const branchID = $branch.val(); + let $row = $branch.closest('tr'); + + var moduleLink = $.createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&extra=nodeleted'); + + while($row.length) + { + const $modulePicker = $row.find('[name^=module]').zui('picker'); + const moduleID = $row.find('[name^=module]').val(); + $.getJSON(moduleLink, function(data) + { + $modulePicker.render({items: data.items}) + $modulePicker.$.setValue(moduleID); + }); + + $row = $row.next('tr'); + if(!$row.find('td[data-name="module"][data-ditto="on"]').length) break; + } + + var planLink = $.createLink('productPlan', 'ajaxGetProductPlans', 'productID=' + productID + '&branch=' + branchID); + let $rows = $branch.closest('tr'); + while($rows.length) + { + const $planPicker = $rows.find('[name^=plan]').zui('picker'); + const planID = $rows.find('[name^=plan]').val(); + $.getJSON(planLink, function(data) + { + $planPicker.render({items: data}) + $planPicker.$.setValue(planID); + }); + + $rows = $rows.next('tr'); + if(!$rows.find('td[data-name="plan"][data-ditto="on"]').length) break; + } +} diff --git a/module/transfer/ui/showimport.html.php b/module/transfer/ui/showimport.html.php index c9eb8ff66c..c15e0e1d89 100644 --- a/module/transfer/ui/showimport.html.php +++ b/module/transfer/ui/showimport.html.php @@ -74,6 +74,7 @@ else set::data(array_values($datas)), set::actions(array()), set::showExtra(false), + set::onRenderRow(jsRaw('renderRowData')), div ( setClass('toolbar form-actions form-group no-label'), @@ -108,6 +109,13 @@ else { $('#importNoticeModal [name=insert]').val(type == 'insert' ? 1 : 0); }; + window.renderRowData = function(\$row, index, row) + { + if(typeof renderImportRowData == 'function') + { + renderImportRowData(\$row, index, row); + } + } JAVASCRIPT); css('.form-batch-container .form-batch-control .check-list-inline {padding-top: 0;}'); }