<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>解算参数</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>

    <div class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">组号</label>
            <div class="layui-input-block">
                <input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">算法版本</label>
            <div class="layui-input-inline">
                <select name="ver" id="ver" lay-filter="ver">
                    <option value="1">1</option>
                    <option value="2">2</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">滤波周期(小时)</label>
            <div class="layui-input-block">
                <input type="number" name="filter_hour" id="filter_hour" lay-verify="required" lay-reqtext="不能为空" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">水平异常门限(mm)</label>
            <div class="layui-input-block">
                <input type="number" name="xy_threshold" id="xy_threshold" lay-verify="required" lay-reqtext="不能为空" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">垂直异常门限(mm)</label>
            <div class="layui-input-block">
                <input type="number" name="z_threshold" id="z_threshold" lay-verify="required" lay-reqtext="不能为空" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">增强异常过滤</label>
            <div class="layui-input-inline">
                <select name="adv_filter" id="adv_filter" lay-filter="adv_filter">
                    <option value="0">禁用</option>
                    <option value="1">启用</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">自适应滤波</label>
            <div class="layui-input-inline">
                <select name="auto_filter" id="auto_filter" lay-filter="auto_filter">
                    <option value="0">禁用</option>
                    <option value="1">启用</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最小滤波周期(小时)</label>
            <div class="layui-input-block">
                <input type="number" name="filter_min_hour" id="filter_min_hour" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">触发门限(mm)</label>
            <div class="layui-input-block">
                <input type="number" name="auto_threshold" id="auto_threshold" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">自动补传</label>
            <div class="layui-input-inline">
                <select name="auto_upload" id="auto_upload" lay-filter="auto_upload">
                    <option value="0">禁用</option>
                    <option value="1">启用</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>

    <script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form'], function () {
            var form = layui.form,
                $ = layui.$;
            var iframeIndex = parent.layer.getFrameIndex(window.name);

            //监听提交
            form.on('submit(saveBtn)', function (data) {
                $.ajax({
                    type:"POST",
                    url:"/gnss/group/update_calc",
                    contentType: "application/json;charset=UTF-8",
                    data: JSON.stringify(data.field),
                    success: function (result) {
                        parent.onCalcParaUpdated();
                        parent.layer.close(iframeIndex);
                    },
                    error: function () {
                        console.log("ajax error");
                        parent.layer.close(iframeIndex);
                    }
                });

                return false;
            });

        });

        function setParams(data){
            var form = layui.form,
                $ = layui.$;
            var group_id = $('#id');
            group_id.val(data.id);
            group_id.attr('readonly',true);
            $('#filter_hour').val(data.filter_hour);
            $('#xy_threshold').val(data.xy_threshold);
            $('#z_threshold').val(data.z_threshold);
            $('#adv_filter').val(data.adv_filter?'1':'0');
            $('#auto_filter').val(data.auto_filter?'1':'0');
            $('#filter_min_hour').val(data.filter_min_hour);
            $('#auto_threshold').val(data.auto_threshold);
            $('#auto_upload').val(data.auto_upload?'1':'0');
            $('#ver').val(data.ver);
            form.render();
        }
    </script>

</body>
</html>