<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>备件信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base" />
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css" />
    <style>
        html{
            background-color: #fff;
        }
    </style>
</head>
<body>

<div class="layui-card md-0 layui-form" lay-filter="layuiadmin-form-admin">
        <div class="layui-card-body">
                <div class="layui-form-item">
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label"><i class="mark hide">*</i>服务商名称：</label>
                        <div class="layui-input-block">
                            <input type="text" id="siteName" class="layui-input layui-bg-gray" value="${applyRecord.columns.site_name}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label"><i class="mark hide">*</i>申请人：</label>
                        <div class="layui-input-block">
                            <input type="text" id="applicantName" class="layui-input layui-bg-gray" value="${applyRecord.columns.applicant_name}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label">物料号：</label>
                        <div class="layui-input-block">
                            <input type="text" id="fittingCode" class="layui-input layui-bg-gray" value="${applyRecord.columns.fitting_code}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label"><i class="mark hide">*</i>备件名称：</label>
                        <div class="layui-input-block">
                            <input type="text" id="fittingName" class="layui-input layui-bg-gray" value="${applyRecord.columns.fitting_name}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label">备件型号：</label>
                        <div class="layui-input-block">
                            <input type="text"  class="layui-input layui-bg-gray" value="${applyRecord.columns.fitting_version}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label"><i class="mark hide">*</i>备件数量：</label>
                        <div class="layui-input-block">
                            <input type="text" lay-verify="ling" name="applyNum" id="applyNum" class="layui-input layui-bg-gray" value="<fmt:formatNumber type="number" value="${applyRecord.columns.apply_num}" maxFractionDigits="2"/>" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs12 mb-5">
                        <label class="layui-form-label">申请备注：</label>
                        <div class="layui-input-block">
                            <input type="text" id="applyMarks" class="layui-input layui-bg-gray" value="${applyRecord.columns.apply_marks}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label">审核数量：</label>
                        <div class="layui-input-block">
                            <input type="text"  class="layui-input layui-bg-gray" value="${applyRecord.columns.fitting_audit_num}" disabled>
                        </div>
                    </div>
                 <%--   <div class="layui-col-xs6 mb-5">
                        <label class="layui-form-label">返还旧件：</label>
                        <div class="layui-input-block">
                            <c:if test="${applyRecord.columns.old_fitting_flag eq '1'}"> <input type="text"  class="layui-input layui-bg-gray" value="需要返还" disabled></c:if>
                            <c:if test="${applyRecord.columns.old_fitting_flag ne '1'}"> <input type="text"  class="layui-input layui-bg-gray" value="无需返还" disabled></c:if>

                        </div>
                    </div>--%>
                    <div class="layui-col-xs12 mb-5">
                        <label class="layui-form-label">审核备注：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input layui-bg-gray" value="${applyRecord.columns.factory_marks}" disabled>
                        </div>
                    </div>
                </div>
    </div>
    <div class="operate-footer" >
        <button class="layui-btn layui-btn-primary" onclick="cancels()">取消</button>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>
    var imgsCount;
    layui.use(['form', 'jquery','laydate','upload'], function () {
        $ = layui.$
            , element = layui.element
            , form = layui.form
            , laydate = layui.laydate;
        var upload = layui.upload;
        imgsCount = '${imgsCount}';


        $('.deliveryMsg').click(function () {
            var index = $(this).index();
            $(this).removeClass('layui-btn-primary').siblings().addClass('layui-btn-primary')
            if (index == '1') {
                $('.re-record').removeClass('layui-hide');
                $('.bj-msg').addClass('layui-hide');
            } else {
                $('.bj-msg').removeClass('layui-hide');
                $('.re-record').addClass('layui-hide');
            }
        })

        //点击放大查看图片
        $(".selectImg").click(function(){
            var img = $(this).attr("data-img");
            var imgNew = img.replace(/\\/g,"/");
            $('.img-big').css('background-image',"url("+imgNew+")");
            //$("#lookImg img").attr('src',img);
            layer.open({
                type:1,
                title:'查看图片',
                area:['500px','350px'],
                content:$("#lookImg")
            })
        })

        //旋转
        var deg = 0;
        $(".xuanZhuan").click(function(){
            deg += 90;
            document.getElementById("image").style.transform = "rotate(" + deg + "deg)";
        })

        //执行实例
        var uploadInst = upload.render({
            elem: '#uploader' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    /* newBase64 = result;*/
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path);
            }
            , error: function () {
                //请求异常回调
            }
        });

    });

    function addImg(data){
        imgsCount++;
        if (imgsCount >= 3) {
            $("#uploader").hide();
        }else{
            $("#uploader").show();
        }
        var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this)"></span>';
        html += '<img src="${commonStaticImgPath}'+data+'" height="700" width="1200"/>';
        html += '<input type="hidden" class="imgPicker" value="'+data+'"/> </div>';
        $("#imgsDiv").append(html);
    }

    function delImg(that){
        imgsCount--;
        if (imgsCount < 3) {
            $("#uploader").show();
        }
        $(that).parent().remove();
    }

    //点击编辑
    function showUpdateFit(){
        $(".bj-msg").find("input").attr("disabled", false);
        $(".bj-msg").find("input").removeClass("layui-bg-gray");
        $("#upDiv").hide();
        $("#hideDiv").show();
        $(".bj-msg").find(".mark").show();
        $("#uploader").show();
        $(".imgSpan").each(function(){
            $(this).find("img").before('<span class="layui-icon-close layui-icon" onclick="delImg(this)"></span>');
        })
    }

    function cancels(){
        parent.layer.closeAll();
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
</script>
</body>
</html>