Merge branch 'sprint/zentaopms256_lanzongjun' into 'zentaopms_256'

* finish task #75316

See merge request easycorp/zentaopms!6093
This commit is contained in:
孙广明
2022-11-10 00:25:31 +00:00
3 changed files with 71 additions and 3 deletions
-1
View File
@@ -6,7 +6,6 @@
.input-group .control-product + .chosen-container-single .chosen-single {border-radius: 2px 0 0 2px; border-right-width: 1px; padding-right: 1px;}
.input-group .control-product + .chosen-container-active .chosen-single {border-right-width: 1px; padding-right: 0;}
.input-group .control-branch + .chosen-container-single .chosen-single {border-radius: 0 2px 2px 0; border-left-width: 0px;}
#batchCreateForm .input-group, #batchEditForm .input-group,
#batchCreateForm .input-group .form-control, #batchEditForm .input-group .form-control {position: static;}
+68 -2
View File
@@ -118,6 +118,24 @@ $(window).unload(function(){
*/
function addBranchesBox(obj)
{
if($(".table-form select[id^='branches']").length == $('.switchBranch #branchBox option').length) return false;
var selectedVal = [];
$(".table-form select[id^='branches']").each(function()
{
var selectedProduct = $(this).val();
if($.inArray(selectedProduct, selectedVal) < 0) selectedVal.push(selectedProduct);
});
var branch = 0;
$('.table-form #branches0 option').each(function(){
if($.inArray($(this).val(), selectedVal) < 0)
{
branch = $(this).val();
return false;
}
});
var item = $('#addBranchesBox').html().replace(/%i%/g, itemIndex);
$(obj).closest('tr').after('<tr class="addBranchesBox' + itemIndex + '">' + item + '</tr>');
$('#branches_i__chosen').remove();
@@ -128,11 +146,21 @@ $(window).unload(function(){
$('#plans' + itemIndex).chosen();
$('.addBranchesBox' + itemIndex + ' #planIdBox').css('flex', '0 0 ' + gap + 'px');
loadBranchForSiblings($('#product').val(), 0, itemIndex)
$.ajaxSettings.async = false;
loadBranchForSiblings($('#product').val(), branch, itemIndex)
loadModuleForSiblings($('#product').val(), 0, itemIndex)
loadPlanForSiblings($('#product').val(), 0, itemIndex)
$.ajaxSettings.async = true;
$('.addBranchesBox' + itemIndex + ' #branchBox .input-group .input-group-addon').html($.cookie('branchSourceName'))
disableSelectedBranches();
if($(".table-form select[id^='branches']").length == $('.switchBranch #branchBox option').length)
{
$('.icon-plus').parent().css('pointer-events', 'none')
$('.icon-plus').parent().addClass('disabled')
}
itemIndex ++;
}
@@ -146,8 +174,42 @@ $(window).unload(function(){
function deleteBranchesBox(obj)
{
$(obj).closest('tr').remove();
disableSelectedBranches();
$('.icon-plus').parent().css('pointer-events', 'auto')
$('.icon-plus').parent().removeClass('disabled')
}
/**
* Make the selected branch non clickable.
*
* @return void
*/
function disableSelectedBranches()
{
$(".table-form select[id^='branches'] option[disabled='disabled']").removeAttr('disabled');
var selectedVal = [];
$(".table-form select[id^='branches']").each(function()
{
var selectedBranch = $(this).val();
if($.inArray(selectedBranch, selectedVal) < 0) selectedVal.push(selectedBranch);
})
$(".table-form select[id^='branches']").each(function()
{
var selectedBranch = $(this).val();
$(this).find('option').each(function()
{
var optionVal = $(this).attr('value');
if(optionVal != selectedBranch && $.inArray(optionVal, selectedVal) >= 0) $(this).attr('disabled', 'disabled');
})
})
$(".table-form select[id^=branches]").trigger('chosen:updated');
}
/**
* Load branch for multi branch or multi platform.
*
@@ -161,8 +223,12 @@ function loadBranchRelation(branch, branchIndex)
var productID = $('#product').val();
if(typeof(branch) == 'undefined') branch = 0;
$.ajaxSettings.async = false;
loadModuleForSiblings(productID, branch, branchIndex)
loadPlanForSiblings(productID, branch, branchIndex)
$.ajaxSettings.async = true;
disableSelectedBranches()
}
/**
@@ -177,7 +243,7 @@ function loadBranchRelation(branch, branchIndex)
function loadBranchForSiblings(productID, branch, branchIndex)
{
var isSiblings = storyType == 'story' ? 'yes' : 'no';
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0&param=active&projectID=" + executionID + "&withMainBranch=1&isSiblings=" + isSiblings + "&fieldID=" + branchIndex), function(data)
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=" + branch + "&param=active&projectID=" + executionID + "&withMainBranch=1&isSiblings=" + isSiblings + "&fieldID=" + branchIndex), function(data)
{
if(data)
{
+3
View File
@@ -17,6 +17,9 @@
<?php js::set('feedbackSource', $config->story->feedbackSource); ?>
<?php js::set('storyType', $type);?>
<?php js::set('requiredFields', $config->story->create->requiredFields);?>
<?php if($type == 'requirement'): ?>
<style>.input-group .control-branch + .chosen-container-single .chosen-single {border-radius: 0 2px 2px 0; border-left-width: 0px;}</style>
<?php endif; ?>
<?php
foreach(explode(',', $config->story->create->requiredFields) as $field)
{