| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <#@ template language="C#" #>
- <#@ assembly name="System.Core" #>
- <#@ import namespace="System.Linq" #>
- <#@ import namespace="System.Text" #>
- <#@ import namespace="System.Collections.Generic" #>
- @using <#=Model.ProjectName#>.Web.Models.Input
- @using <#=Model.ProjectName#>.Web.Models.Modals
- @using <#=Model.ProjectName#>.Web.Models.Search
- @using <#=Model.ProjectName#>.Web.Models.Table
- @using VberZero
- @{
- ViewBag.Title = "<#=Model.HtmlPageTitle#>";
- string activeMenu = PermissionNames.Vber<#=Model.ParentPath#><#=Model.FileName#>Mg; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- var searchForm = new VmSearch(new List<VmSearchItem>()
- {
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(item.IsSearch)
- {
- var typeStr= item.AttrType=="int"?"FType.I": item.AttrType=="int"?"FType.In": item.AttrType=="DateTime"?"FType.D": item.AttrType=="DateTime?"?"FType.Dn":"";
- typeStr= string.IsNullOrEmpty(typeStr)?"":".WithFieldType("+typeStr+")";
-
- #> new VmSearchItem("<#=item.CamelColumnName#>","<#=item.Comment#>")<#=typeStr#>,
- <# }
- }
- #>
- });
- var table = new VmTable(VzConsts.ApiAppUrl + "<#=Model.FileName#>/GetAll", activeMenu, searchForm)
- .AddItems(new List<VmTableItem>()
- {
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(item.IsTable)
- {
- #> new VmTableItem("<#=item.CamelColumnName#>", "<#=item.Comment#>"),
- <# }
- }
- #>
- });
- var modalBody = new VmModalBody()
- .AddInputs(new List<VmInputBase>
- {
- new VmInputHidden("id"),
- })
- .AddGroup(new List<VmInputBase>
- {
- <# foreach (var item in Model.Columns)
- {
- if(!item.IsGenreated) continue;
- if(!item.IsModal) continue;
- var inputType=item.AttrType=="int"?"VmInputNumber": item.AttrType=="int?"?"VmInputNumber": item.AttrType=="DateTime"?"VmInputDate": item.AttrType=="DateTime?"?"VmInputDate":"VmInput";
- if(item.IsRequired) {
- #> new <#=inputType#>("<#=item.CamelColumnName#>", "<#=item.Comment#>").WithRequired(),
- <#
- }else{
- #> new <#=inputType#>("<#=item.CamelColumnName#>", "<#=item.Comment#>"),
- <#
- }
- #>
- <# }
- #>
- },2);
- var modal = new VmModal().WithHeaderAndFooter("<#=Model.HtmlModalTitle#>","").WithBody(modalBody);
- }
- @section styles{
-
- }
- @await Html.PartialAsync("_Table", table)
- <!--Modal Start-->
- @await Html.PartialAsync("_Modal", modal)
- <!--Modal End-->
- @section scripts
- {
- <script type="text/javascript">
- var $table = $('#table');
- $(function () {
- var funs = LoadTable();
- funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
- funs["btnUpdate"] = function () {
- //var row = $table.VbTable("getSelection");
- BtnUpdate({ disabled: "" });
- };
- });
- </script>
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- function TypeFormatter(v) {
- var name = $('#hid-type option[value="' + v + '"]').text();
- switch (v) {
- case 0:
- return '<span class="label label-danger">' + name +'</span>';
- default:
- return '<span class="label label-info">' + name +'</span>';
- }
- }
- </script>
- }
- <section style="display: none">
- <select id="hid-type">
- <option value=""></option>
- </select>
- </section>
|