<%@ 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(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){

              if(obj == 1){
                  $('#flag').val('yes');
              }else{
                  $('#flag').val('no');
              }

              $("#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);
					}
				}
			});
           /* laydate.render({
                elem: '#borrowDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus', //响应事件。如果没有传入event，则按照默认的click
                type : 'date'
            });*/

		});
	</script>
</head>
<body>
<div class="single-form">
    <div class="container">
		<form:form id="inputForm" modelAttribute="workBorrowBack" action="${ctx}/workborrowmangement/workBorrowBack/saveAudit" method="post" class="form-horizontal">
		<form:hidden path="id"/>
        <form:hidden path="borrowMangementId"/>
        <form:hidden path="home"/>
        <form:hidden path="act.taskId"/>
        <form:hidden path="act.taskName"/>
        <form:hidden path="act.taskDefKey"/>
        <form:hidden path="act.procInsId"/>
        <form:hidden path="act.procDefId"/>
        <form:hidden id="flag" path="act.flag"/>
            <div class="form-group layui-row first">
                <div class="form-group-label"><h2>基础信息</h2></div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>借用人：</label>
                    <div class="layui-input-block">
                        <form:input path="workBorrowMangement.userName" htmlEscape="false" readonly="true" class="form-control  layui-input required"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>借用编号：</label>
                    <div class="layui-input-block">
                        <div class="input-group">
                            <form:input path="workBorrowMangement.number" htmlEscape="false"  readonly="true"  class="form-control  layui-input"/>
                            <span class="input-group-btn">
                                <label class="form-status"><c:choose><c:when test="${not empty workBorrowBack.workBorrowMangement.state}">${fns:getDictLabel(workBorrowBack.workBorrowMangement.state, 'audit_state', '')}</c:when><c:otherwise>新添</c:otherwise></c:choose></label>
                             </span>
                        </div>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>借用日期：</label>
                    <div class="layui-input-block">
                        <input type="text" readonly="true" class="form-control layui-input"
                               value="<fmt:formatDate value="${workBorrowBack.workBorrowMangement.borrowDate}" pattern="yyyy-MM-dd"/>"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>借用部门：</label>
                    <div class="layui-input-block">
                        <form:input path="workBorrowMangement.officeName" htmlEscape="false" readonly="true" class="form-control  layui-input required"/>
                    </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="workBorrowMangement.borrowFor" cssStyle="resize: none" htmlEscape="false" rows="4"    maxlength="255" class="form-control "/>
                    </div>
                </div>
            </div>
            <div class="form-group layui-row first lw8">
                <div class="form-group-label"><h2>借用详情</h2></div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label  double-line"><span class="require-item">*</span>固定资产编号：</label>
                    <div class="layui-input-block">
                        <form:input id="assetsNumber" readonly="true" path="workBorrowMangement.assetsNumber" htmlEscape="false" class="form-control required layui-input"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>物品名称：</label>
                    <div class="layui-input-block">
                        <form:input id="itemName" readonly="true" path="workBorrowMangement.itemName" htmlEscape="false" class="form-control layui-input"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>物品分类：</label>
                    <div class="layui-input-block">
                        <form:input id="itemType" readonly="true" path="workBorrowMangement.itemType" htmlEscape="false" class="form-control layui-input"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>物品编号：</label>
                    <div class="layui-input-block">
                        <form:input id="itemNumber" readonly="true" path="workBorrowMangement.itemNumber" htmlEscape="false" class="form-control  layui-input "/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>规格型号：</label>
                    <div class="layui-input-block">
                        <form:input id="itemModel" readonly="true" path="workBorrowMangement.itemModel" htmlEscape="false" class="form-control layui-input "/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label"><span class="require-item">*</span>计量单位：</label>
                    <div class="layui-input-block">
                        <form:input id="itemPrimaryUnit" readonly="true" path="workBorrowMangement.itemPrimaryUnit" htmlEscape="false" 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 id="backState" readonly="true" path="workBorrowMangement.backState" value="0" htmlEscape="false" class="form-control  hidden layui-input "/>
                        <form:input id="" readonly="true" path="" htmlEscape="false" value="未归还" class="form-control  layui-input "/>
                    </div>
                </div>
            </div>
            <div class="form-group layui-row">
                <div class="form-group-label"><h2>审批意见</h2></div>
                <div class="layui-item layui-col-xs12 with-textarea" >
                    <label class="layui-form-label">审批意见：</label>
                    <div class="layui-input-block">
                        <form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
                        <input type="file" name="upload_files" style="display: none;">
                    </div>
                </div>
            </div>
            <div class="form-group layui-row">
                <div class="form-group-label"><h2>审批流程</h2></div>
                <div class="layui-item layui-col-xs12 form-table-container" >
                    <act:flowChart procInsId="${workBorrowBack.act.procInsId}"/>
                    <act:histoicFlow procInsId="${workBorrowBack.act.procInsId}"/>
                </div>
            </div>

            <div class="form-group layui-row page-end"></div>
	</form:form>
    </div>
</div>
</body>
</html>