<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!doctype html>
<head>
    <title>需求详情</title>
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
    <jsp:include page="../common/body_header.jsp"></jsp:include>
    <div class="mid11">
    <div class="nr">
        <div class="form-fabu1">
            <input type="hidden" id="rqrmntId" name="rqrmntId" value="${outputModel.rqrmntId}"/>
            <input type="hidden" id="rqrmntFollowId" name="rqrmntFollowId" value="${outputModel.rqrmntFollowId}"/>
            <div class="fabufont">${outputModel.rqrmntName}</div>
            <div class="clearfix"></div>
            <div class="xuqiu-icon">
                              <span class="imgsc">
                                  <img src="<%=resourcePath%>/images/share/icon_chakan.png" alt="">&nbsp;&nbsp;
                                   关注：${outputModel.followTimes ==null ? 0 : outputModel.followTimes}
                              </span>
                <span>
                                    <img src="<%=resourcePath%>/images/share/icon_shoucang.png" alt="">&nbsp;&nbsp;
                                    浏览：${outputModel.viewTimes ==null ? 0 : outputModel.viewTimes}
                              </span>
            </div>
            <div class="xuqiu-1" id="followDivId">
                ${outputModel.rqrmntFollowId ==null ? '<button class="button20" onclick="fnFollow()">关注</button>':'<button class="button20" onclick="fnDelFollow()">取消关注</button>'}
            </div>
            <div class="line-fabu"></div>
            <div class="clearfix"></div>
            <div>
                <div class="xiangqing01">
                    <img src="<%=resourcePath%>/images/share/icon_xiangqing.png" alt="" class="xiangqingimg">
                    详情
                </div>
                <div class="xq0">
                    <div class="xq1">
                        <div class="rz-font2">需求名称：${outputModel.rqrmntName}</div>
                        <div class="rz-font2">需求摘要：${outputModel.rqrmntSummary}</div>
                        <div class="rz-font2">数据用途：${outputModel.dataUses}</div>
                        <div class="rz-font2">数据需求用户：${outputModel.publishUserName}</div>
                        <div class="rz-font2">数据所属部门：${outputModel.sectorName}</div>
                        <div class="rz-font2">发布时间：<fmt:formatDate value="${outputModel.publishAt}" pattern="yyyy-MM-dd"/></div>
                    </div>
                    <table  class="shuju-table">
                        <tr bgcolor=" #dcdfe5">
                            <td class="td6">数据资源名称</td>
                            <td>具体数据项</td>
                        </tr>
                        <c:if test="${outputModel.dataRequirementDataList !=null}">
                            <c:forEach items="${outputModel.dataRequirementDataList}" var="item">
                                <tr>
                                    <td>${item.dataName ==null?'':item.dataName}</td>
                                    <td>${item.dataItem}</td>
                                </tr>
                            </c:forEach>
                        </c:if>
                    </table><br>
                    <div class="xq1">
                        <div class="rz-font2">需求状态：${outputModel.rqrmntState}</div>
                        <div class="rz-font2">审核意见：${outputModel.auditOpinion}</div>
                        <div class="rz-font2">审核用户：${outputModel.auditeByName}</div>
                        <div class="rz-font2">审核日期：<fmt:formatDate value="${outputModel.auditedAt}" pattern="yyyy-MM-dd"/></div>
                        <div class="rz-font2">反馈部门：${outputModel.feedbackSectorName}</div>
                        <div class="rz-font2">反馈情况：${outputModel.feedbackResult}</div>
                        <div class="rz-font2">反馈意见：${outputModel.feedbackDesc}</div>
                        <div class="rz-font2">反馈用户：${outputModel.feedbackByName}</div>
                        <div class="rz-font2">反馈日期：<fmt:formatDate value="${outputModel.feedbackAt}" pattern="yyyy-MM-dd"/></div>
                    </div>
                </div>
                <button class="fhbut1" onclick="toIndex()">返回</button>
            </div>

        </div>

    </div>
</div>
    <jsp:include page="../common/body_footer.jsp"></jsp:include>
</body>
<script type="text/javascript">
    //返回列表页
    function toIndex(){
        window.location.href="<%=basePath%>/share/dataRequirement/index.htm"
    }

    //关注
    function fnFollow(){
        if (!checkAuthentication()){
            return;
        }
        var id=$('#rqrmntId').val();
        $.get("<%=basePath%>/share/dataRequirement/follow.action/"+id,function(result){
            if(result.stateCode==200){
                alert(result.msg)
                $('#rqrmntFollowId').val(result.data);
                $('#followDivId').html("<button class='button20' onclick='fnDelFollow()'>取消关注</button>");
            }else{
                alert(result.msg)
            }
        })
    }

    //取消关注
    function fnDelFollow(){
        var id=$('#rqrmntFollowId').val();
        $.get("<%=basePath%>/share/dataRequirement/delFollow.action/"+id,function(result){
            if(result.stateCode==200){
                alert(result.msg)
                $('#followDivId').html("<button class='button20' onclick='fnFollow()'>关注</button>");
            }else{
                alert(result.msg)
            }
        })
    }
</script>
</html>
