CshtmlTemplate.tt 6.44 KB
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    ViewData["title"] = "<#=TitleName #>";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section header
{
}

<div id="listForm" class="layui-tab-item layui-show">
    <form class="layui-form layui-form-pane" action="" lay-filter="listForm">
        <div class="layui-form-item" id="panelSearch" hidden>
            <fieldset class="layui-elem-field">

                <div class="layui-field-box" id="qform">
                    <div class="layui-form-item layui-col-sm12">
                        <div class="layui-inline toolList">
                            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-radius" data-type="btnQuery"><i class="layui-icon">&#xe615;</i>查询</a>
                            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm" data-type="btnReset"><i class="layui-icon">&#xe66c;</i>重置</a>
                            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger" data-type="btnClose"><i class="layui-icon">&#xe6a7;</i>关闭</a>
                        </div>
                    </div>
                    <div class="layui-row">
<# foreach (var item in QueryColumns) #>
<# { #>
<# if(item.TypeName.Equals("DateTime", StringComparison.OrdinalIgnoreCase)) #>
<# { #>
                        <div class="layui-col-sm3">
                            <label class="layui-form-label"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #></label>
                            <div class="layui-input-inline">
                                <input name="<#=item.ColumnName #>" type="text" autocomplete="off" class="layui-input layui-date">
                            </div>
                        </div>
<# }else if(item.TypeName.Equals("Int", StringComparison.OrdinalIgnoreCase)){ #>
                        <div class="layui-col-sm3">
                            <label class="layui-form-label"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #></label>
                            <div class="layui-input-inline">
                                <input name="<#=item.ColumnName #>" type="number" autocomplete="off" class="layui-input">
                            </div>
                        </div>
<# }else{ #>
                        <div class="layui-col-sm3">
                            <label class="layui-form-label"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #></label>
                            <div class="layui-input-inline">
                                <input name="<#=item.ColumnName #>" type="text" autocomplete="off" maxlength="<#= Convert.ToInt32(item.TypeLenght * 0.7) #>" class="layui-input">
                            </div>
                        </div>
<# }} #> 
                    </div>
                </div>
            </fieldset>
        </div>
    </form>
    <table id="mainList" lay-filter="mainList"></table>
</div>

<div id="modifyForm" class="layui-tab-item">
    <form class="layui-form layui-form-pane" action="" lay-filter="modifyForm" onsubmit="return false;">
      <div class="layui-row">
<# foreach (var item in EditColumns) #>
<# { #>
<# if(item.TypeName.Equals("DateTime", StringComparison.OrdinalIgnoreCase)) #>
<# { #>
        <div class="layui-col-sm6">
            <label class="layui-form-label layui-col-sm3"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #><span class="lable-required">*</span></label>
            <div class="layui-input-inline layui-col-sm6">
                <input name="<#=item.ColumnName #>" type="text" lay-verify="required" autocomplete="off" class="layui-input layui-date">
            </div>
        </div>
<# }else if(item.TypeName.Equals("Int", StringComparison.OrdinalIgnoreCase)){ #>
        <div class="layui-col-sm6">
            <label class="layui-form-label layui-col-sm3"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #><span class="lable-required">*</span></label>
            <div class="layui-input-inline layui-col-sm6">
                <input name="<#=item.ColumnName #>" type="number" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
<# }else{ #>
        <div class="layui-col-sm6">
            <label class="layui-form-label layui-col-sm3"><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? $"{item.ColumnName}" : $"{item.ColumnDescription}" #><span class="lable-required">*</span></label>
            <div class="layui-input-inline layui-col-sm6">
                <input type="text" name="<#=item.ColumnName #>" lay-verify="required" autocomplete="off" maxlength="<#= Convert.ToInt32(item.TypeLenght * 0.7) #> class="layui-input">
            </div>
        </div>
<# }} #> 
        <div class="layui-form-item">
            <!--表单验证按钮-->
            <button class="layui-btn" style="display:none" name="fromAdd" lay-filter="fromAdd" lay-submit>fromAdd</button>
            <button class="layui-btn" style="display:none" name="fromUpdate" lay-filter="fromUpdate" lay-submit>fromUpdate</button>
        </div>
    </div>
        <div hidden>
            <input name="id" type="text" class="layui-input">

            <input name="createBy" type="text" class="layui-input">
            <input name="createTime" type="text" class="layui-input">
            <input name="updateTime" type="text" class="layui-input">
            <input name="updateBy" type="text" class="layui-input">
        </div>
    </form>
</div>

<script type="text/html" id="toolbarTable">
    <div class="layui-btn-container">
        <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-mini" lay-event="btnSelect"><i class="layui-icon">&#xe628;</i>检索</a>
        <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-mini" lay-event="btnRefresh"><i class="layui-icon">&#xe9aa;</i>刷新</a>
        {{ loadMenus("<#=ControllerName #>", 1) }}
    </div>
</script>

@section Scripts
{
    <script type="text/javascript" src="/productjs/<#=AreaName #>/<#=ControllerName #>.js" asp-append-version="true"></script>
}