<div class="main" id="main">
    <el-form label-width="120px" class="small">
        <el-form-item label="复制源表名">
            <el-input type="text" maxlength="20" v-model="SourceTable" disabled class="form-control" v-validate="{data:SourceTable,dataType:'table',nullMsg:'请填写源表名！',errorMsg:'源表名填写错误'}" />
            <span class="help-block">新表的复制来源表</span>
        </el-form-item>


        <el-form-item label="新表名">
            <el-input placeholder="只能由字母、数字组成，首字符必须英文" type="text" maxlength="20" v-model="Name" v-validate="{data:Name,dataType:'table',nullMsg:'请填写表名！',errorMsg:'表名填写错误'}"/>
            <span class="help-block"></span>
        </el-form-item>


        <el-form-item label="标识">
            <el-input placeholder="仅用于标识，如文章，产品" type="text" name="Remark" id="Remark" v-model="Remark" maxlength="50" class="form-control" v-validate="{data:Remark,dataType:'*',nullMsg:'请填写标识！'}" />
            <span class="help-block"></span>
        </el-form-item>

        <el-form-item label="应用站点">
            <el-input-convert placeholder="请选择应用站点" readonly :config="{url:'@Url.ActionUrl("getName","Site")?id='+SiteId}" v-validate="{data:SiteId,dataType:'numeric',min:1,errorMsg:'请选择应用站点',nullMsg:'请选择应用站点！'}">
                <el-button type="button" v-on:click="dialog({title:'选择站点',url:'@Url.ActionUrl("Select","Site")?setData=parent.vue.SiteId',width:'600px',height:'90%',target:'_self'})">选择</el-button>
            </el-input-convert>
            <span class="help-block">为保证检索速度和数据的独立性，一个信息表只能用于一个站点</span>
        </el-form-item>

        <el-form-item label="信息页默认模版">
            <el-input type="text" placeholder="信息页模板文件" maxlength="100" v-model="TemplateDetail" class="form-control form-control-sm">
                <template slot="append">
                    <el-button type="button" class="btn btn-default ui-dialog" v-on:click="dialog({title:'选择信息页模板',url:'@Url.ActionUrl("Select","TemplateManager")?setData=parent.vue.TemplateDetail',width:'600px',height:'95%',target:'self'})">选择</el-button>
                </template>
            </el-input>
            <span class="help-block">信息不属于任何栏目时的默认模板</span>
        </el-form-item>

        <el-form-item label="默认排序">
            <el-input type="text" name="Orderby" id="Orderby" maxlength="50" value="id desc" v-model="Orderby" class="form-control" />
            <span class="help-block">管理页默认排序方式,留空则默认id desc</span>
        </el-form-item>

        <el-form-item label="管理页显示数">
            <el-input type="text" maxlength="3" value="20" v-model="Pagesize" class="form-control form-control-xs" v-validate="{data:Pagesize,dataType:'numeric',min:1,errorMsg:'请填写大于0的数值!'}" />
            <span class="help-block">管理页默认显示的记录数，留空则默认20</span>
        </el-form-item>

        <el-form-item label="菜单启用">
            <el-checkbox v-model="ShowMenu" :true-label="1" :false-label="0" :label="0">启用</el-checkbox>
            <span class="help-block">启用内容管理菜单中才会出现</span>
        </el-form-item>

        <el-form-item label="删除保护">
            <el-checkbox v-model="DeleteProtect" :true-label="1" :false-label="0" :label="0">启用</el-checkbox>
            <span class="help-block">启用后列表页不能直接删除</span>
        </el-form-item>

        <el-form-item label="序号">
            <el-input placeholder="仅用于排序" type="text" value="1" maxlength="4" name="Xuhao" id="Xuhao" v-model="Xuhao" class="form-control form-control-xs ui-queryString" v-validate="{data:Xuhao,dataType:'numeric',min:1,errorMsg:'请填写大于0的数值!'}" />
            <span class="help-block"></span>
        </el-form-item>
        </el-form>

    <div class="footer-submit-bar" style="padding-left:100px">
        <el-button type="primary" v-on:click="postSubmit">提交保存</el-button>
        <el-button onclick="closeSelf()">关闭</el-button>
    </div>
</div>

<script type="text/javascript">
    //绑定数据
    var formData = @Html.Raw(Model);
    formData.Name = "";
    formData.Remark = "";
    formData.SourceTable = "@ViewBag.SourceTable";
    var vue = new Vue({
        el: "#main",
        data: formData,
        methods: {
            postSubmit: function () {
                var validated =this.validateForm({});//jquery表单验证
                if (validated) {
                    this.submit({ url: "@Url.ActionUrl()", data: formData,callback: function () { postRefreshBack() } });
                }
            }
        },
    });
    function postRefreshBack()
    {
        parent.loadData();
        closeSelf();
    }
</script>