Merge branch 'master_xieqiyu_14595' into 'master'

* Fix bug#14595.

See merge request easycorp/zentaopms!2871
This commit is contained in:
孙广明
2022-04-12 01:41:18 +00:00
+71 -1
View File
@@ -2,7 +2,22 @@ $(function()
{
$('#execution_chosen').click(function()
{
if(systemMode == 'new') $('#execution_chosen ul li:first').append(' <label class="label">' + projectCommon + '</label>');
if(systemMode == 'new')
{
$('#execution_chosen ul li').each(function(index)
{
if(index == 0)
{
var projectName = subString($(this).text(), 56);
$(this).text(projectName);
$(this).append(' <label class="label">' + projectCommon + '</label>');
}
else
{
$(this).prepend('&nbsp;&nbsp;&nbsp;');
}
})
}
})
})
@@ -21,6 +36,13 @@ function setRole(account, roleID)
roleOBJ.val(role) // set the role.
}
/**
* Add item.
*
* @param object $obj
* @access public
* @return void
*/
function addItem(obj)
{
var item = $('#addItem').html().replace(/%i%/g, itemIndex);
@@ -40,12 +62,26 @@ function addItem(obj)
itemIndex ++;
}
/**
* Delete item.
*
* @param object $obj
* @access public
* @return void
*/
function deleteItem(obj)
{
if($('#teamForm .table tbody').children().length < 2) return false;
$(obj).closest('tr').remove();
}
/**
* Set dept users.
*
* @param object $obj
* @access public
* @return void
*/
function setDeptUsers(obj)
{
dept = $(obj).val(); // Get dept ID.
@@ -53,6 +89,13 @@ function setDeptUsers(obj)
location.href=link;
}
/**
* Chose team to copy.
*
* @param object $obj
* @access public
* @return void
*/
function choseTeam2Copy(obj)
{
team = $(obj).val();
@@ -60,3 +103,30 @@ function choseTeam2Copy(obj)
link = createLink('execution', 'manageMembers', 'executionID=' + executionID + '&team2Import=' + team + '&dept=' + dept);
location.href=link;
}
/**
* Cut a string of letters and characters with the same length.
*
* @param string $title
* @param int $stringLength
* @access public
* @return string
*/
function subString(title, stringLength)
{
if(title.replace(/[\u4e00-\u9fa5]/g, "**").length > stringLength)
{
var length = 0;
for(var i = 0; i < title.length; i ++)
{
length += title.charCodeAt(i) > 255 ? 2 : 1;
if(length > stringLength)
{
title = title.substring(0, i) + '...';
break;
}
}
}
return title;
}