* [task#131935,doing,1h] add js method.

This commit is contained in:
sunguangming
2024-11-06 14:00:28 +08:00
committed by 王怡栋
parent 08d6be41fc
commit caf446b2cd
2 changed files with 65 additions and 1 deletions
+63
View File
@@ -618,3 +618,66 @@ window.renderRowData = function($row, index, row)
const mode = $('[name=mode]').val();
$row.find('[data-name=id]').addClass('center').html("<span class='team-number'>" + $row.find('[data-name=id]').text() + "</span><i class='icon-angle-down " + (mode == 'linear' ? '' : 'hidden') + "'><i/>");
}
parentEstStarted = '';
parentDeadline = '';
overParentEstStartedLang = '';
overParentDeadlineLang = '';
window.getParentEstStartedAndDeadline = function()
{
const parent = $('[name=parent]').val();
if(!parent) return;
const link = $.createLink('task', 'ajaxGetTaskEstStartedAndDeadline', 'taskID=' + parent);
$.getJSON(link, function(data)
{
parentEstStarted = data.estStarted;
parentDeadline = data.deadline;
overParentEstStartedLang = data.overParentEstStartedLang;
overParentDeadlineLang = data.overParentDeadlineLang;
window.checkEstStartedAndDeadline({target: $('[name=estStarted]')});
window.checkEstStartedAndDeadline({target: $('[name=deadline]')});
});
}
window.checkEstStartedAndDeadline = function(event)
{
const parent = $('[name=parent]').val();
if(!parent) return;
const $form = $(event.target).closest('form');
const field = $(event.target).attr('name')
const $estStarted = $form.find('[name=estStarted]');
const estStarted = $estStarted.val();
const $deadline = $form.find('[name=deadline]');
const deadline = $deadline.val();
if(field == 'estStarted' && estStarted.length > 0 && parentEstStarted.length > 0 && estStarted < parentEstStarted)
{
const $estStartedDiv = $estStarted.closest('.form-group');
if($estStartedDiv.find('.date-tip').length == 0 || $estStartedDiv.find('.date-tip .form-tip').length > 0)
{
$estStartedDiv.find('.date-tip').remove();
let $datetip = $('<div class="date-tip"></div>');
$datetip.append('<div class="form-tip text-warning">' + overParentEstStartedLang + '<span class="ignore-date underline">' + ignoreLang + '</div>');
$datetip.off('click', '.ignore-date').on('click', '.ignore-date', function(e){ignoreTip(e)});
$estStartedDiv.append($datetip);
}
}
if(field == 'deadline' && deadline.length > 0 && parentDeadline.length > 0 && deadline > parentDeadline)
{
const $deadlineDiv = $deadline.closest('.form-group');
if($deadlineDiv.find('.date-tip').length == 0 || $deadlineDiv.find('.date-tip .form-tip').length > 0)
{
$deadlineDiv.find('.date-tip').remove();
let $datetip = $('<div class="date-tip"></div>');
$datetip.append('<div class="form-tip text-warning">' + overParentDeadlineLang + '<span class="ignore-date underline">' + ignoreLang + '</div>');
$datetip.off('click', '.ignore-date').on('click', '.ignore-date', function(e){ignoreTip(e)});
$deadlineDiv.append($datetip);
}
}
}
+2 -1
View File
@@ -399,6 +399,7 @@ window.setStoryModule = function()
});
}
}
function checkEstStartedAndDeadline(event)
{
const $form = $(event.target).closest('form');
@@ -408,7 +409,7 @@ function checkEstStartedAndDeadline(event)
const $deadline = $form.find('[name=deadline]');
const deadline = $deadline.val();
if(field == 'estStarted' && estStarted.length > 0 && parentEstStarted.length > 0&& estStarted < parentEstStarted)
if(field == 'estStarted' && estStarted.length > 0 && parentEstStarted.length > 0 && estStarted < parentEstStarted)
{
const $estStartedDiv = $estStarted.closest('.form-group');
if($estStartedDiv.find('.date-tip').length == 0 || $estStartedDiv.find('.date-tip .form-tip').length > 0)