<%@ 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>
<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="line0"></div>
    <div class="mid-xuqiu">
        <div class="line-xuqiu"></div>
        <div class="xuqiu-0">
            <input type="hidden" id="rqrmntId" name="rqrmntId" value="${outputModel.rqrmntId}"/>
            <input type="hidden" id="rqrmntFollowId" name="rqrmntFollowId" value="${outputModel.rqrmntFollowId}"/>
            <div class="xuqiu-top">
                <div>
                    <div class="xuqiu-name">${outputModel.rqrmntName}</div>
                    <div class="jinxingzhong1">${outputModel.rqrmntState}</div>
                </div>
                <div class="clearfix"></div>
                <div class="xuqiu-icon">
                                        <span class="imgsc">
                                            <img src="<%=resourcePath%>/images/icon_chakan.png" alt="">&nbsp;&nbsp;
                                            关注：${outputModel.followTimes ==null ? 0 : outputModel.followTimes}
                                        </span>
                                        <span>
                                              <img src="<%=resourcePath%>/images/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>
            <div>
            <div class="xiangqing01">
                <img src="<%=resourcePath%>/images/icon_xiangqing.png" alt="" class="xiangqingimg">
                详情
            </div>
            <div>
                <table border="1" width="1080px" height="216px"  cellspacing="0" class="biaoge01">
                    <tr>
                        <td>需求名称：</td>
                        <td>${outputModel.rqrmntName}</td>
                    </tr>
                    <tr>
                        <td>需求摘要：</td>
                        <td>${outputModel.rqrmntSummary}</td>
                    </tr>
                    <tr>
                        <td>数据用途：</td>
                        <td>${outputModel.dataUses}</td>
                    </tr>
                    <tr>
                        <td>数据需求用户：</td>
                        <td>${outputModel.publishUserName}</td>
                    </tr>
                    <tr>
                        <td>数据所属部门</td>
                        <td>${outputModel.sectorName}</td>
                    </tr>
                    <tr>
                        <td>发布日期：</td>
                        <td><fmt:formatDate value="${outputModel.publishAt}" pattern="yyyy-MM-dd"/></td>
                    </tr>
                </table>
                <table border="1" width="1080px" height="90px"   cellspacing="0"  class="shuju-table">
                    <tr bgcolor=" #dcdfe5">
                        <td>数据资源名称</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>
                <table border="1" width="1080px" height="324px"  cellspacing="0" class="biaoge01">
                    <tr>
                        <td>需求状态：</td>
                        <td>${outputModel.rqrmntState}</td>
                    </tr>
                    <tr>
                        <td>审核意见：</td>
                        <td>${outputModel.auditOpinion}</td>
                    </tr>
                    <tr>
                        <td>审核用户：</td>
                        <td>${outputModel.auditeByName}</td>
                    </tr>
                    <tr>
                        <td>审核日期：</td>
                        <td><fmt:formatDate value="${outputModel.auditedAt}" pattern="yyyy-MM-dd"/></td>
                    </tr>
                    <tr>
                        <td>反馈部门：</td>
                        <td>${outputModel.feedbackSectorName}</td>
                    </tr>
                    <tr>
                        <td>反馈情况:</td>
                        <td>${outputModel.feedbackResult}</td>
                    </tr>
                    <tr>
                        <td>反馈意见：</td>
                        <td>${outputModel.feedbackDesc}</td>
                    </tr>
                    <tr>
                        <td>反馈用户：</td>
                        <td>${outputModel.feedbackByName}</td>
                    </tr>
                    <tr>
                        <td>反馈日期：</td>
                        <td><fmt:formatDate value="${outputModel.feedbackAt}" pattern="yyyy-MM-dd"/></td>
                    </tr>
                </table>
            </div>
            <div class="fanhui" onclick="toIndex()">返回</div>
        </div>
    </div>

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

    //关注
    function fnFollow(){
        if (!checkAuthentication()){
            return;
        }
        var id=$('#rqrmntId').val();
        $.get("<%=basePath%>/open/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=$('#rqrmntId').val();*/
        var id=$('#rqrmntFollowId').val();
        $.get("<%=basePath%>/open/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>