You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
308 lines
11 KiB
JavaScript
308 lines
11 KiB
JavaScript
var commonGridObj_attr;
|
|
var commonGridObj_compattr;
|
|
var comboCustomer;//委托单位
|
|
var user_comp;
|
|
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function createUserTree(){
|
|
user_comp = new dhtmlXTreeObject("dvUserTree","100%","100%",0);
|
|
user_comp.setSkin('dhx_skyblue');
|
|
user_comp.setImagePath("../images/csh_dhx_skyblue/");
|
|
|
|
var url = "../WorkFlow/WorkFlowGridSource.aspx?handle=depttree&uid="+newGuid();
|
|
user_comp.loadJSON(url,function(){
|
|
finishLoading();
|
|
});
|
|
user_comp.enableCheckBoxes(true);
|
|
|
|
user_comp.attachEvent("onClick", function(id){
|
|
initLoading();
|
|
user_comp.setCheck(id,true);
|
|
|
|
var tempItemId = "";
|
|
tempItemId = id;
|
|
while(user_comp.getLevel(tempItemId) != 1){
|
|
tempItemId = user_comp.getParentId(tempItemId);
|
|
continue;
|
|
}
|
|
if(validateType(id) == 2){
|
|
$("h_compid").value = id;
|
|
$("h_deptid").value = "";
|
|
}else if(validateType(id) == 3){
|
|
$("h_deptid").value = id;
|
|
$("h_compid").value = tempItemId;
|
|
}
|
|
|
|
if((tempItemId != id) && (validateType(id) == 3)){
|
|
$("h_deptid").value = id;
|
|
}
|
|
createCompAttrGrid();
|
|
|
|
var selectedVal = user_comp.getAllChecked();
|
|
var selectedArg = new Array();
|
|
if(selectedVal.indexOf(",") >= 0){
|
|
selectedArg = selectedVal.split(",");
|
|
}else{
|
|
selectedArg.push(selectedVal);
|
|
}
|
|
|
|
for(var i=0;i<selectedArg.length;i++){
|
|
if(selectedArg[i] != id){
|
|
user_comp.setCheck(selectedArg[i],false);
|
|
}
|
|
}
|
|
});
|
|
|
|
user_comp.attachEvent("onCheck", function(id,state){
|
|
if(state){
|
|
user_comp.setCheck(id,true);
|
|
var tempItemId = "";
|
|
|
|
tempItemId = id;
|
|
while(user_comp.getLevel(tempItemId) != 1){
|
|
tempItemId = user_comp.getParentId(tempItemId);
|
|
continue;
|
|
}
|
|
|
|
if(validateType(id) == 2){
|
|
$("h_compid").value = id;
|
|
$("h_deptid").value = "";
|
|
}else if(validateType(id) == 3){
|
|
$("h_deptid").value = id;
|
|
$("h_compid").value = tempItemId;
|
|
}
|
|
|
|
if((tempItemId != id) && (validateType(id) == 3)){
|
|
$("h_deptid").value = id;
|
|
$("h_compid").value = tempItemId;
|
|
}
|
|
|
|
createCompAttrGrid();
|
|
$("h_checkvalue").value = id;
|
|
|
|
var selectedVal = user_comp.getAllChecked();
|
|
var selectedArg = new Array();
|
|
if(selectedVal.indexOf(",") >= 0){
|
|
selectedArg = selectedVal.split(",");
|
|
}else{
|
|
selectedArg.push(selectedVal);
|
|
}
|
|
|
|
for(var i=0;i<selectedArg.length;i++){
|
|
if(selectedArg[i] != id){
|
|
user_comp.setCheck(selectedArg[i],false);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function createCompAttrGrid(){
|
|
var compVal = "";
|
|
if($("h_compid").value.trim() != ""){
|
|
compVal = "&checkcompid="+getID($("h_compid").value.trim());
|
|
}
|
|
//header
|
|
var headerArgs_attr = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll('ck_all')\" />","参数名称","参数描述名称","参数值","创建人","创建时间");//
|
|
//width
|
|
var widthArgs_attr = new Array("40","200","300","100","100","130");
|
|
//column align
|
|
var colAlignArgs_attr = new Array("center","center","center","center","center","center");
|
|
//column sort
|
|
var colSortArgs_attr = new Array("na","str","str","str","str","str");
|
|
//column type
|
|
var colTypeArgs_attr = new Array("ch","ro","ro","ro","ro","ro");
|
|
|
|
|
|
commonGridObj_compattr = new TGridCommon("mygrid_container_attrlist","form1",headerArgs_attr,widthArgs_attr,colAlignArgs_attr,colSortArgs_attr,colTypeArgs_attr);
|
|
|
|
commonGridObj_compattr.setResponseUrl("AttributeGridSource.aspx");
|
|
commonGridObj_compattr.setRequest("AttributeGridSource.aspx?handle=compattrlist"+compVal+"&uid="+commonGridObj_compattr.newGuid());
|
|
commonGridObj_compattr.setSourceType("json");
|
|
commonGridObj_compattr.setSkin("xp");
|
|
commonGridObj_compattr.setImageUrl("../images/");
|
|
commonGridObj_compattr.initGrid();
|
|
commonGridObj_compattr.loadafter = true;
|
|
commonGridObj_compattr.after = function(){
|
|
finishLoading();
|
|
};
|
|
commonGridObj_compattr.bind();
|
|
|
|
commonGridObj_compattr.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
|
|
var openSet = "height=200, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-200)/2 + ",Left= "+(screen.width-1024)/2
|
|
var openType = "_blank";
|
|
var openUrl = "AttributeCompanyEdit.aspx?handle=edit&id="+rId+"&checkcompid="+getID($("h_compid").value.trim());
|
|
//var tempWin = window.open ("about:blank",openType,openSet);
|
|
//tempWin.location = openUrl;
|
|
window.open(openUrl,openType,openSet);
|
|
});
|
|
|
|
commonGridObj_compattr.dbclickEvent = function(){
|
|
commonGridObj_compattr.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
|
|
var openSet = "height=200, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-200)/2 + ",Left= "+(screen.width-1024)/2
|
|
var openType = "_blank";
|
|
var openUrl = "AttributeCompanyEdit.aspx?handle=edit&id="+rId+"&checkcompid="+getID($("h_compid").value.trim());
|
|
// var tempWin = window.open ("about:blank",openType,openSet);
|
|
// tempWin.location = openUrl;
|
|
window.open(openUrl,openType,openSet);
|
|
});
|
|
}
|
|
}
|
|
|
|
function newGuid(){
|
|
var guid = "";
|
|
for (var i = 1; i <= 32; i++){
|
|
var n = Math.floor(Math.random()*16.0).toString(16);
|
|
guid += n;
|
|
if((i==8)||(i==12)||(i==16)||(i==20))
|
|
guid += "-";
|
|
}
|
|
return guid.toUpperCase();
|
|
}
|
|
|
|
function initLoading(){
|
|
$("progressBar").style.display = "";
|
|
}
|
|
|
|
function finishLoading(){
|
|
$("progressBar").style.display = "none";
|
|
}
|
|
|
|
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
|
|
|
|
function validateType(strObj){
|
|
var type = 0;
|
|
var result = strObj.substring(0,strObj.indexOf("#"));
|
|
var typeName = strObj.substring(strObj.indexOf("#")+1,strObj.length);
|
|
|
|
switch(typeName){
|
|
case "user":
|
|
type = 1;
|
|
break;
|
|
case "comp":
|
|
type = 2;
|
|
break;
|
|
case "dept":
|
|
type = 3;
|
|
break;
|
|
}
|
|
|
|
return type;
|
|
}
|
|
|
|
function getID(strObj){
|
|
var uid = strObj.substring(0,strObj.indexOf("#"));
|
|
return uid;
|
|
}
|
|
|
|
function searchUser(txtObjName){
|
|
var searchVal = $(txtObjName).value;
|
|
var searchType = $("sel_type").value;
|
|
|
|
var searchUserObj = null;
|
|
var searchDeptObj = null;
|
|
|
|
if(searchType == 1){
|
|
var url = "../Modules/ModuleGridSource.aspx?handle=checkdept&searchdept="+escape(searchVal)+"&uid="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var postStatus = loader.xmlDoc.responseText;
|
|
|
|
if(postStatus != ""){
|
|
searchDeptObj = JSON.parse(postStatus,function(key,value){
|
|
return value;
|
|
});
|
|
}
|
|
if(user_comp != null){
|
|
for(var i=0;i<searchDeptObj.depts.length;i++){
|
|
user_comp.selectItem(searchDeptObj.depts[i].gid+"#dept");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function refreshList(){
|
|
createCompAttrGrid();
|
|
}
|
|
|
|
function addAttribute(){
|
|
var openSet = "height=200, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-200)/2 + ",Left= "+(screen.width-1024)/2
|
|
var openType = "_blank";
|
|
var openUrl = "AttributeCompanyEdit.aspx?handle=add&checkcompid="+getID($("h_compid").value.trim());
|
|
var tempWin = window.open ("about:blank",openType,openSet);
|
|
tempWin.location = openUrl;
|
|
}
|
|
|
|
function editAttribute(){
|
|
var selArg = new Array();
|
|
var iCount = 0;
|
|
for(var i=0;i<commonGridObj_compattr.getGridObj().getRowsNum();i++){
|
|
var checkState = commonGridObj_compattr.getGridObj().cellByIndex(i,0).getValue();
|
|
var rId = commonGridObj_compattr.getGridObj().getRowId(i);
|
|
if(checkState == 1){
|
|
iCount++;
|
|
selArg.push(rId);
|
|
}
|
|
}
|
|
|
|
if(iCount == 1){
|
|
// var openSet = "height=768, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-768)/2 + ",Left= "+(screen.width-1024)/2
|
|
// var openType = "_blank";
|
|
// var openUrl = "AttributeCompanyEdit.aspx?id="+selArg[0]+"&handle=edit&compid="+getID($("h_compid").value.trim());
|
|
// var tempWin = window.open ("about:blank",openType,openSet);
|
|
// tempWin.location = openUrl;
|
|
|
|
var openSet = "height=200, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-200)/2 + ",Left= "+(screen.width-1024)/2
|
|
var openType = "_blank";
|
|
var openUrl = "AttributeCompanyEdit.aspx?handle=edit&id="+selArg[0]+"&checkcompid="+getID($("h_compid").value.trim());
|
|
//var tempWin = window.open ("about:blank",openType,openSet);
|
|
//tempWin.location = openUrl;
|
|
window.open(openUrl,openType,openSet);
|
|
}else{
|
|
alert("每次只能编辑一个参数信息");
|
|
}
|
|
|
|
}
|
|
|
|
function deleteCompanyAttr(){
|
|
var delArg = new Array();
|
|
var iDelCount = 0;
|
|
for(var i=0;i<commonGridObj_compattr.getGridObj().getRowsNum();i++){
|
|
var checkState = commonGridObj_compattr.getGridObj().cellByIndex(i,0).getValue();
|
|
var rId = commonGridObj_compattr.getGridObj().getRowId(i);
|
|
if(checkState == 1){
|
|
iDelCount++;
|
|
delArg.push(rId);
|
|
}
|
|
}
|
|
|
|
if(iDelCount > 0){
|
|
if(window.confirm("确定要将选择的公司参数删除?")){
|
|
for(var j=0;j<delArg.length;j++){
|
|
var url = "AttributeGridSource.aspx?handle=deletecompattr&compattrid="+delArg[j]+"&uid="+commonGridObj_compattr.newGuid();
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
var stateInfo = loader.xmlDoc.responseText;
|
|
var state = parseInt(stateInfo);
|
|
|
|
}
|
|
createCompAttrGrid();
|
|
}
|
|
}
|
|
}
|
|
|
|
function checkAll(id){
|
|
if($(id).checked){
|
|
for(var i=0;i<commonGridObj_compattr.getGridObj().getRowsNum();i++){
|
|
commonGridObj_compattr.getGridObj().cellByIndex(i,0).setValue(1);
|
|
}
|
|
}else{
|
|
for(var i=0;i<commonGridObj_compattr.getGridObj().getRowsNum();i++){
|
|
commonGridObj_compattr.getGridObj().cellByIndex(i,0).setValue(0);
|
|
}
|
|
}
|
|
}
|
|
|