<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>工作内容类型管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            changeContentDetail("${workContentType.typeId}");
		});

        function changeContentDetail(val) {
            detailFlag=1;
            switch (val){
                case '13':
                case '22':
                case '25':
                    $("#contentDetail").load("${ctx}/workcontentinvestmentcost/workContentInvestmentCost/list");
                    break;
                case '31':
                    $("#contentDetail").load("${ctx}/workcontent/workContentContprogram/form");
                    break;
                case '32':
                    $("#contentDetail").load("${ctx}/workcontent/workContentBiddingplan/form");
                    break;
                case '34':
                    $("#contentDetail").load("${ctx}/workcontent/workContentCtrlprice/form");
                    break;
                case '41':
                    $("#contentDetail").load("${ctx}/workcontent/workContentContractinfo/form");
                    break;
                case '42':
                    $("#contentDetail").load("${ctx}/workcontent/workContentPricemanage/form");
                    break;
                case '43':
                    $("#contentDetail").load("${ctx}/workcontent/workContentAltermanage/form");
                    break;
                case '46':
                    $("#contentDetail").load("${ctx}/workcontent/workContentClaim/form");
                    break;
                case '47':
                    $("#contentDetail").load("${ctx}/workcontent/workContentFundplan/form");
                    break;
                case '48':
                    $("#contentDetail").load("${ctx}/workcontent/workContentProjectprice/form");
                    break;
                case '49':
                    $("#contentDetail").load("${ctx}/workcontent/workContentPriceadjust/form");
                    break;
                case '52':
                    $("#contentDetail").load("${ctx}/workcontent/workContentBudget/form");
                    break;
                case '53':
                    $("#contentDetail").load("${ctx}/workcontent/workContentDocument/form");
                    break;
                default:
                    detailFlag=0;
                    $("#contentDetail").html("");
                    break;
            }

        }
	</script>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="workContentType" action="${ctx}/workcontent/workContentType/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<div class="form-group layui-row first lw9">
				<div class="form-group-label"><h2>基础信息</h2></div>
				<div class="layui-item layui-col-sm12">
					<label class="layui-form-label">内容类型编号：</label>
					<div class="layui-input-block">
						<form:input path="typeId" htmlEscape="false"  readonly="true"  class="form-control layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12">
					<label class="layui-form-label">内容类型名称：</label>
					<div class="layui-input-block">
						<form:input path="typeName" htmlEscape="false"   readonly="true"  class="form-control layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12">
					<label class="layui-form-label">父级ID：</label>
					<div class="layui-input-block">
						<form:input path="parentId" htmlEscape="false"    readonly="true" class="form-control layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label">备注信息：</label>
					<div class="layui-input-block">
						<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" readonly="true" style="resize:none;"   class="form-control "/>
					</div>
				</div>
			</div>
		</form:form>
			<div class="form-group layui-row first">
				<div class="form-group-label"><h2>内容样式</h2></div>
				<div style="margin: 0 16px;">
        			<div id="contentDetail"></div>
				</div>
			</div>
	</div>
</div>
</body>
</html>