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.

175 lines
7.2 KiB
JavaScript

var commonGridObj_workflow;
function $(id){
return document.getElementById(id);
}
function createGrid(){//获取工作流workflow信息
//header
var headerArgs_workflow = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll()\" />","系统名称","显示名称","关联模块","步骤信息","创建人","创建时间","状态","排序值","是否已删除");
//width
var widthArgs_workflow = new Array("40","150","150","120","120","150","150","70","70","70");
//column align
var colAlignArgs_workflow = new Array("center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_workflow = new Array("na","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_workflow = new Array("ch","ro","ro","ro","ro","ro","ro","ch","ro","ch");
commonGridObj_workflow = new TGridCommon("mygrid_container_workflow","form1",headerArgs_workflow,widthArgs_workflow,colAlignArgs_workflow,colSortArgs_workflow,colTypeArgs_workflow);
commonGridObj_workflow.setResponseUrl("WorkFlowGridSource.aspx");
commonGridObj_workflow.setRequest("WorkFlowGridSource.aspx?handle=workflowlist");
commonGridObj_workflow.setSourceType("json");
commonGridObj_workflow.setSkin("xp");
commonGridObj_workflow.setImageUrl("../images/");
commonGridObj_workflow.initGrid();
commonGridObj_workflow.bind();
commonGridObj_workflow.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
return true;
}
});
commonGridObj_workflow.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
//var rId = commonGridObj_workflow.getGridObj().getSelectedRowId();
if(cInd == 4){
var openSet = "height=400, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-900)/2
var openType = "_blank";
var openUrl = "StepEdit.aspx?flowid="+rId+"&handle=edit";
var tempWin = window.open ("about:blank",openType,openSet);
tempWin.location = openUrl;
}else if(cInd != 0){
var openSet = "height=270, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-270)/2 + ",Left= "+(screen.width-500)/2
var openType = "_blank";
var openUrl = "Edit.aspx?flowid="+rId+"&handle=edit";
var tempWin = window.open ("about:blank",openType,openSet);
tempWin.location = openUrl;
}
});
}
function deleteWorkFlow(){
var iCount = 0;
var recvArg = new Array();
for(var i=0;i<commonGridObj_workflow.getGridObj().getRowsNum();i++){
var checkState = commonGridObj_workflow.getGridObj().cellByIndex(i,0).getValue();
var rowID = commonGridObj_workflow.getGridObj().getRowId(i);
if(checkState == 1){
recvArg.push(rowID);
iCount++;
}
}
if(iCount > 0){
var delCount = 0;
if(recvArg.length > 0){
if(window.confirm("您确定要将所选工作流删除")){
while(delCount < recvArg.length){
//删除工作流信息分3种情况1:workflow;2:workflow,workflow_step;3:workflow,workflow_step,workflow_do
var urlVal = "WorkFlowGridSource.aspx?flowid="+recvArg[delCount]+"&handle=delete"+"&no="+newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal == 1 ){
//commonGridObj_workflow.getGridObj().deleteRow(recvArg[delCount]);
}
delCount++;
}
}
}
createGrid();
}
}//end deleteWorkFlow
function addWorkFlow(){
var rId = commonGridObj_workflow.getGridObj().getSelectedRowId();
var openSet = "height=270, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-270)/2 + ",Left= "+(screen.width-500)/2
var openType = "_blank";
var openUrl = "Edit.aspx?handle=add";
var tempWin = window.open ("about:blank",openType,openSet);
tempWin.location = openUrl;
}
function checkInfo(){
var checkRowID = "";
var iCheckCount = 0;
for(var i=0;i<commonGridObj_workflow.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_workflow.getGridObj().getRowId(i);
var rowIndex = commonGridObj_workflow.getGridObj().getRowIndex(rowId);
var checkState = commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).getValue();
if(checkState == 1){
if(iCheckCount > 0){
commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).setValue(0);
}else{
iCheckCount++;
checkRowID = rowId;
}
}
}
if(checkRowID != ""){
var openSet = "height=270, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-270)/2 + ",Left= "+(screen.width-500)/2
var openType = "_blank";
var openUrl = "Edit.aspx?flowid="+checkRowID+"&handle=edit";
var tempWin = window.open ("about:blank",openType,openSet);
tempWin.location = openUrl;
}
}
function editauditor(){
var checkRowID = "";
var iCheckCount = 0;
for(var i=0;i<commonGridObj_workflow.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_workflow.getGridObj().getRowId(i);
var rowIndex = commonGridObj_workflow.getGridObj().getRowIndex(rowId);
var checkState = commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).getValue();
if(checkState == 1){
if(iCheckCount > 0){
commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).setValue(0);
}else{
iCheckCount++;
checkRowID = rowId;
}
}
}
if(checkRowID != ""){
var openSet = "height=400, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-900)/2
var openType = "_blank";
var openUrl = "StepEdit.aspx?flowid="+checkRowID+"&handle=edit";
var tempWin = window.open ("about:blank",openType,openSet);
tempWin.location = openUrl;
}
}
function checkAll(){
if(commonGridObj_workflow != null){
for(var i=0;i<commonGridObj_workflow.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_workflow.getGridObj().getRowId(i);
var rowIndex = commonGridObj_workflow.getGridObj().getRowIndex(rowId);
if($("ck_all").checked){
commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).setValue(1);
}else{
commonGridObj_workflow.getGridObj().cellByIndex(rowIndex,0).setValue(0);
}
}
}
}
//刷新
function refreshList(){
createGrid();
}