<%@ 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(obj == 1){
                $('#flag').val('yes');
            }else{
                $('#flag').val('no');
            }
		  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);
					}
				}
			});
            laydate.render({
                elem: '#scrapDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
		});
        function setValue(obj){
            $.ajax({
                type:'post',
                url:'${ctx}/workscrap/workScrap/getItem',
                data:{
                    "obj":obj
                },
                success:function(data){
                    var d = JSON.parse(data);
                    $("#cName").val(d.cName);
                    $("#cNumber").val(d.cNumber);
                    $("#cType").val(d.cType);
                    $("#cModel").val(d.cModel);
                    $("#cPrimaryUnit").val(d.cPrimaryUnit);
                }
            })
        }
	</script>
</head>
<body>
<div class="single-form view-form">
	<div class="container">
		<form:form  id="inputForm" modelAttribute="workScrap" action="${ctx}/workscrap/workScrap/saveAudit" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<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 lw16">
				<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">
						<input htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.createBy.name}"/>
					</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">
							<input htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.number}"/>
							<span class="input-group-btn">
                            <label class="form-status"><c:choose><c:when test="${not empty workScrap.status}">${fns:getDictLabel(workScrap.status, '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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.officeName}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="<fmt:formatDate value="${workScrap.scrapDate}" pattern="yyyy-MM-dd"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label">报废事由：</label>
					<div class="layui-input-block">
						<textarea  htmlEscape="false" rows="4"  readonly="true"  class="form-control ">${workScrap.reason}</textarea>
					</div>
				</div>
			</div>

			<div class="form-group layui-row lw16">
				<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 with-icon">
						<input htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.item.number}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.item.itemName}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.item.workCatalogueItem.number}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${fns:getMainDictLabel(workScrap.item.workCatalogueItem.type, 'item_type', '')}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${workScrap.item.workCatalogueItem.model}"/>
					</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 htmlEscape="false" readonly="true" class="form-control required layui-input" value="${fns:getMainDictLabel(workScrap.item.workCatalogueItem.primaryUnit, 'full_count_unit', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label">备注信息：</label>
					<div class="layui-input-block">
						<textarea  htmlEscape="false" rows="4"  readonly="true"  class="form-control ">${workScrap.remarks}</textarea>
					</div>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>
</body>
</html>