<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>举报管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            var ifClue = "${report.ifClue}";
            if (ifClue == '1') {
                $("#ifClue").prop("checked", true);
                $('#ifClue').attr("disabled", "disabled");
            } else {
                $("#ifClue").prop("checked", false);
                $('#ifClue').attr("disabled", "disabled");
            }
            //显示是否完成选择框

            var admin ="${isAdmin}";
            var fzadmin ="${isAdmin}";
            var status ="${report.reportStatus}";
            if ((admin == '1' || fzadmin == '2')&& status == '2') {
                $("#deal").hide();
            }
        var count = "${result}";
        parent.refreshPromt(count);
        $("input[type='text']").attr("disabled", true);

        $("#btnTrack").click(function () {
            window.location.href = "${ctx}/report/track?id=${report.id}";
        });

        var supplementArea = "${report.supplementArea}";
       /* if (supplementArea == "North China") {
            supplementArea = "华北区域公司";
        } else if (supplementArea == "BeiJing") {
            supplementArea = "北京区域公司";
        } else if (supplementArea == "ShangHai") {
            supplementArea = "上海区域公司";
        } else if (supplementArea == "SouthWest") {
            supplementArea = "西南区域公司";
        } else if (supplementArea == "SouthEast") {
            supplementArea = "东南区域公司";
        } else if (supplementArea == "Central China") {
            supplementArea = "华中区域公司";
        } else if (supplementArea == "GuangShen") {
            supplementArea = "广深区域公司";
        } else if (supplementArea == "Hainan") {
            supplementArea = "海南区域公司";
        } else if (supplementArea == "Group") {
            supplementArea = "集团本部";
        } else if (supplementArea == "PropertyGroup") {
            supplementArea = "物业集团";
        }*/
        $("#supplementArea").val(supplementArea);

        var dealResult = "${report.dealResult}";
        if (dealResult == "1") {
            dealResult = "移交客诉";
        } else if (dealResult == "2") {
            dealResult = "举报无效";
        } else if (dealResult == "3") {
            dealResult = "举报受理";
        } else if (dealResult == "4") {
            dealResult = "举报属实";
        } else if (dealResult == "5") {
            dealResult = "举报不实";
        } else if (dealResult == "6") {
            dealResult = "移交其他部门";
        } else if (dealResult == "7") {
            dealResult = "转为线索";
        }
        $("#deal").val(dealResult);
        })
        ;
        var requestFlag = true;

        function openDownloadDialog(id) {
            if (requestFlag == true) {
                $.ajax({
                    url: "${ctx}/report/toWord?id=" + id,
                    dataType: "text",
                    traditional: true,//这里设置为true
                    cache: false,
                    beforeSend: function () {
                        requestFlag = false;
                    },
                    success: function (url) { //登录成功后返回的数据
                        window.open(url, "_blank");
                    },
                    error: function () {
                        alert("数据错误！");
                    },
                    complete: function () {
                        requestFlag = true;
                    }
                });
            } else {
                top.$.jBox.tip('正在加载，请稍等', 'warning');
            }
        }

        //显示是否完成选择框
        function showDone() {
            var dealResult = $("#dealResult").val();
            if (dealResult == "6") {
                $("#selectType").show();
            } else {
                $("#selectType").hide();
            }

        }

        function again(id) {
            var msg = "您真的确定要重新跟踪吗？\n\n请确认！";
            if (confirm(msg) == true) {

                $.ajax({
                    type: "post",
                    url: "${ctx}/report/again",
                    data: {"id": id},
                    dataType: "json",
                });
                location.reload();
                alert("重新跟踪成功")
            } else {
                return false;
            }
        }


        function clues(id) {
            var msg = "您真的确定要转为线索吗？\n\n请确认！";
            if (confirm(msg) == true) {

                $.ajax({
                    type: "post",
                    url: "${ctx}/report/clues",
                    data: {"id": id},
                    dataType: "json",
                });
                location.reload();
                alert("转为线索成功")
            } else {
                return false;
            }
        }
    </script>
    <style type="text/css">
        .title {
            font-size: 16px;
            font-weight: bold;
        }
    </style>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/report/form">举报详情</a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="report" action="${ctx}/report/conclusion" method="post"
           class="form-horizontal">
    <sys:message content="${message}"/>
    <form:hidden id="reportId" path="id"/>
<span class="title">举报内容</span>
<div class="control-group">
    <label class="control-label">被举报项目/部门:</label>
    <div class="controls">
        <form:input path="reportProject" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">标题:</label>
    <div class="controls">
        <form:input path="supplementTitle" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">被举报人:</label>
    <div class="controls">
        <form:input path="supplementInformant" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">参与人:</label>
    <div class="controls">
        <form:input path="participants" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">知情人:</label>
    <div class="controls">
        <form:input path="insider" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">发生时间:</label>
    <div class="controls">
        <form:input path="reportDate" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">地点:</label>
    <div class="controls">
        <form:input path="site" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">举报时间:</label>
    <div class="controls">
        <form:input path="reportTime" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">所在城市:</label>
    <div class="controls">
        <form:input path="reportCity" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">IP来源:</label>
    <div class="controls">
        <form:input path="reportIp" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">IP所属城市:</label>
    <div class="controls">
        <form:input path="ipCity" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">是否已发送邮件:</label>
    <div class="controls">
        <form:input path="isSendEmail" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">内容:</label>
    <div class="controls">
        <form:textarea id="reportContent" htmlEscape="true" style="width:90%" path="reportContent" rows="6"
                       maxlength="500" class="input-xxlarge" disabled="true"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">调查建议:</label>
    <div class="controls">
        <form:input path="suggestion" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">附件:</label>
    <div class="controls">
        <c:forEach items="${reportAttachmentList}" var="reportAttachment" varStatus="vs">
            ${vs.count}.<a href="${reportAttachment.attachmentPath}" target="_blank">${reportAttachment.attachmentName}</a><br>
        </c:forEach>
    </div>
</div>
<span class="title">举报人信息</span>
<c:if test="${ifClue eq true}">
<div class=" control-group">
    <label class="control-label">姓名:</label>
    <div class="controls">
        <form:input path="reportPersonName" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">手机号:</label>
    <div class="controls">
        <form:input path="reportPersonTel" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">Email:</label>
    <div class="controls">
        <form:input path="reportPersonEmail" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">QQ号:</label>
    <div class="controls">
        <form:input path="qq" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">微信号:</label>
    <div class="controls">
        <form:input path="weixin" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
    </div>
</div>
</c:if>
<c:if test="${isAdmin eq '1'|| isAdmin eq '2'}">
<div class="control-group">
    <label class="control-label">是否显示举报人信息:</label>
    <div class="controls">
        <input type="checkbox" id="ifClue" name="ifClue" Value=""/>
    </div>
</div>
</c:if>
<div class="control-group">
    <label class="control-label">举报途径:</label>
    <div class="controls">
        <form:radiobuttons path="reportSource" items="${fns:getDictList('report_source')}" itemLabel="label"
                           itemValue="value"
                           htmlEscape="false" disabled="true" style="margin-right: -23px\9;"/>
    </div>
</div>
<c:if test="${report.reportStatus ne '0'}">
<span class="title">举报信息补充</span>

<div class="control-group">
    <label class="control-label">所属集团:</label>
    <div class="controls">
        <form:input id="supplementGroup" path="supplementGroup" htmlEscape="false" maxlength="200"
                    class="input-xlarge required" value="${report.supplementGroup}"/>
    </div>
</div>

<div class="control-group">
    <label class="control-label">被举报区域:</label>
    <div class="controls">
        <form:input id="supplementArea" path="supplementArea" htmlEscape="false" maxlength="200"
                    class="input-xlarge required" value="${report.supplementArea}"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">业务类型:</label>
    <div class="controls">
            <%--<form:input id="supplementType" items="split(${report.supplementType},',')" path="supplementType"--%>
            <%--htmlEscape="false" maxlength="200" class="input-xlarge required"/>--%>
        <form:input id="supplementType"
                    path="supplementType"
                    htmlEscape="false" maxlength="200" class="input-xlarge required" value="${report.supplementType}"/>
    </div>
    <br>
    <label class="control-label">业务类别:</label>
    <div class="controls">
            <%--<form:input id="supplementType" items="split(${report.supplementType},',')" path="supplementType"--%>
            <%--htmlEscape="false" maxlength="200" class="input-xlarge required"/>--%>
        <form:input id="supplementCategory"
                    path="supplementCategory"
                    htmlEscape="false" maxlength="200" class="input-xlarge required" value="${report.supplementCategory}"/>
    </div>
</div>

<div class="control-group">
    <label class="control-label">内容:</label>
    <div class="controls">
        <form:textarea id="reportContent" htmlEscape="true" style="width:90%" path="supplementContent" rows="6"
                       maxlength="500" class="input-xxlarge" disabled="true"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">调查建议:</label>
        <%--<div class="controls">--%>
        <%--<form:input path="suggestion" htmlEscape="false" maxlength="200" class="input-xlarge"/>--%>
        <%--</div>--%>
    <div class="controls">
        <form:textarea id="suggestion" htmlEscape="false" style="width:90%" path="suggestion" rows="6"
                       maxlength="500" class="input-xxlarge" disabled="true"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">附件:</label>
    <div class="controls">
        <c:forEach items="${supplementAttachmentList}" var="supplementAttachment" varStatus="vs">
            ${vs.count}.<a href="${supplementAttachment.attachmentPath}" target="_blank">${supplementAttachment.attachmentName}</a><br>
        </c:forEach>
    </div>
</div>
</c:if>

<c:if test="${report.dealResult ne null}">
<span class="title">处理结果</span>
<div class="control-group">
    <label class="control-label">处理人:</label>
    <div class="controls">
        <form:input path="dealPersonName" value="${report.dealPersonName}" disabled="true" htmlEscape="false"
                    maxlength="200" class="input-xlarge required"/>
    </div>
</div>
<div class="control-group">
    <label class="control-label">处理成果文件:</label>
    <div class="controls">
        <c:forEach items="${dealAttachmentList}" var="dealAttachment" varStatus="vs">
            ${vs.count}.<a href="${dealAttachment.attachmentPath}" target="_blank">${dealAttachment.attachmentName}</a><br>
        </c:forEach>
    </div>

</div>
<div class="control-group">
    <label class="control-label">处理结论:</label>
    <div class="controls">
        <c:if test="${(isAdmin eq '1' ||isAdmin eq '2')&& report.reportStatus eq '2'}">
            <form:select path="dealResult" class="input-small required" onchange="showDone();">
                <form:option value=""></form:option>
                <form:options items="${fns:getDictList('deal_result')}" itemLabel="label" itemValue="value"
                              htmlEscape="false"/></form:select></c:if>
            <form:input path=""
                        id="deal" disabled="true"
                        value="${report.dealResult}"
                        htmlEscape="false" maxlength="200"
                        class="input-xlarge required"/>
    </div>
    <div id="selectType" class="control-group" style="display:none">
        <label class="control-label">移交部门:</label>
        <div class="controls">
            <c:if test="${(isAdmin eq '1' ||isAdmin eq '2') && report.reportStatus eq '2'}"><form:select id=""
                                                                                                         path="transferDepartment"
                                                                                                         class="input-small required">
                <form:option value=" ">请选择</form:option>
              <%--  <form:options items="${fns:getDictList('supplement_type')}" itemLabel="label" itemValue="value"
                              htmlEscape="false"/>--%>
                </form:select>
            </c:if>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <br>
    <c:if test="${report.dealResult eq '6'}">
        <div id="transferGroupid" class="control-group">
            <label class="control-label">移交集团:</label>
            <div class="controls">
                <form:input id="transferGroup" path=""
                            value="${report.transferGroup}"
                            htmlEscape="false" maxlength="200"
                            class="input-xlarge"/>
            </div>
        </div>
    </c:if>
    <c:if test="${report.dealResult eq '6'}">
        <div id="transferGroupid" class="control-group">
            <label class="control-label">移交区域:</label>
            <div class="controls">
                <form:input id="transferArea" path=""
                            value="${report.transferArea}"
                            htmlEscape="false" maxlength="200"
                            class="input-xlarge"/>
            </div>
        </div>
    </c:if>
    <c:if test="${report.dealResult eq '6'}">
        <div id="transferDepartmentid" class="control-group">
            <label class="control-label">移交部门:</label>
            <div class="controls">
                <form:input id="transferDepartment" path=""
                            value="${report.transferDepartment}"
                            htmlEscape="false" maxlength="200"
                            class="input-xlarge"/>
            </div>
        </div>
    </c:if>

</div>
</c:if>
<li class="btns">
    <label style="width:auto;">
        <c:if test="${report.reportStatus eq '1'||report.reportStatus eq '0'}"><input id="btnTrack"
                                                                                      class="btn btn-primary"
                                                                                      type="button"
                                                                                      value="跟踪"/>&nbsp;&nbsp;</c:if>
        <input id="btnDocument" class="btn btn-primary" type="button" value="转为文档"
               onclick="openDownloadDialog('${report.id}')"/>&nbsp;&nbsp;
        <input id="btnReturn" class="btn btn-primary" type="button" value="返回" onclick="history.go(-1)"/>&nbsp;&nbsp;
        <c:if test="${(isAdmin eq '1'|| isAdmin eq '2')&& report.reportStatus eq '2'}"><input
                class="btn btn-primary"
                type="submit"
                value="关闭"/>&nbsp;&nbsp;</c:if>
        <c:if test="${isAdmin eq '1'&&(report.reportStatus eq '3'||report.reportStatus eq '2') }"><input id="btnClose"
                                                                                                         class="btn btn-primary"
                                                                                                         type="button"
                                                                                                         onclick="again('${report.id}')"
                                                                                                         value="重新跟踪"/> &nbsp;&nbsp;</c:if>

    </label>
</li>
</form:form>

</html>
</body>