﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作看板</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <%@include file="../../jspf/comm.jspf" %>
    <script>
        var path = "${path}";
    </script>
    <!-- Google Font -->
    <style type="text/css">
        .contentBody{
            background-color: #ECF0F5;
        }
        h3{
            size:14px;
            color: #0f0f0f;
        }
        .workHomeIframe{
            height: calc(100vh - 40px);
        }
    </style>
</head>
<body class="contentBody">
<div class="searchDiv">
    <form style="margin-top:5px;margin-bottom: 0!important;">
        <div class="form-inline">
            <div class="form-group" style="margin-left: 60%">
                <label for="startDateTo">出院日期:</label>
                <div class="input-group input-daterange">
                    <input type="text" class="input-sm form-control" name="start" id="startDateTo"
                           maxlength="10" autocomplete="off"/>
                    <span class="input-group-addon">-</span>
                    <input type="text" class="input-sm form-control" name="end" id="endDateTo" maxlength="10" autocomplete="off"/>
                </div>
            </div>
            <div class="form-group">
                <label for="timeInterval">出院时段:</label>
                <select class="form-control input-sm" id="timeInterval"
                        onchange="loadTableByTime(this.options[this.options.selectedIndex].value,'startDateTo','endDateTo','table')">
                </select>
            </div>
            <button type="button" class="btn btn-primary btn-sm divCss" id="searchBtn">查询</button>
        </div>
    </form>
</div>
<div class="workHomeIframe">
    <iframe src="${path}/faultType/workHomeIframe" width="100%" height="100%" id="iframe"></iframe>
</div>
<script>
    //出院时段触发查询
    function loadTableByTime(value,startDateId,endDateId,tableId){
        //填空出院日期搜索框并立即查询
        //开始日期id
        var startDateDocument = $("#"+startDateId);
        //结束日期id
        var endDateDocument = $("#"+endDateId);
        switch (value) {
            case '':
                //不限
                startDateDocument.val("");
                break;
            case '1':
                //3天内
                //开始日期为3天前getHisDay
                startDateDocument.val(getHisDay(3));
                break;
            case '2':
                //7天内
                //开始日期为7天前getHisDay
                startDateDocument.val(getHisDay(7));
                break;
            case '3':
                //1个月内
                //开始日期为1个月前
                startDateDocument.val(getPreMonthToday());
                break;
            case '4':
                //3个月内
                //开始日期为6个月前
                startDateDocument.val(getPreMonthDay(getNowDay(),3));
                break;
        }
        if(value != ''){
            //非不限结束日期均为今天
            //结束时间为今天
            endDateDocument.val(getNowDay());
        }else{
            //结束时间为今天
            endDateDocument.val("");
        }
        loadIframe();
    }
    $("#searchBtn").click(function(){
        loadIframe();
    })
    function loadIframe(){
        $("#iframe").prop("src","${path}/faultType/workHomeIframe");
    }

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

