storage.esp 13.4 KB
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../css/frame.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        .tab_content {
            min-height: 500px;
        }

        .content_group {
            background-color: #DCDFE2;
            width: 880px;
        }

        .content_items tr td {
            height: 30px;
            text-align: left;
            width: 160px;
        }

        .content_items tr td.tdLarge {
            width: 400px;
        }

        .content_items tr td .settingParameter {
            width: 92px;
            height: 21px;
        }

        .content_items tr td.td_comment {
            width: 400px;
        }

        .content_items tr td select.settingParameter {
            height: 25px;
            line-height: 25px;
            width: 92px;
        }

        .plainBtn {
            border: 1px solid #7C8895;
            width: 60px;
        }

        .plainText {
            width: 60px;
            border: 0;
            background-color: #DCDFE2;
        }
    </style>
</head>

<body>
    <ul class="tab_header">
        <!--<li class="tab_title" data-index="0">硬盘</li>-->
        <li class="tab_title selected" data-index="1">SD卡</li>
        <!--<li class="tab_title" data-index="2">U盘</li>-->
        <li class="clear"></li>
    </ul>
    <form id="storageForm">
        <div class="tab_content" style="display: none;">

        </div>
        <div class="tab_content">
            <div class="content_group">
                <table class="content_items">
                    <tr>
                        <td class="title">存储卡模式</td>
                        <td class="content">
                            <span id="cardType"></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="content_group">
                <table class="content_items">
                    <tr>
                        <td class="title">路径</td>
                        <td class="content">
                            <input name="146" id="146" type="text" class="plainText" disabled="disabled" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">总容量</td>
                        <td class="content">
                            <input type="text" name="147" id="147" class="plainText" disabled="disabled" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">剩余容量</td>
                        <td class="content">
                            <input type="text" name="148" id="148" class="plainText" disabled="disabled" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="content_group">
                <table class="content_items">
                    <tr>
                        <td class="tableTitle">分区信息</td>
                        <td class="tableTitle">
                            <label class="needRebootHint" title="修改需重启生效">分区大小</label>
                        </td>
                        <td class="tableTitle">剩余容量</td>
                        <td class="tableTitle">操作</td>
                    </tr>
                    <tr>
                        <td class="title">结果分区</td>
                        <td>
                            <input type="text" name="149" id="149" class="settingParameter  needReboot" />
                        </td>
                        <td>
                            <input class="plainText" name="150" id="150" type="text" disabled="disabled" />
                        </td>
                        <td class="tdContent">
                            <a class="settingBtn" id="btnFormatResult">格式化</a>
                        </td>
                    </tr>
                    <tr>
                        <td>录像分区</td>
                        <td>
                            <input type="text" name="151" id="151" class="settingParameter  needReboot" />
                        </td>
                        <td>
                            <input class="plainText" name="152" id="152" type="text" disabled="disabled" />
                        </td>
                        <td class="tdContent">
                            <a class="settingBtn" id="btnFormatVideo">格式化</a>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- <div class="content_group">
                <table class="content_items">
                    <tr>
                        <td>
                            <label>录像流类型</label>
                        </td>
                        <td>
                            <select name="158" id="158" class="settingParameter ">
                                <option value="0">主码流</option>
                                <option value="1">子码流</option>
                            </select>
                        </td>
                        <td rowspan="3" class="td_comment">
                            <table>
                                <tr>
                                    <td>编码格式</td>
                                    <td>h264</td>
                                    <td>码率类型</td>
                                    <td>CBR</td>
                                    <td>分辨率</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td>码率</td>
                                    <td></td>
                                    <td>I帧间隔</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        可能存储码流:<span></span>分辨率:<span></span>录像<span></span>天
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>存储类型</label>
                        </td>
                        <td>
                            <select name="159" id="159" class="settingParameter ">
                                <option value="0">avi</option>
                                <option value="1">h264</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>存满策略</label>
                        </td>
                        <td colspan="2">
                            <input name="160" value="0" type="radio" class="checkboxAlign " /> 循环覆盖
                            <input name="160" value="1" type="radio" class="checkboxAlign " /> 存满即停
                        </td>
                    </tr>
                </table>
            </div>
            <div class="content_group">
                <table class="content_items">
                    <tr>
                        <td>
                            <input type="checkbox" name="153" id="153" class="checkboxAlign " /> <label>违法结果存储</label>
                        </td>
                        <td class="tdLarge">
                            违法最多支持(天) <input name="154" id="154" type="text" class="settingParameter " /> (1-100)
                            <span>至少需要 <span>6G</span></span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="checkbox" name="155" id="155" class="checkboxAlign " /> <label>卡口数据存储</label>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="checkbox" name="156" id="156" class="checkboxAlign " /> <label>短时录像独立存储</label>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </div>
        </div> -->
            <div class="tab_content" style="display: none;">

            </div>
            <% inputSecurityToken(); %>
    </form>
    <div class="operateDiv" style="padding-left: 5px;display:none;">
        <a class="settingBtn" id="btnSave" style="float: left;">保存</a>
        <div class="clear"></div>
    </div>
    <script src="../../scripts/jquery-1.11.1.js"></script>
    <script src="../../scripts/easyui/jquery.easyui.min.js"></script>
    <script src="../../scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="../../scripts/utilities.js"></script>
    <script src="../../scripts/jquery.validate.min.js"></script>
    <script src="../../scripts/jquery.validate.extend.js"></script>
    <script type="text/javascript">
        var parameterAdaptor = new ParameterAdaptor();

        var oldValue = null

        $().ready(function () {
            //保存参数
            $("#btnSave").click(saveParametersToServer);
            //加载存储参数
            loadStorageInfo();
            $("#btnFormatResult").click(sendCmdFormatResult);  //格式化结果信息
            $("#btnFormatVideo").click(sendCmdFormatVideo);    //格式化结果信息

            $("#storageForm").validate({
                rules: {
                    154: {
                        range: [1, 100],
                        digits: true
                    }
                }
            });
        });

        //保存参数到服务器
        function saveParametersToServer() {
            var formObj = $("#storageForm");
            if (!formObj.valid()) {
                $.messager.alert("提示", "参数验证有误,请修改后再提交!", "error");
                return;
            }
            parameterAdaptor.saveParameters(formObj);
        }

        //加载参数
        function loadStorageInfo() {
            var RefererInfo = "storageSettings";
            parameterAdaptor.getParameters(RefererInfo, bindStorageInfo);
        }

        //绑定参数的本地方法
        function bindStorageInfo(data) {
            // 根据返回的存储卡模式更新UI
            var cardType = data.feedback["146001"];
            // 根据参数值更新UI
            switch (cardType) {
                case 0:
                    $("#cardType").html("无卡");
                    break;
                case 1:
                    // 只有一张卡,禁用录像分区
                    $("#151").attr("disabled", "disabled");
                    $("#cardType").html("单卡模式");
                    break;
                case 2:
                    // 两张卡,都不可修改
                    $("#cardType").html("双卡模式");
                    $("#151").attr("disabled", "disabled");
                    $("#149").attr("disabled", "disabled");
                    break;
                default:
                    $.messager.alert("提示", "加载存储卡模式失败!", "error");
                    if (window.console && window.console.error) {
                        console.error("存储卡模式参数值为: " + cardType + ",不知道怎么处理!");
                        $("#storageForm").hide();
                    }
                    return;
            }
            // 保存旧值
            oldValue = data.feedback["149"];
            $("#storageForm").form("load", data.feedback);
        }

        //格式化结果信息
        function sendCmdFormatResult() {
            var url = "/do/trafficController/formatResult";
            var params = {
                partionSize: $("#149").val()
            };
            $.get(url, params, function (data) {
                var message = "格式化成功!";
                var currentValue = $("#149").val();
                if (currentValue != oldValue) {
                    message += "分区大小改变,需要重启后生效!";
                }
                if (data.error) {
                    $.messager.alert("格式化", message, "info");
                } else {
                    $.messager.alert("格式化", "格式化失败!" + data.feedback.Msg, "error");
                }
            }, "json");
        }

        //格式化视频信息
        function sendCmdFormatVideo() {
            var url = "/do/trafficController/formatVideo";
            var params = {
                partionSize: $("#151").val()
            };
            $.get(url, params, function (data) {
                if (data.error) {
                    $.messager.alert("格式化", "格式化成功!", "info");
                } else {
                    $.messager.alert("格式化", "格式化失败!" + data.feedback.Msg, "error");
                }
            }, "json");
        }

    </script>
</body>

</html>