<%@ 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">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="${ctxPlugin}/static/element-ui/index.css">
    <!-- 引入组件库 -->
    <script src="${ctxPlugin}/static/element-ui/vue.min.js"></script>
    <script src="${ctxPlugin}/static/element-ui/index.js"></script>
    <style>
        html {
            background-color: #fff;
        }
        .layui-table th{text-align: center}
        #orderForm span{width: 80px;display: inline-block;background: #eee}
        .el-step__icon{width: 40px; height: 40px; font-size: 20px;}
        .el-step.is-horizontal .el-step__line{top: 19px}
        .step-box{background-color: #FFF; width: 100%; height: 85px; padding-top: 15px;}
        .el-step__head.is-success, .el-step__title.is-success{color: #e64e4e; border-color: #e64e4e}

        #orderForm {
            padding-bottom: 30px;
        }

        .layui-table-link {
            font-size: 13px;
            color: #cd2323;
            cursor: pointer;
        }

        .layui-timeline-item {
            position: relative;
             padding-bottom: 0px;
        }
    </style>
</head>
<body class="">
<div class="layui-fluid layui-form" lay-filter="component-form-group" id="orderForm">
    <div class="layui-card pl-10 pr-30 pt-10 over">
        <div class="layui-card-body layui-col-xs12">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <div class="layui-tab-item layui-show">
                    <div class="layui-card jibenxinxi">
                        <div class="layui-card-body ">
                            <div class="layui-row layui-col-space12 layui-form-item">
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">电站编号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="number"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.powerStationCode}" disabled>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">出租人：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="number"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${companyName}" disabled>
                                    </div>
                                </div>

                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">业主姓名：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType" id="serviceType" lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.tenantName}" disabled>
                                    </div>
                                </div>

                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">代理商：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.traderName}" disabled>
                                    </div>
                                </div>

                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">产品名称：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.projectName}" disabled>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">业务：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray"
                                           <%--    <c:if test="${entry.productLine eq '1'}">value="纯租25年业务"</c:if>--%>
                                               <c:if test="${entry.productLine eq '2'}">value="经营性租赁"</c:if>
                                               <c:if test="${entry.productLine eq '3'}">value="融资租赁"</c:if>
                                               <c:if test="${entry.productLine eq '4'}">value="光伏贷"</c:if>
                                               <c:if test="${entry.productLine eq '5'}">value="全款"</c:if>
                                               <c:if test="${entry.productLine eq '6'}">value="其他"</c:if>
                                               disabled>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">项目地址：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.province}${entry.city}${entry.area}${entry.street}${entry.address}" disabled>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">进件序号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="number"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray"
                                        <c:if test="${entry.partnerId eq '03'}">
                                               value="${incomingApplication.inputPieceId}"
                                        </c:if>
                                        <c:if test="${entry.partnerId ne '03'}">
                                               value="${incomingApplication.partnersContractNumber}"
                                        </c:if>
                                               disabled>
                                    </div>
                                </div>
                                <div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">创建时间：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="number"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="${entry.powerStationCode}" disabled>
                                    </div>
                                </div>
                                <%--<div class="layui-col-lg4 layui-col-sm4">
                                    <label class="layui-form-label">进件序号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="serviceType"  lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-bg-gray" value="" disabled>
                                    </div>
                                </div>--%>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="step-box">
                <div class="el-steps el-steps--horizontal">
                    <div class="el-step is-horizontal is-center" style="flex-basis: 20%; margin-right: 0px;">
                        <div class="el-step__head <c:if test="${sort>=1}">is-success</c:if><c:if test="${sort==0}">is-wait</c:if>">
                            <div class="el-step__line" style="margin-right: 0px;">
                                <c:if test="${sort>=1}">
                                    <i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 1px; width: 100%;"></i>
                                </c:if>
                                <c:if test="${sort<1}">
                                    <i class="el-step__line-inner" style="transition-delay: -300ms; border-width: 0px; width: 0%;"></i>
                                </c:if>
                            </div>
                            <div class="el-step__icon is-text">
                                <c:if test="${sort>=1}">
                                    <i class="el-step__icon-inner is-status el-icon-check"></i>
                                </c:if>
                                <c:if test="${sort<1}">
                                    <div class="el-step__icon-inner">1</div>
                                </c:if>
                            </div>
                        </div>
                        <div class="el-step__main">
                            <div class="el-step__title <c:if test="${sort>=1}">is-success</c:if><c:if test="${sort==0}">is-wait</c:if>">预审</div>
                            <div class="el-step__description <c:if test="${sort>=1}">is-success</c:if><c:if test="${sort==0}">is-wait</c:if>"></div>
                        </div>
                    </div>
                    <div class="el-step is-horizontal is-center" style="flex-basis: 20%; margin-right: 0px;">
                        <div class="el-step__head <c:if test="${sort>=2}">is-success</c:if><c:if test="${sort<2}">is-wait</c:if>">
                            <div class="el-step__line" style="margin-right: 0px;">
                                <c:if test="${sort>=2}">
                                    <i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 1px; width: 100%;"></i>
                                </c:if>
                                <c:if test="${sort<2}">
                                    <i class="el-step__line-inner" style="transition-delay: -300ms; border-width: 0px; width: 0%;"></i>
                                </c:if>

                            </div>
                            <div class="el-step__icon is-text">
                                <c:if test="${sort>=2}">
                                    <i class="el-step__icon-inner is-status el-icon-check"></i>
                                </c:if>
                                <c:if test="${sort<2}">
                                    <div class="el-step__icon-inner">2</div>
                                </c:if>
                            </div>
                        </div>
                        <div class="el-step__main">
                            <div class="el-step__title <c:if test="${sort>=2}">is-success</c:if><c:if test="${sort<2}">is-wait</c:if>">进件</div>
                            <div class="el-step__description <c:if test="${sort>=2}">is-success</c:if><c:if test="${sort<2}">is-wait</c:if>"></div>
                        </div>
                    </div>
                    <div class="el-step is-horizontal is-center" style="flex-basis: 20%; margin-right: 0px;">
                        <div class="el-step__head <c:if test="${sort>=4}">is-success</c:if><c:if test="${sort<4}">is-wait</c:if>">
                            <div class="el-step__line" style="margin-right: 0px;">
                                <c:if test="${sort>=4}">
                                <i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 1px; width: 100%;"></i>
                                </c:if>
                                <c:if test="${sort<4}">
                                <i class="el-step__line-inner" style="transition-delay: -300ms; border-width: 0px; width: 0%;"></i>
                                </c:if>
                            </div>
                            <div class="el-step__icon is-text">
                                <c:if test="${sort>=4}">
                                    <i class="el-step__icon-inner is-status el-icon-check"></i>
                                </c:if>
                                <c:if test="${sort<4}">
                                    <div class="el-step__icon-inner">3</div>
                                </c:if>
                            </div>
                        </div>
                        <div class="el-step__main">
                            <div class="el-step__title <c:if test="${sort>=4}">is-success</c:if><c:if test="${sort<4}">is-wait</c:if>">完工资料提交</div>
                            <div class="el-step__description <c:if test="${sort>=4}">is-success</c:if><c:if test="${sort<4}">is-wait</c:if>"></div>
                        </div>
                    </div>
                    <div class="el-step is-horizontal is-center" style="flex-basis: 20%; margin-right: 0px;">
                        <div class="el-step__head <c:if test="${sort>=5}">is-success</c:if><c:if test="${sort<5}">is-wait</c:if>">
                            <div class="el-step__line" style="margin-right: 0px;">
                                <c:if test="${sort>=5}">
                                <i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 1px; width: 100%;"></i>
                                </c:if>
                                <c:if test="${sort<5}">
                                <i class="el-step__line-inner" style="transition-delay: -300ms; border-width: 0px; width: 0%;"></i>
                                </c:if>
                            </div>
                            <div class="el-step__icon is-text">
                                <c:if test="${sort>=5}">
                                    <i class="el-step__icon-inner is-status el-icon-check"></i>
                                </c:if>
                                <c:if test="${sort<5}">
                                    <div class="el-step__icon-inner">4</div>
                                </c:if>
                            </div>
                        </div>
                        <div class="el-step__main">
                            <div class="el-step__title <c:if test="${sort==5}">is-success</c:if><c:if test="${sort<5}">is-wait</c:if>">并网资料提交</div>
                            <div class="el-step__description <c:if test="${sort==5}">is-success</c:if><c:if test="${sort<5}">is-wait</c:if>"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">进程</li>
                    <li>日志</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-card beijianxinxi" style="max-width: 100%;overflow: auto">
                            <table class="layui-table" style="table-layout:fixed;text-align: center;/*min-width: 1290px*/">
                                <thead>
                                <tr>
                                    <th width="30px">序号</th>
                                    <th width="90px">事项</th>
                                    <th width="300px">进度</th>
                                    <th width="80px">事项状态</th>
                                    <th width="80px">接口状态</th>
                                    <th width="80px">审核状态</th>
                                    <th width="120px">审核反馈</th>
                                    <th width="80px">操作</th>
                                </tr>
                                </thead>
                                <tbody class="bodyContent">
                                <tr>
                                    <td>1</td>
                                    <td>预审</td>
                                    <td>提交时间：<span class="mr-25"><fmt:formatDate value="${process1.submitTime}" pattern="yyyy-MM-dd"/></span>审核时间：<span><fmt:formatDate value="${process1.auditTime}" pattern="yyyy-MM-dd"/></span></td>
                                    <td>
                                        <c:if test="${not empty process1}">
                                            <c:if test="${process1.itemStatus eq 'CLOSED'}">终止进件</c:if>
                                            <c:if test="${process1.itemStatus eq '30'}">审批通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process1 && not empty process1.interfaceStatus}">
                                            <c:if test="${process1.interfaceStatus eq '0'}">成功</c:if>
                                            <c:if test="${process1.interfaceStatus eq '1'}">失败</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process1 && not empty process1.auditStatus}">
                                            <c:if test="${process1.auditStatus eq '0'}">待审核</c:if>
                                            <c:if test="${process1.auditStatus eq '1'}">审核中</c:if>
                                            <c:if test="${process1.auditStatus eq '2'}">审核通过</c:if>
                                            <c:if test="${process1.auditStatus eq '3'}">审核不通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>${process1.remarks}</td>
                                    <td> </td>
                                </tr>
                                <tr>
                                    <td>2</td>
                                    <td>进件</td>
                                    <td>提交时间：<span class="mr-25"><fmt:formatDate value="${process2.submitTime}" pattern="yyyy-MM-dd"/></span>审核时间：<span><fmt:formatDate value="${process2.auditTime}" pattern="yyyy-MM-dd"/></span></td>
                                    <td>
                                        <c:if test="${not empty process2 && not empty process2.itemStatus}">
                                            <c:if test="${process2.itemStatus eq '20'}">待审核</c:if>
                                            <c:if test="${process2.itemStatus eq '30'}">审批通过</c:if>
                                            <c:if test="${process2.itemStatus eq '40' || process2.itemStatus eq '50'}">审批不通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process2 && not empty process2.interfaceStatus}">
                                            <c:if test="${process2.interfaceStatus eq '0'}">成功</c:if>
                                            <c:if test="${process2.interfaceStatus eq '1'}">失败</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process2 && not empty process2.auditStatus}">
                                            <c:if test="${process2.auditStatus eq '0'}">待审核</c:if>
                                            <c:if test="${process2.auditStatus eq '1'}">审核中</c:if>
                                            <c:if test="${process2.auditStatus eq '2'}">审核通过</c:if>
                                            <c:if test="${process2.auditStatus eq '3'}">审核不通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>${process2.remarks}</td>
                                    <td>
                                        <c:if test="${not empty incomingApplication.projectStatus && incomingApplication.partnerId eq '03'}">
                                            <c:if test="${incomingApplication.projectStatus eq '10' ||incomingApplication.projectStatus eq '20' || incomingApplication.projectStatus eq '40' ||incomingApplication.projectStatus eq '50'}">
                                                <a href="#" class="layui-table-link" onclick="againPush('oneIncoming')">重新推送</a>
                                            </c:if>
                                        </c:if>
                                    </td>
                                </tr>
                                <tr>
                                    <td>3</td>
                                    <td>完工资料提交</td>
                                    <td>提交时间：<span class="mr-25"><fmt:formatDate value="${process4.submitTime}" pattern="yyyy-MM-dd"/></span>审核时间：<span><fmt:formatDate value="${process4.auditTime}" pattern="yyyy-MM-dd"/></span></td>
                                    <td>
                                        <c:if test="${not empty process4 && not empty process4.itemStatus}">
                                            <c:if test="${process4.itemStatus eq '10'}">待进件</c:if>
                                            <c:if test="${process4.itemStatus eq '20'}">待审核</c:if>
                                            <c:if test="${process4.itemStatus eq '25' || process4.itemStatus eq '60'}">审核中</c:if>
                                            <c:if test="${process4.itemStatus eq '30'}">审批通过</c:if>
                                            <c:if test="${process4.itemStatus eq '40' || process4.itemStatus eq '50'}">审批拒绝</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process4 && not empty process4.interfaceStatus}">
                                            <c:if test="${process4.interfaceStatus eq '0'}">成功</c:if>
                                            <c:if test="${process4.interfaceStatus eq '1'}">失败</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process4 && not empty process4.auditStatus}">
                                            <c:choose>
                                                <c:when test="${process4.auditStatus eq '2'}">审批通过</c:when>
                                                <c:when test="${process4.auditStatus eq '1'}">审核中</c:when>
                                                <c:when test="${process4.auditStatus eq '3'}">审核不通过</c:when>
                                                <c:when test="${process4.auditStatus eq '0'}">待审批</c:when>
                                            </c:choose>
                                        </c:if>
                                    </td>
                                    <td>${process4.remarks}</td>
                                    <td>
                                        <c:if test="${incomingApplication.partnerId eq '03'}">
                                            <c:if test="${not empty incomingApplication.secStatus && not empty process4}">
                                                <c:if test="${incomingApplication.secStatus ne '25' && incomingApplication.secStatus ne '30' && incomingApplication.secStatus ne '60'}">
                                                    <a href="#" class="layui-table-link" onclick="againPush('twoIncoming')">重新推送</a>
                                                </c:if>
                                            </c:if>
                                        </c:if>
                                    </td>
                                </tr>
                                <tr>
                                    <td>4</td>
                                    <td>并网资料提交</td>
                                    <td>提交时间：<span class="mr-25"><fmt:formatDate value="${process5.submitTime}" pattern="yyyy-MM-dd"/></span>审核时间：<span><fmt:formatDate value="${process5.auditTime}" pattern="yyyy-MM-dd"/></span></td>
                                    <td>
                                        <c:if test="${not empty process5 && not empty process5.itemStatus}">
                                            <c:if test="${process5.itemStatus eq '20'}">待审核</c:if>
                                            <c:if test="${process5.itemStatus eq '60'}">审批中</c:if>
                                            <c:if test="${process5.itemStatus eq '30'}">审批通过</c:if>
                                            <c:if test="${process5.itemStatus eq '40' || process5.itemStatus eq '50'}">审批不通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process5 && not empty process5.interfaceStatus}">
                                            <c:if test="${process5.interfaceStatus eq '0'}">成功</c:if>
                                            <c:if test="${process5.interfaceStatus eq '1'}">失败</c:if>
                                        </c:if>
                                    </td>
                                    <td>
                                        <c:if test="${not empty process5 && not empty process5.auditStatus}">
                                            <c:if test="${process5.auditStatus eq '0'}">待审核</c:if>
                                            <c:if test="${process5.auditStatus eq '1'}">审核中</c:if>
                                            <c:if test="${process5.auditStatus eq '2'}">审核通过</c:if>
                                            <c:if test="${process5.auditStatus eq '3'}">审核不通过</c:if>
                                        </c:if>
                                    </td>
                                    <td>${process5.remarks}</td>
                                    <td>
                                        <c:if test="${not empty incomingApplication.mergeSate && incomingApplication.partnerId eq '03'}">
                                            <c:if test="${incomingApplication.mergeSate eq '10' || incomingApplication.mergeSate eq '40' ||incomingApplication.mergeSate eq '50'}">
                                                <a href="#" class="layui-table-link" onclick="againPush('threeIncoming')">重新推送</a>
                                            </c:if>
                                        </c:if>
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="layui-tab-item guocheng">
                        <ul class="layui-timeline">
                            <c:forEach items="${logs}" var="info">
                                <li class="layui-timeline-item">
                                    <i class="layui-icon layui-timeline-axis"></i>
                                    <div class="layui-timeline-content layui-text">
                                        <div class="layui-timeline-title">${info.columns.createTime}&nbsp;&nbsp;&nbsp;${info.columns.remarks}</div>
                                    </div>
                                </li>
                            </c:forEach>

                        </ul>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="layui-form-item operate-footer" style="text-align: center;">
        <div class="layui-btn-container">
            <button type="button" class="layui-btn layui-btn-primary" onclick="cancel()">取消</button>

        </div>
    </div>
</div>

<div class="hide layui-tab-content" id="auditDiv" style="margin-right: 20px">
    <label class="layui-form-label"><span class="red">*</span>取消原因：</label>
    <div class="layui-input-block ">
        <textarea id="reason" class="layui-textarea"></textarea>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/static/js/orderCommon.js"></script>
<script>
    var imgsCount="${imgNumber}";
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layedit' ,'upload', 'laydate'], function () {
        $ = layui.$
            , admin = layui.admin
            , element = layui.element
            , form = layui.form
            , laydate = layui.laydate;
        var  upload = layui.upload;


    });

    // 验证手机号
    function isPhoneNo(phone) {
        var tel = /(^1\d{10}$)|(^(\d{3,4}\-)?\d{5,9}$)/;
        return tel.test($.trim(phone));
    }
    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

    function cancel(){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    //重新推送
    function againPush(type){
        var entryId='${entry.id}';
        var indexla = layer.confirm('您确定要重新推送信息吗？', {
            icon: 3,
            btn: ['确定', '取消'] //按钮
        }, function () {
            var index= layer.load(2, {shade: [0.5,'#fff'], content:''});
            $.ajax({
                type: "POST",
                url: "${ctx}/incomingManagement/againPushIncoming",
                data: {
                    entryId: entryId
                    ,type:type
                },
                success: function (result) {
                    if(result.code=='200'){
                        layer.msg('推送成功！', {icon: 1, time: 2000}, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                            parent.jjDetail(entryId);
                        });
                    }else {
                        layer.msg('推送失败!'+result.errMsg, {icon: 2,time: 3000});
                    }
                },complete: function () {
                    layer.close(index);
                },
                error:{

                }
            })
        }, function () {
            layer.close(indexla);
        });
    }

    //取消进件
    function cancelProjectApply(){
        var entryId='${entry.id}';
        $('#reason').val('');
       var idx= layer.open({
            type: 1,
            area: ['450px', '280px'],
            content: $("#auditDiv"),
            title: '提示',
            btn: ['确认', '取消'],
            btnAlign: 'c',
            yes: function () {
                var reason = $('#reason').val();
                if(isBlank(reason)){
                    layer.msg("取消原因不能为空!");
                    return;
                }
                var index= layer.load(2, {shade: [0.5,'#fff'], content:''});
                $.ajax({
                    type: 'post',
                    url: '${ctx}/incomingManagement/cancelProjectApply',
                    data: {
                        entryId: entryId,
                        cancelReason:reason
                    },
                    success: function (data) {
                        if(data.code =='200'){
                            layer.msg('取消进件成功！', {icon:1,time:1000},function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index);
                                parent.jjDetail(entryId);
                            })
                        }else{
                            layer.msg("取消失败！"+data.errMsg)
                        }
                    },complete: function () {
                        layer.close(index);
                    },
                    error:function (data) {
                        layer.close(index);
                    }
                });

            }
        })

    }

    //重新进件
    function againIncoming(){
        var entryId='${entry.id}';
        var indexla2 = layer.confirm('您确定要重新进件吗？', {
            icon: 3,
            btn: ['确定', '取消'] //按钮
        }, function () {
            var index= layer.load(2, {shade: [0.5,'#fff'], content:''});

            $.ajax({
                type: "POST",
                url: "${ctx}/incomingManagement/againIncoming",
                data: {
                    entryId: entryId
                },
                success: function (result) {
                    if(result.code=='200'){
                        layer.msg('重新进件成功！', {icon: 1, time: 2000}, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                            parent.jjDetail(entryId);
                        });
                    }else {
                        layer.msg('重新进件失败!'+result.errMsg, {icon: 2,time: 3000});
                    }
                },complete: function () {
                    layer.close(index);
                },
                error:{

                }
            })
        }, function () {
            layer.close(indexla2);
        });
    }

    //退回进件
    function returnIncomingApplication(){
        var entryId='${entry.id}';
        $('#reason').val('');
        var idx= layer.open({
            type: 1,
            area: ['500px', '300px'],
            content: $("#auditDiv"),
            title: '提示',
            btn: ['确认', '取消'],
            btnAlign: 'c',
            yes: function () {
                var reason = $('#reason').val();
                if(isBlank(reason)){
                    layer.msg("退回原因不能为空!");
                    return;
                }
                var indexla2 = layer.confirm('退回进件后会触发合同文本重签，您确定要退回进件吗？', {
                    icon: 3,
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    var index= layer.load(2, {shade: [0.5,'#fff'], content:''});

                    $.ajax({
                        type: 'post',
                        url: '${ctx}/incomingManagement/returnIncomingApplication',
                        data: {
                            entryId: entryId,
                            prjCancelReason:reason
                        },
                        success: function (data) {
                            if(data.code =='200'){
                                layer.msg('退回进件成功！', {icon:1,time:2000},function(){
                                    layer.close(idx);
                                    layer.close(index);
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index);
                                    parent.jjDetail(entryId);
                                })
                            }else{
                                layer.msg("退回进件失败！"+data.errMsg, {icon: 2,time:3000})
                                layer.close(index);
                            }
                        }, error:function (data) {
                            layer.close(index);
                        }
                    });
                }, function () {
                    layer.close(indexla2);
                });
            }
        })
    }

    //退回完工
    function returnIncomingToCompletion(){
        var entryId='${entry.id}';
        $('#reason').val('');
        var idx= layer.open({
            type: 1,
            area: ['500px', '300px'],
            content: $("#auditDiv"),
            title: '提示',
            btn: ['确认', '取消'],
            btnAlign: 'c',
            yes: function () {
                var reason = $('#reason').val();
                if(isBlank(reason)){
                    layer.msg("退回原因不能为空!");
                    return;
                }
                var indexla2 = layer.confirm('退回完工后需重新提交农户投放审批流程，您确定要退回完工吗？', {
                    icon: 3,
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    var index= layer.load(2, {shade: [0.5,'#fff'], content:''});

                    $.ajax({
                        type: 'post',
                        url: '${ctx}/incomingManagement/returnIncomingToCompletion',
                        data: {
                            entryId: entryId,
                            prjCancelReason:reason
                        },
                        success: function (data) {
                            if(data.code =='200'){
                                layer.msg('退回完工成功！', {icon:1,time:2000},function(){
                                    layer.close(idx);
                                    layer.close(index);
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index);
                                    parent.jjDetail(entryId);
                                })
                            }else{
                                layer.msg("退回完工失败！"+data.errMsg, {icon: 2,time:3000})
                                layer.close(index);
                            }
                        }, error:function (data) {
                            layer.close(index);
                        }
                    });
                }, function () {
                    layer.close(indexla2);
                });
            }
        })
    }

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