<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>归属管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <link href="${path}/static/css/bootstrap-select.min.css" rel="stylesheet" />
    <script src="${path}/static/js/bootstrap-select.min.js" ></script>
    <script>
        var path = "${path}";
    </script>
    <style type="text/css">
        hr{
            margin:0;
        }
        /*右边内容div*/
        .formDiv{
            width:80%;
            height:100%;
            margin: 0 auto;
        }
        .btns{
            text-align: center;
        }
        .btn{
            margin-left:23px;
        }
        /*多选下拉框*/
           .dropdown{
                margin-left: -23px!important;
            }
         .dropdown-menu {
             position: absolute;
             top: 103%;
             left: 0;
             z-index: 10000;
             display: none;
             float: left;
             list-style: none;
             text-shadow: none;
             /*max-height: 400px;*/
             margin: 0px;
             -webkit-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
             -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
             box-shadow: 0 1px 8px rgba(120, 234, 61, 0.55);
             font-size: 14px;
             font-family: "Segoe UI", Helvetica, Arial, sans-serif;
             border: 1px solid #ddd;
         }
         .dropdown-menu{
             margin-left: 23px!important;
         }
        /*短input*/
        .shortInput{
            width:100px;
        }
        .form-group{
            margin-bottom: 10px!important;
        }
    </style>
</head>
<body class="container">
    <div class="formDiv">
        <c:if test="${level == 0}">
            <!--医院信息-->
            <div id="hospitalDiv">
                <div class=""><h4>医院信息</h4></div>
                <hr>
                <div>
                        <div class="box-body">
                        <form class="form-horizontal" name="form1" id="form1">
                            <input type="hidden" name="parentId" value="0">
                            <input type="hidden" name="dictId" id="hospitalId" value="${hospital.dictId}">
                            <div class="form-group">
                                <label  class="col-sm-2 control-label left">医院名称:</label>
                                <div class="col-sm-5 left">
                                    <input type="text" class="form-control input-sm" id="hospitalName" name="hospitalName" value="${hospital.hospitalName}" maxlength="16">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label left">医院地区:</label>
                                <div class="col-sm-5 left">
                                    <input type="text" class="form-control input-sm" id="dictArea" name="dictArea" value="${hospital.dictArea}" maxlength="25">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label left">医院电话:</label>
                                <div class="col-sm-5 left">
                                    <input type="text" class="form-control input-sm" id="hospitalTel" name="hospitalTel" value="${hospital.hospitalTel}" maxlength="20">
                                </div>
                            </div>
                        </form>
                            <div class="btns">
                                <pm:myPermissions permissions="/dict/update">
                                    <button type="button" class="btn btn-primary input-sm" onclick="addHospital()">保存</button>
                                </pm:myPermissions>
                                <button type="button" class="btn btn-default input-sm" onclick="clearForm('form1')">清空</button>
                            </div>
                        </div>
                </div>
            </div>
        </c:if>
    <c:if test="${level > 0}">
        <!--系统信息-->
        <div id="systemDiv">
            <!--系统医院信息-->
            <div class=""><h4>医院信息</h4></div>
            <hr>
            <div>
                <form class="form-horizontal">
                    <div class="box-body">
                        <div class="form-group" >
                            <label  class="col-sm-2 control-label left">医院名称:</label>
                            <div class="col-sm-5 left">
                                <input type="text" class="form-control input-sm" readonly id="hospitalName1" value="${hospital.hospitalName}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">医院地区:</label>
                            <div class="col-sm-5 left">
                                <input type="text" class="form-control input-sm" readonly id="dictArea1" value="${hospital.dictArea}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">医院电话:</label>
                            <div class="col-sm-5 left">
                                <input type="text" class="form-control input-sm" readonly id="hospitalTel1" value="${hospital.hospitalTel}">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class=""><h4>系统信息</h4></div>
            <hr>
            <div>
                <form class="form-horizontal" id="form2" name="form2">
                    <div class="box-body">
                        <input type="hidden" name="dictId" id="dictId" value="${dict.dictId}">
                        <div class="form-group">
                            <label  class="col-sm-2 control-label left">系统标识:</label>
                            <div class="col-sm-5 left">
                                <input type="text" class="form-control input-sm" name="sysFlag" id="sysFlag" value="${dict.sysFlag}" maxlength="26">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">系统名称:</label>
                            <div class="col-sm-5 left">
                                <input type="text" class="form-control input-sm"  name="sysName" id="sysName" value="${dict.sysName}" maxlength="16">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">系统分类:</label>
                            <div class="col-sm-5 left">
                                <select class="form-control input-sm " id="sysType" name="sysType">
                                    <c:forEach items="${sysTypes}" var="types">
                                        <option value="${types}" <c:if test="${types == dict.sysType}">selected</c:if>>${types}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">所属医院:</label>
                            <div class="col-sm-5 left">
                                <select class="form-control input-sm" id="parentId" name="parentId">
                                    <c:forEach items="${hospitals}" var="h">
                                        <option value="${h.dictId}" <c:if test="${h.dictId == hospital.hospitalId}">selected</c:if>>${h.hospitalName}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group" id="deptDiv" <c:if test="${sysTypes[0]== '权限系统'}">style="display:none"</c:if>>
                            <label class="col-sm-2 control-label left">所属部门:</label>
                            <div class="col-sm-5 left">
                                <c:if test="${operFlag != '' && operFlag == 'add'}">
                                    <select class="selectpicker" multiple id="deptId" name="deptIds" style="max-height:400px!important;overflow:scroll;" data-live-search="true" data-actions-box="true">
                                        <c:forEach items="${depts}" var="dept">
                                            <option value="${dept.deptId}" <c:if test="${deptId == dept.deptId}">selected</c:if>>${dept.deptName}</option>
                                        </c:forEach>
                                    </select>
                                </c:if>
                                <c:if test="${operFlag != '' && operFlag == 'edit'}">
                                    <select class="form-control input-sm"  id="deptId" name="deptId">
                                        <c:forEach items="${depts}" var="dept">
                                            <option value="${dept.deptId}" <c:if test="${dict.deptId == dept.deptId}">selected</c:if>>${dept.deptName}</option>
                                        </c:forEach>
                                    </select>
                                    <%--<select class="selectpicker" multiple id="deptId" name="deptIds" style="max-height:400px!important;overflow:scroll;" data-live-search="true" data-actions-box="true">
                                        <c:forEach items="${depts}" var="dept">
                                            <option value="${dept.deptId}" <c:if test="${dept.checks != '' && dept.checks != null}">selected</c:if>>${dept.deptName}</option>
                                        </c:forEach>
                                    </select>
                                    <input type="hidden" name="deptId" value="${dict.deptId}">--%>
                                </c:if>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;排序:</label>
                            <div class="col-sm-5 left">
                                <input type="number" class="form-control input-sm shortInput"  id="sort" name="sort" value="${dict.sort}" oninput="if(value.length>9)value=value.slice(0,9)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;状态:</label>
                            <div class="col-sm-5 left">
                                <select class="form-control input-sm shortInput" name="dictStatus">
                                    <option value="1" <c:if test="${dict.dictStatus == 1}">selected</c:if>>启用</option>
                                    <option value="0" <c:if test="${dict.dictStatus == 0}">selected</c:if>>不启用</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">可编辑否:</label>
                            <div class="col-sm-5 left">
                                <select class="form-control input-sm shortInput" name="dictEdit">
                                    <option value="1" <c:if test="${dict.dictEdit == 1}">selected</c:if>>是</option>
                                    <option value="0" <c:if test="${dict.dictEdit == 0}">selected</c:if>>否</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注:</label>
                            <div class="col-sm-5 left">
                                <textarea type="text" class="form-control input-sm" name="remark" value="${dict.remark}" maxlength="50">${dict.remark}</textarea>
                            </div>
                        </div>
                        <c:if test="${hospital.dictEdit == 1 || user.roleId == 0}">
                            <div class="btns">
                                <pm:myPermissions permissions="/dict/update">
                                    <button type="button" class="btn btn-primary input-sm" onclick="addSys()">保存</button>
                                </pm:myPermissions>
                                <button type="button" class="btn btn-default input-sm" onclick="clearForm2()">清空</button>
                            </div>
                        </c:if>
                    </div>
                </form>
            </div>
        </div>
    </c:if>
    <script src="${path}/static/js/dictIframe.js"></script>
</body>
</html>