<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<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"/>
</head>
<body>
<div class="layui-card mb-0">
    <div class="layui-form layui-card-body over">
        <div class="layui-col-xs6 mb-20">
            <label class="layui-form-label"><i class="mark">*</i>服务措施：</label>
            <div class="layui-input-block">
                <select name="serviceMeasures" id="serviceMeasures" lay-filter="serviceMeasures" lay-search>
                    <option value="">请选择</option>
                    <c:forEach items="${rds}" var="rd">
                        <option value="${rd.columns.service_measures}" <c:if test="${rd.columns.service_measures == order.serviceMeasures}"> selected</c:if>>${rd.columns.service_measures}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="layui-col-xs12 mb-20">
            <label class="layui-form-label"><i class="mark">*</i>反馈内容：</label>
            <div class="layui-input-block">
                <textarea name="remarks" placeholder="" class="layui-textarea" lay-verify="required"></textarea>
            </div>
        </div>
        <div class="layui-col-xs12">
            <label class="layui-form-label">过程图片：</label>
            <div class="layui-input-block">
                <div id="imgsDiv"></div>
                <div class="upload-container " id="uploader">
                    <img src="" alt="img placeholder" id="imgsAdd">
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 ">
            <label class="layui-form-label"></label>
            <div class="layui-input-block" style="color: #cc2a2c">
                提示：请上传机身条码照片、整机照片、故障点照片
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="sureSubmit" id="sureSubmit" value="重新反馈封单">
    </div>
</div>

</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>
    var imgsCount = 0;
    layui.use(['upload', 'layer', 'form'], function () {
        $ = layui.$;
        layer = layui.layer;
        form = layui.form;
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#uploader' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , size: 5 * 1024
            , number: 1
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#pic').attr('src', result); //图片链接（base64）
                    $("#pic").show();
                });
            }
            , done: function (res) {
                //上传完毕回调
                if (res.code > 0) {
                    return layer.msg("上传失败！", {icon: 2});
                }
                imgsCount++;
                if (imgsCount >= 8) {
                    $("#uploader").hide();
                }
                var imgPath = res.path;

                var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this)"></span>';
                html += '<img src="${commonStaticImgPath}' + imgPath + '" height="700" width="1200"/>';
                html += '<input type="hidden" class="imgPicker" value="' + imgPath + '"/> </div>';
                $("#imgsDiv").append(html)
            }
            , error: function () {
                //请求异常回调
            }
        });


    });

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

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

