<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@page import="com.blueland.bpm.manage.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/meta.jsp"%>
<base href="<%=basePath%>">
<title>流程基础配置</title>
<script type="text/javascript">
	$(document).ready(function() {
		$("#submitButton").click(function() {
			//用jquery中的ajax方法，向服务器提交请求 
			jQuery.ajax({
				type : "POST",
				url : "${ctx}/processInfo/update.do",
				data : $('#myform').serialize(),
				success : function(resp) {
					$("#isChange",window.parent.document).val("0");//保存完毕后把是否已修改还原成未修改
					alert(resp);
				}
			});
		});
		$('#mprotocol').change(function(){ 
			var val=$(this).children('option:selected').val();
			if(val=="http"){
				$("#otherSysDealStatus option[value='no']").attr("selected", "selected"); 
			}else{
				$("#otherSysDealStatus option[value='yes']").attr("selected", "selected");
			}
		});
		//获取绑定的流程梳理的文件名称
		if($("#arisCode").val() != null){
			var url = "<%=MyContants.BPM_FILE_PATH%>"+"/ebpm-bpa-web/flow/getAtt?fileId="+$("#arisCode").val();
			jQuery.ajax({	      
	            url : url,
	            type : "GET",
	            success : function(resp) {
	            	$("#arisCodeName").val(resp.NAME);
	            }
	        });
		}
		
	});
	function processTypeNameOnDbClick(name, value) {
		//判断流程分类是否修改
		moveout("processTypeId");
		
		$("#processTypeName").val(name);
		$("#processTypeId").val(value);

	}
	//焦点移出时对比现在的值和原来的值是否一致 如果不一致则修改父页面的是否修改的标记，标记为已修改
	function moveout(id){
		//获取父页面是否修改的标记
		var isChange = $("#isChange",window.parent.document).val();
		if(isChange==0){//如果父页面标记为未修改 则执行下面的操作
			var preValue = $("#"+id).attr("preValue");
			var value = $("#"+id).val();
			if(preValue != value){
				//设置标记为已修改
				$("#isChange",window.parent.document).val("1");
			}
		}
	}
	
	function save(){
		//用jquery中的ajax方法，向服务器提交请求 
		jQuery.ajax({
			type : "POST",
			async : false,
			url : "${ctx}/processInfo/update.do",
			data : $('#myform').serialize(),
			success : function(resp) {
				//设置标记为已修改
				$("#isChange",window.parent.document).val("0");//保存完毕后把是否已修改还原成未修改
				alert(resp);
			}
		});
	}
	function arisCodeNameOnDbClick(name, value) {
		
		$("#arisCodeName").val(name);
		$("#arisCode").val(value);

	}
	function viewFlowFile(){
		if($("#arisCode").val() != ""){
			var url = "<%=MyContants.BPM_FRONT_PATH%>"+"/ebpm-bpa-front/#/detail?fileId="+$("#arisCode").val()+"&type=.bpmn&isMenu=false";
			showDiaLog(url,'查看流程梳理-业务流程资产','1024px','600px');
		}else{
			alert("请选择流程梳理-业务流程")
		}
	}
</script>
</head>
<body style="font-size: 13px;font-family: 'Open Sans';" class="white-page">

	<form action="${ctx}/processInfo/update.do" method="post"
		id="myform">
		<div class="main-container" id="main-container">
			<div class="panel panel-primary">
				<div class="panel-body">
					<input type="hidden" id="oldValue"/>
					
					<input type="hidden" id="processDefName" name="processDefName"
						value="${processInfoConfig.processDefName}" style="width: 200px;" />
					<input type="hidden" id="processDefId" name="processDefId"
						value="${processInfoConfig.processDefId}" style="width: 200px;" />
					<input type="hidden" id="processDefKey" name="processDefKey"
						value="${processInfoConfig.processDefKey}" style="width: 200px;" />
					<input type="hidden" id="processMgrState" name="processMgrState"
						value="${processInfoConfig.processMgrState}" style="width: 200px;" />
					<input type="hidden" id="processModelSyncState" name="processModelSyncState"
						value="${processInfoConfig.processModelSyncState}" style="width: 200px;" />
					<table class='table table-bordered form-table' border="0" cellspacing="0"
						cellpadding="0" id="myTable">
						
						<!-- 存放隐藏域的区域 -->
						<!-- 存放表单的区域 -->

						<tr>
							<td>流程KEY：</td>
							<td>${processInfoConfig.processDefKey}</td>
							<td>流程ID：</td>
							<td>${processInfoConfig.processDefId}</td>

						</tr>
						<tr>
							<td>流程名称：</td>
							<td>${processInfoConfig.processDefName}</td>
							<td>流程版本号：</td>
							<td>${processInfoConfig.processVersion}</td>
						</tr>
						
						<tr>
							<td>流程类型：</td>
							<td style="width: 250px;">
							<input type="text"
								<c:choose>
									<c:when test="${not empty processInfoConfig.processTypeName}">
										value="${processInfoConfig.processTypeName}"
									</c:when>
									<c:otherwise>
										value="请选择"
									</c:otherwise>
								</c:choose>
								name="processTypeName" id="processTypeName" readonly
								onclick="showMenu('processTypeName','',''); return false;" /> 
								<input
								type="hidden" name="processTypeId" id="processTypeId"
								value="${processInfoConfig.processTypeId}" />
								<a class="blue" href="javascript:void(0);">											
										<i class="ace-icon fa fa-search bigger-130" 
									onclick="showMenu('processTypeName','',''); return false;"/> 									
									</i></a>
								</td>
							<td>流程是否可见：</td>
							<td>
							
							<select name="processStartIsshow" id="processStartIsshow" 
							preValue="${processInfoConfig.processStartIsshow}" 
							onchange="moveout(this.id);">
					    		<option value="Y" ${processInfoConfig.processStartIsshow=="Y"?"selected":""}>可见</option>
					    		<option value="N" ${processInfoConfig.processStartIsshow=="N"?"selected":""}>不可见</option>
				    		</select>
							
							</td>
						</tr>
						<tr>
							<td>流程排序号：</td>
							<td><input type="text" name="processStartOrder"
								preValue="${processInfoConfig.processStartOrder}"
								onblur="moveout(this.id);"
								value="${processInfoConfig.processStartOrder}"
								id="processStartOrder" maxlength="200"
								class="validate[length[0,1000]]" 
								onkeyup="this.value=this.value.replace(/\D/g,'')"  
								onafterpaste="this.value=this.value.replace(/\D/g,'')"/></td>
							<td>流程更新时间：</td>
							<td>${processInfoConfig.lastUpdateTimeString}</td>
							<!-- 
							<td>起草权限：</td>
							<td><input type="text" name="processStartAuth" value=""
								id="processStartAuth" class="validate[length[0,500]]" /></td>
							 -->
						</tr>
						<c:if test="${customSso != '1'}">
							<tr>
								<td rowspan="2" style="width: 200px;">桌面端相关配置：</td>
								<td style="width: 100px;">环节表单路径</td>
								<td colspan="3">
									<input style="width: 600px" type="text" name="processPageUrl" value="${processInfoConfig.processPageUrl}" id="processPageUrl" class="validate[length[0,500]]" />
								</td>
							</tr>
							<tr>
								<td>处理协议</td>
								<td colspan="3">
									<select name="cprotocol" id="cprotocol">
										<option value="hnzy:workitem" ${processInfoConfig.cprotocol=='hnzy:workitem'||processInfoConfig.cprotocol==null?'selected':''}>专用浏览器模式</option>
										<option value="http" ${processInfoConfig.cprotocol=='http'?'selected':''}>普通浏览器模式</option>
									</select>
								</td>
							</tr>
							<tr>
								<td rowspan="3">手机端相关配置：</td>
								<td>环节表单路径</td>
								<td colspan="3">
									<input style="width: 600px" type="text" name="murl" value="${processInfoConfig.murl}" id="murl" class="validate[length[0,500]]" />
								</td>
							</tr>

							<tr>
								<td>处理协议</td>
								<td colspan="3">
									<select name="mprotocol" id="mprotocol">
										<option value="none" ${processInfoConfig.mprotocol=='none'||processInfoConfig.mprotocol==null?'selected':''}>不支持手机处理</option>
										<option value="http" ${processInfoConfig.mprotocol=='http'?'selected':''}>H5</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>处理状态</td>
								<td colspan="3">
									<select name="otherSysDealStatus" id="otherSysDealStatus">
										<option value="" ${processInfoConfig.mprotocol==null?'selected':''}>请选择</option>
										<option value="yes" ${processInfoConfig.otherSysDealStatus=='yes'?'selected':''}>仅阅读</option>
										<option value="no" ${processInfoConfig.otherSysDealStatus=='no'?'selected':''}>可处理</option>
									</select>
								</td>
							</tr>
							<tr>
								<td width="15%">流程业务处理类：</td>
								<td colspan="3"><input style="width: 550px;" type="text"
													   name="processHandlerClassPath"
													   preValue="${processInfoConfig.processHandlerClassPath}"
													   onblur="moveout(this.id);"
													   value="${processInfoConfig.processHandlerClassPath}"
													   id="processHandlerClassPath" maxlength="200"
													   class="validate[length[0,1000]]" /></td>
							</tr>
						</c:if>

						<%-- <tr>
							
								<td width="15%">流程梳理-业务流程：</td>
							<td colspan="3">
								<input
									<c:choose>
										<c:when test="${not empty processInfoConfig.arisCode}">
											value=""
										</c:when>
										<c:otherwise>
											value="请选择"
										</c:otherwise>
									</c:choose>
									name="arisCodeName" id="arisCodeName" readonly
									onclick="showFlowFile('arisCodeName','',''); return false;" /> 
									<input
									type="hidden" name="arisCode" id="arisCode"
									preValue="${processInfoConfig.arisCode}"
									value="${processInfoConfig.arisCode}" />
									<a class="blue" href="javascript:void(0);">											
										<i class="ace-icon fa fa-search bigger-130" 
									onclick="viewFlowFile()"/> 									
									</i></a>
							</td>
							
						</tr> --%>
						<!-- 
						<tr>
							<td>更新者：</td>
							<td></td>
							<td>更新时间：</td>
							<td>${processInfoConfig.lastUpdateTimeString}</td>
						</tr>
 -->
						
						<tr>
							<td>流程备注：</td>
							<td colspan="3"><span class="float_left"> <textarea
										preValue="${processInfoConfig.remark}"
										onblur="moveout(this.id);"
										name="remark" id="remark" style="width: 550px;">${processInfoConfig.remark}</textarea>
							</span></td>
						</tr>
					</table>
					<div class="col-md-offset-1 col-md-9" style="text-align: center;">
						<button type="button" class="btn btn-sm btn-primary"
							id="submitButton" />
							保存
							<i class="ace-icon fa fa-save bigger-110"></i>
							</button>
					</div>
				</div>
			</div>
		</div>
	</form>
	<jsp:include page="../../../pages/sysGlType/selectTypeTree.jsp" flush="false" />
</body>
</html>
