⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkroute.js

📁 非常完整的Java开发的网络办公系统
💻 JS
字号:
function checkRoute( textValue , name )
{
    var theObject = "document.forms[0]."+name;
    if  (  ( !stripWhitespace( textValue ) || isEmpty( textValue ) )  &&  ( name == 'routeName')  )  
    {    
        alert('请输入工作流模板的标题,不能为空!');
        
        document.forms[0].routeName.focus();
        return false;
    }
    if (  textValue.length > 30 &&  ( name == 'routeName') )
    {
    	alert('工作流模板的标题必须小于30个字符!');
    	 document.forms[0].routeName.focus();
        return false;
    }
    if (  textValue.length > 800 && ( name =='description' ) )
    {
    	alert('工作流描述必须小于800个字符!');
    	 document.forms[0].description.focus();
        return false;
    }
    return true;
}

function checkDescription( textValue )
{ 
    if (  textValue.length > 800 )
    {
    	alert(' 工作流描述必须小于800个字符!');
    	document.forms[0].description.focus();
        return false;
    }
    return true;
	
}

function checkSelected()
{
    if ( document.forms[0].subtaskList.value == '' )
    {
        alert('请选择子任务!');
        document.forms[0].subtaskList.focus();
        return false;
    }
    else 
       return true;
}

function noMultiSelect()
{
    var number = 0;
    for( var i =0 ; i < document.forms[0].subtaskList.length ; i++)
    {
        if ( document.forms[0].subtaskList.options[i].selected == true )
               number ++; 
    }
    if ( number > 1 )
    {
        alert("只能选择一个!");
        document.forms[0].subtaskList.focus();
        return false;
    }
    else
        return true;       
}

function onlyOne()
{
    if ( document.forms[0].subtaskList.length == 1 )
    {
        alert("只有一个子任务存在,不能删除或排序!");
        document.forms[0].subtaskList.focus();
        return false;
    }
    else
        return true;  
}


function moveUpDn(direction) 
{
     if ( !checkSelected() )  return false;
    if (  ! noMultiSelect() ) return false;
    myform = document.forms[0];
    myindex = -1;

    index = myform.subtaskList.options.length;
    count = 0;
    for (i = myform.subtaskList.options.length - 1; i > myindex; i--) 
    {
        if (myform.subtaskList.options(i).selected == true)
        {
	         count++;
	         index = i;
	       }
    }
    if (count == 1) 
    {	// Select One only
        if (direction < 0 && index > myindex + 1)
         {		// Up
	          newOpt = new Option(myform.subtaskList.item(index).text, myform.subtaskList.item(index).value);
	          newOpt.selected = true;
            myform.subtaskList.remove(index);
            myform.subtaskList.add(newOpt, index + direction);
        }
        if (direction > 0 && index < myform.subtaskList.options.length - 1) 
        { // Down
	         newOpt = new Option(myform.subtaskList.item(index).text, myform.subtaskList.item(index).value);
	         newOpt.selected = true;
            myform.subtaskList.remove(index);
            myform.subtaskList.add(newOpt, index + direction);
        }
    }
    submitForm('sort');
}

function checkSequence( subtaskList )
{
    var list = subtaskList;	
	if ( !subtaskList )
	{
	    alert("子任务必须不为空!");
	    return false;   
	}
	var k = 0;
	if ( !list.type)
	{
		// check subtask sequence
		for( i = 0; i<list.length; i++ )
		{
			var found = 0;
			for(j = 0; j< list.length;j++)
			{
				if ( i+1 == list[j].value)
				{					
					k++;
					found =1;
				}
			}
			if (k == list.length)
			{
				break;
			}
			if ( found == 0)
			{
				alert("子任务顺序必须是从1开始不间断的整数!");
				return false;
			}
		}
	}
   return true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -