Merge branch release/21.7.8 of zentao/zentaopms (#12896)
This commit is contained in:
@@ -127,6 +127,7 @@ $config->testcase->form->showImport['keywords'] = array('required' => false,
|
||||
$config->testcase->form->showImport['stage'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->testcase->form->showImport['steps'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->testcase->form->showImport['expects'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
if($config->edition != 'open') $config->testcase->form->showImport['scene'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
|
||||
$config->testcase->form->automation = array();
|
||||
$config->testcase->form->automation['product'] = array('required' => true, 'type' => 'int', 'default' => 0);
|
||||
|
||||
@@ -2075,4 +2075,23 @@ class testcase extends control
|
||||
$caseModuleItmes = isset($moduleItems[$caseID]) ? $moduleItems[$caseID] : array();
|
||||
return print(json_encode($caseModuleItmes));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: 获取用例对应产品模块的场景。
|
||||
* AJAX: Get scenes items for case.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @param string $branch
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function ajaxGetProductScenes(int $productID, int $moduleID, string $branch)
|
||||
{
|
||||
$items = array();
|
||||
$branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$scenes = $this->testcase->getSceneMenu($productID, $moduleID, ($branch === 'all' || !isset($branches[$branch])) ? 'all' : (string)$branch);
|
||||
foreach($scenes as $sceneID => $sceneName) $items[] = array('text' => $sceneName, 'value' => $sceneID);
|
||||
return print(json_encode($items));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,19 @@ window.renderRowCol = function($result, col, row)
|
||||
});
|
||||
});
|
||||
}
|
||||
if(col.name == 'scene')
|
||||
{
|
||||
$result.find('.picker-box').on('inited', function(e, info)
|
||||
{
|
||||
const sceneLink = $.createLink('testcase', 'ajaxGetProductScenes', 'productID=' + row.product + '&moduleID=' + row.module + '&branch=' + row.branch);
|
||||
$.getJSON(sceneLink, function(scenes)
|
||||
{
|
||||
let $scene = info[0];
|
||||
$scene.render({items: scenes});
|
||||
$scene.$.setValue(row.scene);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function computeImportTimes()
|
||||
@@ -52,6 +65,15 @@ function changeModule(event)
|
||||
$storyPicker.render({items: stories});
|
||||
$storyPicker.$.setValue(oldStory);
|
||||
});
|
||||
|
||||
const $scenePicker = $currentRow.find('.form-batch-control[data-name="scene"] .picker').zui('picker');
|
||||
const oldScene = $currentRow.find('input[name^=scene]').val();
|
||||
const sceneLink = $.createLink('testcase', 'ajaxGetProductScenes', 'productID=' + productID + '&moduleID=' + moduleID + '&branch=' + branch);
|
||||
$.getJSON(sceneLink, function(scenes)
|
||||
{
|
||||
$scenePicker.render({items: scenes});
|
||||
$scenePicker.$.setValue(oldScene);
|
||||
});
|
||||
}
|
||||
|
||||
function changeBranch(event)
|
||||
|
||||
@@ -93,6 +93,19 @@ else
|
||||
'required' => strpos(",$requiredFields,", ',module,') !== false
|
||||
);
|
||||
|
||||
if($this->config->edition != 'open')
|
||||
{
|
||||
$items[] = array
|
||||
(
|
||||
'name' => 'scene',
|
||||
'label' => $lang->testcase->scene,
|
||||
'control' => array('control' => 'picker', 'required' => true),
|
||||
'items' => array(),
|
||||
'width' => '200px',
|
||||
'required' => strpos(",$requiredFields,", ',scene,') !== false
|
||||
);
|
||||
}
|
||||
|
||||
$items[] = array
|
||||
(
|
||||
'name' => 'story',
|
||||
|
||||
Reference in New Issue
Block a user