<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sptg="http://www.thymeleaf.org">
    <head>
        <script th:replace="common/head"></script>
        <style>
            .layui-layer.alert_content .layui-layer-content {
                padding: 0;
            }
            .layui-layer.alert_content .layui-layer-btn{
                padding: 0 30px 12px;
            }
            .xm-toolbar .toolbar-tag {
                width: 100%;
                display: flex;
                justify-content: center;
                background-color: #1E9FFF!important;
                color: #fff!important;
            }
        </style>
    </head>

    <body style="position: absolute;top:0;bottom: 0;left:0;right: 0;">
        <div class="layui-fluid">
            <input type="hidden" id="onlineStatus" th:value="${onlineStatus}">
            <input type="hidden" id="residentialId" th:value="${residentialId}" />
            <!-- 下拉树 -->
            <div class="x-body">
                <div class="layui-card">
                    <!-- 查询条件 -->
                    <div class="layui-form layui-card-header layuiadmin-card-header-auto"  style="padding:0;">
                        <div class="layui-form-item border-b">
                            <div class="layui-inline">
                                <label class="layui-form-label">设备名称</label>
                                <div class="layui-input-block">
                                    <input type="text" id="name" placeholder="请输入设备名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label">设备序列号</label>
                                <div class="layui-input-block">
                                    <input type="text" id="serial_number" placeholder="请输入设备序列号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">设备状态</label>
                                <div class="layui-input-block">
                                    <select id="on_line_status" >
                                        <option value="" selected>全部</option>
                                        <option value="1" >在线</option>
                                        <option value="0" >离线</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline" style="margin-left: 38px;">
                                <button class="layui-btn layuiadmin-btn-useradmin"  lay-submit lay-filter="query">查询</button>
                                <button class="layui-btn  layui-btn-primary"  lay-submit lay-filter="reset">重置</button>
                            </div>
                        </div>

                        <!-- 表格+头部按钮 -->
                        <div class="layui-card-body" style="padding:0;">
                            <div style="padding-bottom: 10px;">
                                <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="add" sptg:security="device:info:add">添加设备</button>
                                <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="batch_update" sptg:security="device:info:batchUpdate">批量设置</button>
                                <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="select_upgrade" sptg:security="device:app:package:upgrade">版本升级</button>
                                <!--<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="upgrade" sptg:security="device:app:package:upgrade">版本升级</button>-->
                            </div>
                            <table id="data_entity_table" lay-filter="data_table_event"></table>
                        </div>
                    </div>
                </div>
            </div>
            <!--/*@thymesVar id="onLineUser" type="com.sptg.permissions.api.entity.Account"*/-->
            <input type="hidden" id="user_org_id" th:value="${onLineUser.orgId}" />
        </div>

        <!-- javascript -->
        <script type="text/javascript" th:src="@{'/layui/layui.js'}" charset="utf-8"></script>
        <script type="text/javascript">
            layui.config({
                base: '/' //静态资源所在路径
            });
            var selectDeviceIds = new Set();
        </script>
        <script type="text/javascript" th:src="@{'/js/estate/residential-device.js'}" charset="utf-8"></script>

        <!-- 设备类型 -->
        <!--<script type="text/html" id="device_type">
            {{#  if(d.unitId!=null){ }}
            <span>单元机</span>
            {{# } else{ }}
            <span>小区机</span>
            {{#  } }}
        </script>-->
        <script type="text/html" id="device_type">
            {{#  if(d.unitId!=null){ }}
            <span>单元机</span>
            {{# }else{  }}
            <span>小区机</span>
            {{# } }}
        </script>

        <!-- 设备朝向 -->
        <script type="text/html" id="device_is_out">
            {{#  if(d.isOut == 1){ }}
            <span>进</span>
            {{# } else if(d.isOut == 2){ }}
            <span>出</span>
            {{#  } }}
        </script>

        <!-- 是否支持人脸识别 -->
        <script type="text/html" id="have_face">
            {{#  if(d.haveFace == 1){ }}
            <span class="layui-badge layui-bg-green">支持</span>
            {{# } else if(d.haveFace == 2){ }}
            <span class="layui-badge layui-bg-black">不支持</span>
            {{#  } }}
        </script>

        <!-- 流量卡卡号 -->
        <script type="text/html" id="flowCard">
            {{#  if(d.flowCardId != null && d.flowCard){ }}
            <span class="layui-badge layui-bg-blue">{{d.flowCard.cardNum}}</span>
            {{# } else { }}
            <span class="layui-badge layui-bg-black">未绑定</span>
            {{#  } }}
        </script>


        <!--操作-->
        <script type="text/html" id="table-operate">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="info">详情</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete" sptg:security="device:info:delete">删除</a>
            <a class="layui-btn layui-btn-xs" data-dropdown="#dropUser{{d.LAY_INDEX}}" lay-event="more" no-shade="true">
                更多<i class="layui-icon layui-icon-drop" style="font-size: 12px;margin-right: 0;"></i></a>
            <!-- 下拉菜单 -->
            <ul class="dropdown-menu-nav dropdown-bottom-right layui-hide" id="dropUser{{d.LAY_INDEX}}">
                <div class="dropdown-anchor"></div>
                <li> <a  lay-event="log">日志</a></li>
                <li> <a  lay-event="edit" sptg:security="device:info:update">修改</a></li>
                <li> <a  lay-event="checkOnline" id="checkOnline" sptg:security="device:info:checkOnline">在线检测</a></li>
                <li> <a  lay-event="editPwd" sptg:security="device:info:update">修改开门密码</a></li>
                {{#  if(d.reboot == 1){ }}
                <li> <a  lay-event="reload" id="reload" sptg:security="device:info:reload">重启设备</a></li>
                {{#  } }}
<!--                <li> <a  lay-event="reload" sptg:security="device:info:reload">重启设备</a></li>-->
                <li> <a  lay-event="openDoor" id="openDoor" sptg:security="device:info:openDoor">一键开门</a></li>
                <li> <a  lay-event="dataSync" id="dataSync"  sptg:security="device:data:sync">数据同步</a></li>
                <li> <a  lay-event="dataFormat" id="dataFormat"  sptg:security="device:info:formatData">格式化</a></li>
<!--                <li> <a  lay-event="flowCard" sptg:security="device:flowCard:bind">绑定流量卡</a></li>-->
            </ul>
        </script>

        <!--版本升级-->
        <script type="text/html" id="app-package-table">
            <!-- 数据表格 -->
            <div class="layui-card-body">
                <table id="data_app_package_table" lay-filter="data_app_package_event"></table>
            </div>
        </script>

    </body>

</html>
