<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta name="decorator" content="base" />
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
    <style>
        html{background-color: #fff;padding-bottom: 50px;}
    </style>
</head>
<body>
<div class="layui-form">
    <div class="layui-card">
        <div class="layui-card-body ">
            <div class="layui-col-xs11 mb-10">
                <label class="layui-form-label"><i class="mark">*</i>附件类型：</label>
                <div class="layui-input-block ">
                    <select id="fileType" name="fileType" >
                        <option value="" rel=""></option>
                        <option value="5" >信息使用授权书</option>
                        <option value="1" >风险审查附件</option>
                        <option value="2" >农户投放审查附件</option>
                        <option value="3" >并网信息附件</option>
                        <%--<option value="4" >购售电合同</option>--%>
                    </select>
                </div>
            </div>
            <div class="layui-col-xs11 mb-10" >
                <label class="layui-form-label"><i class="mark">*</i>电站编码：</label>
                <div class="layui-input-block">
                    <input type="text" id="powerStationCode" name="powerStationCode" class="layui-input" >
                </div>
            </div>
        </div>
    </div>

    <div class="operate-footer">
        <input type="button" class="layui-btn" id="refuseInDoc" value="提交"/>
        <input type="button" class="layui-btn layui-btn-primary" onclick="closeSelf();" value="取消"/>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>


    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','laydate','jquery','layer'], function () {
        $ = layui.$
            , form = layui.form
            , layer = layui.layer
            ,laydate = layui.laydate;
        //执行实例

        var refuseFlag = false;
        $('#refuseInDoc').click(function(){
            if(refuseFlag){
                return;
            }

            var fileType = $('#fileType').val();
            if (isBlank(fileType)) {
                layer.msg('请选择附件类型', {icon: 2});
                return;
            }
            var powerStationCode = $('#powerStationCode').val();
            if (isBlank(powerStationCode)) {
                layer.msg('请输入电站编码', {icon: 2});
                return;
            }

            refuseFlag = true;
            $.ajax({
                url:"${ctx}/customerEntryExtra/accessProjectApply",
                type:"POST",
                data: {
                    fileType: fileType,
                    powerStationCode: powerStationCode,
                }
                , success: function (result) {
                    if (result.code == '200') {
                        parent.layer.msg('上传成功', {icon: 1});
                        closeSelf();
                        parent.searchOrder();
                    } else {
                        refuseFlag = false;
                        layer.msg(result.errMsg, {icon: 2});
                    }
                }
            })
        });
    });


    window.closeSelf = function () {
        var index = parent.layer.getFrameIndex(window.name);
        // window.parent.location.reload();//刷新父级页面
        parent.layer.close(index);//关闭当前页
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

</script>
</body>
</html>
