dept.js
来自「很全面的hrm管理。提供通用的企业人力资源管理。」· JavaScript 代码 · 共 192 行
JS
192 行
function setDepartmentValue(val,text,_defaultDeptId,type,_url){
var defaultDeptID = "";
if(type == undefined || type == null || type == ""){
type = "T";
}
if(_defaultDeptId && _defaultDeptId != ""){
defaultDeptID = "&CurrentDeptUuid="+_defaultDeptId;
}
var newWindow = window.showModalDialog("../common/deptListAction.do?DisplayType="+type+defaultDeptID);
if(newWindow['id'] == undefined || newWindow['name'] == undefined){
alert("请选择值");
return;
}
var valueObj = document.getElementById(val);
var textObj = document.getElementById(text);
if (newWindow) {
if (newWindow['id']) {
valueObj.value = newWindow['id'];
textObj.value = newWindow['name'];
}
}
}
function setDepartmentValueWithSecond(val,text,secondId,secondName,selectOn,_defaultDeptId,type,_url){
var defaultDeptID = "";
if(type == undefined || type == null || type == ""){
type = "T";
}
if(_defaultDeptId && _defaultDeptId != ""){
defaultDeptID = "&CurrentDeptUuid="+_defaultDeptId;
}
var newWindow = window.showModalDialog("../common/deptListAction.do?DisplayType="+type+defaultDeptID);
if (newWindow) {
if(newWindow['id'] == undefined || newWindow['name'] == undefined){
alert("请选择值");
return;
}
}
var valueObj = document.getElementById(val);
var textObj = document.getElementById(text);
var secondIdObj = document.getElementById(secondId);
var secondNameObj = document.getElementById(secondName);
if (newWindow) {
// alert("ccccccccccccccc");
if(newWindow['id']){
// alert("aaaaaaaaaaa");
valueObj.value = newWindow['id'];
textObj.value = newWindow['name'];
}
if(selectOn=='dept'&& newWindow['id']){
// alert("bbbbbbbbbbbbb");
secondIdObj.value = newWindow['id'];
secondNameObj.value = newWindow['name'];
}else if(selectOn=='class'&& newWindow['secondDeptId']){
secondIdObj.value = newWindow['secondDeptId'];
secondNameObj.value = newWindow['secondDeptName'];
}
}
}
function setDepartmentValueByNameWithSecond(idNames, textNames, secondId, secondName, selectOn, popuper, type){
var objNumber;
popuper.setAttribute("number","#");
popuperArray = document.getElementsByName(popuper.name);
for(i=0; i<popuperArray.length; i++) {
if (popuperArray[i].number) {
popuperArray[i].removeAttribute("number");
objNumber = i;
}
}
var returnValues = getDepartmentValue(type);
idArray = document.getElementsByName(idNames);
textArray = document.getElementsByName(textNames);
secondIdArray = document.getElementsByName(secondId);
secondNameArray = document.getElementsByName(secondName);
if (returnValues) {
if (returnValues['id']) {
idArray[objNumber].value = returnValues['id'];
textArray[objNumber].value = returnValues['name'];
}
}
if (returnValues) {
if(selectOn=='dept' && returnValues['id']){
secondIdArray[objNumber].value = returnValues['id'];
secondNameArray[objNumber].value = returnValues['name'];
}else if(selectOn=='class' && returnValues['secondDeptId'] != 'undefined'){
secondIdArray[objNumber].value = returnValues['secondDeptId'];
secondNameArray[objNumber].value = returnValues['secondDeptName'];
}
}
}
function getDepartmentValue(type,_defaultDeptId, deptId){
dialogBoxWidth = 600 //window.screen.width / 2;
dialogBoxHeight = 480 //window.screen.height / 2;
dialogBoxLeft = 100 //dialogBoxWidth / 2;
dialogBoxTop = 100 //dialogBoxHeight /2;
var defaultDeptID = "";
if(!type || type == ""){
type = "T";
}
if(_defaultDeptId && _defaultDeptId != ""){
defaultDeptID = "&CurrentDeptUuid="+_defaultDeptId;
}
// alert(deptId);
if (deptId && deptId != "") {
defaultDeptID = defaultDeptID + "&deptId=" + deptId;
}
var newWindow = window.showModalDialog("../common/deptListAction.do?DisplayType="+type+defaultDeptID, '', 'dialogWidth:' + dialogBoxWidth + 'px;dialogHeight:' + dialogBoxHeight + 'px;dialogLeft:' + dialogBoxLeft + 'px;dialogTop:' + dialogBoxTop + 'px;center:yes;help:no;resizable:yes;status:no');
if(newWindow) {
if(!newWindow['id'] || !newWindow['name']){
return;
}
}
return newWindow;
}
function setDepartmentValueByName(idNames, textNames, newWorkTeamId, teamname, popuper, type) {
var objNumber;
popuper.setAttribute("number","#");
popuperArray = document.getElementsByName(popuper.name);
for(i=0; i<popuperArray.length; i++) {
if (popuperArray[i].number) {
popuperArray[i].removeAttribute("number");
objNumber = i;
}
}
var returnValues = getDepartmentValue(type);
idArray = document.getElementsByName(idNames);
textArray = document.getElementsByName(textNames);
newWorkTeamIdArray = document.getElementsByName(newWorkTeamId);
teamnameArray = document.getElementsByName(teamname);
if (returnValues) {
if (returnValues['id']) {
/*
alert("id " + returnValues['id']);
alert("name " + returnValues['name']);
alert("secondDeptId " + returnValues['secondDeptId']);
alert("secondDeptName " + returnValues['secondDeptName']);
*/
if (returnValues['secondDeptId'] == 'undefined') {
returnValues['secondDeptId'] = returnValues['id'];
returnValues['secondDeptName'] = returnValues['name'];
}
idArray[objNumber].value = returnValues['secondDeptId'];
textArray[objNumber].value = returnValues['secondDeptName'];
if (returnValues['id'] == returnValues['secondDeptId']) {
newWorkTeamIdArray[objNumber].value = "";
teamnameArray[objNumber].value = "";
} else {
newWorkTeamIdArray[objNumber].value = returnValues['id'];
teamnameArray[objNumber].value = returnValues['name'];
}
}
}
}
function setTeamValueByName(idNames, textNames, deptId, deptname, popuper, type) {
setDepartmentValueByName(deptId, deptname, idNames, textNames, popuper, type);
}
window.onerror = function(){
return false;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?