* Finish create testcase changeProduct event.

This commit is contained in:
wangyuting
2023-06-02 10:25:33 +08:00
parent 58f03cbff7
commit 16a9c5d40b
2 changed files with 65 additions and 1 deletions
+60
View File
@@ -0,0 +1,60 @@
function changeProduct(event)
{
const productID = $(event.target).val();
loadProductBranchs(productID);
loadProductModules(productID);
loadProductStories(productID);
loadScenes(productID);
}
function loadProductBranchs(productID)
{
var param = config.currentMethod == 'create' ? 'active' : 'all';
var oldBranch = config.currentMethod == 'edit' ? caseBranch : 0;
var param = "productID=" + productID + "&oldBranch=" + oldBranch + "&param=" + param;
if(typeof(tab) != 'undefined' && (tab == 'execution' || tab == 'project')) param += "&projectID=" + objectID;
$.get($.createLink('branch', 'ajaxGetBranches', param), function(data)
{
$('#branch').remove();
if(data)
{
$('#product').closest('.input-group').append(data);
$('#branch').css('width', config.currentMethod == 'create' ? '120px' : '95px');
}
})
}
function loadProductModules(productID)
{
let branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
const currentModuleID = config.currentMethod == 'edit' ? $('#module').val() : 0;
const link = $.createLink('testcase', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + currentModuleID);
$('#moduleBox').load(link);
}
function loadProductStories(productID)
{
let branch = $('#branch').val();
let moduleID = $('#module').val();
let storyID = $('#story').val();
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(moduleID) == 'undefined') moduleID = 0;
if(typeof(storyID) == 'undefined') storyID = 0;
const link = $.createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + storyID + '&onlyOption=false&status=noclosed&limit=0&type=full&hasParent=1&executionID=' + executionID);
$('#storyBox').load(link);
}
function loadScenes(productID)
{
let branch = $('#branch').val();
let moduleID = $('#module').val();
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(moduleID) == 'undefined') moduleID = 0;
const link = $.createLink('testcase', 'ajaxGetModuleScenes', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&stype=2&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1');
$('#sceneBox').load(link);
}
+5 -1
View File
@@ -10,10 +10,14 @@ declare(strict_types=1);
* @link http://www.zentao.net
*/
namespace zin;
jsVar('executionID', $executionID);
jsVar('tab', $this->app->tab);
if($app->tab == 'execution') jsVar('objectID', $executionID);
if($app->tab == 'project') jsVar('objectID', $projectID);
formPanel
(
on::change('#product', 'loadAllNew'),
on::change('#product', 'changeProduct'),
on::change('#branch', 'loadBranchNew'),
on::click('#refresh', 'loadProductModulesNew'),
to::headingActions(icon('cog-outline')),