<%@ page contentType="text/html;charset=UTF-8" %>
<script>
	/**
	 * 配网专职提交申请页面
	 * */
	$(document).ready(function() {
		jp.ajaxForm("#inputForm",function(data){
			if(data.success){
				jp.alert(data.msg);
				jp.go("${ctx}"+ data.body.targetUrl);
			}else{
				jp.alert(data.msg);
				$("#inputForm").find("button:submit").button("reset");
			}
		});

		//包含非涉电项目，需填写项目类型
		$("#contain").click(function () {
			var name= "";
			$("input:checkbox[name='projectType']:checked").each(function () {
				name+= $(this).val() + "|";
			});
			var procDefId = $("#procDefId").val();
			var projectId = $("#projectId").val();
			var projectName = $("#projectName").val();
			if (projectName == "") {
				jp.error("请选择项目");
			}else {
				if (name == "") {
					jp.error("请选择项目类型");
				} else {
					jp.post("${ctx}/materialmodule/activiti/containSave",
					{
						"projectType": name,
						"projectId": projectId,
						"projectName":projectName,
						"procDefId":procDefId,
						"flag": "contain",
					},
					function (data) {
						if (data.success) {
							jp.success(data.msg);
							jp.go("${ctx}/act/task/todo");
						} else {
							jp.error(data.msg);
						}
					});
				}
			}
		});


		$('#acceptDate').datetimepicker({
			format: "YYYY-MM-DD HH:mm:ss"
		});

		$('#examineDate').datetimepicker({
			format: "YYYY-MM-DD HH:mm:ss"
		});
		//富文本初始化
		$('#reason').summernote({
			height: 300,
			lang: 'zh-CN',
			callbacks: {
				onChange: function(contents, $editable) {
					$("input[name='reason']").val($('#reason').summernote('code'));//取富文本的值
				}
			}
		});
	})
</script>
