From 37688315ad8620af7bb0e3c66b2ea478d02f36d2 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Fri, 11 Aug 2023 13:48:16 +0800 Subject: [PATCH] * Fix can not load data in current page when click search button of mr module. --- module/mr/control.php | 6 +++--- module/mr/js/linkbug.ui.js | 10 +++++++++- module/mr/js/linkstory.ui.js | 10 +++++++++- module/mr/js/linktask.ui.js | 10 +++++++++- module/search/js/buildzinform.ui.js | 2 +- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index f80b1b2d43..a73df04219 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -624,7 +624,7 @@ class mr extends control $queryID = ($browseType == 'bySearch') ? (int) $param : 0; unset($this->config->product->search['fields']['product']); - $this->config->product->search['actionURL'] = $this->createLink('mr', 'link', "$MRID=$MRID&type=story&orderBy=$orderBy&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); + $this->config->product->search['actionURL'] = $this->createLink('mr', 'linkStory', "MRID={$MRID}&productID={$productID}&browseType=bySearch¶m=myQueryID&orderBy={$orderBy}"); $this->config->product->search['queryID'] = $queryID; $this->config->product->search['style'] = 'simple'; $this->config->product->search['params']['product']['values'] = array($product) + array('all' => $this->lang->product->allProductsOfProject); @@ -711,7 +711,7 @@ class mr extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Build search form. */ - $this->config->bug->search['actionURL'] = $this->createLink('mr', 'link', "$MRID=$MRID&type=bug&orderBy=$orderBy&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); + $this->config->bug->search['actionURL'] = $this->createLink('mr', 'linkBug', "MRID={$MRID}&productID={$productID}&browseType=bySearch¶m=myQueryID&orderBy={$orderBy}"); $this->config->bug->search['queryID'] = $queryID; $this->config->bug->search['style'] = 'simple'; $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($productID => $productID)); @@ -806,7 +806,7 @@ class mr extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Build search form. */ - $this->config->execution->search['actionURL'] = $this->createLink('mr', 'link', "$MRID=$MRID&type=task&orderBy=$orderBy&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); + $this->config->execution->search['actionURL'] = $this->createLink('mr', 'linkTask', "MRID={$MRID}&productID={$productID}&browseType=bySearch¶m=myQueryID&orderBy={$orderBy}"); $this->config->execution->search['queryID'] = $queryID; $this->config->execution->search['params']['module']['values'] = $modules; $this->config->execution->search['params']['execution']['values'] = $this->product->getExecutionPairsByProduct($productID); diff --git a/module/mr/js/linkbug.ui.js b/module/mr/js/linkbug.ui.js index 475ab59c8f..f64dd9a1ad 100644 --- a/module/mr/js/linkbug.ui.js +++ b/module/mr/js/linkbug.ui.js @@ -20,4 +20,12 @@ $(document).off('click','.dtable-footer .batch-btn').on('click', '.dtable-footer url: $(this).data('url'), data: postData }); -}); \ No newline at end of file +}); + +window.onSearchFormResult = function(formName, response) +{ + response.then(res => res.json()) + .then(json => { + loadTarget(json.load, 'mr-bug'); + }).catch(console.error); +} \ No newline at end of file diff --git a/module/mr/js/linkstory.ui.js b/module/mr/js/linkstory.ui.js index 475ab59c8f..23596b2a6d 100644 --- a/module/mr/js/linkstory.ui.js +++ b/module/mr/js/linkstory.ui.js @@ -20,4 +20,12 @@ $(document).off('click','.dtable-footer .batch-btn').on('click', '.dtable-footer url: $(this).data('url'), data: postData }); -}); \ No newline at end of file +}); + +window.onSearchFormResult = function(formName, response) +{ + response.then(res => res.json()) + .then(json => { + loadTarget(json.load, 'mr-story'); + }).catch(console.error); +} diff --git a/module/mr/js/linktask.ui.js b/module/mr/js/linktask.ui.js index 475ab59c8f..012ec34b27 100644 --- a/module/mr/js/linktask.ui.js +++ b/module/mr/js/linktask.ui.js @@ -20,4 +20,12 @@ $(document).off('click','.dtable-footer .batch-btn').on('click', '.dtable-footer url: $(this).data('url'), data: postData }); -}); \ No newline at end of file +}); + +window.onSearchFormResult = function(formName, response) +{ + response.then(res => res.json()) + .then(json => { + loadTarget(json.load, 'mr-task'); + }).catch(console.error); +} \ No newline at end of file diff --git a/module/search/js/buildzinform.ui.js b/module/search/js/buildzinform.ui.js index 52f5cdd453..b8ba1e43a6 100644 --- a/module/search/js/buildzinform.ui.js +++ b/module/search/js/buildzinform.ui.js @@ -1,4 +1,4 @@ -window.onSearchFormResult = function(formName, response) +if(window.onSearchFormResult === undefined) window.onSearchFormResult = function(formName, response) { response.then(res => res.json()) .then(json => {