@{
    ViewBag.Title = "Form"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
    <script>
        layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
            var form = layui.form,
                $ = layui.$,
                common = layui.common,
                laydate = layui.laydate;
            var keyValue = $.request("keyValue");
            var moduleId = $.request("moduleId");
            //权限字段
            common.authorizeFields('adminform');
            $(function () {
                if (!!keyValue) {
                    common.ajax({
                        url: '/SystemManage/ModuleFields/GetFormJson',
                        dataType: 'json',
                        data: { keyValue: keyValue },
                        async: false,
                        success: function (data) {
                            common.val('adminform', data);
                        }
                    });
                }
                form.render();
            });
            wcLoading.close();
            //监听提交
            form.on('submit(saveBtn)', function (data) {
                var postData = data.field;
                if (!postData["F_IsPublic"]) postData["F_IsPublic"] = false;
                if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
                postData["F_ModuleId"] = moduleId;
                common.submitForm({
                    url: '/SystemManage/ModuleFields/SubmitForm?keyValue=' + keyValue,
                    param: postData,
                    success: function () {
                        common.parentreload('data-search-btn');
                    }
                })
                return false;
            });
        });
    </script>

<body>
    <div class="layuimini - container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">编号</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_EnCode" name="F_EnCode" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_FullName" name="F_FullName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">选项</label>
                    <div class="layui-input-block">
                        <input id="F_IsPublic" name="F_IsPublic" type="checkbox" value="true" title="公共">
                        <input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text layui-hide">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</body>

