@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/lib/jquery.ui/1.12.1/jquery-ui.min.js" charset="utf-8"></script>
<link href="~/lib/jquery.ui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
<link href="~/css/stepcss.css" rel="stylesheet" />
<script>
    var setup_draggable = function () {
        $(".draggable").draggable({
            appendTo: "body",
            helper: "clone"
        });
        $(".droppable").droppable({
            accept: ".draggable",
            helper: "clone",
            hoverClass: "droppable-active",
            drop: function (event, ui) {
                $(".empty-form").remove();
                var $orig = $(ui.draggable);
                if (!$(ui.draggable).hasClass("dropped")) {
                    var $el = $orig.clone().addClass("dropped").css({ "position": "static", "left": null, "right": null }).appendTo(this);
                    var id = $orig.find(":input").attr("id");
                    if (id) {
                        id = id.split("-").slice(0, -1).join("-") + "-" + (parseInt(id.split("-").slice(-1)[0]) + 1);
                        $orig.find(":input").attr("id", id);
                        $orig.find("label").attr("for", id)
                    }
                    //$('<p class="tools col-sm-12 col-sm-offset-3"><a class="edit-link">编辑HTML<a></p>').appendTo($el)
                } else {
                    if ($(this)[0] != $orig.parent()[0]) {
                        var $el = $orig.clone().css({ "position": "static", "left": null, "right": null }).appendTo(this);
                        $orig.remove()
                    }
                }
            }
        }).sortable();
    };
    layui.use(['element', 'table', 'form', 'step', 'common', 'dtree', 'laydate', 'commonTable', 'optimizeSelectOption'], function () {
        var $ = layui.$,
            form = layui.form,
            element = layui.element,
            commonTable = layui.commonTable,
            dtree = layui.dtree,
            table = layui.table,
            laydate = layui.laydate,
            common = layui.common,
            step = layui.step;
        var keyValue = $.request("keyValue");
        var dbNumber = $.request("dbNumber");
        //权限字段
        common.authorizeFields('stepForm');
        wcLoading.close();
        //执行一个laydate实例
        laydate.render({
            elem: '#CreateDate'
            , btns: ['clear', 'now']
            , type: 'datetime'
            , trigger: 'click',
            format: 'yyyy-MM-dd HH:mm',
        });
        //初始化步骤控件
        step.render({
            elem: '#stepForm',
            filter: 'stepForm',
            width: '100%', //设置容器宽度
            stepWidth: '600px',
            height: '550px',
            stepItems: [{
                title: '基本配置'
            }, {
                title: '列表界面'
            }, {
                title: '表单页面'
            }, {
                title: '代码预览'
            }]
        });
        var baseConfig;
        $(function () {
            setup_draggable();
            $("#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('stepForm', data);
                        common.val('stepForm', data.FileConfig);
                        common.val('stepForm', data.OutputConfig);
                        common.val('stepForm', data.PageIndex);
                        $("#KeywordColum").val(data.PageIndex.KeywordColum.join(','));
                        $("#n_columns").val(data.PageForm.ShowMode);
                        $("#ParentColum").parent().parent().addClass("layui-hide");
                        $("#TreeColum").parent().parent().addClass("layui-hide");
                        var datas = [];
                        for (var i = 0; i < data.PageIndex.ColumnList.length; i++) {
                            let o = {};
                            o = data.PageIndex.ColumnList[i];
                            o["F_Id"] = uuid();
                            datas.push(o);
                        }
                        table.reload('currentTableId', {
                            data: datas
                        });
                        form.render();
                    }
                });
            }
        });
        //按钮选择
        var buttonList = common.multipleSelectRender({
            el: '#ButtonList',
            remoteSearch: false,
            layVerify: 'required',
            layVerType: 'msg',
            data: [
                { text: '添加按钮', id: 'add', selected: true },
                { text: '编辑按钮', id: 'edit', selected: true },
                { text: '删除按钮', id: 'delete', selected: true },
                { text: '查看按钮', id: 'details', selected: true },
            ]
        });
        commonTable.rendertable({
            elem: '#currentTableId',
            id: 'currentTableId',
            data: [],
            search: false,
            limit: 9999,//每页数据 默认
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['count'] //自定义分页布局
                , first: false //不显示首页
                , last: false //不显示尾页
            },
            rowDrag: {
                done: function (obj) {
                }
            }, 
            height: 'full-340',
            defaultToolbar: false,//默认工具栏
            cols: [[
                { field: 'field', title: '字段', width: 200 },
                { field: 'title', title: '名称', width: 200, edit: 'string' },
                { field: 'width', title: '宽度', width: 90, edit: 'string' },
                {
                    field: 'isAotuWidth', title: '补全列宽', width: 90, templet: function (d) {
                        if (d.isAotuWidth == true) {
                            return ' <input type="checkbox" name="isAotuWidth" lay-skin="switch" checked value= "' + d.field + '"   lay-text="是|否" lay-filter="AotuWidth" >';
                        }
                        else {
                            return '<input type="checkbox" name="isAotuWidth" lay-skin="switch"  value= "' + d.field + '"  lay-text="是|否" lay-filter="AotuWidth" >';
                        }
                    }
                },
                {
                    field: 'isSorted', title: '是否排序', width: 90, templet: function (d) {
                        if (d.isSorted == true) {
                            return ' <input type="checkbox" name="isSorted" lay-skin="switch" checked  value= "' + d.field + '"  lay-text="是|否" lay-filter="Sorted" >';
                        }
                        else {
                            return '<input type="checkbox" name="isSorted" lay-skin="switch"  value= "' + d.field + '" lay-text="是|否" lay-filter="Sorted" >';
                        }
                    }
                },
                {
                    field: 'isFilter', title: '是否过滤', width: 90, templet: function (d) {
                        if (d.isFilter == true) {
                            return ' <input type="checkbox" name="isFilter" lay-skin="switch" checked  value= "' + d.field + '"  lay-text="是|否" lay-filter="Filter" >';
                        }
                        else {
                            return '<input type="checkbox" name="isFilter" lay-skin="switch"  value= "' + d.field + '" lay-text="是|否" lay-filter="Filter" >';
                        }
                    }
                },
                {
                    field: 'isShow', title: '是否显示', width: 90, templet: function (d) {
                        if (d.isShow == true) {
                            return ' <input type="checkbox" name="isShow" lay-skin="switch" checked   value= "' + d.field + '" lay-text="是|否" lay-filter="Show" >';
                        }
                        else {
                            return '<input type="checkbox" name="isShow" lay-skin="switch"  value= "' + d.field + '" lay-text="是|否" lay-filter="Show" >';
                        }
                    }
                },
                {
                    field: 'value', title: '初始值', width: 90, edit: 'string'
                },
                {
                    field: 'filterType', title: '过滤类型', width: 150, edit: 'string'
                },
                {
                    field: 'templet', title: '模板', minWidth: 150, edit: 'string'
                }
            ]]
        });
        form.on('switch(AotuWidth)', function (data) {
            // 得到开关的value值，实际是需要修改的ID值。
            var field = data.value;
            var status = this.checked ? true : false;
            var cachedata = table.cache.currentTableId;
            for (var i = 0; i < cachedata.length; i++) {
                if (field == cachedata[i].field) {
                    cachedata[i].isAotuWidth = status;
                    break;
                }
            }
        });
        form.on('switch(Sorted)', function (data) {
            // 得到开关的value值，实际是需要修改的ID值。
            var field = data.value;
            var status = this.checked ? true : false;
            var cachedata = table.cache.currentTableId;
            for (var i = 0; i < cachedata.length; i++) {
                if (field == cachedata[i].field) {
                    cachedata[i].isSorted = status;
                    break;
                }
            }
        });
        form.on('switch(Filter)', function (data) {
            // 得到开关的value值，实际是需要修改的ID值。
            var field = data.value;
            var status = this.checked ? true : false;
            var cachedata = table.cache.currentTableId;
            for (var i = 0; i < cachedata.length; i++) {
                if (field == cachedata[i].field) {
                    cachedata[i].isFilter = status;
                    break;
                }
            }
        });
        form.on('switch(Show)', function (data) {
            // 得到开关的value值，实际是需要修改的ID值。
            var field = data.value;
            var status = this.checked ? true : false;
            var cachedata = table.cache.currentTableId;
            for (var i = 0; i < cachedata.length; i++) {
                if (field == cachedata[i].field) {
                    cachedata[i].isShow = status;
                    break;
                }
            }
        });
        var entity;
        table.on('row(currentTableFilter)', function (obj) {
            obj.tr.addClass("layui-table-click").siblings().removeClass("layui-table-click");
            entity = obj;
        })
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event === 'add') {  // 监听操作
                common.modalOpen({
                    title: "添加字段",
                    url: "/SystemManage/CodeGenerator/RuleForm",
                    width: "500px",
                    height: "500px",
                });
            }
            else if (obj.event === 'delete') {
                if (entity == null) {
                    common.modalMsg("未选中数据", "warning");
                    return false;
                }
                common.modalConfirm("注：您确定要删除该项数据吗？", function (r) {
                    if (r) {
                        var index = parent.layer.load(0, {
                            shade: [0.5, '#000'], //0.1透明度的背景
                        });
                        try {
                            var cachedata = table.cache.currentTableId;
                            for (var i = 0; i < cachedata.length; i++) {
                                if (entity.data.F_Id == cachedata[i].F_Id) {
                                    cachedata.splice(i, 1);
                                    break;
                                }
                            }
                            var divId = "#" + "div" + entity.data.field;
                            if ($(divId).length > 0) {
                                $(divId).remove();
                            }
                            table.reload('currentTableId', {
                                data: cachedata
                            });
                            entity = null;
                            common.modalMsg("操作成功", "success");
                        } catch (e) {
                            alert(e);
                        }
                        parent.layer.close(index);
                    }
                    else {
                        return false;
                    }
                });
            }
            else if (obj.event === 'edit') {
                if (entity == null) {
                    common.modalMsg("未选中数据", "warning");
                    return false;
                }
                common.modalOpen({
                    title: "编辑字段",
                    url: "/SystemManage/CodeGenerator/RuleForm",
                    width: "500px",
                    height: "500px",
                    dataJson: entity.data
                });
            }
            else if (obj.event === 'sort') {
                if (entity == null) {
                    common.modalMsg("未选中数据", "warning");
                    return false;
                }
                common.modalConfirm("注：您确定要把该项数据设定为排序字段吗？", function (r) {
                    if (r) {
                        var index = parent.layer.load(0, {
                            shade: [0.5, '#000'], //0.1透明度的背景
                        });
                        try {
                            $("#SortColumn").val(entity.data.field);
                            common.modalMsg("操作成功", "success");
                        } catch (e) {
                            alert(e);
                        }
                        parent.layer.close(index);
                    }
                    else {
                        return false;
                    }
                });
            } 
            return false;
        });
        form.on('select(n_columns)', function (data) {
            var v = $("select[name=n_columns").val();
            if (v === "1") {
                var $col = $(".layui-card-body .layui-col-md12").toggle(true);
                $(".layui-card-body .layui-col-md6 .draggable").each(function (i, el) {
                    $(this).remove().appendTo($col);
                });
                $(".layui-card-body .layui-col-md6").toggle(false);
            } else {
                var $col = $(".layui-card-body .layui-col-md6").toggle(true);
                $(".layui-card-body .layui-col-md12 .draggable").each(function (i, el) {
                    $(this).remove().appendTo(i % 2 ? $col[1] : $col[0]);
                });
                $(".layui-card-body .layui-col-md12").toggle(false);
            }
        });
        form.on('checkbox(IsTree)', function (data) {
            if (data.elem.checked) {
                $("#ParentColum").parent().parent().removeClass("layui-hide");
                $("#TreeColum").parent().parent().removeClass("layui-hide");
            }
            else {
                $("#ParentColum").parent().parent().addClass("layui-hide");
                $("#TreeColum").parent().parent().addClass("layui-hide");
            }
        });
        form.on('submit(formStep1)', function (data) {
            baseConfig.FileConfig.ClassPrefix = data.field.ClassPrefix;
            baseConfig.FileConfig.EntityName = data.field.ClassPrefix + "Entity";
            baseConfig.FileConfig.ServiceName = data.field.ClassPrefix + "Service";
            baseConfig.FileConfig.ControllerName = data.field.ClassPrefix + "Controller";
            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, "");
            step.next('#stepForm');
            return false;
        });
        var cout = 0;
        form.on('submit(formStep2)', function (data) {
            if (buttonList.getValue('value').length == 0) {
                buttonList.warning();
                return false;
            }
            //if (columnList.getValue('value').length == 0) {
            //    columnList.warning();
            //    return false;
            //}
            baseConfig.PageIndex.IsMunu = !data.field.IsMunu || data.field.IsMunu != "true" ? false : true;
            baseConfig.PageIndex.IsSearch = !data.field.IsSearch || data.field.IsSearch != "true" ? false : true;
            baseConfig.PageIndex.IsTree = !data.field.IsTree || data.field.IsTree != "true" ? false : true;
            baseConfig.PageIndex.IsPagination = !data.field.IsPagination || data.field.IsPagination != "true" ? false : true;
            baseConfig.PageIndex.IsFields = !data.field.IsFields || data.field.IsFields != "true" ? false : true;
            baseConfig.PageIndex.IsPublic = !data.field.IsPublic || data.field.IsPublic != "true" ? false : true;
            baseConfig.PageIndex.IsCache = false;
            baseConfig.PageIndex.ButtonList = buttonList.getValue('value');
            var cachedata = table.cache.currentTableId
            if (cachedata.length == 0) {
                common.modalMsg("未添加字段", "warning");
                return false;
            }
            baseConfig.PageIndex.SortColumn = data.field.SortColumn;
            baseConfig.PageIndex.ParentColum = data.field.ParentColum;
            baseConfig.PageIndex.TreeColum = data.field.TreeColum;
            baseConfig.PageIndex.CreateColum = data.field.CreateColum;
            baseConfig.PageIndex.DeleteColum = data.field.DeleteColum;
            baseConfig.PageIndex.KeywordColum = data.field.KeywordColum.split(',');
            baseConfig.PageIndex.IsAsc = !data.field.IsAsc || data.field.IsAsc != "true" ? false : true;
            baseConfig.PageIndex.ColumnList = [];
            var treelist = [];
            for (var i = 0; i < cachedata.length; i++) {
                var temp = {};
                var treetemp = {};
                temp["field"] = cachedata[i].field;
                temp["title"] = cachedata[i].title;
                temp["isFilter"] = cachedata[i].isFilter;
                temp["isAotuWidth"] = cachedata[i].isAotuWidth;
                temp["isSorted"] = cachedata[i].isSorted;
                temp["isShow"] = cachedata[i].isShow;
                temp["width"] = cachedata[i].width;
                temp["filterType"] = cachedata[i].filterType;
                temp["templet"] = cachedata[i].templet;
                temp["value"] = cachedata[i].value;
                baseConfig.PageIndex.ColumnList.push(temp);
                if (cachedata[i].isShow == true) {
                    treetemp["id"] = cachedata[i].field;
                    treetemp["title"] = cachedata[i].title;
                    treetemp["parentId"] = "0";
                    treetemp["checkArr"] = "0";
                    treelist.push(treetemp);
                }
                else {
                    var divId = "#" + "div" + cachedata[i].field;
                    if ($(divId).length > 0) {
                        $(divId).remove();
                    }
                }
            }
            //form字段选择
            var formColumnList = dtree.render({
                elem: "#formColumnList",
                height: 'full-200',
                width: '180px',
                checkbar: true,
                checkbarType: "all", // 默认就是all，其他的值为： no-all  p-casc   self  only
                method: "GET",
                scroll: "#toolbarDiv", // 绑定div元素
                ficon: "-1",
                icon: "-1",  // 显示非最后一级节点图标，隐藏最后一级节点图标
                initLevel: 0,
                data: treelist,
                checkbarFun: {
                    chooseBefore: function ($i, node) {
                        var id = node.nodeId;
                        var divId = "#" + "div" + id;
                        if (node.checked == "0") {
                            if ($(divId).length == 0) {

                                var target = null;
                                if (parseInt($("#n_columns").val()) == 1) {
                                    target = $(".layui-card-body .layui-col-md12");
                                }
                                else {
                                    var firstColumnInput = $(".layui-card-body .layui-col-md6").first().find("input").length;
                                    var secondColumnInput = $(".layui-card-body .layui-col-md6").last().find("input").length;
                                    if (firstColumnInput > secondColumnInput) {
                                        target = $(".layui-card-body .layui-col-md6").last();
                                    }
                                    else {
                                        target = $(".layui-card-body .layui-col-md6").first();
                                    }
                                }
                                var html = $("#divInputTemplate").prop("outerHTML");
                                html = html.replace("FieldName", node.context);
                                html = html.replace(/fieldName/g, "fieldName" + cout);
                                html = html.replace(/fieldCode/g, id); // 替换多个
                                html = html.replace("divInputTemplate", "div" + id);
                                var obj = $(html);
                                obj.removeAttr("style");
                                obj.appendTo(target);
                                formColumnList.checkStatus($i).check();
                                cout++;
                            }
                        }
                        else {
                            if ($(divId).length > 0) {
                                $(divId).remove();
                            }
                            formColumnList.checkStatus($i).noCheck();  // 恢复选中状态
                        }
                    },
                    chooseDone: function (checkbarNodesParam) { //复选框点击事件完毕后，返回该树关于复选框操作的全部信息。
                        return;
                    }
                }
            });
            //tree单击节点 监听事件
            dtree.on("node('formColumnList')", function (obj) {
                formColumnList.clickNodeCheckbar(obj.param.nodeId);// 点击节点选中复选框
                var id = obj.param.nodeId;
                var divId = "#" + "div" + id;
                if (obj.param.checked == "0") {
                    if ($(divId).length == 0) {

                        var target = null;
                        if (parseInt($("#n_columns").val()) == 1) {
                            target = $(".layui-card-body .layui-col-md12");
                        }
                        else {
                            var firstColumnInput = $(".layui-card-body .layui-col-md6").first().find("input").length;
                            var secondColumnInput = $(".layui-card-body .layui-col-md6").last().find("input").length;
                            if (firstColumnInput > secondColumnInput) {
                                target = $(".layui-card-body .layui-col-md6").last();
                            }
                            else {
                                target = $(".layui-card-body .layui-col-md6").first();
                            }
                        }
                        var html = $("#divInputTemplate").prop("outerHTML");
                        html = html.replace(/FieldName/g, obj.param.context);
                        html = html.replace(/fieldName/g, "fieldName" + cout);
                        html = html.replace(/fieldCode/g, id); // 替换多个
                        html = html.replace("divInputTemplate", "div" + id);
                        var obj = $(html);
                        obj.removeAttr("style");
                        obj.appendTo(target);
                        cout++;
                    }
                }
                else {
                    if ($(divId).length > 0) {
                        $(divId).remove();
                    }
                }
            });
            step.next('#stepForm');
            return false;
        });
        var codeList;
        form.on('submit(formStep3)', function (data) {
            baseConfig.PageForm.ShowMode = $("#n_columns").val();
            baseConfig.PageForm.FieldList = [];
            $("#divForm label:not(.hidden)").each(function (i, ele) {
                if ($(ele).parent().css("display") != "none") {
                    var key = $(ele).parent().find("input")[0].id;
                    var temp = {};
                    temp["key"] = key;
                    temp["value"] = $(ele).html();
                    baseConfig.PageForm.FieldList.push(temp);
                }
            });
            if (baseConfig.PageForm.FieldList.length <= 0) {
                common.modalMsg("未添加表单字段", "warning");
                return false;
            }
            $.ajax({
                url: "/SystemManage/CodeGenerator/CodePreviewJson?dbNumber=" + dbNumber,
                type: "post",
                dataType: 'json',
                async: false,
                data: baseConfig,
                success: function (data) {
                    if (data.state == "success") {
                        $("div.layui-tab-item").each(function (i, ele) {
                            var col = $(ele).attr("col");
                            if (col == "CodeMenu") {
                                $(this).html("<pre class='no-padding no-margin no-top-border'><code class='html'>" + data.data[col] + "</code></pre>");
                            }
                            else {
                                $(this).html("<pre class='no-padding no-margin no-top-border'><code class='csharp'>" + data.data[col] + "</code></pre>");
                            }
                        });
                        //$('pre code').each(function (i, ele) {
                        //    hljs.highlightBlock(ele)
                        //});
                        codeList = data.data;
                        step.next('#stepForm');
                    }
                    else {
                        common.modalAlert(data.message, data.state);
                    }
                }
            });
            return false;
        });
        form.on('submit(formStep4)', function (data) {
            var postData = baseConfig;
            postData.Code = encodeURIComponent(JSON.stringify(codeList));
            postData.dbNumber = dbNumber;
            common.submitForm({
                url: "/SystemManage/CodeGenerator/CodeGenerateJson",
                param: postData,
                success: function () {
                }
            })
            return false;
        });
        $('.pre').click(function () {
            step.pre('#stepForm');
        });
    })
    function editName(data) {
        var key = $('#' + data).parent().find("input")[0].id;
        var value = $('#' + data).html();

        layui.use(['jquery', 'form', 'laydate', 'common'], function () {
            layui.common.modalOpen({
                title: "修改值",
                url: "/SystemManage/CodeGenerator/AddForm?parentform=" + window.name + "&event=" + data,
                width: "400px",
                height: "400px",
                data: { TableColumn: key, Remark: value },
            });
        });
    }
</script>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-carousel" id="stepForm" lay-filter="stepForm">
            <div carousel-item>
                <div>
                    <form class="layui-form layuimini-form">
                        <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="form-group-bottom text-right">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formStep1">下一步</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div>
                    <form class="layui-form layuimini-form">
                        <div class="layui-form-item">
                            <div class="layui-col-md12">
                                <label class="layui-form-label required">页面选项</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="IsMunu" id="IsMunu" checked="checked" value="true" title="菜单显示">
                                    <input type="checkbox" name="IsTree" id="IsTree" checked="" value="true" lay-filter="IsTree" title="树形表格">
                                    <input type="checkbox" name="IsSearch" id="IsSearch" checked="checked" value="true" title="搜索框">
                                    <input type="checkbox" name="IsPagination" id="IsPagination" checked="checked" value="true" title="分页">
                                    <input type="checkbox" name="IsFields" id="IsFields" checked="" value="true" title="字段控制">
                                    <input type="checkbox" name="IsPublic" id="IsPublic" checked="" value="true" title="是否公共">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md6 layui-col-xs6">
                                <label class="layui-form-label required">按钮选项</label>
                                <div class="layui-input-block">
                                    <div id="ButtonList" name="ButtonList" class="xm-select-demo">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6 layui-col-xs6">
                                <label class="layui-form-label required">模糊查询字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="KeywordColum" name="KeywordColum" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md3 layui-col-xs3">
                                <label class="layui-form-label required">排序字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="SortColumn" name="SortColumn" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-md3 layui-col-xs3">
                                <label class="layui-form-label">排序</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="IsAsc" id="IsAsc" checked="" value="true" title="顺序">
                                </div>
                            </div>
                            <div class="layui-col-md3 layui-col-xs3">
                                <label class="layui-form-label">删除字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="DeleteColum" name="DeleteColum" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-md3 layui-col-xs3">
                                <label class="layui-form-label">创建字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="CreateColum" name="CreateColum" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md6 layui-col-xs6">
                                <label class="layui-form-label">父级字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="ParentColum" name="ParentColum" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-md6 layui-col-xs6">
                                <label class="layui-form-label">树形显示字段</label>
                                <div class="layui-input-block">
                                    <input type="text" id="TreeColum" name="TreeColum" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="form-group-bottom text-right">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
                                <button class="layui-btn" lay-submit lay-filter="formStep2">下一步</button>
                            </div>
                        </div>
                    </form>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container" id="toolbar">
                            <button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe654;</i>新增</button>
                            <button class="layui-btn layui-btn-sm layui-btn-warm" lay-event="edit"><i class="layui-icon">&#xe642;</i>编辑</button>
                            <button class="layui-btn layui-btn-sm" lay-event="sort"><i class="layui-icon">&#xe61a;</i>设为排序</button>
                            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete"> <i class="layui-icon">&#xe640;</i>删除</button>                        </div>
                    </script>
                    <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
                </div>
                <div>
                    <form class="layui-form layuimini-form ">
                        <div class="layui-fluid" style="padding:0 0px">
                            <div class="layui-row layui-col-space5">
                                <div class="layui-card layui-col-md3 layui-col-xs4">
                                    <div class="layui-card-header"><i class="fa fa-warning icon"></i>字段选择</div>
                                    <div class="layui-card-body" style="background-color:#cce3ff3b" id="toolbarDiv">
                                        <ul id="formColumnList" name="formColumnList" class="dtree" data-id="0"></ul>
                                    </div>
                                </div>
                                <div class="layui-card layui-col-md9 layui-col-xs8">
                                    <div class="layui-card-header layui-col-md3 layui-col-xs5">
                                        <i class="fa fa-warning icon"></i>列数
                                    </div>
                                    <div class="layui-card-header layui-col-md9  layui-col-xs7">
                                        <select id="n_columns" name="n_columns" lay-filter="n_columns">
                                            <option value="1">显示1列</option>
                                            <option value="2">显示2列</option>
                                        </select>
                                    </div>
                                    <div class="layui-card-body" id="divForm">
                                        <div id="divInputTemplate" class="layui-form-item draggable ui-draggable dropped" style="display:none">
                                            <label class="layui-form-label" id="fieldName">FieldName</label>
                                            <div class="layui-input-block" style="padding-right: 70px;">
                                                <input id="fieldCode" col="fieldCode" type="text" class="layui-input" readonly value="fieldCode">
                                                <button class="layui-btn layui-btn-normal" style="position: absolute;top: 0;right: 6px;cursor: pointer;" type="button" onclick="editName('fieldName')">编辑</button>
                                            </div>
                                        </div>
                                        <div class="layui-col-md12 layui-col-xs12 droppable sortable">
                                        </div>
                                        <div class="layui-col-md6 layui-col-xs6 droppable sortable" style="display:none">
                                        </div>
                                        <div class="layui-col-md6 layui-col-xs6 droppable sortable" style="display:none">
                                        </div>
                                    </div>
                                    </div>
                            </div>
                            </div>
                        <div class="form-group-bottom text-right">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
                                <button class="layui-btn" lay-submit lay-filter="formStep3">下一步</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div>
                    <form class="layui-form layuimini-form">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li class="layui-this">实体类</li>
                                <li>服务类</li>
                                <li>控制器</li>
                                <li>列表页</li>
                                <li>表单页</li>
                                <li>详情页</li>
                                <li>菜单</li>
                            </ul>
                            <div class="layui-tab-content" style="height:300px;overflow:auto">
                                <div class="layui-tab-item layui-show" id="codeEntity" col="CodeEntity">
                                </div>
                                <div class="layui-tab-item" id="codeService" col="CodeService">
                                </div>
                                <div class="layui-tab-item" id="codeController" col="CodeController">
                                </div>
                                <div class="layui-tab-item" id="codeIndex" col="CodeIndex">
                                </div>
                                <div class="layui-tab-item" id="codeForm" col="CodeForm">
                                </div>
                                <div class="layui-tab-item" id="codeDetails" col="CodeDetails">
                                </div>
                                <div class="layui-tab-item" id="codeMenu" col="CodeMenu">
                                </div>
                            </div>
                        </div>
                        <div class="form-group-bottom text-right">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
                                <button class="layui-btn site-demo-active" lay-submit lay-filter="formStep4">确认生成</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

    </div>
</div>
