@page
@model Waste.Web.Entry.Pages.Device.ConfigModel
@{
    ViewData["Title"] = "设备配置";
}
<div class="layui-card">
    <div class="layui-card-body">
        <div class="form-horizontal layui-form">
            <div class="layui-form-item row">
                <label class="layui-form-label col-md-2" for="Url">推送地址</label>
                <div class="col-md-4">
                    <input type="text" class="layui-input" id="Url" name="Url" value="@Model.data.Url" placeholder="请输入推送地址" lay-verify="required" />
                </div>
            </div>
            <div class="layui-form-item row">
                <label class="layui-form-label col-md-2" for="Body">额外参数</label>
                <div class="col-md-4">
                    <input type="text" class="layui-input" id="Body" name="Body" value="@Model.data.Body" placeholder="请输入额外参数信息" />
                    <span class="tiptext">消息推送时会以body参数名原样传递此参数</span>
                </div>
            </div>
            <div class="text-center col-md-7">
                <button class="btn btn-primary btn-lg" lay-submit lay-filter="submit" type="button">提交</button>
            </div>
        </div>
    </div>
</div>
@section Scripts{
<script type="text/javascript" src="~/js/ajaxCascader/ajaxCascader.js"></script>
<script type="text/javascript">
         layui.use(['form', 'common'], function () {
             var form = layui.form,
                 common = layui.common;
             form.on("submit(submit)", function (data) {
                 data.field['id'] = '@Model.data.DeviceId';
                 common.ajax({
                     url: "/api/device/setconfig",
                     type: "post",
                     data: data.field
                 });
             });
    });
</script>
}