This commit is contained in:
tianshujie
2022-04-11 09:16:55 +08:00
parent 63946bb238
commit 4a80b55540
4 changed files with 31 additions and 25 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ $(function()
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
{
if(!stories) modules = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
if(!stories) stories = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
$('#story' + num).replaceWith(stories);
$('#story' + num + "_chosen").remove();
$('#story' + num).next('.picker').remove();
+1 -1
View File
@@ -361,7 +361,7 @@ function updateStepID()
*/
function loadStories(productID, moduleID, num)
{
var branchIDName = config.currentMethod == 'batchcreate' ? '#branch' : '#branches';
var branchIDName = (config.currentMethod == 'batchcreate' || config.currentMethod == 'showimport') ? '#branch' : '#branches';
var branchID = $(branchIDName + num).val();
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
+28 -22
View File
@@ -1,25 +1,31 @@
$(document).on('mouseup', '[id^=story].chosen-with-drop', function()
$("[name^='product']").each(function()
{
var select = $(this).prev('select');
var id = $(select).attr('id');
var index = id.substring(5);
var moduleID = $('#module' + index).val();
var branch = $('#branch' + index).length > 0 ? $('#branch' + index).val() : 0;
if(moduleID == 'ditto')
var id = $(this).attr('id');
$(this).attr('id', 'product' + id.match(/\d+/));
});
$("[name^='branch']").each(function()
{
var id = $(this).attr('id');
$(this).attr('id', 'branch' + id.match(/\d+/));
});
$("[name^='story']").each(function()
{
var id = $(this).attr('id');
var num = id.substring(5);
var productID = $('#product' + num).val();
var branchID = $('#branch' + num).val();
var moduleID = $('#module' + num).val();
var storyID = $("#story" + num).val();
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
{
for(var i = index - 1; i >=0; i--)
{
if($('#module' + i).val() != 'ditto')
{
moduleID = $('#module' + i).val();
break;
}
}
}
var link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID='+ ($(select).val() || '0') + '&onlyOption=true&status=noclosed&limit=0&type=null');
var $story = $('#story' + index);
if($story.data('loadLink') !== link)
{
$story.load(link, function(){$story.data('loadLink', link).trigger("chosen:updated");});
}
if(!stories) stories = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
$('#story' + num).replaceWith(stories);
$('#story' + num + "_chosen").remove();
$('#story' + num).next('.picker').remove();
$('#story' + num).attr('name', 'story[' + num + ']').chosen();
$('#story' + num).val(storyID).trigger('chosen:updated');
});
});
+1 -1
View File
@@ -82,7 +82,7 @@ $(function()
<td><?php echo html::input("title[$key]", htmlSpecialString($case->title, ENT_QUOTES), "class='form-control'")?></td>
<td style='overflow:visible'>
<?php $caseModules = (isset($case->branch) and $case->branch != 0) ? $modules[BRANCH_MAIN] + $modules[$case->branch] : $modules[BRANCH_MAIN];?>
<?php echo html::select("module[$key]", $caseModules, isset($case->module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange'")?>
<?php echo html::select("module[$key]", $caseModules, isset($case->module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange' onchange='loadStories($case->product, this.value, $key)'")?>
</td>
<td style='overflow:visible'>
<?php $storyID = isset($case->story) ? $case->story : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->story : '');?>