@{
    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 event = $.request("event");
            var dbNumber = $.request("dbNumber");
            //权限字段
            common.authorizeFields('adminform');
            var baseConfig;
            $(function () {
                $("#OutputModule").bindSelect({
                    url: "/SystemManage/Module/GetSelectJson",
                });
                if (!!keyValue) {
                    common.ajax({
                        url: "/SystemManage/CodeGenerator/GetBaseConfigJson",
                        dataType: "json",
                        data: { keyValue: keyValue,dbNumber:dbNumber },
                        async: false,
                        success: function (data) {
                            baseConfig = data;
                            common.val('adminform', data);
                            common.val('adminform', data.FileConfig);
                            common.val('adminform', data.OutputConfig);
                            form.render();
                        }
                    });
                }
            });
            wcLoading.close();

            //监听提交
            form.on('submit(saveBtn)', function (data) {
                baseConfig.FileConfig.ClassPrefix = data.field.ClassPrefix;
                baseConfig.FileConfig.EntityName = data.field.ClassPrefix + "Entity";
                baseConfig.FileConfig.ClassDescription = data.field.ClassDescription;
                baseConfig.FileConfig.CreateUserName = data.field.CreateUserName;
                baseConfig.FileConfig.CreateDate = data.field.CreateDate;
                baseConfig.OutputConfig.OutputModule = $("#OutputModule option:selected").text().replace(/^\s+|\s+$/g, "");
                common.submitForm({
                    url: "/SystemManage/CodeGenerator/EntityCodeGenerateJson?keyValue=" + keyValue+"&dbNumber="+dbNumber,
                    param: baseConfig,
                    success: function () {
                    }
                })
                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="ClassPrefix" name="ClassPrefix" autocomplete="off" lay-verify="required" maxlength="50" 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="ClassDescription" name="ClassDescription" autocomplete="off" maxlength="50" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">输出模块名</label>
                    <div class="layui-input-block">
                        <select id="OutputModule" name="OutputModule" lay-filter="OutputModule" lay-verify="required" lay-search>
                            <option value="">请选择</option>
                        </select>
                    </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="CreateUserName" name="CreateUserName" autocomplete="off" maxlength="50" 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="CreateDate" name="CreateDate" autocomplete="off" lay-verify="required" class="layui-input">
                    </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>
